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

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

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

Directory.getSession介绍

[英]Creates a session for accessing entries in this directory.
[中]创建用于访问此目录中的条目的会话。

代码示例

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

public static <T> T withDirectorySession(Directory directory, DirectorySessionRunner<T> runner) {
  try (Session session = directory.getSession()) {
    return runner.run(session);
  }
}

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

@Override
protected ContentProvider getProvider(WebContext ctx) {
  return new DirectoryContentProvider(dir.getSession());
}

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

protected MongoDBSession getMongoDBSession() {
  return (MongoDBSession) getSourceDirectory().getSession();
}

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

protected SQLSession getSQLSession() {
  return (SQLSession) getSourceDirectory().getSession();
}

代码示例来源: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.template.rendering/nuxeo-template-rendering-core

String schema = dir.getSchema();
if ("vocabulary".equals(schema) || "xvocabulary".equals(schema)) {
  try (Session session = dir.getSession()) {
    DocumentModel entry = session.getEntry(keyValue);
    if (entry != null) {

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

String dirName = null;
try {
  Session dirSession = dir.getSession();
  dirSession.close();
  dirName = dir.getName();

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

try (Session session = directory.getSession()) {
  String schemaName = directory.getSchema();
  SchemaManager schemaManager = Framework.getService(SchemaManager.class);

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

Session session = null;
try {
  session = directory.getSession();
  if (session != null) {
    if (value.isList()) {

相关文章