Skip to content

Commit

Permalink
feat: problems with handling custom attributes #2752
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Dec 21, 2022
1 parent 7dd35fb commit e4e87b2
Show file tree
Hide file tree
Showing 12 changed files with 605 additions and 462 deletions.
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

0 comments on commit e4e87b2

Please sign in to comment.