cancel
Showing results for 
Search instead for 
Did you mean: 

Add a File to workflow package problem

mangar
Star Contributor
Star Contributor
I am trying to add a file to my workflow.  Here is the (relevant) code:


        Map<QName, Serializable> vars = new HashMap<QName, Serializable>();
        NodeRef wfPackage = workflowService.createPackage(null);
   QName contentQName = QName.createQName("{http://www.alfresco.org/model/content/1.0}content");
        NodeRef node = fileFolderService.create(wfPackage, myfile.getName(), contentQName).getNodeRef();
        ContentWriter writer = contentService.getWriter(node, ContentModel.PROP_CONTENT, true);
        writer.putContent(new ByteArrayInputStream(IOUtils.readBytesFromStream(contentList.get(0).getInputStream())));
        vars.put(WorkflowModel.ASSOC_PACKAGE, wfPackage);
   WorkflowDefinition wfDefinition = workflowService.getDefinitionByName(workflowName);
   workflowService.startWorkflow(wfDefinition.getId(), vars);


I am getting no errors.  When I log onto alfresco explorer, I see the task in my todo list.  I click on it, and all the other pices of data are there (things I set in the model) and displaying properly. 

However, the Resources section is blank.  No files are showing up.

What am I doing wrong?
1 REPLY 1

mangar
Star Contributor
Star Contributor
Well,  it turns out the code above works just fine.  I can go and get the content just fine like this (For someone who cares)

<java>
    WorkflowInstance wi = workflowService.getWorkflowById(workflowId);
    NodeRef wfPackage = wi.getWorkflowPackage();
    List<ChildAssociationRef> children = nodeService.getChildAssocs(wfPackage);
</java>

and just do your regular NodeRef Cookbook magic…

As my project uses Alfresco as a strictly back end subsystem, I am all sorts of happy.  I am now just curious as to why it wont show up in explorer.