org.nuxeo.ecm.directory.Directory.getReferences()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.nuxeo.ecm.directory.Directory.getReferences()方法的一些代码示例,展示了Directory.getReferences()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getReferences()方法的具体详情如下:
包路径:org.nuxeo.ecm.directory.Directory
类名称:Directory
方法名:getReferences

Directory.getReferences介绍

[英]Lookup all References defined on the directory.
[中]查找目录中定义的所有引用。

代码示例

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-multi

protected List<String> doCollect(Collector extractor) {
  DirectoryService dirService = Framework.getService(DirectoryService.class);
  Set<String> ids = new HashSet<>();
  for (SourceDescriptor src : dir.getDescriptor().sources) {
    for (SubDirectoryDescriptor sub : src.subDirectories) {
      Directory dir = dirService.getDirectory(sub.name);
      if (dir == null) {
        continue;
      }
      List<Reference> ref = dir.getReferences(fieldName);
      if (ref == null) {
        continue;
      }
      try {
        ids.addAll(extractor.collect(ref));
      } catch (DirectoryEntryNotFoundException e) {
        log.debug(e.getMessage());
      }
    }
  }
  List<String> x = new ArrayList<>(ids.size());
  x.addAll(ids);
  return x;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-ldap

List<org.nuxeo.ecm.directory.Reference> references = directory.getReferences(fieldName);
if (references != null && references.size() > 0) {
  if (fetchReferences) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-api

@Override
public DocumentModel createEntry(Map<String, Object> fieldMap) {
  checkPermission(SecurityConstants.WRITE);
  DocumentModel docModel = createEntryWithoutReferences(fieldMap);
  // Add references fields
  Map<String, Field> schemaFieldMap = directory.getSchemaFieldMap();
  String idFieldName = schemaFieldMap.get(getIdField()).getName().getPrefixedName();
  Object entry = fieldMap.get(idFieldName);
  String sourceId = docModel.getId();
  for (Reference reference : getDirectory().getReferences()) {
    String referenceFieldName = schemaFieldMap.get(reference.getFieldName()).getName().getPrefixedName();
    if (getDirectory().getReferences(reference.getFieldName()).size() > 1) {
      if (log.isWarnEnabled()) {
        log.warn("Directory " + directoryName + " cannot create field " + reference.getFieldName()
            + " for entry " + entry + ": this field is associated with more than one reference");
      }
      continue;
    }
    List<String> targetIds = toStringList(fieldMap.get(referenceFieldName));
    if (reference.getClass() == referenceClass) {
      reference.addLinks(sourceId, targetIds, this);
    } else {
      reference.addLinks(sourceId, targetIds);
    }
  }
  getDirectory().invalidateCaches();
  return docModel;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-mongodb

for (Reference reference : directory.getReferences()) {
  List<String> targetIds;
  if (reference instanceof MongoDBReference) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-api

List<Reference> references = directory.getReferences(referenceFieldName);
if (references.size() > 1) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-sql

for (org.nuxeo.ecm.directory.Reference reference : directory.getReferences()) {
  List<String> targetIds = reference.getTargetIdsForSource(entry.getId());
  targetIds = new ArrayList<>(targetIds);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-sql

for (org.nuxeo.ecm.directory.Reference reference : directory.getReferences()) {
  List<String> targetIds = reference.getTargetIdsForSource(docModel.getId());
  String fieldName = reference.getFieldName();

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-sql

for (org.nuxeo.ecm.directory.Reference reference : directory.getReferences()) {
  List<String> targetIds = reference.getTargetIdsForSource(docModel.getId());
  String fieldName = reference.getFieldName();

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-api

@Override
public void deleteEntry(String id) {
  if (!canDeleteMultiTenantEntry(id)) {
    throw new OperationNotAllowedException("Operation not allowed in the current tenant context",
        "label.directory.error.multi.tenant.operationNotAllowed", null);
  }
  checkPermission(SecurityConstants.WRITE);
  checkDeleteConstraints(id);
  for (Reference reference : getDirectory().getReferences()) {
    if (reference.getClass() == referenceClass) {
      reference.removeLinksForSource(id, this);
    } else {
      reference.removeLinksForSource(id);
    }
  }
  deleteEntryWithoutReferences(id);
  getDirectory().invalidateCaches();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-ldap

attrs.put(attr);
} else if (getDirectory().isReference(fieldId)) {
  List<org.nuxeo.ecm.directory.Reference> references = directory.getReferences(fieldId);
  if (references.size() > 1) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-directory-mongodb

for (Reference reference : directory.getReferences()) {
  List<String> targetIds;
  if (reference instanceof MongoDBReference) {

相关文章