Package io.jans.casa.service
Interface IPersistenceService
- All Superinterfaces:
LocalDirectoryInfo,LocalDirectoryInfo2
Provides CRUD access to the underlying persistence engine of your Jans Server installation.
To obtain an instance object that implements this interface, use method
Utils.managedBean(Class).
- Author:
- jgomer
-
Method Summary
Modifier and TypeMethodDescription<T> booleanadd(T object) Adds an entry in the underlying persistence engine.<T> intcount(T object) Similar tofind(Object)search except it only returns the amount of matching objects.<T> booleandelete(T object) Deletes the entry represented by parameterobjectfrom the persistence engine.<T> List<T>Builds aListof objects of typeTfrom a search (with scope of SUB) usingbaseDnas search base; this type of search accounts for the entry referenced atbaseDnand any subordinate entries to any depth.<T> List<T>Performs a search as methodfind(Class, String, Filter)does except the firststartelements are skipped and at mostcountresults are included in the returned list<T> List<T>find(Class<T> clazz, String baseDn, io.jans.orm.search.filter.Filter filter, int start, int count, io.jans.orm.model.SearchScope searchScope) Performs a search as methodfind(Class, String, Filter)does except the firststartelements are skipped and at mostcountresults are included in the returned list<T> List<T>find(T object) Builds aListof objects of typeTfrom a search (with scope of SUB) using as search base the field annotated withio.jans.orm.annotation.DNin the object passed as parameter; this type of search accounts for the entry referenced at the search base and any subordinate entries to any depth.<T> TRetrieves the object representing the entry at the provided DN location.<T> booleanmodify(T object) Stores a previously obtained object (via get or find) - and potentially modified - into the persistence engine.Methods inherited from interface io.jans.casa.service.LocalDirectoryInfo
getClientsDn, getCustomScriptsDn, getGroupsDn, getIssuerUrl, getPeopleDn, getPersonDn, getScopesDnMethods inherited from interface io.jans.casa.service.LocalDirectoryInfo2
getAgamaFlowConfigProperties, getCustScriptConfigProperties, getOrganization, getPersonOCs
-
Method Details
-
find
Builds aListof objects of typeTfrom a search (with scope of SUB) usingbaseDnas search base; this type of search accounts for the entry referenced atbaseDnand any subordinate entries to any depth. The search can use an instance ofio.jans.search.filter.Filterto include an LDAP-like filter expression.Note this search is performed in the context of
oxcore-persist. In this sense, the Class referenced as parameter has to be annotated withio.jans.persist.model.base.Entryand potentially other annotations of the same package to be functional.- Type Parameters:
T- Type parameter of clazz- Parameters:
clazz- A class to which the search objects must belong tobaseDn- Search base DNfilter- Filter to constrain the search (supply null to returned ALL entries under the base DN that can be associated to Class clazz)- Returns:
- A List of matching objects. Empty if no matches
-
find
<T> List<T> find(Class<T> clazz, String baseDn, io.jans.orm.search.filter.Filter filter, int start, int count) Performs a search as methodfind(Class, String, Filter)does except the firststartelements are skipped and at mostcountresults are included in the returned list- Type Parameters:
T- Type parameter of clazz- Parameters:
clazz- A class to which the search objects must belong tobaseDn- Search base DNfilter- Filter to constrain the search (supply null to returned ALL entries under the base DN that can be associated to Class clazz)start- Zero-based index at which the search startscount- Maximum number of results to return- Returns:
- A List of matching objects according to the rules specified above. Empty if no matches
-
find
Builds aListof objects of typeTfrom a search (with scope of SUB) using as search base the field annotated withio.jans.orm.annotation.DNin the object passed as parameter; this type of search accounts for the entry referenced at the search base and any subordinate entries to any depth. The object passed as parameter is used to internally build a filter to perform the search.Note this search is performed in the context of
jans-orm. In this sense, the class to which the object passed belongs to has to be annotated withio.jans.orm.model.base.Entryand potentially other annotations of the same package to be functional.- Type Parameters:
T- Type parameter of clazz- Parameters:
object- An object employed to build a filter- Returns:
- A List of matching objects. Empty if no matches
-
find
<T> List<T> find(Class<T> clazz, String baseDn, io.jans.orm.search.filter.Filter filter, int start, int count, io.jans.orm.model.SearchScope searchScope) Performs a search as methodfind(Class, String, Filter)does except the firststartelements are skipped and at mostcountresults are included in the returned list- Type Parameters:
T- Type parameter of clazz- Parameters:
clazz- A class to which the search objects must belong tobaseDn- Search base DNfilter- Filter to constrain the search (supply null to returned ALL entries under the base DN that can be associated to Class clazz)start- Zero-based index at which the search startscount- Maximum number of results to returnsearchScope- LDAP search scope (if LDAP DB is used)- Returns:
- A List of matching objects according to the rules specified above. Empty if no matches
-
count
<T> int count(T object) Similar tofind(Object)search except it only returns the amount of matching objects.- Type Parameters:
T- Type parameter of the class to which the object belongs to- Parameters:
object- Object describing the search- Returns:
- An int with the number of matching objects, -1 if there was an error performing the operation
-
add
<T> boolean add(T object) Adds an entry in the underlying persistence engine.- Type Parameters:
T- Type parameter of clazz- Parameters:
object- Represents the entry to be added. Its class should be annotated withio.jans.orm.model.base.Entry- Returns:
- A boolean value indicating the success (true) or failure (false) of the operation
-
get
Retrieves the object representing the entry at the provided DN location.- Type Parameters:
T- Type parameter of clazz- Parameters:
clazz- The class the object to return is an instance ofdn- Path (DN) of the entry- Returns:
- An object of type T (null if an error was found performing the operation or if the entry does not exist)
-
modify
<T> boolean modify(T object) Stores a previously obtained object (via get or find) - and potentially modified - into the persistence engine.- Type Parameters:
T- Type parameter of the class to which the object belongs to- Parameters:
object- An object whose attributes are potentially altered (eg. via setters) with respect to the original retrieved via get or find methods- Returns:
- A boolean value indicating the success (true) or failure (false) of the operation.
-
delete
<T> boolean delete(T object) Deletes the entry represented by parameterobjectfrom the persistence engine.- Type Parameters:
T- Type parameter of the class to which the object belongs to- Parameters:
object- A representation of the object to delete. It must have been previously retrieved via get or find methods- Returns:
- A boolean value indicating the success (true) or failure (false) of the operation
-