@Override public NodeRef doWork() throws Exception { return nodeService.getChildByName(contextNodeRef, ContentModel.ASSOC_CONTAINS, element); } }, AuthenticationUtil.getSystemUserName());
@Override public NodeRef doWork() throws Exception { return nodeService.getChildByName(contextNodeRef, ContentModel.ASSOC_CONTAINS, element); } }, AuthenticationUtil.getSystemUserName());
@Override public NodeRef doWork() throws Exception { NodeRef child = ScriptNode.this.nodeRef; while (t.hasMoreTokens() && child != null) { String name = t.nextToken(); child = nodeService.getChildByName(child, ContentModel.ASSOC_CONTAINS, name); } return child; } }, AuthenticationUtil.getSystemUserName());
@Override public NodeRef doWork() throws Exception { NodeRef child = ScriptNode.this.nodeRef; while (t.hasMoreTokens() && child != null) { String name = t.nextToken(); child = nodeService.getChildByName(child, ContentModel.ASSOC_CONTAINS, name); } return child; } }, AuthenticationUtil.getSystemUserName());
@Override public NodeRef doWork() throws Exception { NodeRef child = parent.nodeRef; while (t.hasMoreTokens() && child != null) { String name = t.nextToken(); child = services.getNodeService().getChildByName(child, org.alfresco.model.ContentModel.ASSOC_CONTAINS, name); } return child; } }, AuthenticationUtil.getSystemUserName());
@Override public TopicInfo getTopic(NodeRef parentNodeRef, String topicName) { NodeRef topic = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, topicName); if (topic != null) { return buildTopic(topic, parentNodeRef, topicName); } return null; }
@Override public NodeRef getChildByName(NodeRef nodeRef, QName assocTypeQName, String childName) { return apiFacet.getNodeService().getChildByName(nodeRef, assocTypeQName, childName); }
/** * * @param name String * @return NodeRef */ private NodeRef lookupTransferTarget(String name) { NodeRef defaultGroup = getDefaultGroup(); return nodeService.getChildByName(defaultGroup, ContentModel.ASSOC_CONTAINS, name); }
/** * * @param name String * @return NodeRef */ private NodeRef lookupTransferTarget(String name) { NodeRef defaultGroup = getDefaultGroup(); return nodeService.getChildByName(defaultGroup, ContentModel.ASSOC_CONTAINS, name); }
@Override public NodeRef getChildByName(NodeRef nodeRef, QName assocTypeQName, String childName) { return apiFacet.getNodeService().getChildByName(nodeRef, assocTypeQName, childName); }
/** * Finds first child with specified name * * @param nodeRef Parent node for the search * @param name String for search * @return Reference to found node or null if node isn't found */ protected NodeRef getTopicNode(NodeRef nodeRef, String name) { String workingName = encodeSubject(name); NodeRef ret = getNodeService().getChildByName(nodeRef, ContentModel.ASSOC_CONTAINS, workingName); return ret; }
@Override public Void execute() throws Throwable { NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef newNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, FILE_NAME); assertNull("can still find new node", newNode); return null; } };
@Override public Boolean execute() throws Throwable { NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef nodeRef = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, FILE_NAME); lockKeeper.removeLock(nodeRef); boolean locked = nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE); return locked; } };
@Override public Void execute() throws Throwable { NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef newNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, FILE_NAME); assertNotNull("can't find new node", newNode); nodeService.deleteNode(newNode); return null; } };
@Override public Void execute() throws Throwable { byte[] stuff = "Hello World".getBytes(); file.writeFile(stuff, stuff.length, 0, 0); file.close(); NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef newNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, FILE_NAME); assertNotNull("can't find new node", newNode); return null; } };
@Test public void testCreateAssociation() throws Exception { NodeRef createDownloadNode = createDownloadNode(); NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef, ContentModel.ASSOC_CONTAINS, "Node2"); nodeService.createAssociation(createDownloadNode, node2, DownloadModel.ASSOC_REQUESTED_NODES); }
@Override public Void execute() throws Throwable { NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef newNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, FILE_NAME); testContext.testNodeRef = newNode; assertNotNull("can't find new node", newNode); Serializable content = nodeService.getProperty(newNode, ContentModel.PROP_CONTENT); assertNotNull("content is null", content); return null; } };
@Test public void testIsWorkingCopy() throws Exception { checkOutCheckInService.checkout(originalContentNodeRef); NodeRef workingCopyVirtualContext = nodeService.getChildByName(node, ContentModel.ASSOC_CONTAINS, PROP_WORKING_COPY_NAME); assertNotNull(workingCopyVirtualContext); assertTrue(checkOutCheckInService.isWorkingCopy(workingCopyVirtualContext)); checkOutCheckInService.cancelCheckout(workingCopyVirtualContext); }
@Test public void testGetPath() throws Exception { NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef, ContentModel.ASSOC_CHILDREN, "Node2"); assertNotNull(node2); Path node2Path = nodeService.getPath(node2); assertNotNull(node2Path); assertEquals("/app:company_home/cm:TestFolder/cm:VirtualFolder1/smf:Node2", node2Path.toPrefixString(environment.getNamespacePrefixResolver())); }
/** Test for MNT-14730*/ public void testExecutionApproveWhenDestinationSameAsSource() { addWorkflowAspect(node, sourceFolder, Boolean.FALSE, Boolean.FALSE); assertTrue(nodeService.hasAspect(node, ApplicationModel.ASPECT_SIMPLE_WORKFLOW)); NodeRef pParent = nodeService.getPrimaryParent(node).getParentRef(); assertEquals(sourceFolder, pParent); ActionImpl action = new ActionImpl(null, ID, "accept-simpleworkflow", null); acceptExecuter.execute(action, node); String copyName = QName.createValidLocalName("Copy of my node.txt"); NodeRef nodeRef = nodeService.getChildByName(sourceFolder, ContentModel.ASSOC_CONTAINS, copyName); assertNotNull(nodeRef); }