Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SplitAndJoinPlugin can not copy file attributes #736

Closed
rsoika opened this issue Apr 13, 2021 · 3 comments
Closed

SplitAndJoinPlugin can not copy file attributes #736

rsoika opened this issue Apr 13, 2021 · 3 comments
Labels
Milestone

Comments

@rsoika
Copy link
Member

rsoika commented Apr 13, 2021

In case a source workitem contains a $File with custom attributes, the SplitAndJoinPlugin lost the custom attributes if the value of a custom attribute is a ArrayList of Strings....

@rsoika rsoika added the bug label Apr 13, 2021
@rsoika rsoika added this to the 5.2.10 milestone Apr 13, 2021
rsoika added a commit that referenced this issue Apr 13, 2021
@rsoika
Copy link
Member Author

rsoika commented Apr 13, 2021

Example Code

    @SuppressWarnings("unchecked")
    @Test
    public void testCreateSubProcessWithFile() throws ModelException {

        
        // add a dummy file
        byte[] empty = { 0 };
        FileData fileData=new FileData("test1.txt", empty, "application/xml", null);
        
        List<Object> textlist = new ArrayList<Object>();
        textlist.add("\n\n\n\n hello world");
        fileData.setAttribute("text", textlist);
        documentContext.addFileData(fileData);
        
        
        
        try {
            documentActivity = workflowMockEnvironment.getModel().getEvent(100, 60);
            splitAndJoinPlugin.run(documentContext, documentActivity);
        } catch (PluginException e) {

            e.printStackTrace();
            Assert.fail();
        }

        Assert.assertNotNull(documentContext);

        List<String> workitemRefList = documentContext.getItemValue(SplitAndJoinPlugin.LINK_PROPERTY);

        Assert.assertEquals(1, workitemRefList.size());

        String subprocessUniqueid = workitemRefList.get(0);

        // get the subprocess...
        ItemCollection subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid);

        // test data in subprocess
        Assert.assertNotNull(subprocess);

        Assert.assertEquals(100, subprocess.getTaskID());

        logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID());

        // test if the field namTeam is available
        List<String> team = subprocess.getItemValue("_sub_Team");
        Assert.assertEquals(2, team.size());
        Assert.assertTrue(team.contains("manfred"));
        Assert.assertTrue(team.contains("anna"));
        
        
        
        // verify file content....
        Assert.assertNotNull(subprocess);
        List<FileData> targetFileList = subprocess.getFileData();
        Assert.assertEquals(1,targetFileList.size());
        
        List<Object> result=(List<Object>) targetFileList.get(0).getAttribute("text");
        
        Assert.assertNotNull(result);
    }

@rsoika
Copy link
Member Author

rsoika commented Apr 13, 2021

The issue can't be reproduced with a simple junit test!

@rsoika
Copy link
Member Author

rsoika commented Apr 14, 2021

Bug is related to imixs-archive-api impl only

@rsoika rsoika closed this as completed Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant