AnsweredAssumed Answered

workflow package

Question asked by kaklaman on Dec 23, 2008
Dear all, I am trying to start a workflow with java api. The problem is that I cannot see the doc that I attach to the resources of the task. Users that receive the task can not see any document attached to it. When they try to end the task by pressing Task done they receive the following error:

Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}package

The noderef to attach is a predefined in the repository. PLEASE any hint - comment - suggestion would be greatly appreciated. I am using the following code

.
.
NodeRef workflowNodeRef = this.getWorkflowPackage(workflowService);
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowNodeRef);
WorkflowPath path = workflowService.startWorkflow(wid, parameters);
      
// null for the default transition
workflowService.signal(path.id, null);
.
.

private NodeRef getWorkflowPackage(WorkflowService workflowService){
      NodeRef workflowPackage = workflowService.createPackage(null);
      
      this.addContentToPackage(workflowPackage);
      
      boolean bb =nodeService.hasAspect(workflowPackage, WorkflowModel.ASPECT_WORKFLOW_PACKAGE);
   
       return workflowPackage;
   }
   
   private void addContentToPackage(NodeRef workflowPackage){
      NodeRef addedNodeRef = this.nodeRef;
      String name = this.getNodeRefName(addedNodeRef);
      nodeService.addChild(
                workflowPackage,
                addedNodeRef,
                ContentModel.ASSOC_CONTAINS,
                QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX,
                      QName.createValidLocalName(name)));
  );
       
   }


private String getNodeRefName(NodeRef nodeRef){
      String result = (String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
      return result;
   }

Outcomes