Skip to content

Commit

Permalink
Read full project name into project title
Browse files Browse the repository at this point in the history
  • Loading branch information
joniles committed Jan 25, 2018
1 parent 29b22b3 commit 7a6bc9f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* UniversalProjectReader updated to recognise MPX files with non-default separator characters.
* Update FastTrack reader to handle invalid percentage values on resource assignments.
* Update FastTrack reader to handle variations in UUID format.
* Read the full project name from XER files and the Primavera database and store it in the project title attribute.

## 7.2.0 (18/01/2018)
* Added support for reading TurboProject PEP files.
Expand Down
1 change: 1 addition & 0 deletions maven/src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<action dev="joniles" type="update">UniversalProjectReader updated to recognise MPX files with non-default separator characters.</action>
<action dev="joniles" type="update">Update FastTrack reader to handle invalid percentage values on resource assignments.</action>
<action dev="joniles" type="update">Update FastTrack reader to handle variations in UUID format.</action>
<action dev="joniles" type="update">Read the full project name from XER files and the Primavera database and store it in the project title attribute.</action>
</release>
<release date="18/01/2018" version="7.2.0">
<action dev="joniles" type="add">Added support for reading TurboProject PEP files.</action>
Expand Down
22 changes: 18 additions & 4 deletions src/net/sf/mpxj/primavera/PrimaveraReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ public void processProjectProperties(List<Row> rows)
properties.setFinishDate(row.getDate("plan_end_date"));
properties.setName(row.getString("proj_short_name"));
properties.setStartDate(row.getDate("plan_start_date")); // data_date?
properties.setProjectTitle(row.getString("proj_short_name"));
properties.setDefaultTaskType(TASK_TYPE_MAP.get(row.getString("def_duration_type")));
properties.setStatusDate(row.getDate("last_recalc_date"));
properties.setFiscalYearStartMonth(row.getInteger("fy_start_month_num"));
Expand Down Expand Up @@ -574,16 +573,31 @@ public void processTasks(List<Row> wbs, List<Row> tasks)
*/
public void processTasks(List<Row> wbs, List<Row> tasks, List<Row> udfVals)
{
ProjectProperties projectProperties = m_project.getProjectProperties();
String projectName = projectProperties.getName();
Set<Integer> uniqueIDs = new HashSet<Integer>();

//
// We set the project name when we read the project properties, but that's just
// the short name. The full project name lives on the first WBS item. Rather than
// querying twice, we'll just set it here where we have access to the WBS items.
// I haven't changed what's in the project name attribute as that's the value
// MPXJ users are used to receiving in that attribute, so we'll use the title
// attribute instead.
//
if (!wbs.isEmpty())
{
projectProperties.setProjectTitle(wbs.get(0).getString("wbs_name"));
}

//
// Read WBS entries and create tasks.
// Note that the wbs list is supplied to us in the correct order.
//
for (Row row : wbs)
{
Task task = m_project.addTask();
task.setProject(m_project.getProjectProperties().getName()); // P6 task always belongs to project
task.setProject(projectName); // P6 task always belongs to project
processFields(m_wbsFields, row, task);
uniqueIDs.add(task.getUniqueID());
m_eventManager.fireTaskReadEvent(task);
Expand Down Expand Up @@ -632,7 +646,7 @@ public void processTasks(List<Row> wbs, List<Row> tasks, List<Row> udfVals)
{
task = parentTask.addTask();
}
task.setProject(m_project.getProjectProperties().getName()); // P6 task always belongs to project
task.setProject(projectName); // P6 task always belongs to project

processFields(m_taskFields, row, task);

Expand Down Expand Up @@ -671,7 +685,7 @@ public void processTasks(List<Row> wbs, List<Row> tasks, List<Row> udfVals)
Date endDate = row.getDate("act_end_date") == null ? row.getDate("reend_date") : row.getDate("act_end_date");
task.setFinish(endDate);

Duration work = Duration.add(task.getActualWork(), task.getRemainingWork(), m_project.getProjectProperties());
Duration work = Duration.add(task.getActualWork(), task.getRemainingWork(), projectProperties);
task.setWork(work);

// Add User Defined Fields
Expand Down

0 comments on commit 7a6bc9f

Please sign in to comment.