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

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

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

Directory.getName介绍

[英]Gets the unique name of the directory, used for registering.
[中]获取用于注册的目录的唯一名称。

代码示例

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

@Override
public String toString() {
  return "SQLSession [directory=" + directory.getName() + ", sid=" + sid + "]";
}

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

public String getName() {
  return directory.getName();
}

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

@Override
// useful for the log function
public String toString() {
  return String.format("LDAPSession '%s' for directory %s", sid, directory.getName());
}

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

private void acquireConnection() {
  try {
    if (sqlConnection == null || sqlConnection.isClosed()) {
      sqlConnection = getDirectory().getConnection();
    }
  } catch (SQLException e) {
    throw new DirectoryException(
        "Cannot connect to SQL directory '" + directory.getName() + "': " + e.getMessage(), e);
  }
}

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

@Override
  DirectoryEntry run(Session session) {
    DocumentModel docEntry = session.createEntry(entry.getDocumentModel());
    return new DirectoryEntry(directory.getName(), docEntry);
  }
});

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

@Override
  public List<DirectoryEntry> getCurrentPage() {
    Object[] parameters = getParameters();
    if (parameters == null || parameters.length > 1) {
      throw new IllegalStateException("Invalid parameters: " + Arrays.toString(parameters));
    }

    if (!(parameters[0] instanceof Directory)) {
      throw new IllegalStateException("Provided parameter is not a Directory: " + parameters[0]);
    }

    Directory directory = (Directory) parameters[0];

    try (Session session = directory.getSession()) {
      return session.query(Collections.emptyMap(), Collections.emptySet(), Collections.emptyMap(), false,
          (int) getPageSize(), (int) getCurrentPageOffset())
             .stream()
             .map(dir -> new DirectoryEntry(directory.getName(), dir))
             .collect(Collectors.toList());
    }
  }
}

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

void checkEditGuards() {
  NuxeoPrincipal currentUser = getContext().getCoreSession().getPrincipal();
  if (!(currentUser.isAdministrator() || currentUser.isMemberOf("powerusers"))) {
    throw new WebSecurityException("Not allowed to edit directory");
  }
  UserManager um = Framework.getService(UserManager.class);
  if (directory.getName().equals(um.getUserDirectoryName())
      || directory.getName().equals(um.getGroupDirectoryName())) {
    throw new NuxeoException("Not allowed to edit user/group directories, please use user/group endpoints",
        SC_BAD_REQUEST);
  }
}

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

Session dirSession = dir.getSession();
  dirSession.close();
  dirName = dir.getName();
} catch (DirectoryException e) {
  success = false;

代码示例来源: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-rest-api-server

@Override
  Object run(Session session) {
    DocumentModel entry = session.getEntry(entryId);
    if (entry == null) {
      throw new WebResourceNotFoundException("Entry not found");
    }
    return newObject("directoryEntry", new DirectoryEntry(directory.getName(), entry), entryId);
  }
});

代码示例来源: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-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-rest-api-server

@Override
  DirectoryEntry run(Session session) {
    try {
      DocumentModel docEntry = entry.getDocumentModel();
      session.updateEntry(docEntry);
      return new DirectoryEntry(directory.getName(), session.getEntry(docEntry.getId()));
    } catch (DirectoryException e) {
      throw new NuxeoException(e.getMessage(), SC_BAD_REQUEST);
    }
  }
});

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

log.warn("Directory " + getDirectory().getName() + " cannot update field " + referenceFieldName
    + " for entry " + docModel.getId()
    + ": this field is associated with more than one reference");

相关文章