public String getId() { return doc.getId(); }
@Override // need this for tree in RCP clients public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof DocumentModelImpl) { DocumentModel documentModel = (DocumentModel) obj; String id = documentModel.getId(); if (id != null) { return id.equals(this.id); } } return false; }
@Override public String getHash() { Blob blob = getBlob(); if (blob != null) { String h = blob.getDigest(); if (h != null) { return h; } } return doc.getId() + xPath + String.valueOf(getModificationDate()); }
public DocumentLocationImpl(DocumentModel doc) { serverName = doc.getRepositoryName(); docRef = doc.getRef(); String id = doc.getId(); if (id != null) { docIdRef = new IdRef(id); } else { docIdRef = null; } String path = doc.getPathAsString(); if (path != null) { docPathRef = new PathRef(path); } else { docPathRef = null; } }
/** * * @param document * @return true if document is an empty document model (creation). */ public static boolean isEmptyDocumentModel(DocumentModel document) { return document.getId() == null; }
public String getAction() { if (visible && documentModel != null) { String docId = documentModel.getId(); String actionValue = String.format("#{navigationContext.navigateToId('%s')}", docId); return actionValue; } return null; }
public DocumentDescriptor(DocumentModel doc, String title) { this.title = title; id = doc.getId(); type = doc.getType(); }
protected String getDocKey(DocumentModel doc) { // Don't merge commands with different session, so we work only on attached doc return doc.getId() + "#" + doc.getSessionId(); }
public BusinessAdapter(DocumentModel document) { type = document.getType(); doc = document; id = doc.getId(); }
@Override public void run() throws NuxeoException { DocumentModel domain = ToutaticeDocumentHelper.getDomain(this.session, this.document, false); Serializable property = domain.getPropertyValue(TTCD_DEFAULT_PORTAL_SITE_ID); this.defaultPortal = property != null && property.toString().equals(this.document.getId()); }
protected List<SelectItem> convertToSelectItems(List<DocumentModel> docs) { List<SelectItem> items = new ArrayList<>(); for (DocumentModel doc : docs) { items.add(new SelectItem(doc.getId(), doc.getTitle(), "")); } return items; }
@Override public DocumentModelList getDocuments(DocumentModel parent) { CoreSession session = parent.getCoreSession(); return session.query(String.format(TRASHED_QUERY, parent.getId())); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel document) { tagService.removeTags(session, document.getId()); return document; } }
@SuppressWarnings("unchecked") public DocumentModel addComment(DocumentModel comment, String path) { comment.setPropertyValue(COMMENT_PARENT_ID, docModel.getId()); return commentManager.createLocatedComment(docModel, comment, path); }
@Factory(value = "relatedRoutes") public List<DocumentModel> findRelatedRoute() throws ClientException { DocumentModel currentDoc = navigationContext.getCurrentDocument(); if (currentDoc != null) { return findRelatedRoute(currentDoc.getId()); } return new ArrayList<DocumentModel>(); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { IdRef idRef = new IdRef(input.getId()); return session.getLastDocumentVersion(idRef); }
@Override public void run() { version = documentManager.getSourceDocument(document.getRef()); if (version != null) { sourceDocForVersionId = session.getSourceDocument(version.getRef()).getId(); } } }
protected String computeKeyForAtomicCreation(DocumentModel docModel) { String repositoryName = docModel.getRepositoryName(); if (repositoryName == null) { repositoryName = getRepositoryName(); } String parentId = getDocument(docModel.getParentRef()).getId(); String name = docModel.getName(); return repositoryName + "-" + parentId + "-" + name; }
@Override public void deleteComment(DocumentModel docModel, DocumentModel comment) { try (CloseableCoreSession session = CoreInstance.openCoreSessionSystem(docModel.getRepositoryName())) { DocumentRef ref = comment.getRef(); if (!session.exists(ref)) { throw new NuxeoException("Comment Document does not exist: " + comment.getId()); } session.removeDocument(ref); notifyEvent(session, CommentEvents.COMMENT_REMOVED, docModel, comment); session.save(); } }
protected void trashDescendants(DocumentModel model, Boolean value) { CoreSession session = model.getCoreSession(); BulkService service = Framework.getService(BulkService.class); String nxql = String.format("SELECT * from Document where ecm:ancestorId='%s'", model.getId()); service.submit(new BulkCommand.Builder(ACTION_NAME, nxql).repository(session.getRepositoryName()) .user(session.getPrincipal().getName()) .param(PARAM_NAME, value) .build()); }