Support for writing P6 pmxml activity codes
Hey Jon, First of all, thank you for all your work on mpxj!
Our usecase is transforming schedule data from our application model into mpxj and export it in a format readable by P6.
From our tests it seems that even though it is possible to add activity codes to the task, they are not reflected in the exported pmxml file. Is that assumption correct?
Do you have any plans for adding this kind of functionality (extending p6 writing in general)?
Thanks for the answer!
Scala code used to generate test p6 pmxml file:
import net.sf.mpxj.primavera.PrimaveraPMFileWriter
import net.sf.mpxj._
import java.awt.Color
import java.time.{LocalDate, ZoneOffset}
import scala.concurrent.duration.FiniteDuration
object ExportPlaygroundActivityCodes extends App {
implicit def toJavaDuration(duration: FiniteDuration): Duration =
Duration.getInstance(java.time.Duration.ofNanos(duration.toNanos).toMinutes, TimeUnit.MINUTES)
implicit def toJavaDate(date: java.time.LocalDate): java.util.Date =
java.util.Date.from(date.atStartOfDay().toInstant(ZoneOffset.UTC))
val writer = new PrimaveraPMFileWriter
val projectFile = new ProjectFile
val startDate = LocalDate.of(2022, 1, 1)
projectFile.getProjectProperties.setStartDate(startDate)
projectFile.getProjectProperties.setName("test 1")
val task1 = projectFile.addTask()
task1.setName("Some task 1")
task1.setPlannedStart(startDate)
task1.setPlannedFinish(startDate.plusDays(1))
val somePropertyActivityCodeType = new ActivityCode(1, ActivityCodeScope.GLOBAL, 1, 1, "Some property")
task1.addActivityCode(new ActivityCodeValue(somePropertyActivityCodeType, 1, 1, "Some property value", "some property description", Color.BLUE))
writer.write(projectFile, "playground.xml")
}
Generated pmxml:
<?xml version="1.0" encoding="UTF-8"?>
<APIBusinessObjects xmlns="http://xmlns.oracle.com/Primavera/P6/V20.12/API/BusinessObjects"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="">
<Currency>
<DecimalPlaces>2</DecimalPlaces>
<DecimalSymbol>Period</DecimalSymbol>
<DigitGroupingSymbol>Comma</DigitGroupingSymbol>
<ExchangeRate>1</ExchangeRate>
<Id>CUR</Id>
<Name>Default Currency</Name>
<NegativeSymbol>(#1.1)</NegativeSymbol>
<ObjectId>1</ObjectId>
<PositiveSymbol>#1.1</PositiveSymbol>
<Symbol>$</Symbol>
</Currency>
<Project>
<ActivityDefaultActivityType>Task Dependent</ActivityDefaultActivityType>
<ActivityDefaultDurationType>Fixed Duration and Units</ActivityDefaultDurationType>
<ActivityDefaultPercentCompleteType>Duration</ActivityDefaultPercentCompleteType>
<ActivityDefaultPricePerUnit>0</ActivityDefaultPricePerUnit>
<ActivityIdBasedOnSelectedActivity>1</ActivityIdBasedOnSelectedActivity>
<ActivityIdIncrement>10</ActivityIdIncrement>
<ActivityIdPrefix>A</ActivityIdPrefix>
<ActivityIdSuffix>1000</ActivityIdSuffix>
<ActivityPercentCompleteBasedOnActivitySteps>0</ActivityPercentCompleteBasedOnActivitySteps>
<AddActualToRemaining>0</AddActualToRemaining>
<AllowNegativeActualUnitsFlag>0</AllowNegativeActualUnitsFlag>
<AssignmentDefaultDrivingFlag>1</AssignmentDefaultDrivingFlag>
<AssignmentDefaultRateType>Price / Unit</AssignmentDefaultRateType>
<CheckOutStatus>0</CheckOutStatus>
<CostQuantityRecalculateFlag>0</CostQuantityRecalculateFlag>
<CriticalActivityFloatLimit>0</CriticalActivityFloatLimit>
<CriticalActivityPathType>Critical Float</CriticalActivityPathType>
<DefaultPriceTimeUnits>Hour</DefaultPriceTimeUnits>
<DiscountApplicationPeriod>Month</DiscountApplicationPeriod>
<EarnedValueComputeType>Activity Percent Complete</EarnedValueComputeType>
<EarnedValueETCComputeType>ETC = Remaining Cost for Activity</EarnedValueETCComputeType>
<EarnedValueETCUserValue>0.88</EarnedValueETCUserValue>
<EarnedValueUserPercent>0.06</EarnedValueUserPercent>
<EnableSummarization>1</EnableSummarization>
<FiscalYearStartMonth>1</FiscalYearStartMonth>
<Id>PROJECT</Id>
<LevelingPriority>10</LevelingPriority>
<LinkActualToActualThisPeriod>1</LinkActualToActualThisPeriod>
<LinkPercentCompleteWithActual>1</LinkPercentCompleteWithActual>
<LinkPlannedAndAtCompletionFlag>1</LinkPlannedAndAtCompletionFlag>
<Name>test 1</Name>
<ObjectId>1</ObjectId>
<PlannedStartDate>2022-01-01T01:00:00</PlannedStartDate>
<PrimaryResourcesCanMarkActivitiesAsCompleted>1</PrimaryResourcesCanMarkActivitiesAsCompleted>
<ResetPlannedToRemainingFlag>0</ResetPlannedToRemainingFlag>
<ResourceCanBeAssignedToSameActivityMoreThanOnce>1</ResourceCanBeAssignedToSameActivityMoreThanOnce>
<ResourcesCanAssignThemselvesToActivities>1</ResourcesCanAssignThemselvesToActivities>
<ResourcesCanEditAssignmentPercentComplete>0</ResourcesCanEditAssignmentPercentComplete>
<ResourcesCanMarkAssignmentAsCompleted>0</ResourcesCanMarkAssignmentAsCompleted>
<ResourcesCanViewInactiveActivities>0</ResourcesCanViewInactiveActivities>
<RiskLevel>Medium</RiskLevel>
<StartDate>2022-01-01T01:00:00</StartDate>
<Status>Active</Status>
<StrategicPriority>500</StrategicPriority>
<SummarizeToWBSLevel>2</SummarizeToWBSLevel>
<SummaryLevel>Assignment Level</SummaryLevel>
<UseProjectBaselineForEarnedValue>1</UseProjectBaselineForEarnedValue>
<WBSCodeSeparator>.</WBSCodeSeparator>
<Activity>
<DurationType>Fixed Units</DurationType>
<Id>1</Id>
<Name>Some task 1</Name>
<ObjectId>1</ObjectId>
<PercentCompleteType>Duration</PercentCompleteType>
<PlannedFinishDate>2022-01-02T01:00:00</PlannedFinishDate>
<PlannedStartDate>2022-01-01T01:00:00</PlannedStartDate>
<ProjectObjectId>1</ProjectObjectId>
<RemainingLaborCost>0</RemainingLaborCost>
<RemainingLaborUnits>0</RemainingLaborUnits>
<RemainingNonLaborCost>0</RemainingNonLaborCost>
<RemainingNonLaborUnits>0</RemainingNonLaborUnits>
<Status>Not Started</Status>
<Type>Resource Dependent</Type>
</Activity>
</Project>
</APIBusinessObjects>
Hi Jan, thanks for the note!
I am planning to update MPXJ to write activity codes to the PMXML file. I'm actually now in a position where I am able to look after MPXJ on a full time basis... so I'm getting a lot more done than I used to, but I'm still having to balance this with undertaking some revenue earning work (keeps the bills paid!) so I can't guarantee when the changes for this will make it into MPXJ.
Jon
Hi Jan. Just to let you know I've released MPXJ 11.1.0 today which includes an update to write activity codes and activity code assignments to PMXML files. Enjoy!
Jon