doThrow(new ContentIOException()).when(StubbedObject).putContent(contentStream);
@Override protected long lengthOfData() throws IOException { return contentService.getRawReader(data.getContentUrl()).getSize(); }
/** * Simulates the node begin attached ot the root node of the version store. */ public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException { return new ChildAssociationRef( ContentModel.ASSOC_CHILDREN, dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, STORE_ID)), rootAssocName, nodeRef); }
@Override public NodeRef execute() throws Exception { final NodeRef nodeRef = createDownloadTypeNode(moduleId + SHARE_EXT_MODULE_SUFFIX); ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_XML); writer.setEncoding("UTF-8"); writer.putContent(moduleFile); return nodeRef; } });
public NodeRef getArchivedNode(NodeRef originalNodeRef) { StoreRef orginalStoreRef = originalNodeRef.getStoreRef(); NodeRef archiveRootNodeRef = nodeService.getStoreArchiveNode(orginalStoreRef); // create the likely location of the archived node NodeRef archivedNodeRef = new NodeRef( archiveRootNodeRef.getStoreRef(), originalNodeRef.getId()); return archivedNodeRef; }
public Object getDocumentNode(Object o) { ChildAssociationRef assocRef = (ChildAssociationRef) o; StoreRef storeRef = assocRef.getChildRef().getStoreRef(); return new ChildAssociationRef(null, null, null, nodeService.getRootNode(storeRef)); }
@Override public Void execute() throws Throwable { NodeRef file1NodeRef = getNodeForPath(testConnection, FILE_PATH1); nodeService.addAspect(file1NodeRef, ContentModel.ASPECT_VERSIONABLE, null); ContentWriter contentWriter2 = contentService.getWriter(file1NodeRef, ContentModel.PROP_CONTENT, true); contentWriter2.putContent("test rename versionable"); nodeService.setProperty(file1NodeRef, ContentModel.PROP_LASTNAME, LAST_NAME); nodeService.setProperty(file1NodeRef, TransferModel.PROP_ENDPOINT_PROTOCOL, "http"); return null; } };
@Override public void onDeleteAssociation(AssociationRef nodeAssocRef) { // The act:actionSchedule type must have the association, so remove the source when the // association is deleted. NodeRef actionScheduleNodeRef = nodeAssocRef.getSourceRef(); if (nodeService.exists(actionScheduleNodeRef) && !nodeService.hasAspect(actionScheduleNodeRef, ContentModel.ASPECT_PENDING_DELETE)) { // Delete the source nodeService.deleteNode(actionScheduleNodeRef); } }
@Override public NodeRef doWork() throws Exception { NodeRef result = null; ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); if (assoc != null) { result = assoc.getParentRef(); } return result; } }, AuthenticationUtil.getSystemUserName());
private NodeRef lookupParentNodeRef(final NodeRef nodeRef) throws JSONException { NodeRef parentNodeRef = null; if (nodeService.exists(nodeRef)) { parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); } return parentNodeRef; }
public void process(NodeRef entry) throws Throwable { nodeService.removeAspect(entry, ImapModel.ASPECT_IMAP_FOLDER_NONSUBSCRIBED); for (ChildAssociationRef userRef : users) { nodeService.createAssociation(userRef.getChildRef(), entry, ImapModel.ASSOC_IMAP_UNSUBSCRIBED); } }
@Override protected void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options) throws Exception { // just stream it writer.putContent(reader.getContentInputStream()); }
@Override public ContentData getContentData() { if (!this.cacheWriter.getReader().exists()) { return this.bsWriter.getContentData(); } return this.cacheWriter.getContentData(); }
/** * Creates an instance of the options serializer * * @return the options serializer */ public static TransformationSourceOptionsSerializer createSerializerInstance() { return (new TemporalSourceOptions()).new TemporalSourceOptionsSerializer(); }
/** * Creates an instance of the options serializer * * @return the options serializer */ public static TransformationSourceOptionsSerializer createSerializerInstance() { return (new CropSourceOptions()).new CropSourceOptionsSerializer(); }
@Override public Date execute() throws Throwable { ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setEncoding("UTF-8"); String text = "Test content"; writer.putContent(text); return (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED); } };
/** * Simulates the node begin attached ot the root node of the version store. */ public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException { return new ChildAssociationRef( ContentModel.ASSOC_CHILDREN, dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, STORE_ID)), rootAssocName, nodeRef); }
private NodeRef getOwningNodeRefRuleImpl(NodeRef ruleNodeRef) { // Get the system folder parent NodeRef systemFolder = this.nodeService.getPrimaryParent(ruleNodeRef).getParentRef(); // Get the owning node ref return this.nodeService.getPrimaryParent(systemFolder).getParentRef(); }
/** * Simulates the node begin attached to the root node of the version store. */ public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException { return new ChildAssociationRef( ContentModel.ASSOC_CHILDREN, dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID)), rootAssocName, nodeRef); }