Package org.nuxeo.ecm.directory
Class AbstractDirectory
- java.lang.Object
-
- org.nuxeo.ecm.directory.AbstractDirectory
-
- All Implemented Interfaces:
Directory
- Direct Known Subclasses:
CoreDirectory,LDAPDirectory,MemoryDirectory,MongoDBDirectory,MultiDirectory,SQLDirectory
public abstract class AbstractDirectory extends Object implements Directory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractDirectory.CSVLoaderConsumerConsumer to load data from CSV according to the dataLoadingPolicy.
-
Field Summary
Fields Modifier and Type Field Description protected DirectoryCachecacheBaseDirectoryDescriptordescriptorprotected DirectoryFieldMapperfieldMapperprotected Class<? extends Reference>referenceClassprotected Map<String,List<Reference>>referencesprotected io.dropwizard.metrics5.MetricRegistryregistryprotected Map<String,Field>schemaFieldMapprotected io.dropwizard.metrics5.CountersessionCountprotected io.dropwizard.metrics5.CountersessionMaxCountstatic StringTENANT_ID_FIELDprotected List<String>types
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDirectory(BaseDirectoryDescriptor descriptor, Class<? extends Reference> referenceClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddInverseReferences()voidaddReference(Reference reference)protected voidaddReferences()voidaddSession(Session session)protected booleandoSanityChecks()protected voidfallbackOnDefaultCache()DirectoryCachegetCache()Gets the cache instance of the directoryList<DirectoryDeleteConstraint>getDirectoryDeleteConstraints()DirectoryFieldMappergetFieldMapper()StringgetIdField()Gets the id field of the schema for this directory.StringgetName()Gets the unique name of the directory, used for registering.StringgetParentDirectory()Gets the name of the parent directory.StringgetPasswordField()Gets the password field of the schema for this directory.ReferencegetReference(String referenceFieldName)Deprecated.Collection<Reference>getReferences()Lookup all References defined on the directory.List<Reference>getReferences(String referenceFieldName)Lookup the References by field name.StringgetSchema()Gets the schema name used by this directory.Map<String,Field>getSchemaFieldMap()Get schema field mapList<String>getTypes()since @8.4voidinitialize()INTERNAL, DO NOT CALL.voidinitializeInverseReferences()INTERNAL, DO NOT CALL.voidinitializeReferences()INTERNAL, DO NOT CALL.protected voidinitSchemaFieldMap()voidinvalidateCaches()Invalidate cachesvoidinvalidateDirectoryCache()Invalidates the cache instance of the directorybooleanisMultiTenant()Returnstrueif this directory is a multi tenant directory,falseotherwise.booleanisReadOnly()Checks if this directory is read-only.booleanisReference(String referenceFieldName)protected voidloadData()Deprecated.since 11.1, useloadDataOnInit(boolean)insteadprotected voidloadDataOnInit(boolean tableExists)voidloadFromCSV(Blob dataBlob, String dataLoadingPolicy)Loads a CSV into a Directory.static Map<String,String>makeOrderBy(OrderByList orders)Helper to create an old-style ordering map.protected ReferencenewReference(ReferenceDescriptor desc)voidorderEntries(List<DocumentModel> entries, Map<String,String> orderBy)Helper method to order entries.voidremoveSession(Session session)voidsetReadOnly(boolean readOnly)voidshutdown()Shuts down the directory.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.directory.Directory
getDescriptor, getSession
-
-
-
-
Field Detail
-
TENANT_ID_FIELD
public static final String TENANT_ID_FIELD
- See Also:
- Constant Field Values
-
descriptor
public final BaseDirectoryDescriptor descriptor
-
fieldMapper
protected DirectoryFieldMapper fieldMapper
-
cache
protected final DirectoryCache cache
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry
-
sessionCount
protected final io.dropwizard.metrics5.Counter sessionCount
-
sessionMaxCount
protected final io.dropwizard.metrics5.Counter sessionMaxCount
-
-
Constructor Detail
-
AbstractDirectory
protected AbstractDirectory(BaseDirectoryDescriptor descriptor, Class<? extends Reference> referenceClass)
-
-
Method Detail
-
doSanityChecks
protected boolean doSanityChecks()
-
initialize
public void initialize()
Description copied from interface:DirectoryINTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializein interfaceDirectory
-
loadData
@Deprecated(since="11.1") protected void loadData()
Deprecated.since 11.1, useloadDataOnInit(boolean)instead
-
loadDataOnInit
protected void loadDataOnInit(boolean tableExists)
-
loadFromCSV
public void loadFromCSV(Blob dataBlob, String dataLoadingPolicy)
Description copied from interface:DirectoryLoads a CSV into a Directory.- Specified by:
loadFromCSVin interfaceDirectory- See Also:
BaseDirectoryDescriptor.DATA_LOADING_POLICIES
-
initializeReferences
public void initializeReferences()
Description copied from interface:DirectoryINTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializeReferencesin interfaceDirectory
-
initializeInverseReferences
public void initializeInverseReferences()
Description copied from interface:DirectoryINTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializeInverseReferencesin interfaceDirectory
-
getName
public String getName()
Description copied from interface:DirectoryGets the unique name of the directory, used for registering.
-
getSchema
public String getSchema()
Description copied from interface:DirectoryGets the schema name used by this directory.
-
getParentDirectory
public String getParentDirectory()
Description copied from interface:DirectoryGets the name of the parent directory. This is used for hierarchical vocabularies.- Specified by:
getParentDirectoryin interfaceDirectory- Returns:
- the name of the parent directory, or null.
-
getIdField
public String getIdField()
Description copied from interface:DirectoryGets the id field of the schema for this directory.- Specified by:
getIdFieldin interfaceDirectory- Returns:
- the id field.
-
getPasswordField
public String getPasswordField()
Description copied from interface:DirectoryGets the password field of the schema for this directory.- Specified by:
getPasswordFieldin interfaceDirectory- Returns:
- the password field.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:DirectoryChecks if this directory is read-only.- Specified by:
isReadOnlyin interfaceDirectory
-
setReadOnly
public void setReadOnly(boolean readOnly)
-
invalidateCaches
public void invalidateCaches()
Description copied from interface:DirectoryInvalidate caches- Specified by:
invalidateCachesin interfaceDirectory
-
getFieldMapper
public DirectoryFieldMapper getFieldMapper()
-
getReference
@Deprecated public Reference getReference(String referenceFieldName)
Deprecated.Description copied from interface:DirectoryLookup a Reference by field name.- Specified by:
getReferencein interfaceDirectory- Returns:
- the matching reference implementation or null
-
getReferences
public List<Reference> getReferences(String referenceFieldName)
Description copied from interface:DirectoryLookup the References by field name.- Specified by:
getReferencesin interfaceDirectory- Returns:
- the matching references implementation or null
-
isReference
public boolean isReference(String referenceFieldName)
-
addReference
public void addReference(Reference reference)
-
addReferences
protected void addReferences()
-
newReference
protected Reference newReference(ReferenceDescriptor desc)
-
addInverseReferences
protected void addInverseReferences()
-
getReferences
public Collection<Reference> getReferences()
Description copied from interface:DirectoryLookup all References defined on the directory.- Specified by:
getReferencesin interfaceDirectory- Returns:
- all registered references
-
orderEntries
public void orderEntries(List<DocumentModel> entries, Map<String,String> orderBy)
Helper method to order entries.- Parameters:
entries- the list of entries.orderBy- an ordered map of field name -@gt; "asc" or "desc".
-
makeOrderBy
public static Map<String,String> makeOrderBy(OrderByList orders)
Helper to create an old-style ordering map.- Since:
- 10.3
-
getCache
public DirectoryCache getCache()
Description copied from interface:DirectoryGets the cache instance of the directory
-
removeSession
public void removeSession(Session session)
-
addSession
public void addSession(Session session)
-
invalidateDirectoryCache
public void invalidateDirectoryCache()
Description copied from interface:DirectoryInvalidates the cache instance of the directory- Specified by:
invalidateDirectoryCachein interfaceDirectory
-
isMultiTenant
public boolean isMultiTenant()
Description copied from interface:DirectoryReturnstrueif this directory is a multi tenant directory,falseotherwise.- Specified by:
isMultiTenantin interfaceDirectory
-
shutdown
public void shutdown()
Description copied from interface:DirectoryShuts down the directory.
-
getDirectoryDeleteConstraints
public List<DirectoryDeleteConstraint> getDirectoryDeleteConstraints()
- Specified by:
getDirectoryDeleteConstraintsin interfaceDirectory- Since:
- 8.4
-
initSchemaFieldMap
protected void initSchemaFieldMap()
-
getSchemaFieldMap
public Map<String,Field> getSchemaFieldMap()
Description copied from interface:DirectoryGet schema field map- Specified by:
getSchemaFieldMapin interfaceDirectory
-
fallbackOnDefaultCache
protected void fallbackOnDefaultCache()
-
-