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

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

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

Directory.getSchema介绍

[英]Gets the schema name used by this directory.
[中]获取此目录使用的架构名称。

代码示例

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

@Override
public DocumentModel createEntry(DocumentModel entry) {
  Map<String, Object> fieldMap = entry.getProperties(directory.getSchema());
  Map<String, Object> simpleNameFieldMap = new HashMap<>();
  for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) {
    String fieldKey = fieldEntry.getKey();
    if (fieldKey.contains(":")) {
      fieldKey = fieldKey.split(":")[1];
    }
    simpleNameFieldMap.put(fieldKey, fieldEntry.getValue());
  }
  return createEntry(simpleNameFieldMap);
}

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

if (field == null) {
  String message = String.format("Invalid field name '%s' for directory '%s' with schema '%s'", fieldName,
      directory.getName(), directory.getSchema());
  throw new DirectoryException(message);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-forms-layout-io-plugins

public static List<WidgetSelectOption> getVocabularySelectOptions(String dirName, String lang) {
  DirectoryService ds = Framework.getService(DirectoryService.class);
  try (Session session = ds.open(dirName)) {
    String schema = ds.getDirectory(dirName).getSchema();
    DocumentModelList entries = session.getEntries();
    return convertToSelectOptions(entries, schema, dirName, lang);
  } catch (DirectoryException e) {
    log.error("Error while getting content of directory " + dirName, e);
    return Collections.emptyList();
  }
}

代码示例来源:origin: org.nuxeo.template.rendering/nuxeo-template-rendering-core

if (ds.getDirectoryNames().contains(voc)) {
  Directory dir = ds.getDirectory(voc);
  String schema = dir.getSchema();
  if ("vocabulary".equals(schema) || "xvocabulary".equals(schema)) {
    try (Session session = dir.getSession()) {

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

@Override
public DocumentModel adapt(Directory directory, DocumentModel entry) {
  if (fieldName == null || pattern == null) {
    log.warn(getClass().getName() + " is missing configuration parameters");
    return entry;
  }
  if (BaseSession.isReadOnlyEntry(entry)) {
    // keep already existing flag
    return entry;
  }
  try {
    Object fieldValue = entry.getProperty(directory.getSchema(), fieldName);
    String value = fieldValue != null ? fieldValue.toString() : "";
    if (pattern.matcher(value).matches()) {
      BaseSession.setReadWriteEntry(entry);
    } else {
      BaseSession.setReadOnlyEntry(entry);
    }
  } catch (PropertyException e) {
    throw new DirectoryException(
        String.format(
            "The field '%s' of entry '%s' could not be adapt and map on directory '%s', check that the field exist in the schema",
            fieldName, entry.getId(), directory.getName()), e);
  }
  return entry;
}

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

protected BaseSession(Directory directory, Class<? extends Reference> referenceClass) {
  this.directory = directory;
  schemaName = directory.getSchema();
  directoryName = directory.getName();
  BaseDirectoryDescriptor desc = directory.getDescriptor();
  substringMatchType = desc.getSubstringMatchType();
  autoincrementId = desc.isAutoincrementIdField();
  permissions = desc.permissions;
  passwordHashAlgorithm = desc.passwordHashAlgorithm;
  this.referenceClass = referenceClass;
  computeMultiTenantId = desc.isComputeMultiTenantId();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-ui-select2

protected JSONObject getSingleDirectoryEntry(final String storedReference, final String directoryName,
    final boolean localize, String keySeparator, final boolean dbl10n, final String labelFieldName) {
  if (storedReference == null || storedReference.isEmpty()) {
    return null;
  }
  DirectoryService directoryService = Framework.getService(DirectoryService.class);
  try {
    Directory directory = directoryService.getDirectory(directoryName);
    if (directory == null) {
      log.error("Could not find directory with name " + directoryName);
      return null;
    }
    try (Session session = directory.getSession()) {
      String schemaName = directory.getSchema();
      SchemaManager schemaManager = Framework.getService(SchemaManager.class);
      Schema schema = schemaManager.getSchema(schemaName);
      final Locale locale = org.jboss.seam.core.Locale.instance();
      final String label = SuggestConstants.getLabelFieldName(schema, dbl10n, labelFieldName,
          locale.getLanguage());
      JSONObject obj = resolveDirectoryEntry(storedReference, keySeparator, session, schema, label, localize,
          dbl10n);
      return obj;
    }
  } catch (DirectoryException de) {
    log.error("An error occured while obtaining directory " + directoryName, de);
    return null;
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-ui-select2

String schemaName = directory.getSchema();
SchemaManager schemaManager = Framework.getService(SchemaManager.class);
Schema schema = schemaManager.getSchema(schemaName);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-forms-layout-io-plugins

List<WidgetSelectOption> result = new ArrayList<WidgetSelectOption>();
try (Session session = ds.open(parentDirName); Session subSession = ds.open(childDirName)) {
  String schema = ds.getDirectory(parentDirName).getSchema();
  String subSchema = ds.getDirectory(childDirName).getSchema();

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

/**
 * Fetches both statically and dynamically defined references and merges the results.
 *
 * @see org.nuxeo.ecm.directory.Reference#getSourceIdsForTarget(String)
 */
@Override
// XXX: broken, use getLdapTargetIds for a proper implementation
public List<String> getTargetIdsForSource(String sourceId) {
  String schemaName = getSourceDirectory().getSchema();
  try (Session session = getSourceDirectory().getSession()) {
    try {
      return BaseSession.toStringList(session.getEntry(sourceId).getProperty(schemaName, fieldName));
    } catch (PropertyException e) {
      throw new DirectoryException(e);
    }
  }
}

代码示例来源:origin: toutatice-services.carto-nat/toutatice-carto-nat-ecm

String schema = directory.getSchema();
DocumentModel entry = session.getEntry(entryId);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

Schema schema = schemaManager.getSchema(directory.getSchema());
if (!schema.hasField(PARENT_FIELD_ID)) {
  throw new DirectoryException(directoryName + "does not have the required field: "

相关文章