@Override public boolean accept(DocumentModel docModel) { CoreSession session = docModel.getCoreSession(); return session != null && hasPermission(session, docModel, excluded, false) && hasPermission(session, docModel, required, true); }
@Override public Object fetch() { return resolver.fetch(doc.getPropertyValue(xpath), doc.getCoreSession()); }
@Override public boolean validate() { return resolver.validate(doc.getPropertyValue(xpath), doc.getCoreSession()); }
protected CoreSession getSession() { if (session == null) { if (doc == null) { return null; } session = doc.getCoreSession(); } return session; }
protected CoreSession getSession() { if (adaptedDoc == null) { return null; } return adaptedDoc.getCoreSession(); }
/** * {@inheritDoc} */ @Override public void setCurrentSession(DocumentModel doc){ this.session = doc.getCoreSession(); }
protected boolean initSession(DocumentModel eventDoc) { session = eventDoc.getCoreSession(); return session != null; }
protected CoreSession getSession() { if (session == null && doc != null) { session = doc.getCoreSession(); } return session; }
CoreSession session = currentDoc.getCoreSession(); if (session == null) { return null;
protected CoreSession getCoreSession() { CoreSession session = document.getCoreSession(); if (session == null) { session = (CoreSession) Component.getInstance("documentManager", ScopeType.CONVERSATION); } return session; }
@Override public DocumentModel getThreadForComment(DocumentModel comment) throws CommentSecurityException { return getThreadForComment(comment.getCoreSession(), comment); }
@Override public DocumentModelList getDocuments(DocumentModel parent) { CoreSession session = parent.getCoreSession(); return session.query(String.format(TRASHED_QUERY, parent.getId())); }
public List<Object> getChildren() { List<DocumentModel> children = doc.getCoreSession().getChildren(doc.getRef()); List<Object> docs = new ArrayList<Object>(); for (DocumentModel child : children) { docs.add(nuxeoWrapper.wrap(child)); } return docs; }
/** * @deprecated if the caller is remote, we cannot obtain the session */ @Deprecated private static String getCurrentUser(DocumentModel target) { CoreSession userSession = target.getCoreSession(); if (userSession == null) { throw new NuxeoException("userSession is null, do not invoke this method when the user is not local"); } return userSession.getPrincipal().getName(); }
@Override public void removeForcedType(String type, boolean save) { List<String> types = getForcedTypes(); if (types.contains(type)) { types.remove(type); String[] typesArray = types.toArray(new String[types.size()]); getAdaptedDoc().setPropertyValue(TemplateSourceDocumentAdapterImpl.TEMPLATE_FORCED_TYPES_PROP, typesArray); if (save) { adaptedDoc = getAdaptedDoc().getCoreSession().saveDocument(getAdaptedDoc()); } } }
/** * Can be overwritten to allow workflow. Defaults to delete right away. * * @param target commented document * @param comment comment itself */ protected void deleteComment(DocumentModel target, DocumentModel comment) { getCommentManager().deleteComment(target.getCoreSession(), comment.getId()); }
@Override public DocumentModel getAboveDocument(DocumentModel doc, Set<Path> rootPaths) { CoreSession session = doc.getCoreSession(); while (underOneOf(doc.getPath(), rootPaths)) { doc = session.getParentDocument(doc.getRef()); if (doc == null) { // handle placeless document break; } } return doc; }
@Override public List<VersioningOption> getSaveOptions(DocumentModel docModel) { boolean versionable = docModel.isVersionable(); String lifeCycleState = docModel.getCoreSession().getCurrentLifeCycleState(docModel.getRef()); String type = docModel.getType(); return getSaveOptions(versionable, lifeCycleState, type); }
@Override public void setForcedTypes(String[] forcedTypes, boolean save) { getAdaptedDoc().setPropertyValue(TemplateSourceDocumentAdapterImpl.TEMPLATE_FORCED_TYPES_PROP, forcedTypes); if (save) { adaptedDoc = getAdaptedDoc().getCoreSession().saveDocument(getAdaptedDoc()); } }
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()); }