This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes MPXJ problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "MPXJ problem" Watch "MPXJ problem" New topic
Author

MPXJ problem

mkoliop juiok
Greenhorn

Joined: Sep 29, 2005
Posts: 4
Hi All

I am trying to edit a MSPDI(xml) file through mpxj.

When I read the file programtically before editing the contants are:

Task name : Summary Task
Task Unique ID : 1
Task Unique ID : 1
Start Date : null
Finish Date : null
Duration : 0.0

Task name : First Sub Task
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 01/01/2003
Finish Date : null
Duration : 10.5

Task name : Second Sub Task
Task Parent Unique ID : 1
Task Unique ID : 3
Start Date : 11/01/2003
Finish Date : null
Duration : 10.0

Task name : Milestone
Task Parent Unique ID : 1
Task Unique ID : 4
Start Date : 21/01/2003
Finish Date : null
Duration : 0.0

But when I edit the file using the code below:

==============================

MPXFile file = new MSPDIFile (filename);

file.setAutoTaskID(true);
file.setAutoTaskUniqueID(true);

file.setAutoOutlineLevel(true);
file.setAutoOutlineNumber(true);

file.setAutoWBS(true);
file.setAutoCalendarUniqueID(true);

LinkedList llist=file.getChildTasks();
Task milestone1 =(Task)llist.get(0);

Task task1 = milestone1.addTask();
task1.setName ("Added programaticaaly 3");
task1.setDuration (MPXDuration.getInstance (12, TimeUnit.DAYS));
task1.setStart (df.parse("17/03/2005"));

Task task2 = milestone1.addTask();
task2.setName ("Added programaticaaly 4");
task2.setDuration (MPXDuration.getInstance (12, TimeUnit.DAYS));
task2.setStart (df.parse("17/03/2005"));

file.write (filename);
=========================================

Now when I again read the file through the program the contents are

Task name : Summary Task
Task Unique ID : 1
Task Unique ID : 1
Start Date : null
Finish Date : null
Duration : 0.0


Task name : Added programaticaaly 3
Task Parent Unique ID : 1
Task Unique ID : 1
Start Date : 17/03/2005
Finish Date : null
Duration : 12.0


Task name : First Sub Task
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 01/01/2003
Finish Date : null
Duration : 10.5


Task name : Added programaticaaly 4
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 17/03/2005
Finish Date : null
Duration : 12.0


Task name : Second Sub Task
Task Parent Unique ID : 1
Task Unique ID : 3
Start Date : 11/01/2003
Finish Date : null
Duration : 10.0


Task name : Milestone
Task Parent Unique ID : 1
Task Unique ID : 4
Start Date : 21/01/2003
Finish Date : null
Duration : 0.0

Just wanted to know why are the Task Unique ID same for multiple tasks.

Shouldn't they be unique.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MPXJ problem
 
Similar Threads
Assigning jsonobject to java class having one to many relationship
How to create NON SINGLETON beans in Spring ?
can not deploy application!!!!
to write to a mpx file.
How can I save Baseline by using MPXJ