@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentRef ref) { String n = name; if (name == null || name.length() == 0) { n = session.getDocument(ref).getName(); } return session.copy(ref, target, n); } }
newDocuments.addAll(documentManager.copy(docRefs, parent.getRef(), CopyOption.RESET_LIFE_CYCLE));
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { String n = name; if (name == null || name.length() == 0) { n = doc.getName(); } return session.copy(doc.getRef(), target, n); }
@Override public DocumentModel saveDocumentRouteInstanceAsNewModel(DocumentModel routeInstance, DocumentModel parentFolder, String newName, CoreSession session) { DocumentModel result = session.copy(routeInstance.getRef(), parentFolder.getRef(), newName); return undoReadOnlySecurityPolicy(result, session); }
@Override public DocumentModel copyItem(DocumentModel source, PathRef targetParentRef) { DocumentModel model = getSession().copy(source.getRef(), targetParentRef, source.getName()); return model; }
DocumentModel discardedDoc = session.copy(existingDoc.getRef(), existingDoc.getParentRef(), newName, new CoreSession.CopyOption[0]); discardedDoc.setPropertyValue(DocumentationItem.PROP_APPLICABLE_VERSIONS, (Serializable) discardedVersion);
documentManager.copy(doc.getRef(), target.getRef(), doc.getName()); nbPublishedDocs++; } else {
@Override public DocumentModel createDocumentRouteInstanceFromDocumentRouteModel(DocumentModel model, CoreSession session) { DocumentModel parent = getParentFolderForDocumentRouteInstance(model, session); DocumentModel result = session.copy(model.getRef(), parent.getRef(), null); // copy now copies all the acls, and we don't need the readOnly // policy applied on the model // on the instance, too => removing acls result = undoReadOnlySecurityPolicy(result, session); // set initiator NuxeoPrincipal principal = session.getPrincipal(); String initiator = principal.getActingUser(); result.setPropertyValue(DocumentRoutingConstants.INITIATOR, initiator); // using the ref, the value of the attached document might not been // saved on the model result.setPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME, model.getPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME)); // reset creation date, used for workflow start time result.setPropertyValue("dc:created", Calendar.getInstance()); result.setPropertyValue(DocumentRoutingConstants.DOCUMENT_ROUTE_INSTANCE_MODEL_ID, model.getId()); session.saveDocument(result); return result; }
documentManager.copy(new IdRef(selectedTemplateId), currentDocRef, name); DocumentModel created = documentManager.getChild(currentDocRef, name);
DocumentModel created = documentManager.copy(new IdRef(selectedTemplateId), currentDocRef, name, CopyOption.RESET_CREATOR);