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 class
AbstractDirectory.CSVLoaderConsumer
Consumer to load data from CSV according to the dataLoadingPolicy.
-
Field Summary
Fields Modifier and Type Field Description protected DirectoryCache
cache
BaseDirectoryDescriptor
descriptor
protected DirectoryFieldMapper
fieldMapper
protected Class<? extends Reference>
referenceClass
protected Map<String,List<Reference>>
references
protected io.dropwizard.metrics5.MetricRegistry
registry
protected Map<String,Field>
schemaFieldMap
protected io.dropwizard.metrics5.Counter
sessionCount
protected io.dropwizard.metrics5.Counter
sessionMaxCount
static String
TENANT_ID_FIELD
protected List<String>
types
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDirectory(BaseDirectoryDescriptor descriptor, Class<? extends Reference> referenceClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addInverseReferences()
void
addReference(Reference reference)
protected void
addReferences()
void
addSession(Session session)
protected boolean
doSanityChecks()
protected void
fallbackOnDefaultCache()
DirectoryCache
getCache()
Gets the cache instance of the directoryList<DirectoryDeleteConstraint>
getDirectoryDeleteConstraints()
DirectoryFieldMapper
getFieldMapper()
String
getIdField()
Gets the id field of the schema for this directory.String
getName()
Gets the unique name of the directory, used for registering.String
getParentDirectory()
Gets the name of the parent directory.String
getPasswordField()
Gets the password field of the schema for this directory.Reference
getReference(String referenceFieldName)
Deprecated.Collection<Reference>
getReferences()
Lookup all References defined on the directory.List<Reference>
getReferences(String referenceFieldName)
Lookup the References by field name.String
getSchema()
Gets the schema name used by this directory.Map<String,Field>
getSchemaFieldMap()
Get schema field mapList<String>
getTypes()
since @8.4void
initialize()
INTERNAL, DO NOT CALL.void
initializeInverseReferences()
INTERNAL, DO NOT CALL.void
initializeReferences()
INTERNAL, DO NOT CALL.protected void
initSchemaFieldMap()
void
invalidateCaches()
Invalidate cachesvoid
invalidateDirectoryCache()
Invalidates the cache instance of the directoryboolean
isMultiTenant()
Returnstrue
if this directory is a multi tenant directory,false
otherwise.boolean
isReadOnly()
Checks if this directory is read-only.boolean
isReference(String referenceFieldName)
protected void
loadData()
Deprecated.since 11.1, useloadDataOnInit(boolean)
insteadprotected void
loadDataOnInit(boolean tableExists)
void
loadFromCSV(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 Reference
newReference(ReferenceDescriptor desc)
void
orderEntries(List<DocumentModel> entries, Map<String,String> orderBy)
Helper method to order entries.void
removeSession(Session session)
void
setReadOnly(boolean readOnly)
void
shutdown()
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:Directory
INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initialize
in 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:Directory
Loads a CSV into a Directory.- Specified by:
loadFromCSV
in interfaceDirectory
- See Also:
BaseDirectoryDescriptor.DATA_LOADING_POLICIES
-
initializeReferences
public void initializeReferences()
Description copied from interface:Directory
INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializeReferences
in interfaceDirectory
-
initializeInverseReferences
public void initializeInverseReferences()
Description copied from interface:Directory
INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializeInverseReferences
in interfaceDirectory
-
getName
public String getName()
Description copied from interface:Directory
Gets the unique name of the directory, used for registering.
-
getSchema
public String getSchema()
Description copied from interface:Directory
Gets the schema name used by this directory.
-
getParentDirectory
public String getParentDirectory()
Description copied from interface:Directory
Gets the name of the parent directory. This is used for hierarchical vocabularies.- Specified by:
getParentDirectory
in interfaceDirectory
- Returns:
- the name of the parent directory, or null.
-
getIdField
public String getIdField()
Description copied from interface:Directory
Gets the id field of the schema for this directory.- Specified by:
getIdField
in interfaceDirectory
- Returns:
- the id field.
-
getPasswordField
public String getPasswordField()
Description copied from interface:Directory
Gets the password field of the schema for this directory.- Specified by:
getPasswordField
in interfaceDirectory
- Returns:
- the password field.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:Directory
Checks if this directory is read-only.- Specified by:
isReadOnly
in interfaceDirectory
-
setReadOnly
public void setReadOnly(boolean readOnly)
-
invalidateCaches
public void invalidateCaches()
Description copied from interface:Directory
Invalidate caches- Specified by:
invalidateCaches
in interfaceDirectory
-
getFieldMapper
public DirectoryFieldMapper getFieldMapper()
-
getReference
@Deprecated public Reference getReference(String referenceFieldName)
Deprecated.Description copied from interface:Directory
Lookup a Reference by field name.- Specified by:
getReference
in interfaceDirectory
- Returns:
- the matching reference implementation or null
-
getReferences
public List<Reference> getReferences(String referenceFieldName)
Description copied from interface:Directory
Lookup the References by field name.- Specified by:
getReferences
in 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:Directory
Lookup all References defined on the directory.- Specified by:
getReferences
in 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:Directory
Gets 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:Directory
Invalidates the cache instance of the directory- Specified by:
invalidateDirectoryCache
in interfaceDirectory
-
isMultiTenant
public boolean isMultiTenant()
Description copied from interface:Directory
Returnstrue
if this directory is a multi tenant directory,false
otherwise.- Specified by:
isMultiTenant
in interfaceDirectory
-
shutdown
public void shutdown()
Description copied from interface:Directory
Shuts down the directory.
-
getDirectoryDeleteConstraints
public List<DirectoryDeleteConstraint> getDirectoryDeleteConstraints()
- Specified by:
getDirectoryDeleteConstraints
in interfaceDirectory
- Since:
- 8.4
-
initSchemaFieldMap
protected void initSchemaFieldMap()
-
getSchemaFieldMap
public Map<String,Field> getSchemaFieldMap()
Description copied from interface:Directory
Get schema field map- Specified by:
getSchemaFieldMap
in interfaceDirectory
-
fallbackOnDefaultCache
protected void fallbackOnDefaultCache()
-
-