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; } }
if (factories.containsKey(doc.getType())) { BlobHolderFactory factory = factories.get(doc.getType()); return factory.getBlobHolder(doc); if (doc.hasFacet(entry.getKey())) { return entry.getValue().getBlobHolder(doc); if (doc.hasSchema("file")) { return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { mt = (String) doc.getPropertyValue("note:mime_type"); if (mt == null) { String note = (String) doc.getPropertyValue("note:note"); if (note != null && !"".equals(note)) { mt = "text/plain"; // BBB
@Override public void setObject(Object object) { Serializable reference = resolver.getReference(object); doc.setPropertyValue(xpath, reference); }
public InstanceRef(DocumentModel doc, NuxeoPrincipal principal) { if (doc.getRef() == null) { throw new NullPointerException("document as no reference yet"); } referent = doc; repositoryName = doc.getRepositoryName(); this.principal = principal; ref = doc.getRef(); }
@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 Object fetch() { return resolver.fetch(doc.getPropertyValue(xpath), doc.getCoreSession()); }
@Override public void run() throws NuxeoException { String docTitle = this.document.getTitle(); DocumentModel docParent = this.session.getParentDocument(this.document.getRef()); DocumentModelList rs = this.session.query("SELECT * FROM " + this.document.getType() + " WHERE ecm:parentId = '" + docParent.getId() + "' " + "AND ecm:mixinType != 'HiddenInNavigation' " + "AND ecm:isCheckedInVersion = 0 " + "AND dc:title LIKE '" + docTitle.replace("'", "\\'") + "%'", this.filter); this.count = rs.size(); } }
@Override public void run() { DocumentModel parent = session.getParentDocument(sectionRoot.getRef()); SchemaManager schemaManager = Framework.getService(SchemaManager.class); while (parent != null && !"/".equals(parent.getPathAsString())) { if (schemaManager.hasSuperType(parent.getType(), "Domain")) { domainName.add(parent.getTitle()); return; } } } }.runUnrestricted();
public String getId() { return doc.getId(); }
@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(); } }
private void initializeThread(DocumentModel thread) { // Update ttcth:lastCommentDate to set Thread first in list // (nb answers is set to 0 by default - schema definition) GregorianCalendar dateCreation = (GregorianCalendar) thread.getPropertyValue("dc:created"); thread.setPropertyValue(CollabToolsConstants.TTC_THREAD_LAST_COMMENT_DATE_XPATH, dateCreation); }
@Override public Blob getBlob() { return (Blob) doc.getPropertyValue(xPath); }
@Observer(value = {EventNames.NEW_DOCUMENT_CREATED}) public void initShowInMenu() throws NuxeoException { final DocumentModel newDocument = navigationContext.getChangeableDocument(); if (newDocument.hasFacet(ToutaticeNuxeoStudioConst.CST_FACET_SPACE_NAVIGATION_ITEM) || "Folder".equals(newDocument.getType()) || "OrderedFolder".equals(newDocument.getType())) { newDocument.setPropertyValue(ToutaticeNuxeoStudioConst.CST_DOC_XPATH_TOUTATICE_SIM, true); if ("PortalSite".equals(newDocument.getType())) { newDocument.setPropertyValue(ToutaticeNuxeoStudioConst.CST_DOC_XPATH_TOUTATICE_INTERNAL_CONTEXTUALIZATION, true); } } }
protected boolean hasPermission(CoreSession session, DocumentModel doc, Set<String> permissions, boolean required) { for (String permission : permissions) { if ((required && !session.hasPermission(doc.getRef(), permission)) || (!required && session.hasPermission(doc.getRef(), permission))) { return false; } } return true; }
@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()); }
@SuppressWarnings("unchecked") public DocumentModel addComment(DocumentModel comment, String path) { comment.setPropertyValue(COMMENT_PARENT_ID, docModel.getId()); return commentManager.createLocatedComment(docModel, comment, path); }
@Override public Calendar getModificationDate() { return (Calendar) doc.getProperty("dublincore", "modified"); }
@Override protected String getBasePath() { return doc.getPathAsString(); }