public class MongoDBReference extends AbstractReference
Reference
Modifier and Type | Field and Description |
---|---|
protected String |
collection |
protected String |
dataFileName |
protected String |
sourceField |
protected String |
targetField |
fieldName, sourceDirectory, sourceDirectoryName, targetDirectory, targetDirectoryName
Constructor and Description |
---|
MongoDBReference(MongoDBReferenceDescriptor descriptor) |
MongoDBReference(ReferenceDescriptor descriptor) |
MongoDBReference(String field,
String directory,
String collection,
String sourceField,
String targetField,
String dataFileName) |
Modifier and Type | Method and Description |
---|---|
void |
addLinks(List<String> sourceIds,
String targetId) |
void |
addLinks(List<String> sourceIds,
String targetId,
Session session)
Adds the links between the source ids and the target id
|
void |
addLinks(String sourceId,
List<String> targetIds) |
void |
addLinks(String sourceId,
List<String> targetIds,
Session session)
Adds the links between the source id and the target ids
|
protected com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(MongoDBSession session) |
protected MongoDBSession |
getMongoDBSession() |
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 id
|
protected void |
initialize(MongoDBSession session) |
void |
removeLinksForSource(String sourceId) |
void |
removeLinksForSource(String sourceId,
Session session)
Removes all the links for a given source id
|
void |
removeLinksForTarget(String targetId) |
void |
removeLinksForTarget(String targetId,
Session session)
Removes all the links for a given target id
|
void |
setSourceIdsForTarget(String targetId,
List<String> sourceIds) |
void |
setSourceIdsForTarget(String targetId,
List<String> sourceIds,
Session session)
Sets all source ids to be associated to the given target id
|
void |
setTargetIdsForSource(String sourceId,
List<String> targetIds) |
void |
setTargetIdsForSource(String sourceId,
List<String> targetIds,
Session session)
Sets all target ids to be associated to the given source id
|
getFieldName, getSourceDirectory, getTargetDirectory, setSourceDirectoryName, setTargetDirectoryName
protected String collection
protected String sourceField
protected String targetField
protected String dataFileName
public MongoDBReference(String field, String directory, String collection, String sourceField, String targetField, String dataFileName)
public MongoDBReference(MongoDBReferenceDescriptor descriptor)
public MongoDBReference(ReferenceDescriptor descriptor)
public void addLinks(String sourceId, List<String> targetIds, Session session)
Reference
sourceId
- the source idtargetIds
- the target idssession
- the sessionpublic void addLinks(List<String> sourceIds, String targetId, Session session)
Reference
sourceIds
- the source idstargetId
- the target idsession
- the sessionpublic void removeLinksForSource(String sourceId)
public void removeLinksForSource(String sourceId, Session session)
Reference
sourceId
- the source idsession
- the sessionpublic void removeLinksForTarget(String targetId)
public void removeLinksForTarget(String targetId, Session session)
Reference
targetId
- the target idsession
- the sessionpublic List<String> getTargetIdsForSource(String sourceId)
public List<String> getTargetIdsForSource(String sourceId, MongoDBSession session)
sourceId
- the source idsession
- the mongoDB sessionpublic List<String> getSourceIdsForTarget(String targetId)
public void setTargetIdsForSource(String sourceId, List<String> targetIds)
public void setTargetIdsForSource(String sourceId, List<String> targetIds, Session session)
Reference
sourceId
- the source idtargetIds
- the target idssession
- the sessionpublic void setSourceIdsForTarget(String targetId, List<String> sourceIds)
public void setSourceIdsForTarget(String targetId, List<String> sourceIds, Session session)
Reference
targetId
- the target idsourceIds
- the source idssession
- the sessionprotected void initialize(MongoDBSession session)
protected MongoDBSession getMongoDBSession()
protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection(MongoDBSession session)
Copyright © 2019 Nuxeo. All rights reserved.