/** * @param task WorkflowTask * @return Object */ private Object getPackageItemValues(WorkflowTask task) { List<NodeRef> items = workflowService.getPackageContents(task.getId()); ArrayList<String> results = new ArrayList<String>(items.size()); for (NodeRef item : items) { results.add(item.toString()); } return results; }
/** * @param task WorkflowTask * @return Object */ private Object getPackageItemValues(WorkflowTask task) { List<NodeRef> items = workflowService.getPackageContents(task.getId()); ArrayList<String> results = new ArrayList<String>(items.size()); for (NodeRef item : items) { results.add(item.toString()); } return results; }
/** * Get the packe resources (array of noderefs) * * @return Scriptable */ public Scriptable getPackageResources() { List<NodeRef> contents = workflowService.getPackageContents(task.getId()); List<ScriptNode> resources = new ArrayList<ScriptNode>(contents.size()); Collection<QName> allowedTypes = getAllowedPackageResourceTypes(); for (NodeRef node : contents) { if (isValidResource(node, allowedTypes)) { ScriptNode scriptNode = new ScriptNode(node, serviceRegistry, getScope()); resources.add(scriptNode); } } return Context.getCurrentContext().newArray(getScope(), resources.toArray()); }
/** * Get the packe resources (array of noderefs) * * @return Scriptable */ public Scriptable getPackageResources() { List<NodeRef> contents = workflowService.getPackageContents(task.getId()); List<ScriptNode> resources = new ArrayList<ScriptNode>(contents.size()); Collection<QName> allowedTypes = getAllowedPackageResourceTypes(); for (NodeRef node : contents) { if (isValidResource(node, allowedTypes)) { ScriptNode scriptNode = new ScriptNode(node, serviceRegistry, getScope()); resources.add(scriptNode); } } return Context.getCurrentContext().newArray(getScope(), resources.toArray()); }
/** * @return the resources from the package attached to this workflow task */ public List<TemplateContent> getPackageResources() { List<TemplateContent> resources = new ArrayList<TemplateContent>(); List<NodeRef> contents = this.services.getWorkflowService().getPackageContents(this.task.id); NodeService nodeService = this.services.getNodeService(); DictionaryService ddService = this.services.getDictionaryService(); for(NodeRef nodeRef : contents) { QName type = nodeService.getType(nodeRef); // make sure the type is defined in the data dictionary if (ddService.getType(type) != null) { // look for content nodes or links to content // NOTE: folders within workflow packages are ignored for now if (ddService.isSubClass(type, ContentModel.TYPE_CONTENT) || ApplicationModel.TYPE_FILELINK.equals(type)) { resources.add(new TemplateNode(nodeRef, this.services, this.resolver)); } } } return resources; }
/** * @return the resources from the package attached to this workflow task */ public List<TemplateContent> getPackageResources() { List<TemplateContent> resources = new ArrayList<TemplateContent>(); List<NodeRef> contents = this.services.getWorkflowService().getPackageContents(this.task.id); NodeService nodeService = this.services.getNodeService(); DictionaryService ddService = this.services.getDictionaryService(); for(NodeRef nodeRef : contents) { QName type = nodeService.getType(nodeRef); // make sure the type is defined in the data dictionary if (ddService.getType(type) != null) { // look for content nodes or links to content // NOTE: folders within workflow packages are ignored for now if (ddService.isSubClass(type, ContentModel.TYPE_CONTENT) || ApplicationModel.TYPE_FILELINK.equals(type)) { resources.add(new TemplateNode(nodeRef, this.services, this.resolver)); } } } return resources; }
public void testGeneratePackageItems() throws Exception { // Check empty package String fieldName = PackageItemsFieldProcessor.KEY; Form form = processForm(fieldName); Serializable packageItems = (Serializable) Collections.emptyList(); checkSingleAssociation(form, fieldName, packageItems); // Effectively add 3 items to package. List<NodeRef> value = Arrays.asList(FAKE_NODE, FAKE_NODE2, FAKE_NODE3); when(workflowService.getPackageContents(TASK_ID)) .thenReturn(value); form = processForm(fieldName); packageItems = (Serializable) Arrays.asList(FAKE_NODE.toString(), FAKE_NODE2.toString(), FAKE_NODE3.toString()); checkSingleAssociation(form, fieldName, packageItems); }
workflowService.endTask(startTask.getId(), null); List<NodeRef> taskPackage = workflowService.getPackageContents(startTask.getId()); assertTrue(taskPackage.isEmpty()); List<NodeRef> packageContents = workflowService.getPackageContents(wfPackage); assertTrue(packageContents.isEmpty());