Menu

#57 Relation.getTask returns null

closed-fixed
Jon Iles
None
5
2008-10-29
2008-03-28
No

When importing following MPX file created using MPXJ, for many: Relation.getTask() I get null only 2 relations are imported successfully.

NOTE: I used following settings:
file.setAutoTaskID(true);
file.setAutoTaskUniqueID(true);
file.setAutoCalendarUniqueID(true);
file.setAutoResourceID(true);
file.setAutoResourceUniqueID(true);
file.setAutoOutlineLevel(true);
file.setAutoOutlineNumber(true);
file.setAutoWBS(true);

MPX,Microsoft Project for Windows,4.0,ANSI
10,$,1,2,",",.
11,2,0,1,8.000,40.000,$10.00/h,$15.00/h,1,0
12,1,0,480,/,:,am,pm,20,20
20,Kalendarz bazowy planu,0,1,1,1,1,1,0
25,1
25,2,08:00 am,12:00 pm,01:00 pm,05:00 pm
25,3,08:00 am,12:00 pm,01:00 pm,05:00 pm
25,4,08:00 am,12:00 pm,01:00 pm,05:00 pm
25,5,08:00 am,12:00 pm,01:00 pm,05:00 pm
25,6,08:00 am,12:00 pm,01:00 pm,05:00 pm
25,7
30,Project1,,,Kalendarz bazowy planu,28/03/2008,02/04/2008,0,28/03/2008,,$0.00,$0.00,$0.00,0h,0h,0h,0%,0d,0d,0d,0%,,,,,0d,0d
60,Name,WBS,Outline Level,Duration,Start,Finish,Constraint Date,Predecessors,Fixed,ID,Constraint Type,Unique ID,Outline Number
61,1,2,3,40,50,51,68,70,80,90,91,98,99
70,Nowy produkt (wytworzenie),1.0,1,480m,01/04/2008,01/04/2008,28/03/2008,"7,6,5,4,3,2",Yes,1,As Soon As Possible,1,1.0
70,Nowy produkt (wytworzenie),2.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,2,As Soon As Possible,2,2.0
70,Nowy produkt (wytworzenie),3.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,3,As Soon As Possible,3,3.0
70,Nowy produkt (wytworzenie),4.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,4,As Soon As Possible,4,4.0
70,Nowy produkt (wytworzenie),5.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,5,As Soon As Possible,5,5.0
70,Nowy produkt (wytworzenie),6.0,1,480m,31/03/2008,31/03/2008,28/03/2008,"9,10",Yes,6,As Soon As Possible,6,6.0
70,Nowy produkt (wytworzenie),7.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,7,As Soon As Possible,7,7.0
70,Nowy produkt (wytworzenie),8.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,8,As Soon As Possible,8,8.0
70,Nowy produkt (wytworzenie),9.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,9,As Soon As Possible,9,9.0
70,Nowy produkt (wytworzenie),10.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,10,As Soon As Possible,10,10.0
70,Nowy produkt (wytworzenie),11.0,1,480m,02/04/2008,02/04/2008,28/03/2008,"1,8",Yes,11,As Soon As Possible,11,11.0
70,Nowy produkt (wytworzenie),12.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,12,As Soon As Possible,12,12.0
70,Nowy produkt (wytworzenie),13.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,13,As Soon As Possible,13,13.0
70,Nowy produkt (wytworzenie),14.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,14,As Soon As Possible,14,14.0
70,Nowy produkt (wytworzenie),15.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,15,As Soon As Possible,15,15.0
70,Nowy produkt (wytworzenie),16.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,16,As Soon As Possible,16,16.0
70,Nowy produkt (wytworzenie),17.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,17,As Soon As Possible,17,17.0
70,Nowy produkt (wytworzenie),18.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,18,As Soon As Possible,18,18.0
70,Nowy produkt (wytworzenie),19.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,19,As Soon As Possible,19,19.0
70,Nowy produkt (wytworzenie),20.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,20,As Soon As Possible,20,20.0
70,Nowy produkt (wytworzenie),21.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,21,As Soon As Possible,21,21.0
70,Nowy produkt (wytworzenie),22.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,22,As Soon As Possible,22,22.0
70,(bez nazwy),23.0,1,480m,28/03/2008,28/03/2008,28/03/2008,,Yes,23,As Soon As Possible,23,23.0

Discussion

  • Jon Iles

    Jon Iles - 2008-03-28
    • assigned_to: nobody --> joniles
     
  • Marcin Kosieradzki

    Logged In: YES
    user_id=1619676
    Originator: YES

    I have got a better reproduction and I suppose a fix:

    This is mpxj that is imported incorrectly:

    MPX,Microsoft Project for Windows,4.0,ANSI
    10,$,1,2,",",.
    11,2,0,1,8.000,40.000,$10.00/h,$15.00/h,1,0
    12,1,0,480,/,:,am,pm,20,20
    20,Kalendarz bazowy planu,0,1,1,1,1,1,0
    25,1
    25,2,08:00 am,12:00 pm,01:00 pm,05:00 pm
    25,3,08:00 am,12:00 pm,01:00 pm,05:00 pm
    25,4,08:00 am,12:00 pm,01:00 pm,05:00 pm
    25,5,08:00 am,12:00 pm,01:00 pm,05:00 pm
    25,6,08:00 am,12:00 pm,01:00 pm,05:00 pm
    25,7
    30,Project1,,,Kalendarz bazowy planu,04/04/2008,07/04/2008,0,04/04/2008,,$0.00,$0.00,$0.00,0h,0h,0h,0%,0d,0d,0d,0%,,,,,0d,0d
    60,Name,WBS,Outline Level,Duration,Start,Finish,Constraint Date,Predecessors,Fixed,ID,Constraint Type,Unique ID,Outline Number
    61,1,2,3,40,50,51,68,70,80,90,91,98,99
    70,A,1.0,1,480m,07/04/2008,07/04/2008,04/04/2008,"3,2",Yes,1,As Soon As Possible,1,1.0
    70,B,2.0,1,480m,04/04/2008,04/04/2008,04/04/2008,,Yes,2,As Soon As Possible,2,2.0
    70,C,3.0,1,480m,04/04/2008,04/04/2008,04/04/2008,,Yes,3,As Soon As Possible,3,3.0

    I think that issue is that tasks 2 and 3 referred from task 1 are after task 1

    When I reordered tasks:
    70,B,2.0,1,480m,04/04/2008,04/04/2008,04/04/2008,,Yes,2,As Soon As Possible,2,2.0
    70,C,3.0,1,480m,04/04/2008,04/04/2008,04/04/2008,,Yes,3,As Soon As Possible,3,3.0
    70,A,1.0,1,480m,07/04/2008,07/04/2008,04/04/2008,"3,2",Yes,1,As Soon As Possible,1,1.0

    Everything is imported correctly.

    I think can be fixed in following way (unfortunatelly I have no java environment set up so I can prepare a patch, but I think fixing it may go this way):

    declare in MPXReader dictionary (or list of pairs) relation => taskId: m_relationToTaskId

    MPXReader: line 875:
    change:
    Task task = m_projectFile.getTaskByID(taskID);
    if (task != null)
    {
    relation.setTaskUniqueID(task.getUniqueID());
    }
    to:
    m_relationToTaskId.Add(relation, taskID);

    add method: FixRelationIds where iterate through dictionary entries and make (where relation and taskId are taken from m_relationToTaskId
    Task task = m_projectFile.getTaskByID(taskID);
    if (task != null)
    {
    relation.setTaskUniqueID(task.getUniqueID());
    }

     
  • Marcin Kosieradzki

    Logged In: YES
    user_id=1619676
    Originator: YES

    I have set up java environment and prepared a patch. I have attached modified file it is modified version of file dated for: 2008-03-21 00:44
    File Added: MPXReader.java

     
  • Marcin Kosieradzki

    MPXReader.java - patched

     
  • Jon Iles

    Jon Iles - 2008-10-29
    • status: open --> closed-fixed
     
  • Jon Iles

    Jon Iles - 2008-10-29

    Hi,

    the code now in CVS contains a fix for this.

    Jon

     

Log in to post a comment.

MongoDB Logo MongoDB