private boolean accept(DocumentModel doc) { if (type != null && !type.equals(doc.getType())) { return false; } if (filter != null && !filter.accept(doc)) { return false; } return true; }
public ThumbnailFactory getThumbnailFactory(DocumentModel doc, CoreSession session) { if (factoriesByDocType.containsKey(doc.getType())) { ThumbnailFactory factory = factoriesByDocType.get(doc.getType()); return factory; } for (Map.Entry<String, ThumbnailFactory> entry : factoriesByFacets.entrySet()) { if (doc.hasFacet(entry.getKey())) { return entry.getValue(); } } if (defaultFactory == null) { throw new NuxeoException("Please contribute a default thumbnail factory"); } return defaultFactory; } }
@Override public boolean accept(DocumentModel document) { String docType = document.getType(); if (excludedTypes != null && excludedTypes.contains(docType)) { return false; } // exclude trashed documents from tree if (document.isTrashed()) { return false; } // XXX AT: this could have not been copied from FacetFilter if fields // were not private there. if (excludedFacets != null) { for (String exc : excludedFacets) { if (document.hasFacet(exc)) { return false; } } } if (includedFacets != null) { for (String req : includedFacets) { if (!document.hasFacet(req)) { return false; } } } return true; }
@Override public String getSequenceKey(DocumentModel document) throws DocumentException { assert document != null; return document.getType(); }
/** * {@inheritDoc} */ @Override protected boolean isSyncReIndexation(DocumentModel linkedDocument) { if(linkedDocument != null){ // Done in asynchronous way return !ArrayUtils.contains(DenormalizationConstants.UNUM_LINKED_TYPES, linkedDocument.getType()); } return true; }
@Override public boolean accept(DocumentModel docModel) { return ToutaticeNuxeoStudioConst.CST_DOC_TYPE_DOMAIN.equals(docModel.getType()); } }, runInUnrestrictedMode, true, true);
@Override public String getSuperParentType(DocumentModel doc) { DocumentModel superSpace = getSuperSpace(doc); if (superSpace == null) { return null; } else { return superSpace.getType(); } }
@Override public boolean test(DocumentModel previousDocument, DocumentModel currentDocument) { // exclude 'Workspace' document type because it owns 'file' schema which is involved in versioning policy return WORKSPACE_TYPE.equals(currentDocument.getType()) || currentDocument.hasFacet(FacetNames.SYSTEM_DOCUMENT); }
public BusinessAdapter(DocumentModel document) { type = document.getType(); doc = document; id = doc.getId(); }
@Override public DocumentModel getThreadForComment(DocumentModel comment) throws CommentSecurityException { List<DocumentModel> threads = getDocumentsForComment(comment); if (threads.size() > 0) { DocumentModel thread = threads.get(0); while (thread.getType().equals("Post") || thread.getType().equals(COMMENT_DOC_TYPE)) { thread = getThreadForComment(thread); } return thread; } return null; }
public DocumentDescriptor(DocumentModel doc, String title) { this.title = title; id = doc.getId(); type = doc.getType(); }
protected String getPublicationAreaName(DocumentModel document) { String name = CST_DEFAULT_PUBLICATON_AREA_TITLE; final DocumentModel area = ((ToutaticeNavigationContext) navigationContext).getPublicationArea(document); if (!ToutaticeGlobalConst.NULL_DOCUMENT_MODEL.getType().equals(area.getType())) { try { name = area.getTitle(); } catch (final NuxeoException e) { log.debug("Failed to get the publication area name, error: " + e.getMessage()); } } return name; }
/** * Check if the container is a publish space. If this is not the case, a proxy copied to it will be recreated as a * new document. */ protected boolean isPublishSpace(DocumentModel container) { SchemaManager schemaManager = Framework.getService(SchemaManager.class); Set<String> publishSpaces = schemaManager.getDocumentTypeNamesForFacet(FacetNames.PUBLISH_SPACE); if (publishSpaces == null || publishSpaces.isEmpty()) { publishSpaces = new HashSet<>(); } return publishSpaces.contains(container.getType()); }
protected void retrieveContentViewHeaders(DocumentModel doc) { String docType = doc.getType(); if (!typeToContentView.containsKey(docType)) { TypeInfo typeInfo = doc.getAdapter(TypeInfo.class); Map<String, List<ContentViewHeader>> byCategories = getContentViewHeaders(typeInfo, false); typeToContentView.put(docType, byCategories); } }
private String getAssoiciatedTrainingRef(String mode, DocumentModel doc) { onModeChange(mode); if (doReloadDocTrainingData) { doReloadDocTrainingData = false; if (doc.getType().equals(DafpicConstants.CST_DOC_TYPE_STAGE)) { // edit or view modes linkedTrainingDocumentRef = (String) getDocumentProperty(doc, DafpicConstants.CST_DOC_XPATH_STAGE_FORMATION_REF); } } // else create mode (no document exists yet) return linkedTrainingDocumentRef; }
private String getAssoiciatedTrainingRef(String mode, DocumentModel doc) { onModeChange(mode); if (doReloadDocTrainingData) { doReloadDocTrainingData = false; if (doc.getType().equals(NuxeoStudioConst.CST_DOC_TYPE_STAGE)) { // edit or view modes linkedTrainingDocumentRef = (String) getDocumentProperty(doc, NuxeoStudioConst.CST_DOC_XPATH_STAGE_FORMATION_REF); } } // else create mode (no document exists yet) return linkedTrainingDocumentRef; }
@Override public void write(JsonGenerator jg, DocumentModel document) throws IOException { PermissionProvider permissionProvider = Framework.getService(PermissionProvider.class); List<UserVisiblePermission> userVisiblePermissions = permissionProvider.getUserVisiblePermissionDescriptors(document.getType()); jg.writeArrayFieldStart(NAME); for (UserVisiblePermission permission : userVisiblePermissions) { jg.writeString(permission.getId()); } jg.writeEndArray(); }
private String getPropertyValCurrentDoc(final String xpath) { DocumentModel currentDoc = navigationContext.getCurrentDocument(); String val = null; if ((currentDoc != null) && currentDoc.getType().equals("uar-demande-impression-dossier")) { currentDoc = navigationContext.getChangeableDocument(); } if (currentDoc != null) { val = (String) currentDoc.getPropertyValue(xpath); } return val; }
public DocumentRoot(WebContext ctx, DocumentModel root) { initialize(ctx, ctx.getModule().getType(root.getType()), root); setRoot(true); ctx.push(this); }