Package org.nuxeo.directory.mongodb
Class MongoDBReference
- java.lang.Object
-
- org.nuxeo.ecm.directory.AbstractReference
-
- org.nuxeo.directory.mongodb.MongoDBReference
-
- All Implemented Interfaces:
Reference
public class MongoDBReference extends AbstractReference
MongoDB implementation of aReference- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringcollectionprotected StringdataFileNamestatic StringGROUP_TO_GROUP_CHILD_GROUP_IDstatic StringGROUP_TO_GROUP_COLLECTIONstatic StringGROUP_TO_GROUP_PARENT_GROUP_IDprotected StringsourceFieldprotected StringtargetFieldstatic StringUSER_TO_GROUP_COLLECTIONstatic StringUSER_TO_GROUP_GROUP_IDstatic StringUSER_TO_GROUP_USER_ID-
Fields inherited from class org.nuxeo.ecm.directory.AbstractReference
fieldName, sourceDirectory, sourceDirectoryName, targetDirectory, targetDirectoryName
-
-
Constructor Summary
Constructors Constructor Description MongoDBReference(String field, String directory, String collection, String sourceField, String targetField, String dataFileName)MongoDBReference(MongoDBReferenceDescriptor descriptor)MongoDBReference(ReferenceDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLinks(String sourceId, List<String> targetIds)voidaddLinks(String sourceId, List<String> targetIds, Session session)Adds the links between the source id and the target idsvoidaddLinks(List<String> sourceIds, String targetId)voidaddLinks(List<String> sourceIds, String targetId, Session session)Adds the links between the source ids and the target idprotected voidcreateIndexes(MongoDBSession session)protected com.mongodb.client.MongoCollection<org.bson.Document>getCollection(MongoDBSession session)protected MongoDBSessiongetMongoDBSession()List<String>getSourceIdsForTarget(String targetId)List<String>getTargetIdsForSource(String sourceId)List<String>getTargetIdsForSource(String sourceId, MongoDBSession session)Retrieves all target ids associated to the given source idprotected voidinitialize(MongoDBSession session)protected booleanisGroupToGroup()protected booleanisUserToGroup()voidremoveLinksForSource(String sourceId)voidremoveLinksForSource(String sourceId, Session session)Removes all the links for a given source idvoidremoveLinksForTarget(String targetId)voidremoveLinksForTarget(String targetId, Session session)Removes all the links for a given target idvoidsetSourceIdsForTarget(String targetId, List<String> sourceIds)voidsetSourceIdsForTarget(String targetId, List<String> sourceIds, Session session)Sets all source ids to be associated to the given target idvoidsetTargetIdsForSource(String sourceId, List<String> targetIds)voidsetTargetIdsForSource(String sourceId, List<String> targetIds, Session session)Sets all target ids to be associated to the given source id-
Methods inherited from class org.nuxeo.ecm.directory.AbstractReference
getFieldName, getSourceDirectory, getTargetDirectory, setSourceDirectoryName, setTargetDirectoryName
-
-
-
-
Field Detail
-
GROUP_TO_GROUP_COLLECTION
public static final String GROUP_TO_GROUP_COLLECTION
- Since:
- 11.5
- See Also:
- Constant Field Values
-
GROUP_TO_GROUP_CHILD_GROUP_ID
public static final String GROUP_TO_GROUP_CHILD_GROUP_ID
- Since:
- 11.5
- See Also:
- Constant Field Values
-
GROUP_TO_GROUP_PARENT_GROUP_ID
public static final String GROUP_TO_GROUP_PARENT_GROUP_ID
- Since:
- 11.5
- See Also:
- Constant Field Values
-
USER_TO_GROUP_COLLECTION
public static final String USER_TO_GROUP_COLLECTION
- Since:
- 11.5
- See Also:
- Constant Field Values
-
USER_TO_GROUP_GROUP_ID
public static final String USER_TO_GROUP_GROUP_ID
- Since:
- 11.5
- See Also:
- Constant Field Values
-
USER_TO_GROUP_USER_ID
public static final String USER_TO_GROUP_USER_ID
- Since:
- 11.5
- See Also:
- Constant Field Values
-
collection
protected String collection
-
sourceField
protected String sourceField
-
targetField
protected String targetField
-
dataFileName
protected String dataFileName
-
-
Constructor Detail
-
MongoDBReference
public MongoDBReference(String field, String directory, String collection, String sourceField, String targetField, String dataFileName)
- Since:
- 9.2
-
MongoDBReference
public MongoDBReference(MongoDBReferenceDescriptor descriptor)
- Since:
- 9.2
-
MongoDBReference
public MongoDBReference(ReferenceDescriptor descriptor)
- Since:
- 9.2
-
-
Method Detail
-
addLinks
public void addLinks(String sourceId, List<String> targetIds, Session session)
Description copied from interface:ReferenceAdds the links between the source id and the target ids- Parameters:
sourceId- the source idtargetIds- the target idssession- the session
-
addLinks
public void addLinks(List<String> sourceIds, String targetId, Session session)
Description copied from interface:ReferenceAdds the links between the source ids and the target id- Parameters:
sourceIds- the source idstargetId- the target idsession- the session
-
removeLinksForSource
public void removeLinksForSource(String sourceId)
-
removeLinksForSource
public void removeLinksForSource(String sourceId, Session session)
Description copied from interface:ReferenceRemoves all the links for a given source id- Parameters:
sourceId- the source idsession- the session
-
removeLinksForTarget
public void removeLinksForTarget(String targetId)
-
removeLinksForTarget
public void removeLinksForTarget(String targetId, Session session)
Description copied from interface:ReferenceRemoves all the links for a given target id- Parameters:
targetId- the target idsession- the session
-
getTargetIdsForSource
public List<String> getTargetIdsForSource(String sourceId, MongoDBSession session)
Retrieves all target ids associated to the given source id- Parameters:
sourceId- the source idsession- the mongoDB session- Returns:
- the list of target ids
-
setTargetIdsForSource
public void setTargetIdsForSource(String sourceId, List<String> targetIds, Session session)
Description copied from interface:ReferenceSets all target ids to be associated to the given source id- Parameters:
sourceId- the source idtargetIds- the target idssession- the session
-
setSourceIdsForTarget
public void setSourceIdsForTarget(String targetId, List<String> sourceIds, Session session)
Description copied from interface:ReferenceSets all source ids to be associated to the given target id- Parameters:
targetId- the target idsourceIds- the source idssession- the session
-
initialize
protected void initialize(MongoDBSession session)
-
createIndexes
protected void createIndexes(MongoDBSession session)
-
isGroupToGroup
protected boolean isGroupToGroup()
-
isUserToGroup
protected boolean isUserToGroup()
-
getMongoDBSession
protected MongoDBSession getMongoDBSession()
-
getCollection
protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection(MongoDBSession session)
-
-