idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
20,600
private void readCostRateTables ( Resource resource , Rates rates ) { if ( rates == null ) { CostRateTable table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 0 , table ) ; table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ;...
Reads the cost rate tables from the file .
20,601
private void readAvailabilityTable ( Resource resource , AvailabilityPeriods periods ) { if ( periods != null ) { AvailabilityTable table = resource . getAvailability ( ) ; List < AvailabilityPeriod > list = periods . getAvailabilityPeriod ( ) ; for ( AvailabilityPeriod period : list ) { Date start = period . getAvaila...
Reads the availability table from the file .
20,602
private void readTasks ( Project project ) { Project . Tasks tasks = project . getTasks ( ) ; if ( tasks != null ) { int tasksWithoutIDCount = 0 ; for ( Project . Tasks . Task task : tasks . getTask ( ) ) { Task mpxjTask = readTask ( task ) ; if ( mpxjTask . getID ( ) == null ) { ++ tasksWithoutIDCount ; } } for ( Proj...
This method extracts task data from an MSPDI file .
20,603
private void updateProjectProperties ( Task task ) { ProjectProperties props = m_projectFile . getProjectProperties ( ) ; props . setComments ( task . getNotes ( ) ) ; }
Update the project properties from the project summary task .
20,604
private void readTaskBaselines ( Project . Tasks . Task xmlTask , Task mpxjTask , TimeUnit durationFormat ) { for ( Project . Tasks . Task . Baseline baseline : xmlTask . getBaseline ( ) ) { int number = NumberHelper . getInt ( baseline . getNumber ( ) ) ; Double cost = DatatypeConverter . parseCurrency ( baseline . ge...
Reads baseline values for the current task .
20,605
private void readTaskExtendedAttributes ( Project . Tasks . Task xml , Task mpx ) { for ( Project . Tasks . Task . ExtendedAttribute attrib : xml . getExtendedAttribute ( ) ) { int xmlFieldID = Integer . parseInt ( attrib . getFieldID ( ) ) & 0x0000FFFF ; TaskField mpxFieldID = MPPTaskField . getInstance ( xmlFieldID )...
This method processes any extended attributes associated with a task .
20,606
private ProjectCalendar getTaskCalendar ( Project . Tasks . Task task ) { ProjectCalendar calendar = null ; BigInteger calendarID = task . getCalendarUID ( ) ; if ( calendarID != null ) { calendar = m_projectFile . getCalendarByUniqueID ( Integer . valueOf ( calendarID . intValue ( ) ) ) ; } return ( calendar ) ; }
This method is used to retrieve the calendar associated with a task . If no calendar is associated with a task this method returns null .
20,607
private void readPredecessors ( Project . Tasks . Task task ) { Integer uid = task . getUID ( ) ; if ( uid != null ) { Task currTask = m_projectFile . getTaskByUniqueID ( uid ) ; if ( currTask != null ) { for ( Project . Tasks . Task . PredecessorLink link : task . getPredecessorLink ( ) ) { readPredecessor ( currTask ...
This method extracts predecessor data from an MSPDI file .
20,608
private void readPredecessor ( Task currTask , Project . Tasks . Task . PredecessorLink link ) { BigInteger uid = link . getPredecessorUID ( ) ; if ( uid != null ) { Task prevTask = m_projectFile . getTaskByUniqueID ( Integer . valueOf ( uid . intValue ( ) ) ) ; if ( prevTask != null ) { RelationType type ; if ( link ....
This method extracts data for a single predecessor from an MSPDI file .
20,609
private void readAssignments ( Project project ) { Project . Assignments assignments = project . getAssignments ( ) ; if ( assignments != null ) { SplitTaskFactory splitFactory = new SplitTaskFactory ( ) ; TimephasedWorkNormaliser normaliser = new MSPDITimephasedWorkNormaliser ( ) ; for ( Project . Assignments . Assign...
This method extracts assignment data from an MSPDI file .
20,610
private void readAssignmentBaselines ( Project . Assignments . Assignment assignment , ResourceAssignment mpx ) { for ( Project . Assignments . Assignment . Baseline baseline : assignment . getBaseline ( ) ) { int number = NumberHelper . getInt ( baseline . getNumber ( ) ) ; Number cost = DatatypeConverter . parseExten...
Extracts assignment baseline data .
20,611
private void readAssignmentExtendedAttributes ( Project . Assignments . Assignment xml , ResourceAssignment mpx ) { for ( Project . Assignments . Assignment . ExtendedAttribute attrib : xml . getExtendedAttribute ( ) ) { int xmlFieldID = Integer . parseInt ( attrib . getFieldID ( ) ) & 0x0000FFFF ; AssignmentField mpxF...
This method processes any extended attributes associated with a resource assignment .
20,612
private boolean isSplit ( ProjectCalendar calendar , List < TimephasedWork > list ) { boolean result = false ; for ( TimephasedWork assignment : list ) { if ( calendar != null && assignment . getTotalAmount ( ) . getDuration ( ) == 0 ) { Duration calendarWork = calendar . getWork ( assignment . getStart ( ) , assignmen...
Test to determine if this is a split task .
20,613
private LinkedList < TimephasedWork > readTimephasedAssignment ( ProjectCalendar calendar , Project . Assignments . Assignment assignment , int type ) { LinkedList < TimephasedWork > result = new LinkedList < TimephasedWork > ( ) ; for ( TimephasedDataType item : assignment . getTimephasedData ( ) ) { if ( NumberHelper...
Reads timephased assignment data .
20,614
private ProjectCalendar deriveResourceCalendar ( Integer parentCalendarID ) { ProjectCalendar calendar = m_project . addDefaultDerivedCalendar ( ) ; calendar . setUniqueID ( Integer . valueOf ( m_project . getProjectConfig ( ) . getNextCalendarUniqueID ( ) ) ) ; calendar . setParent ( m_project . getCalendarByUniqueID ...
Derive a calendar for a resource .
20,615
public void processTasks ( List < Row > bars , List < Row > expandedTasks , List < Row > tasks , List < Row > milestones ) { List < Row > parentBars = buildRowHierarchy ( bars , expandedTasks , tasks , milestones ) ; createTasks ( m_project , "" , parentBars ) ; deriveProjectCalendar ( ) ; updateStructure ( ) ; }
Organises the data from Asta into a hierarchy and converts this into tasks .
20,616
private List < Row > buildRowHierarchy ( List < Row > bars , List < Row > expandedTasks , List < Row > tasks , List < Row > milestones ) { List < Row > leaves = new ArrayList < Row > ( ) ; leaves . addAll ( tasks ) ; leaves . addAll ( milestones ) ; Collections . sort ( bars , BAR_COMPARATOR ) ; Collections . sort ( le...
Builds the task hierarchy .
20,617
private void createTasks ( ChildTaskContainer parent , String parentName , List < Row > rows ) { for ( Row row : rows ) { boolean rowIsBar = ( row . getInteger ( "BARID" ) != null ) ; if ( rowIsBar && row . getChildRows ( ) . isEmpty ( ) ) { continue ; } Task task = parent . addTask ( ) ; if ( rowIsBar ) { if ( skipBar...
Recursively descend through the hierarchy creating tasks .
20,618
private boolean skipBar ( Row row ) { List < Row > childRows = row . getChildRows ( ) ; return childRows . size ( ) == 1 && childRows . get ( 0 ) . getChildRows ( ) . isEmpty ( ) ; }
Returns true if we should skip this bar i . e . the bar only has a single child task .
20,619
private void populateLeaf ( String parentName , Row row , Task task ) { if ( row . getInteger ( "TASKID" ) != null ) { populateTask ( row , task ) ; } else { populateMilestone ( row , task ) ; } String name = task . getName ( ) ; if ( name == null || name . isEmpty ( ) ) { task . setName ( parentName ) ; } }
Adds a leaf node which could be a task or a milestone .
20,620
private void populateTask ( Row row , Task task ) { task . setUniqueID ( row . getInteger ( "TASKID" ) ) ; task . setDuration ( row . getDuration ( "GIVEN_DURATIONHOURS" ) ) ; task . setResume ( row . getDate ( "RESUME" ) ) ; task . setActualDuration ( row . getDuration ( "ACTUAL_DURATIONHOURS" ) ) ; task . setEarlySta...
Populate a task from a Row instance .
20,621
private void populateBar ( Row row , Task task ) { Integer calendarID = row . getInteger ( "CALENDAU" ) ; ProjectCalendar calendar = m_project . getCalendarByUniqueID ( calendarID ) ; task . setUniqueID ( row . getInteger ( "BARID" ) ) ; task . setStart ( row . getDate ( "STARV" ) ) ; task . setFinish ( row . getDate (...
Uses data from a bar to populate a task .
20,622
private void populateMilestone ( Row row , Task task ) { task . setMilestone ( true ) ; task . setUniqueID ( row . getInteger ( "MILESTONEID" ) ) ; task . setStart ( row . getDate ( "GIVEN_DATE_TIME" ) ) ; task . setFinish ( row . getDate ( "GIVEN_DATE_TIME" ) ) ; task . setPercentageComplete ( row . getBoolean ( "COMP...
Populate a milestone from a Row instance .
20,623
private String getInitials ( String name ) { String result = null ; if ( name != null && name . length ( ) != 0 ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( name . charAt ( 0 ) ) ; int index = 1 ; while ( true ) { index = name . indexOf ( ' ' , index ) ; if ( index == - 1 ) { break ; } ++ index ; if ( i...
Convert a name into initials .
20,624
private void deriveProjectCalendar ( ) { Map < ProjectCalendar , Integer > map = new HashMap < ProjectCalendar , Integer > ( ) ; for ( Task task : m_project . getTasks ( ) ) { ProjectCalendar calendar = task . getCalendar ( ) ; Integer count = map . get ( calendar ) ; if ( count == null ) { count = Integer . valueOf ( ...
Asta Powerproject assigns an explicit calendar for each task . This method is used to find the most common calendar and use this as the default project calendar . This allows the explicitly assigned task calendars to be removed .
20,625
private void processConstraints ( Row row , Task task ) { ConstraintType constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; Date constraintDate = null ; switch ( row . getInt ( "CONSTRAINU" ) ) { case 0 : { if ( row . getInt ( "PLACEMENT" ) == 0 ) { constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; } else { ...
Determines the constraints relating to a task .
20,626
public Map < Integer , Row > createWorkPatternMap ( List < Row > rows ) { Map < Integer , Row > map = new HashMap < Integer , Row > ( ) ; for ( Row row : rows ) { map . put ( row . getInteger ( "WORK_PATTERNID" ) , row ) ; } return map ; }
Creates a map of work pattern rows indexed by the primary key .
20,627
public Map < Integer , List < Row > > createWorkPatternAssignmentMap ( List < Row > rows ) { Map < Integer , List < Row > > map = new HashMap < Integer , List < Row > > ( ) ; for ( Row row : rows ) { Integer calendarID = row . getInteger ( "WORK_PATTERN_ASSIGNMENTID" ) ; List < Row > list = map . get ( calendarID ) ; i...
Creates a map between a calendar ID and a list of work pattern assignment rows .
20,628
public Map < Integer , List < Row > > createTimeEntryMap ( List < Row > rows ) { Map < Integer , List < Row > > map = new HashMap < Integer , List < Row > > ( ) ; for ( Row row : rows ) { Integer workPatternID = row . getInteger ( "TIME_ENTRYID" ) ; List < Row > list = map . get ( workPatternID ) ; if ( list == null ) ...
Creates a map between a work pattern ID and a list of time entry rows .
20,629
public void processCalendar ( Row calendarRow , Map < Integer , Row > workPatternMap , Map < Integer , List < Row > > workPatternAssignmentMap , Map < Integer , List < Row > > exceptionAssignmentMap , Map < Integer , List < Row > > timeEntryMap , Map < Integer , DayType > exceptionTypeMap ) { ProjectCalendar calendar =...
Creates a ProjectCalendar instance from the Asta data .
20,630
private void processWorkPattern ( ProjectCalendarWeek week , Integer workPatternID , Map < Integer , Row > workPatternMap , Map < Integer , List < Row > > timeEntryMap , Map < Integer , DayType > exceptionTypeMap ) { Row workPatternRow = workPatternMap . get ( workPatternID ) ; if ( workPatternRow != null ) { week . se...
Populates a ProjectCalendarWeek instance from Asta work pattern data .
20,631
private String getNotes ( Row row ) { String notes = row . getString ( "NOTET" ) ; if ( notes != null ) { if ( notes . isEmpty ( ) ) { notes = null ; } else { if ( notes . indexOf ( LINE_BREAK ) != - 1 ) { notes = notes . replace ( LINE_BREAK , "\n" ) ; } } } return notes ; }
Extract note text .
20,632
private void addListeners ( ProjectReader reader ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { reader . addProjectListener ( listener ) ; } } }
Adds any listeners attached to this reader to the reader created internally .
20,633
private ProjectFile readTextFile ( InputStream inputStream ) throws MPXJException { ProjectReader reader = new AstaTextFileReader ( ) ; addListeners ( reader ) ; return reader . read ( inputStream ) ; }
Process a text - based PP file .
20,634
private ProjectFile readDatabaseFile ( InputStream inputStream ) throws MPXJException { ProjectReader reader = new AstaDatabaseFileReader ( ) ; addListeners ( reader ) ; return reader . read ( inputStream ) ; }
Process a SQLite database PP file .
20,635
public static String getFileFormat ( POIFSFileSystem fs ) throws IOException { String fileFormat = "" ; DirectoryEntry root = fs . getRoot ( ) ; if ( root . getEntryNames ( ) . contains ( "\1CompObj" ) ) { CompObj compObj = new CompObj ( new DocumentInputStream ( ( DocumentEntry ) root . getEntry ( "\1CompObj" ) ) ) ; ...
This method allows us to peek into the OLE compound document to extract the file format . This allows the UniversalProjectReader to determine if this is an MPP file or if it is another type of OLE compound document .
20,636
public ProjectFile read ( POIFSFileSystem fs ) throws MPXJException { try { ProjectFile projectFile = new ProjectFile ( ) ; ProjectConfig config = projectFile . getProjectConfig ( ) ; config . setAutoTaskID ( false ) ; config . setAutoTaskUniqueID ( false ) ; config . setAutoResourceID ( false ) ; config . setAutoResou...
Alternative entry point allowing an MPP file to be read from a user - supplied POI file stream .
20,637
private void validationRelations ( Task task ) { List < Relation > predecessors = task . getPredecessors ( ) ; if ( ! predecessors . isEmpty ( ) ) { ArrayList < Relation > invalid = new ArrayList < Relation > ( ) ; for ( Relation relation : predecessors ) { Task sourceTask = relation . getSourceTask ( ) ; Task targetTa...
This method validates all relationships for a task removing any which have been incorrectly read from the MPP file and point to a parent task .
20,638
public static TaskField getMpxjField ( int value ) { TaskField result = null ; if ( value >= 0 && value < MPX_MPXJ_ARRAY . length ) { result = MPX_MPXJ_ARRAY [ value ] ; } return ( result ) ; }
Retrieve an instance of the TaskField class based on the data read from an MPX file .
20,639
public static int getMpxField ( int value ) { int result = 0 ; if ( value >= 0 && value < MPXJ_MPX_ARRAY . length ) { result = MPXJ_MPX_ARRAY [ value ] ; } return ( result ) ; }
Retrieve the integer value used to represent a task field in an MPX file .
20,640
public Task add ( ) { Task task = new Task ( m_projectFile , ( Task ) null ) ; add ( task ) ; m_projectFile . getChildTasks ( ) . add ( task ) ; return task ; }
Add a task to the project .
20,641
public void synchronizeTaskIDToHierarchy ( ) { clear ( ) ; int currentID = ( getByID ( Integer . valueOf ( 0 ) ) == null ? 1 : 0 ) ; for ( Task task : m_projectFile . getChildTasks ( ) ) { task . setID ( Integer . valueOf ( currentID ++ ) ) ; add ( task ) ; currentID = synchroizeTaskIDToHierarchy ( task , currentID ) ;...
Microsoft Project bases the order of tasks displayed on their ID value . This method takes the hierarchical structure of tasks represented in MPXJ and renumbers the ID values to ensure that this structure is displayed as expected in Microsoft Project . This is typically used to deal with the case where a hierarchical t...
20,642
private int synchroizeTaskIDToHierarchy ( Task parentTask , int currentID ) { for ( Task task : parentTask . getChildTasks ( ) ) { task . setID ( Integer . valueOf ( currentID ++ ) ) ; add ( task ) ; currentID = synchroizeTaskIDToHierarchy ( task , currentID ) ; } return currentID ; }
Called recursively to renumber child task IDs .
20,643
public void updateStructure ( ) { if ( size ( ) > 1 ) { Collections . sort ( this ) ; m_projectFile . getChildTasks ( ) . clear ( ) ; Task lastTask = null ; int lastLevel = - 1 ; boolean autoWbs = m_projectFile . getProjectConfig ( ) . getAutoWBS ( ) ; boolean autoOutlineNumber = m_projectFile . getProjectConfig ( ) . ...
This method is used to recreate the hierarchical structure of the project file from scratch . The method sorts the list of all tasks then iterates through it creating the parent - child structure defined by the outline level field .
20,644
private void process ( String input , String output ) throws MPXJException , IOException { MPPReader reader = new MPPReader ( ) ; m_project = reader . read ( input ) ; String varDataFileName ; String projectDirName ; int mppFileType = NumberHelper . getInt ( m_project . getProjectProperties ( ) . getMppFileType ( ) ) ;...
Process an MPP file to make it anonymous .
20,645
private void mapText ( String oldText , Map < String , String > replacements ) { char c2 = 0 ; if ( oldText != null && oldText . length ( ) != 0 && ! replacements . containsKey ( oldText ) ) { StringBuilder newText = new StringBuilder ( oldText . length ( ) ) ; for ( int loop = 0 ; loop < oldText . length ( ) ; loop ++...
Converts plan text into anonymous text . Preserves upper case lower case punctuation whitespace and digits while making the text unreadable .
20,646
private byte [ ] getBytes ( String value , boolean unicode ) { byte [ ] result ; if ( unicode ) { int start = 0 ; byte [ ] bytes ; try { bytes = value . getBytes ( "UTF-16" ) ; } catch ( UnsupportedEncodingException e ) { bytes = value . getBytes ( ) ; } if ( bytes . length > 2 && bytes [ 0 ] == - 2 && bytes [ 1 ] == -...
Convert a Java String instance into the equivalent array of single or double bytes .
20,647
private boolean compareBytes ( byte [ ] lhs , byte [ ] rhs , int rhsOffset ) { boolean result = true ; for ( int loop = 0 ; loop < lhs . length ; loop ++ ) { if ( lhs [ loop ] != rhs [ rhsOffset + loop ] ) { result = false ; break ; } } return ( result ) ; }
Compare an array of bytes with a subsection of a larger array of bytes .
20,648
private void writeCurrency ( ) { ProjectProperties props = m_projectFile . getProjectProperties ( ) ; CurrencyType currency = m_factory . createCurrencyType ( ) ; m_apibo . getCurrency ( ) . add ( currency ) ; String positiveSymbol = getCurrencyFormat ( props . getSymbolPosition ( ) ) ; String negativeSymbol = "(" + po...
Create a handful of default currencies to keep Primavera happy .
20,649
private String getSymbolName ( char c ) { String result = null ; switch ( c ) { case ',' : { result = "Comma" ; break ; } case '.' : { result = "Period" ; break ; } } return result ; }
Map the currency separator character to a symbol name .
20,650
private String getCurrencyFormat ( CurrencySymbolPosition position ) { String result ; switch ( position ) { case AFTER : { result = "1.1#" ; break ; } case AFTER_WITH_SPACE : { result = "1.1 #" ; break ; } case BEFORE_WITH_SPACE : { result = "# 1.1" ; break ; } default : case BEFORE : { result = "#1.1" ; break ; } } r...
Generate a currency format .
20,651
private void writeUserFieldDefinitions ( ) { for ( CustomField cf : m_sortedCustomFieldsList ) { if ( cf . getFieldType ( ) != null && cf . getFieldType ( ) . getDataType ( ) != null ) { UDFTypeType udf = m_factory . createUDFTypeType ( ) ; udf . setObjectId ( Integer . valueOf ( FieldTypeHelper . getFieldID ( cf . get...
Add UDFType objects to a PM XML file .
20,652
private void writeCalendar ( ProjectCalendar mpxj ) { CalendarType xml = m_factory . createCalendarType ( ) ; m_apibo . getCalendar ( ) . add ( xml ) ; String type = mpxj . getResource ( ) == null ? "Global" : "Resource" ; xml . setBaseCalendarObjectId ( getCalendarUniqueID ( mpxj . getParent ( ) ) ) ; xml . setIsPerso...
This method writes data for an individual calendar to a PM XML file .
20,653
private void writeResources ( ) { for ( Resource resource : m_projectFile . getResources ( ) ) { if ( resource . getUniqueID ( ) . intValue ( ) != 0 ) { writeResource ( resource ) ; } } }
This method writes resource data to a PM XML file .
20,654
private void writeResource ( Resource mpxj ) { ResourceType xml = m_factory . createResourceType ( ) ; m_apibo . getResource ( ) . add ( xml ) ; xml . setAutoComputeActuals ( Boolean . TRUE ) ; xml . setCalculateCostFromUnits ( Boolean . TRUE ) ; xml . setCalendarObjectId ( getCalendarUniqueID ( mpxj . getResourceCalen...
Write a single resource .
20,655
private void writeTask ( Task task ) { if ( ! task . getNull ( ) ) { if ( extractAndConvertTaskType ( task ) == null || task . getSummary ( ) ) { writeWBS ( task ) ; } else { writeActivity ( task ) ; } } }
Given a Task instance this task determines if it should be written to the PM XML file as an activity or as a WBS item and calls the appropriate method .
20,656
private void writeWBS ( Task mpxj ) { if ( mpxj . getUniqueID ( ) . intValue ( ) != 0 ) { WBSType xml = m_factory . createWBSType ( ) ; m_project . getWBS ( ) . add ( xml ) ; String code = mpxj . getWBS ( ) ; code = code == null || code . length ( ) == 0 ? DEFAULT_WBS_CODE : code ; Task parentTask = mpxj . getParentTas...
Writes a WBS entity to the PM XML file .
20,657
private void writeActivity ( Task mpxj ) { ActivityType xml = m_factory . createActivityType ( ) ; m_project . getActivity ( ) . add ( xml ) ; Task parentTask = mpxj . getParentTask ( ) ; Integer parentObjectID = parentTask == null ? null : parentTask . getUniqueID ( ) ; xml . setActualStartDate ( mpxj . getActualStart...
Writes an activity to a PM XML file .
20,658
private String extractAndConvertTaskType ( Task task ) { String activityType = ( String ) task . getCachedValue ( m_activityTypeField ) ; if ( activityType == null ) { activityType = "Resource Dependent" ; } else { if ( ACTIVITY_TYPE_MAP . containsKey ( activityType ) ) { activityType = ACTIVITY_TYPE_MAP . get ( activi...
Attempts to locate the activity type value extracted from an existing P6 schedule . If necessary converts to the form which can be used in the PMXML file . Returns Resource Dependent as the default value .
20,659
private void writeAssignments ( ) { for ( ResourceAssignment assignment : m_projectFile . getResourceAssignments ( ) ) { Resource resource = assignment . getResource ( ) ; if ( resource != null ) { Task task = assignment . getTask ( ) ; if ( task != null && task . getUniqueID ( ) . intValue ( ) != 0 && ! task . getSumm...
Writes assignment data to a PM XML file .
20,660
private void writeAssignment ( ResourceAssignment mpxj ) { ResourceAssignmentType xml = m_factory . createResourceAssignmentType ( ) ; m_project . getResourceAssignment ( ) . add ( xml ) ; Task task = mpxj . getTask ( ) ; Task parentTask = task . getParentTask ( ) ; Integer parentTaskUniqueID = parentTask == null ? nul...
Writes a resource assignment to a PM XML file .
20,661
private void writePredecessors ( Task task ) { List < Relation > relations = task . getPredecessors ( ) ; for ( Relation mpxj : relations ) { RelationshipType xml = m_factory . createRelationshipType ( ) ; m_project . getRelationship ( ) . add ( xml ) ; xml . setLag ( getDuration ( mpxj . getLag ( ) ) ) ; xml . setObje...
Writes task predecessor links to a PM XML file .
20,662
private List < UDFAssignmentType > writeUDFType ( FieldTypeClass type , FieldContainer mpxj ) { List < UDFAssignmentType > out = new ArrayList < UDFAssignmentType > ( ) ; for ( CustomField cf : m_sortedCustomFieldsList ) { FieldType fieldType = cf . getFieldType ( ) ; if ( fieldType != null && type == fieldType . getFi...
Writes a list of UDF types .
20,663
private void setUserFieldValue ( UDFAssignmentType udf , DataType dataType , Object value ) { switch ( dataType ) { case DURATION : { udf . setTextValue ( ( ( Duration ) value ) . toString ( ) ) ; break ; } case CURRENCY : { if ( ! ( value instanceof Double ) ) { value = Double . valueOf ( ( ( Number ) value ) . double...
Sets the value of a UDF .
20,664
private Double getDuration ( Duration duration ) { Double result ; if ( duration == null ) { result = null ; } else { if ( duration . getUnits ( ) != TimeUnit . HOURS ) { duration = duration . convertUnits ( TimeUnit . HOURS , m_projectFile . getProjectProperties ( ) ) ; } result = Double . valueOf ( duration . getDura...
Retrieve a duration in the form required by Primavera .
20,665
private String getResourceType ( Resource resource ) { String result ; net . sf . mpxj . ResourceType type = resource . getType ( ) ; if ( type == null ) { type = net . sf . mpxj . ResourceType . WORK ; } switch ( type ) { case MATERIAL : { result = "Material" ; break ; } case COST : { result = "Nonlabor" ; break ; } d...
Formats a resource type .
20,666
private Double getPercentage ( Number number ) { Double result = null ; if ( number != null ) { result = Double . valueOf ( number . doubleValue ( ) / 100 ) ; } return result ; }
Formats a percentage value .
20,667
private Double getDouble ( Number number ) { Double result = null ; if ( number != null ) { result = Double . valueOf ( number . doubleValue ( ) ) ; } return result ; }
Formats a double value .
20,668
private String getActivityStatus ( Task mpxj ) { String result ; if ( mpxj . getActualStart ( ) == null ) { result = "Not Started" ; } else { if ( mpxj . getActualFinish ( ) == null ) { result = "In Progress" ; } else { result = "Completed" ; } } return result ; }
Retrieve an activity status .
20,669
private String getActivityID ( Task task ) { String result = null ; if ( m_activityIDField != null ) { Object value = task . getCachedValue ( m_activityIDField ) ; if ( value != null ) { result = value . toString ( ) ; } } return result ; }
Retrieve the Activity ID value for this task .
20,670
private void configureCustomFields ( ) { CustomFieldContainer customFields = m_projectFile . getCustomFields ( ) ; if ( m_activityIDField == null ) { m_activityIDField = ( TaskField ) customFields . getFieldByAlias ( FieldTypeClass . TASK , "Code" ) ; if ( m_activityIDField == null ) { m_activityIDField = TaskField . W...
Find the fields in which the Activity ID and Activity Type are stored .
20,671
private void populateSortedCustomFieldsList ( ) { m_sortedCustomFieldsList = new ArrayList < CustomField > ( ) ; for ( CustomField field : m_projectFile . getCustomFields ( ) ) { FieldType fieldType = field . getFieldType ( ) ; if ( fieldType != null ) { m_sortedCustomFieldsList . add ( field ) ; } } Collections . sort...
Populate a sorted list of custom fields to ensure that these fields are written to the file in a consistent order .
20,672
public void setDay ( Day d ) { if ( m_day != null ) { m_parentCalendar . removeHoursFromDay ( this ) ; } m_day = d ; m_parentCalendar . attachHoursToDay ( this ) ; }
Set day .
20,673
public void applyPatterns ( String [ ] patterns ) { m_formats = new SimpleDateFormat [ patterns . length ] ; for ( int index = 0 ; index < patterns . length ; index ++ ) { m_formats [ index ] = new SimpleDateFormat ( patterns [ index ] ) ; } }
This method is used to configure the format pattern .
20,674
public static Duration getDuration ( ProjectProperties properties , Integer durationValue , Integer unitsValue ) { Duration result ; if ( durationValue == null ) { result = null ; } else { result = Duration . getInstance ( durationValue . intValue ( ) , TimeUnit . MINUTES ) ; TimeUnit units = getDurationUnits ( unitsVa...
Convert the integer representation of a duration value and duration units into an MPXJ Duration instance .
20,675
public static Integer getDurationValue ( ProjectProperties properties , Duration duration ) { Integer result ; if ( duration == null ) { result = null ; } else { if ( duration . getUnits ( ) != TimeUnit . MINUTES ) { duration = duration . convertUnits ( TimeUnit . MINUTES , properties ) ; } result = Integer . valueOf (...
Convert an MPXJ Duration instance into an integer duration in minutes ready to be written to an MPX file .
20,676
public static Integer getDurationUnits ( RecurringTask recurrence ) { Duration duration = recurrence . getDuration ( ) ; Integer result = null ; if ( duration != null ) { result = UNITS_MAP . get ( duration . getUnits ( ) ) ; } return ( result ) ; }
Converts a TimeUnit instance to an integer value suitable for writing to an MPX file .
20,677
private static TimeUnit getDurationUnits ( Integer value ) { TimeUnit result = null ; if ( value != null ) { int index = value . intValue ( ) ; if ( index >= 0 && index < DURATION_UNITS . length ) { result = DURATION_UNITS [ index ] ; } } if ( result == null ) { result = TimeUnit . DAYS ; } return ( result ) ; }
Maps a duration unit value from a recurring task record in an MPX file to a TimeUnit instance . Defaults to days if any problems are encountered .
20,678
public static Integer getDays ( String days ) { Integer result = null ; if ( days != null ) { result = Integer . valueOf ( Integer . parseInt ( days , 2 ) ) ; } return ( result ) ; }
Converts the string representation of the days bit field into an integer .
20,679
public static String getDays ( RecurringTask task ) { StringBuilder sb = new StringBuilder ( ) ; for ( Day day : Day . values ( ) ) { sb . append ( task . getWeeklyDay ( day ) ? "1" : "0" ) ; } return sb . toString ( ) ; }
Convert weekly recurrence days into a bit field .
20,680
public static Day getDay ( Integer day ) { Day result = null ; if ( day != null ) { result = DAY_ARRAY [ day . intValue ( ) ] ; } return ( result ) ; }
Convert MPX day index to Day instance .
20,681
public static Integer getDay ( Day day ) { Integer result = null ; if ( day != null ) { result = DAY_MAP . get ( day ) ; } return ( result ) ; }
Convert Day instance to MPX day index .
20,682
public static Date getYearlyAbsoluteAsDate ( RecurringData data ) { Date result ; Integer yearlyAbsoluteDay = data . getDayNumber ( ) ; Integer yearlyAbsoluteMonth = data . getMonthNumber ( ) ; Date startDate = data . getStartDate ( ) ; if ( yearlyAbsoluteDay == null || yearlyAbsoluteMonth == null || startDate == null ...
Retrieves the yearly absolute date .
20,683
public int readInt ( int offset , byte [ ] data ) { int result = 0 ; int i = offset + m_offset ; for ( int shiftBy = 0 ; shiftBy < 32 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; }
Read a four byte integer from the data .
20,684
private void parse ( String header ) { ArrayList < String > list = new ArrayList < String > ( 4 ) ; StringBuilder sb = new StringBuilder ( ) ; int index = 1 ; while ( index < header . length ( ) ) { char c = header . charAt ( index ++ ) ; if ( Character . isDigit ( c ) ) { sb . append ( c ) ; } else { if ( sb . length ...
Parses values out of the header text .
20,685
public int getIndexByDate ( Date date ) { int result = - 1 ; int index = 0 ; for ( CostRateTableEntry entry : this ) { if ( DateHelper . compare ( date , entry . getEndDate ( ) ) < 0 ) { result = index ; break ; } ++ index ; } return result ; }
Retrieve the index of the table entry valid for the supplied date .
20,686
public static final int getInt ( String value ) { return ( value == null || value . length ( ) == 0 ? 0 : Integer . parseInt ( value ) ) ; }
This method retrieves an int value from a String instance . It returns zero by default if a null value or an empty string is supplied .
20,687
public static final double getDouble ( String value ) { return ( value == null || value . length ( ) == 0 ? 0 : Double . parseDouble ( value ) ) ; }
This method retrieves a double value from a String instance . It returns zero by default if a null value or an empty string is supplied .
20,688
public static final Integer getInteger ( Number value ) { Integer result = null ; if ( value != null ) { if ( value instanceof Integer ) { result = ( Integer ) value ; } else { result = Integer . valueOf ( ( int ) Math . round ( value . doubleValue ( ) ) ) ; } } return ( result ) ; }
Utility method used to convert an arbitrary Number into an Integer .
20,689
public static final Integer getInteger ( String value ) { Integer result ; try { result = Integer . valueOf ( Integer . parseInt ( value ) ) ; } catch ( Exception ex ) { result = null ; } return ( result ) ; }
Converts a string representation of an integer into an Integer object . Silently ignores any parse exceptions and returns null .
20,690
public static final BigInteger getBigInteger ( Number value ) { BigInteger result = null ; if ( value != null ) { if ( value instanceof BigInteger ) { result = ( BigInteger ) value ; } else { result = BigInteger . valueOf ( Math . round ( value . doubleValue ( ) ) ) ; } } return ( result ) ; }
Utility method used to convert a Number into a BigInteger .
20,691
public static final double round ( double value , double precision ) { precision = Math . pow ( 10 , precision ) ; return Math . round ( value * precision ) / precision ; }
Utility method used to round a double to the given precision .
20,692
public static final Integer parseInteger ( String value ) { return ( value == null || value . length ( ) == 0 ? null : Integer . valueOf ( Integer . parseInt ( value ) ) ) ; }
Utility method to convert a String to an Integer and handles null values .
20,693
public static int compare ( Integer n1 , Integer n2 ) { int result ; if ( n1 == null || n2 == null ) { result = ( n1 == null && n2 == null ? 0 : ( n1 == null ? 1 : - 1 ) ) ; } else { result = n1 . compareTo ( n2 ) ; } return ( result ) ; }
Compare two integers accounting for null values .
20,694
private final Object getObject ( String name ) { if ( m_map . containsKey ( name ) == false ) { throw new IllegalArgumentException ( "Invalid column name " + name ) ; } Object result = m_map . get ( name ) ; return ( result ) ; }
Retrieve a value from the map ensuring that a key exists in the map with the specified name .
20,695
public int nextToken ( ) throws IOException { int c ; int nextc = - 1 ; boolean quoted = false ; int result = m_next ; if ( m_next != 0 ) { m_next = 0 ; } m_buffer . setLength ( 0 ) ; while ( result == 0 ) { if ( nextc != - 1 ) { c = nextc ; nextc = - 1 ; } else { c = read ( ) ; } switch ( c ) { case TT_EOF : { if ( m_...
This method retrieves the next token and returns a constant representing the type of token found .
20,696
public ResourceAssignmentWorkgroupFields addWorkgroupAssignment ( ) throws MPXJException { if ( m_workgroup != null ) { throw new MPXJException ( MPXJException . MAXIMUM_RECORDS ) ; } m_workgroup = new ResourceAssignmentWorkgroupFields ( ) ; return ( m_workgroup ) ; }
This method allows a resource assignment workgroup fields record to be added to the current resource assignment . A maximum of one of these records can be added to a resource assignment record .
20,697
public Date getStart ( ) { Date result = ( Date ) getCachedValue ( AssignmentField . START ) ; if ( result == null ) { result = getTask ( ) . getStart ( ) ; } return result ; }
Returns the start of this resource assignment .
20,698
public Date getFinish ( ) { Date result = ( Date ) getCachedValue ( AssignmentField . FINISH ) ; if ( result == null ) { result = getTask ( ) . getFinish ( ) ; } return result ; }
Returns the finish date for this resource assignment .
20,699
public List < TimephasedWork > getTimephasedOvertimeWork ( ) { if ( m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork ( ) != null ) { double perDayFactor = getRemainingOvertimeWork ( ) . getDuration ( ) / ( getRemainingWork ( ) . getDuration ( ) - getRemainingOvertimeWork ( ) . getDuration...
Retrieves the timephased breakdown of the planned overtime work for this resource assignment .