protected DirectoryTree(String directory) { this(Framework.getService(DirectoryService.class).getDirectory(directory)); }
continue; Directory dir = directoryService.getDirectory(id); long startTime = Calendar.getInstance().getTimeInMillis(); String dirName = null;
String keyValue = keys.get(i); if (ds.getDirectoryNames().contains(voc)) { Directory dir = ds.getDirectory(voc); String schema = dir.getSchema(); if ("vocabulary".equals(schema) || "xvocabulary".equals(schema)) {
@Override protected void initialize(Object... args) { super.initialize(args); if (args.length < 1) { throw new IllegalArgumentException("Directory Object takes one parameter"); } String dirName = (String) args[0]; directory = Framework.getService(DirectoryService.class).getDirectory(dirName); if (directory == null) { throw new WebResourceNotFoundException("Directory " + dirName + " was not found"); } }
public VocabularyTreeNode get(String vocabularyName, boolean displayObsoleteEntries, char keySeparator, String orderingField) { if (treeModels == null) { treeModels = new HashMap<String, VocabularyTreeNode>(); } VocabularyTreeNode treeModel = treeModels.get(vocabularyName); if (treeModel != null) { // return cached model return treeModel; } DirectoryService directoryService = Framework.getService(DirectoryService.class); try { Directory directory = Framework.getService(DirectoryService.class).getDirectory(vocabularyName); if (directory == null) { throw new DirectoryException(vocabularyName + " is not a registered directory"); } } catch (DirectoryException e) { throw new RuntimeException(e); } treeModel = new VocabularyTreeNode(0, "", "", "", vocabularyName, directoryService, displayObsoleteEntries, keySeparator, orderingField); treeModels.put(vocabularyName, treeModel); return treeModel; }
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(); } }
private Directory getDirectoryFromEntry(final DirectoryEntry entry) { DirectoryService ds = Framework.getService(DirectoryService.class); Directory directory; try { directory = ds.getDirectory(entry.getDirectoryName()); } catch (DirectoryException e) { throw new WebResourceNotFoundException("directory not found"); } return directory; }
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; }
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; } }
Directory directory = directoryService.getDirectory(directoryName); if (directory == null) { log.error("Could not find directory with name " + directoryName);
@Override public void invalidateDirectoryCache() { DirectoryService dirService = Framework.getService(DirectoryService.class); getCache().invalidateAll(); // and also invalidates the cache from the source directories for (SourceDescriptor src : getDescriptor().sources) { for (SubDirectoryDescriptor sub : src.subDirectories) { Directory dir = dirService.getDirectory(sub.name); if (dir != null) { dir.invalidateDirectoryCache(); } } } }
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();
Directory directory = getDirectoryService().getDirectory(directoryName); String schema = directory.getSchema(); DocumentModel entry = session.getEntry(entryId);
Directory userDirectory = directoryService.getDirectory(userDirectoryName);
boolean isFirst = true; for (String directoryName : directories) { Directory directory = directoryService.getDirectory(directoryName); if (directory == null) { throw new DirectoryException(directoryName + " is not a registered directory");
String directoryName = propEntry[1]; Directory directory = denormalizationHelper.getDirectoryService().getDirectory(directoryName); Session session = null; try {
Directory userDir = dirService.getDirectory(userManager.getUserDirectoryName()); if (prefixed) { if (storedReference.startsWith(NuxeoPrincipal.PREFIX)) {
Schema schema = schemaManager.getSchema(userManager.getUserSchemaName()); userList = userManager.searchUsers(prefix); Directory userDir = directoryService.getDirectory(userManager.getUserDirectoryName()); for (DocumentModel user : userList) { NuxeoPrincipal principal = userManager.getPrincipal(user.getTitle());