Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: problems with handling custom attributes #2752 #3378

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.orm.exception;

/**
* An exception is a result if search operation fails
*
* @author Yuriy Movchan Date: 2022/11/04
*/
public class SearchEntryException extends BasePersistenceException {

private static final long serialVersionUID = 1321766232087075304L;

public SearchEntryException(Throwable root) {
super(root);
}

public SearchEntryException(String string, Throwable root) {
super(string, root);
}

public SearchEntryException(String s) {
super(s);
}

}
18 changes: 14 additions & 4 deletions jans-orm/core/src/main/java/io/jans/orm/model/EntryData.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@
*/
public class EntryData {
private final List<AttributeData> attributeData;
private String dn;

public EntryData(List<AttributeData> attributeData) {
this.attributeData = attributeData;
}

public EntryData(String dn, List<AttributeData> attributeData) {
this.dn = dn;
this.attributeData = attributeData;
}

public List<AttributeData> getAttributeData() {
return attributeData;
}

@Override
public String toString() {
return "EntryData [attributeData=" + attributeData + "]";
public String getDN() {
return dn;
}

public AttributeData getAttributeDate(String internalAttribute) {
public AttributeData getAttributeData(String internalAttribute) {
if (attributeData == null) {
return null;
}
Expand All @@ -43,4 +48,9 @@ public AttributeData getAttributeDate(String internalAttribute) {
return null;
}

@Override
public String toString() {
return "EntryData [attributeData=" + attributeData + ", dn=" + dn + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.unboundid.ldap.sdk.SearchResult;
import com.unboundid.ldap.sdk.SearchResultEntry;
import io.jans.orm.model.BatchOperation;
import io.jans.orm.model.EntryData;
import io.jans.orm.reflect.property.PropertyAnnotation;

import java.util.ArrayList;
Expand Down Expand Up @@ -43,14 +44,12 @@ public final BatchOperation<T> getBatchOperation() {
return batchOperation;
}

public List<T> createEntities(SearchResult searchResult) {
public List<T> createEntities(List<EntryData> entryDataList) {
if (ldapEntryManager == null) {
return new ArrayList<T>(0);
}
SearchResultEntry[] searchResultEntry = searchResult.getSearchEntries()
.toArray(new SearchResultEntry[searchResult.getSearchEntries().size()]);

return ldapEntryManager.createEntities(entryClass, propertiesAnnotations, searchResultEntry);
return ldapEntryManager.createEntities(entryClass, propertiesAnnotations, entryDataList);
}

}
Loading