Menu

#349 MPPReader12/14: Incorrect processing of hierarchical ResourceOutlineCodes

v1.0_(example)
closed-fixed
nobody
None
5
2021-06-11
2021-06-08
No

Hi Jon!

If reading the values of hierarchical ResourceOutlineCodes, we get the value of the leaf node only.
Example: CodeValue is 'A.AA', but the method Resource#getOutlineCodeX return 'AA' only.
(For TaskOutlineCodes it works as expected.)

Code to reproduce the issue (File Projekt2.mpp is attached):

        net.sf.mpxj.mpp.MPPReader mppReader = new net.sf.mpxj.mpp.MPPReader();
        net.sf.mpxj.ProjectFile projectFile = mppReader.read(new java.io.File("Projekt2.mpp"));

        net.sf.mpxj.Resource r2 = projectFile.getResources().stream().filter(i -> "Resource 2".equals(i.getName())).findFirst().get();
        assertEquals("A.AA", r2.getOutlineCode2());

Possible solution:

Process ResourceOutlineCodeValues the same way as TaskOutlineCodeValues:
This is done in method MPPReader14#processResourceData, starting with line 1684 (master branch from 28.05.2021 16:41:40):

Replace

resource.setOutlineCode1(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE1_INDEX))), OUTLINECODE_DATA));

by

resource.setOutlineCode1(getCustomFieldOutlineCodeValue(rscVarData, m_outlineCodeVarData, id, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE1_INDEX)));

and the same for the following 9 lines, of course.

It works fine in our tests so far, but i'm not sure if there are any unwanted side-effect, by doing so...

Discussion

  • Markus Höger

    Markus Höger - 2021-06-08

    Testfile to reproduce the issue

     
  • Jon Iles

    Jon Iles - 2021-06-10

    Thanks for that! I've implemented the suggested change, the code is in Git and will be in the next release.

     
  • Jon Iles

    Jon Iles - 2021-06-10
    • status: open --> closed-fixed
     
  • Markus Höger

    Markus Höger - 2021-06-11

    Great :)
    Thanks for fast reply!

     

Log in to post a comment.

MongoDB Logo MongoDB