idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
143,800
private void writeAssignmentTimephasedData ( ResourceAssignment mpx , Project . Assignments . Assignment xml ) { if ( m_writeTimphasedData && mpx . getHasTimephasedData ( ) ) { List < TimephasedDataType > list = xml . getTimephasedData ( ) ; ProjectCalendar calendar = mpx . getCalendar ( ) ; BigInteger assignmentID = x...
Writes the timephased data for a resource assignment .
143,801
private void writeAssignmentTimephasedData ( BigInteger assignmentID , List < TimephasedDataType > list , List < TimephasedWork > data , int type ) { for ( TimephasedWork mpx : data ) { TimephasedDataType xml = m_factory . createTimephasedDataType ( ) ; list . add ( xml ) ; xml . setStart ( mpx . getStart ( ) ) ; xml ....
Writes a list of timephased data to the MSPDI file .
143,802
private List < AssignmentField > getAllAssignmentExtendedAttributes ( ) { ArrayList < AssignmentField > result = new ArrayList < AssignmentField > ( ) ; result . addAll ( Arrays . asList ( AssignmentFieldLists . CUSTOM_COST ) ) ; result . addAll ( Arrays . asList ( AssignmentFieldLists . CUSTOM_DATE ) ) ; result . addA...
Retrieve list of assignment extended attributes .
143,803
private List < TaskField > getAllTaskExtendedAttributes ( ) { ArrayList < TaskField > result = new ArrayList < TaskField > ( ) ; result . addAll ( Arrays . asList ( TaskFieldLists . CUSTOM_TEXT ) ) ; result . addAll ( Arrays . asList ( TaskFieldLists . CUSTOM_START ) ) ; result . addAll ( Arrays . asList ( TaskFieldLis...
Retrieve list of task extended attributes .
143,804
private List < ResourceField > getAllResourceExtendedAttributes ( ) { ArrayList < ResourceField > result = new ArrayList < ResourceField > ( ) ; result . addAll ( Arrays . asList ( ResourceFieldLists . CUSTOM_TEXT ) ) ; result . addAll ( Arrays . asList ( ResourceFieldLists . CUSTOM_START ) ) ; result . addAll ( Arrays...
Retrieve list of resource extended attributes .
143,805
private void processUDF ( UDFTypeType udf ) { FieldTypeClass fieldType = FIELD_TYPE_MAP . get ( udf . getSubjectArea ( ) ) ; if ( fieldType != null ) { UserFieldDataType dataType = UserFieldDataType . getInstanceFromXmlName ( udf . getDataType ( ) ) ; String name = udf . getTitle ( ) ; FieldType field = addUserDefinedF...
Process an individual UDF .
143,806
private FieldType addUserDefinedField ( FieldTypeClass fieldType , UserFieldDataType dataType , String name ) { FieldType field = null ; try { switch ( fieldType ) { case TASK : { do { field = m_taskUdfCounters . nextField ( TaskField . class , dataType ) ; } while ( RESERVED_TASK_FIELDS . contains ( field ) ) ; m_proj...
Map the Primavera UDF to a custom field .
143,807
private Double zeroIsNull ( Double value ) { if ( value != null && value . doubleValue ( ) == 0 ) { value = null ; } return value ; }
Render a zero Double as null .
143,808
private Duration getDuration ( Double duration ) { Duration result = null ; if ( duration != null ) { result = Duration . getInstance ( NumberHelper . getDouble ( duration ) , TimeUnit . HOURS ) ; } return result ; }
Extracts a duration from a JAXBElement instance .
143,809
private void readUDFTypes ( FieldContainer mpxj , List < UDFAssignmentType > udfs ) { for ( UDFAssignmentType udf : udfs ) { FieldType fieldType = m_fieldTypeMap . get ( Integer . valueOf ( udf . getTypeObjectId ( ) ) ) ; if ( fieldType != null ) { mpxj . set ( fieldType , getUdfValue ( udf ) ) ; } } }
Process UDFs for a specific object .
143,810
private Object getUdfValue ( UDFAssignmentType udf ) { if ( udf . getCostValue ( ) != null ) { return udf . getCostValue ( ) ; } if ( udf . getDoubleValue ( ) != null ) { return udf . getDoubleValue ( ) ; } if ( udf . getFinishDateValue ( ) != null ) { return udf . getFinishDateValue ( ) ; } if ( udf . getIndicatorValu...
Retrieve the value of a UDF .
143,811
private Integer mapTaskID ( Integer id ) { Integer mappedID = m_clashMap . get ( id ) ; if ( mappedID == null ) { mappedID = id ; } return ( mappedID ) ; }
Deals with the case where we have had to map a task ID to a new value .
143,812
public int evaluate ( FieldContainer container ) { List < GraphicalIndicatorCriteria > criteria ; if ( container instanceof Task ) { Task task = ( Task ) container ; if ( NumberHelper . getInt ( task . getUniqueID ( ) ) == 0 ) { if ( m_projectSummaryInheritsFromSummaryRows == false ) { criteria = m_projectSummaryCriter...
This method evaluates a if a graphical indicator should be displayed given a set of Task or Resource data . The method will return - 1 if no indicator should be displayed .
143,813
private void writeFileCreationRecord ( ) throws IOException { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; m_buffer . setLength ( 0 ) ; m_buffer . append ( "MPX" ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( properties . getMpxProgramName ( ) ) ; m_buffer . append ( m_delimite...
Write file creation record .
143,814
private void writeCalendar ( ProjectCalendar record ) throws IOException { if ( record . getParent ( ) == null || record . getResource ( ) != null ) { m_buffer . setLength ( 0 ) ; if ( record . getParent ( ) == null ) { m_buffer . append ( MPXConstants . BASE_CALENDAR_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter )...
Write a calendar .
143,815
private void writeCalendarHours ( ProjectCalendar parentCalendar , ProjectCalendarHours record ) throws IOException { m_buffer . setLength ( 0 ) ; int recordNumber ; if ( ! parentCalendar . isDerived ( ) ) { recordNumber = MPXConstants . BASE_CALENDAR_HOURS_RECORD_NUMBER ; } else { recordNumber = MPXConstants . RESOURC...
Write calendar hours .
143,816
private void writeResource ( Resource record ) throws IOException { m_buffer . setLength ( 0 ) ; int [ ] fields = m_resourceModel . getModel ( ) ; m_buffer . append ( MPXConstants . RESOURCE_RECORD_NUMBER ) ; for ( int loop = 0 ; loop < fields . length ; loop ++ ) { int mpxFieldType = fields [ loop ] ; if ( mpxFieldTyp...
Write a resource .
143,817
private void writeNotes ( int recordNumber , String text ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( recordNumber ) ; m_buffer . append ( m_delimiter ) ; if ( text != null ) { String note = stripLineBreaks ( text , MPXConstants . EOL_PLACEHOLDER_STRING ) ; boolean quote = ( note . indexOf ( ...
Write notes .
143,818
private void writeResourceAssignment ( ResourceAssignment record ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( MPXConstants . RESOURCE_ASSIGNMENT_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( formatResource ( record . getResource ( ) ) ) ; m_buffer . append ( m_deli...
Write resource assignment .
143,819
private void writeResourceAssignmentWorkgroupFields ( ResourceAssignmentWorkgroupFields record ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( MPXConstants . RESOURCE_ASSIGNMENT_WORKGROUP_FIELDS_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( format ( record . getMessag...
Write resource assignment workgroup .
143,820
private void writeTasks ( List < Task > tasks ) throws IOException { for ( Task task : tasks ) { writeTask ( task ) ; writeTasks ( task . getChildTasks ( ) ) ; } }
Recursively write tasks .
143,821
private Integer getIntegerTimeInMinutes ( Date date ) { Integer result = null ; if ( date != null ) { Calendar cal = DateHelper . popCalendar ( date ) ; int time = cal . get ( Calendar . HOUR_OF_DAY ) * 60 ; time += cal . get ( Calendar . MINUTE ) ; DateHelper . pushCalendar ( cal ) ; result = Integer . valueOf ( time ...
This internal method is used to convert from a Date instance to an integer representing the number of minutes past midnight .
143,822
private String escapeQuotes ( String value ) { StringBuilder sb = new StringBuilder ( ) ; int length = value . length ( ) ; char c ; sb . append ( '"' ) ; for ( int index = 0 ; index < length ; index ++ ) { c = value . charAt ( index ) ; sb . append ( c ) ; if ( c == '"' ) { sb . append ( '"' ) ; } } sb . append ( '"' ...
This method is called when double quotes are found as part of a value . The quotes are escaped by adding a second quote character and the entire value is quoted .
143,823
private String stripLineBreaks ( String text , String replacement ) { if ( text . indexOf ( '\r' ) != - 1 || text . indexOf ( '\n' ) != - 1 ) { StringBuilder sb = new StringBuilder ( text ) ; int index ; while ( ( index = sb . indexOf ( "\r\n" ) ) != - 1 ) { sb . replace ( index , index + 2 , replacement ) ; } while ( ...
This method removes line breaks from a piece of text and replaces them with the supplied text .
143,824
private String format ( Object o ) { String result ; if ( o == null ) { result = "" ; } else { if ( o instanceof Boolean == true ) { result = LocaleData . getString ( m_locale , ( ( ( Boolean ) o ) . booleanValue ( ) == true ? LocaleData . YES : LocaleData . NO ) ) ; } else { if ( o instanceof Float == true || o instan...
This method returns the string representation of an object . In most cases this will simply involve calling the normal toString method on the object but a couple of exceptions are handled here .
143,825
private void stripTrailingDelimiters ( StringBuilder buffer ) { int index = buffer . length ( ) - 1 ; while ( index > 0 && buffer . charAt ( index ) == m_delimiter ) { -- index ; } buffer . setLength ( index + 1 ) ; }
This method removes trailing delimiter characters .
143,826
private String formatTime ( Date value ) { return ( value == null ? null : m_formats . getTimeFormat ( ) . format ( value ) ) ; }
This method is called to format a time value .
143,827
private String formatCurrency ( Number value ) { return ( value == null ? null : m_formats . getCurrencyFormat ( ) . format ( value ) ) ; }
This method is called to format a currency value .
143,828
private String formatUnits ( Number value ) { return ( value == null ? null : m_formats . getUnitsDecimalFormat ( ) . format ( value . doubleValue ( ) / 100 ) ) ; }
This method is called to format a units value .
143,829
private String formatDateTimeNull ( Date value ) { return ( value == null ? m_formats . getNullText ( ) : m_formats . getDateTimeFormat ( ) . format ( value ) ) ; }
This method is called to format a date . It will return the null text if a null value is supplied .
143,830
private String formatPercentage ( Number value ) { return ( value == null ? null : m_formats . getPercentageDecimalFormat ( ) . format ( value ) + "%" ) ; }
This method is called to format a percentage value .
143,831
private String formatAccrueType ( AccrueType type ) { return ( type == null ? null : LocaleData . getStringArray ( m_locale , LocaleData . ACCRUE_TYPES ) [ type . getValue ( ) - 1 ] ) ; }
This method is called to format an accrue type value .
143,832
private String formatConstraintType ( ConstraintType type ) { return ( type == null ? null : LocaleData . getStringArray ( m_locale , LocaleData . CONSTRAINT_TYPES ) [ type . getValue ( ) ] ) ; }
This method is called to format a constraint type .
143,833
private String formatDuration ( Object value ) { String result = null ; if ( value instanceof Duration ) { Duration duration = ( Duration ) value ; result = m_formats . getDurationDecimalFormat ( ) . format ( duration . getDuration ( ) ) + formatTimeUnit ( duration . getUnits ( ) ) ; } return result ; }
This method is called to format a duration .
143,834
private String formatRate ( Rate value ) { String result = null ; if ( value != null ) { StringBuilder buffer = new StringBuilder ( m_formats . getCurrencyFormat ( ) . format ( value . getAmount ( ) ) ) ; buffer . append ( "/" ) ; buffer . append ( formatTimeUnit ( value . getUnits ( ) ) ) ; result = buffer . toString ...
This method is called to format a rate .
143,835
private String formatPriority ( Priority value ) { String result = null ; if ( value != null ) { String [ ] priorityTypes = LocaleData . getStringArray ( m_locale , LocaleData . PRIORITY_TYPES ) ; int priority = value . getValue ( ) ; if ( priority < Priority . LOWEST ) { priority = Priority . LOWEST ; } else { if ( pr...
This method is called to format a priority .
143,836
private String formatTaskType ( TaskType value ) { return ( LocaleData . getString ( m_locale , ( value == TaskType . FIXED_DURATION ? LocaleData . YES : LocaleData . NO ) ) ) ; }
This method is called to format a task type .
143,837
private String formatRelationList ( List < Relation > value ) { String result = null ; if ( value != null && value . size ( ) != 0 ) { StringBuilder sb = new StringBuilder ( ) ; for ( Relation relation : value ) { if ( sb . length ( ) != 0 ) { sb . append ( m_delimiter ) ; } sb . append ( formatRelation ( relation ) ) ...
This method is called to format a relation list .
143,838
private String formatRelation ( Relation relation ) { String result = null ; if ( relation != null ) { StringBuilder sb = new StringBuilder ( relation . getTargetTask ( ) . getID ( ) . toString ( ) ) ; Duration duration = relation . getLag ( ) ; RelationType type = relation . getType ( ) ; double durationValue = durati...
This method is called to format a relation .
143,839
private String formatTimeUnit ( TimeUnit timeUnit ) { int units = timeUnit . getValue ( ) ; String result ; String [ ] [ ] unitNames = LocaleData . getStringArrays ( m_locale , LocaleData . TIME_UNITS_ARRAY ) ; if ( units < 0 || units >= unitNames . length ) { result = "" ; } else { result = unitNames [ units ] [ 0 ] ;...
This method formats a time unit .
143,840
@ SuppressWarnings ( "unchecked" ) private Object formatType ( DataType type , Object value ) { switch ( type ) { case DATE : { value = formatDateTime ( value ) ; break ; } case CURRENCY : { value = formatCurrency ( ( Number ) value ) ; break ; } case UNITS : { value = formatUnits ( ( Number ) value ) ; break ; } case ...
Converts a value to the appropriate type .
143,841
public final boolean getBoolean ( String name ) { boolean result = false ; Boolean value = ( Boolean ) getObject ( name ) ; if ( value != null ) { result = BooleanHelper . getBoolean ( value ) ; } return result ; }
Retrieve a boolean value .
143,842
public InputStream getInstance ( DirectoryEntry directory , String name ) throws IOException { DocumentEntry entry = ( DocumentEntry ) directory . getEntry ( name ) ; InputStream stream ; if ( m_encrypted ) { stream = new EncryptedDocumentInputStream ( entry , m_encryptionCode ) ; } else { stream = new DocumentInputStr...
Method used to instantiate the appropriate input stream reader a standard one or one which can deal with encrypted data .
143,843
private TaskField getTaskField ( int field ) { TaskField result = MPPTaskField14 . getInstance ( field ) ; if ( result != null ) { switch ( result ) { case START_TEXT : { result = TaskField . START ; break ; } case FINISH_TEXT : { result = TaskField . FINISH ; break ; } case DURATION_TEXT : { result = TaskField . DURAT...
Maps an integer field ID to a field type .
143,844
public void updateUniqueCounters ( ) { for ( Task task : m_parent . getTasks ( ) ) { int uniqueID = NumberHelper . getInt ( task . getUniqueID ( ) ) ; if ( uniqueID > m_taskUniqueID ) { m_taskUniqueID = uniqueID ; } } for ( Resource resource : m_parent . getResources ( ) ) { int uniqueID = NumberHelper . getInt ( resou...
This method is called to ensure that after a project file has been read the cached unique ID values used to generate new unique IDs start after the end of the existing set of unique IDs .
143,845
public static Date min ( Date d1 , Date d2 ) { Date result ; if ( d1 == null ) { result = d2 ; } else if ( d2 == null ) { result = d1 ; } else { result = ( d1 . compareTo ( d2 ) < 0 ) ? d1 : d2 ; } return result ; }
Returns the earlier of two dates handling null values . A non - null Date is always considered to be earlier than a null Date .
143,846
public static Date max ( Date d1 , Date d2 ) { Date result ; if ( d1 == null ) { result = d2 ; } else if ( d2 == null ) { result = d1 ; } else { result = ( d1 . compareTo ( d2 ) > 0 ) ? d1 : d2 ; } return result ; }
Returns the later of two dates handling null values . A non - null Date is always considered to be later than a null Date .
143,847
public static Duration getVariance ( Task task , Date date1 , Date date2 , TimeUnit format ) { Duration variance = null ; if ( date1 != null && date2 != null ) { ProjectCalendar calendar = task . getEffectiveCalendar ( ) ; if ( calendar != null ) { variance = calendar . getWork ( date1 , date2 , format ) ; } } if ( var...
This utility method calculates the difference in working time between two dates given the context of a task .
143,848
public static Date getDateFromLong ( long date ) { TimeZone tz = TimeZone . getDefault ( ) ; return ( new Date ( date - tz . getRawOffset ( ) ) ) ; }
Creates a date from the equivalent long value . This conversion takes account of the time zone .
143,849
public static Date getTimestampFromLong ( long timestamp ) { TimeZone tz = TimeZone . getDefault ( ) ; Date result = new Date ( timestamp - tz . getRawOffset ( ) ) ; if ( tz . inDaylightTime ( result ) == true ) { int savings ; if ( HAS_DST_SAVINGS == true ) { savings = tz . getDSTSavings ( ) ; } else { savings = DEFAU...
Creates a timestamp from the equivalent long value . This conversion takes account of the time zone and any daylight savings time .
143,850
public static Date getTime ( int hour , int minutes ) { Calendar cal = popCalendar ( ) ; cal . set ( Calendar . HOUR_OF_DAY , hour ) ; cal . set ( Calendar . MINUTE , minutes ) ; cal . set ( Calendar . SECOND , 0 ) ; Date result = cal . getTime ( ) ; pushCalendar ( cal ) ; return result ; }
Create a Date instance representing a specific time .
143,851
public static void setTime ( Calendar cal , Date time ) { if ( time != null ) { Calendar startCalendar = popCalendar ( time ) ; cal . set ( Calendar . HOUR_OF_DAY , startCalendar . get ( Calendar . HOUR_OF_DAY ) ) ; cal . set ( Calendar . MINUTE , startCalendar . get ( Calendar . MINUTE ) ) ; cal . set ( Calendar . SEC...
Given a date represented by a Calendar instance set the time component of the date based on the hours and minutes of the time supplied by the Date instance .
143,852
public static Date setTime ( Date date , Date canonicalTime ) { Date result ; if ( canonicalTime == null ) { result = date ; } else { Calendar cal = popCalendar ( canonicalTime ) ; int dayOffset = cal . get ( Calendar . DAY_OF_YEAR ) - 1 ; int hourOfDay = cal . get ( Calendar . HOUR_OF_DAY ) ; int minute = cal . get ( ...
Given a date represented by a Date instance set the time component of the date based on the hours and minutes of the time supplied by the Date instance .
143,853
public static Date addDays ( Date date , int days ) { Calendar cal = popCalendar ( date ) ; cal . add ( Calendar . DAY_OF_YEAR , days ) ; Date result = cal . getTime ( ) ; pushCalendar ( cal ) ; return result ; }
Add a number of days to the supplied date .
143,854
public static Calendar popCalendar ( ) { Calendar result ; Deque < Calendar > calendars = CALENDARS . get ( ) ; if ( calendars . isEmpty ( ) ) { result = Calendar . getInstance ( ) ; } else { result = calendars . pop ( ) ; } return result ; }
Acquire a calendar instance .
143,855
public List < MapRow > read ( ) throws IOException { List < MapRow > result = new ArrayList < MapRow > ( ) ; int fileCount = m_stream . readInt ( ) ; if ( fileCount != 0 ) { for ( int index = 0 ; index < fileCount ; index ++ ) { Map < String , Object > map = new LinkedHashMap < String , Object > ( ) ; readBlock ( map )...
Read a list of fixed sized blocks from the input stream .
143,856
protected int readByte ( InputStream is ) throws IOException { byte [ ] data = new byte [ 1 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getByte ( data , 0 ) ) ; }
This method reads a single byte from the input stream .
143,857
protected int readShort ( InputStream is ) throws IOException { byte [ ] data = new byte [ 2 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getShort ( data , 0 ) ) ; }
This method reads a two byte integer from the input stream .
143,858
protected int readInt ( InputStream is ) throws IOException { byte [ ] data = new byte [ 4 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getInt ( data , 0 ) ) ; }
This method reads a four byte integer from the input stream .
143,859
protected byte [ ] readByteArray ( InputStream is , int size ) throws IOException { byte [ ] buffer = new byte [ size ] ; if ( is . read ( buffer ) != buffer . length ) { throw new EOFException ( ) ; } return ( buffer ) ; }
This method reads a byte array from the input stream .
143,860
public int blast ( InputStream input , OutputStream output ) throws IOException { m_input = input ; m_output = output ; int lit ; int dict ; int symbol ; int len ; int dist ; int copy ; lit = bits ( 8 ) ; if ( lit > 1 ) { return - 1 ; } dict = bits ( 8 ) ; if ( dict < 4 || dict > 6 ) { return - 2 ; } do { if ( bits ( 1...
Decode PKWare Compression Library stream .
143,861
private int decode ( Huffman h ) throws IOException { int len ; int code ; int first ; int count ; int index ; int bitbuf ; int left ; bitbuf = m_bitbuf ; left = m_bitcnt ; code = first = index = 0 ; len = 1 ; int nextIndex = 1 ; while ( true ) { while ( left -- != 0 ) { code |= ( bitbuf & 1 ) ^ 1 ; bitbuf >>= 1 ; coun...
Decode a code from the stream s using huffman table h . Return the symbol or a negative value if there is an error . If all of the lengths are zero i . e . an empty code or if the code is incomplete and an invalid code is received then - 9 is returned after reading MAXBITS bits .
143,862
private void validateSameDay ( ProjectCalendar calendar , LinkedList < TimephasedWork > list ) { for ( TimephasedWork assignment : list ) { Date assignmentStart = assignment . getStart ( ) ; Date calendarStartTime = calendar . getStartTime ( assignmentStart ) ; Date assignmentStartTime = DateHelper . getCanonicalTime (...
Ensures that the start and end dates for ranges fit within the working times for a given day .
143,863
public Table createTable ( ProjectFile file , byte [ ] data , VarMeta varMeta , Var2Data varData ) { Table table = new Table ( ) ; table . setID ( MPPUtility . getInt ( data , 0 ) ) ; table . setResourceFlag ( MPPUtility . getShort ( data , 108 ) == 1 ) ; table . setName ( MPPUtility . removeAmpersands ( MPPUtility . g...
Creates a new Table instance from data extracted from an MPP file .
143,864
private final boolean parseBoolean ( String value ) { return value != null && ( value . equalsIgnoreCase ( "true" ) || value . equalsIgnoreCase ( "y" ) || value . equalsIgnoreCase ( "yes" ) ) ; }
Parse a string representation of a Boolean value . XER files sometimes have N and Y to indicate boolean
143,865
public void processActivityCodes ( List < Row > types , List < Row > typeValues , List < Row > assignments ) { ActivityCodeContainer container = m_project . getActivityCodes ( ) ; Map < Integer , ActivityCode > map = new HashMap < Integer , ActivityCode > ( ) ; for ( Row row : types ) { ActivityCode code = new Activity...
Read activity code types and values .
143,866
public void processCalendar ( Row row ) { ProjectCalendar calendar = m_project . addCalendar ( ) ; Integer id = row . getInteger ( "clndr_id" ) ; m_calMap . put ( id , calendar ) ; calendar . setName ( row . getString ( "clndr_name" ) ) ; try { calendar . setMinutesPerDay ( Integer . valueOf ( ( int ) NumberHelper . ge...
Process data for an individual calendar .
143,867
private void processCalendarDays ( ProjectCalendar calendar , Record root ) { Record daysOfWeek = root . getChild ( "DaysOfWeek" ) ; if ( daysOfWeek != null ) { for ( Record dayRecord : daysOfWeek . getChildren ( ) ) { processCalendarHours ( calendar , dayRecord ) ; } } }
Process calendar days of the week .
143,868
private void processCalendarHours ( ProjectCalendar calendar , Record dayRecord ) { Day day = Day . getInstance ( Integer . parseInt ( dayRecord . getField ( ) ) ) ; List < Record > recHours = dayRecord . getChildren ( ) ; if ( recHours . size ( ) == 0 ) { calendar . setWorkingDay ( day , false ) ; } else { calendar . ...
Process hours in a working day .
143,869
private void addHours ( ProjectCalendarDateRanges ranges , Record hoursRecord ) { if ( hoursRecord . getValue ( ) != null ) { String [ ] wh = hoursRecord . getValue ( ) . split ( "\\|" ) ; try { String startText ; String endText ; if ( wh [ 0 ] . equals ( "s" ) ) { startText = wh [ 1 ] ; endText = wh [ 3 ] ; } else { s...
Parses a record containing hours and add them to a container .
143,870
private ProjectCalendar getResourceCalendar ( Integer calendarID ) { ProjectCalendar result = null ; if ( calendarID != null ) { ProjectCalendar calendar = m_calMap . get ( calendarID ) ; if ( calendar != null ) { if ( ! calendar . isDerived ( ) ) { ProjectCalendar resourceCalendar = m_project . addCalendar ( ) ; resou...
Retrieve the correct calendar for a resource .
143,871
private FieldType getActivityIDField ( Map < FieldType , String > map ) { FieldType result = null ; for ( Map . Entry < FieldType , String > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) . equals ( "task_code" ) ) { result = entry . getKey ( ) ; break ; } } return result ; }
Determine which field the Activity ID has been mapped to .
143,872
private void addUserDefinedField ( FieldTypeClass fieldType , UserFieldDataType dataType , String name ) { try { switch ( fieldType ) { case TASK : TaskField taskField ; do { taskField = m_taskUdfCounters . nextField ( TaskField . class , dataType ) ; } while ( m_taskFields . containsKey ( taskField ) || m_wbsFields . ...
Configure a new user defined field .
143,873
private void addUDFValue ( FieldTypeClass fieldType , FieldContainer container , Row row ) { Integer fieldId = row . getInteger ( "udf_type_id" ) ; String fieldName = m_udfFields . get ( fieldId ) ; Object value = null ; FieldType field = m_project . getCustomFields ( ) . getFieldByAlias ( fieldType , fieldName ) ; if ...
Adds a user defined field value to a task .
143,874
private void populateUserDefinedFieldValues ( String tableName , FieldTypeClass type , FieldContainer container , Integer uniqueID ) { Map < Integer , List < Row > > tableData = m_udfValues . get ( tableName ) ; if ( tableData != null ) { List < Row > udf = tableData . get ( uniqueID ) ; if ( udf != null ) { for ( Row ...
Populate the UDF values for this entity .
143,875
public void processDefaultCurrency ( Row row ) { ProjectProperties properties = m_project . getProjectProperties ( ) ; properties . setCurrencySymbol ( row . getString ( "curr_symbol" ) ) ; properties . setSymbolPosition ( CURRENCY_SYMBOL_POSITION_MAP . get ( row . getString ( "pos_curr_fmt_type" ) ) ) ; properties . s...
Code common to both XER and database readers to extract currency format data .
143,876
private void processFields ( Map < FieldType , String > map , Row row , FieldContainer container ) { for ( Map . Entry < FieldType , String > entry : map . entrySet ( ) ) { FieldType field = entry . getKey ( ) ; String name = entry . getValue ( ) ; Object value ; switch ( field . getDataType ( ) ) { case INTEGER : { va...
Generic method to extract Primavera fields and assign to MPXJ fields .
143,877
private void applyAliases ( Map < FieldType , String > aliases ) { CustomFieldContainer fields = m_project . getCustomFields ( ) ; for ( Map . Entry < FieldType , String > entry : aliases . entrySet ( ) ) { fields . getCustomField ( entry . getKey ( ) ) . setAlias ( entry . getValue ( ) ) ; } }
Apply aliases to task and resource fields .
143,878
private Number calculatePercentComplete ( Row row ) { Number result ; switch ( PercentCompleteType . getInstance ( row . getString ( "complete_pct_type" ) ) ) { case UNITS : { result = calculateUnitsPercentComplete ( row ) ; break ; } case DURATION : { result = calculateDurationPercentComplete ( row ) ; break ; } defau...
Determine which type of percent complete is used on on this task and calculate the required value .
143,879
private Number calculateUnitsPercentComplete ( Row row ) { double result = 0 ; double actualWorkQuantity = NumberHelper . getDouble ( row . getDouble ( "act_work_qty" ) ) ; double actualEquipmentQuantity = NumberHelper . getDouble ( row . getDouble ( "act_equip_qty" ) ) ; double numerator = actualWorkQuantity + actualE...
Calculate the units percent complete .
143,880
private Number calculateDurationPercentComplete ( Row row ) { double result = 0 ; double targetDuration = row . getDuration ( "target_drtn_hr_cnt" ) . getDuration ( ) ; double remainingDuration = row . getDuration ( "remain_drtn_hr_cnt" ) . getDuration ( ) ; if ( targetDuration == 0 ) { if ( remainingDuration == 0 ) { ...
Calculate the duration percent complete .
143,881
public static Map < FieldType , String > getDefaultResourceFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( ResourceField . UNIQUE_ID , "rsrc_id" ) ; map . put ( ResourceField . GUID , "guid" ) ; map . put ( ResourceField . NAME , "rsrc_name" ) ; map . put ( Res...
Retrieve the default mapping between MPXJ resource fields and Primavera resource field names .
143,882
public static Map < FieldType , String > getDefaultWbsFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( TaskField . UNIQUE_ID , "wbs_id" ) ; map . put ( TaskField . GUID , "guid" ) ; map . put ( TaskField . NAME , "wbs_name" ) ; map . put ( TaskField . BASELINE_C...
Retrieve the default mapping between MPXJ task fields and Primavera wbs field names .
143,883
public static Map < FieldType , String > getDefaultTaskFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( TaskField . UNIQUE_ID , "task_id" ) ; map . put ( TaskField . GUID , "guid" ) ; map . put ( TaskField . NAME , "task_name" ) ; map . put ( TaskField . ACTUAL_...
Retrieve the default mapping between MPXJ task fields and Primavera task field names .
143,884
public static Map < FieldType , String > getDefaultAssignmentFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( AssignmentField . UNIQUE_ID , "taskrsrc_id" ) ; map . put ( AssignmentField . GUID , "guid" ) ; map . put ( AssignmentField . REMAINING_WORK , "remain_q...
Retrieve the default mapping between MPXJ assignment fields and Primavera assignment field names .
143,885
public static Map < FieldType , String > getDefaultAliases ( ) { Map < FieldType , String > map = new HashMap < FieldType , String > ( ) ; map . put ( TaskField . DATE1 , "Suspend Date" ) ; map . put ( TaskField . DATE2 , "Resume Date" ) ; map . put ( TaskField . TEXT1 , "Code" ) ; map . put ( TaskField . TEXT2 , "Acti...
Retrieve the default aliases to be applied to MPXJ task and resource fields .
143,886
private static void filter ( String filename , String filtername ) throws Exception { ProjectFile project = new UniversalProjectReader ( ) . read ( filename ) ; Filter filter = project . getFilters ( ) . getFilterByName ( filtername ) ; if ( filter == null ) { displayAvailableFilters ( project ) ; } else { System . out...
This method opens the named project applies the named filter and displays the filtered list of tasks or resources . If an invalid filter name is supplied a list of valid filter names is shown .
143,887
private static void displayAvailableFilters ( ProjectFile project ) { System . out . println ( "Unknown filter name supplied." ) ; System . out . println ( "Available task filters:" ) ; for ( Filter filter : project . getFilters ( ) . getTaskFilters ( ) ) { System . out . println ( " " + filter . getName ( ) ) ; } Sy...
This utility displays a list of available task filters and a list of available resource filters .
143,888
private static void processTaskFilter ( ProjectFile project , Filter filter ) { for ( Task task : project . getTasks ( ) ) { if ( filter . evaluate ( task , null ) ) { System . out . println ( task . getID ( ) + "," + task . getUniqueID ( ) + "," + task . getName ( ) ) ; } } }
Apply a filter to the list of all tasks and show the results .
143,889
private static void processResourceFilter ( ProjectFile project , Filter filter ) { for ( Resource resource : project . getResources ( ) ) { if ( filter . evaluate ( resource , null ) ) { System . out . println ( resource . getID ( ) + "," + resource . getUniqueID ( ) + "," + resource . getName ( ) ) ; } } }
Apply a filter to the list of all resources and show the results .
143,890
public void process ( String inputFile , String outputFile ) throws Exception { System . out . println ( "Reading input file started." ) ; long start = System . currentTimeMillis ( ) ; ProjectFile projectFile = readFile ( inputFile ) ; long elapsed = System . currentTimeMillis ( ) - start ; System . out . println ( "Re...
Convert one project file format to another .
143,891
private ProjectFile readFile ( String inputFile ) throws MPXJException { ProjectReader reader = new UniversalProjectReader ( ) ; ProjectFile projectFile = reader . read ( inputFile ) ; if ( projectFile == null ) { throw new IllegalArgumentException ( "Unsupported file type" ) ; } return projectFile ; }
Use the universal project reader to open the file . Throw an exception if we can t determine the file type .
143,892
private void readProjectProperties ( Settings phoenixSettings , Storepoint storepoint ) { ProjectProperties mpxjProperties = m_projectFile . getProjectProperties ( ) ; mpxjProperties . setName ( phoenixSettings . getTitle ( ) ) ; mpxjProperties . setDefaultDurationUnits ( phoenixSettings . getBaseunit ( ) ) ; mpxjPrope...
This method extracts project properties from a Phoenix file .
143,893
private void readCalendars ( Storepoint phoenixProject ) { Calendars calendars = phoenixProject . getCalendars ( ) ; if ( calendars != null ) { for ( Calendar calendar : calendars . getCalendar ( ) ) { readCalendar ( calendar ) ; } ProjectCalendar defaultCalendar = m_projectFile . getCalendarByName ( phoenixProject . g...
This method extracts calendar data from a Phoenix file .
143,894
private void readCalendar ( Calendar calendar ) { ProjectCalendar mpxjCalendar = m_projectFile . addCalendar ( ) ; mpxjCalendar . setName ( calendar . getName ( ) ) ; for ( Day day : Day . values ( ) ) { mpxjCalendar . setWorkingDay ( day , true ) ; } List < NonWork > nonWorkingDays = calendar . getNonWork ( ) ; for ( ...
This method extracts data for a single calendar from a Phoenix file .
143,895
private void readResources ( Storepoint phoenixProject ) { Resources resources = phoenixProject . getResources ( ) ; if ( resources != null ) { for ( net . sf . mpxj . phoenix . schema . Project . Storepoints . Storepoint . Resources . Resource res : resources . getResource ( ) ) { Resource resource = readResource ( re...
This method extracts resource data from a Phoenix file .
143,896
private Resource readResource ( net . sf . mpxj . phoenix . schema . Project . Storepoints . Storepoint . Resources . Resource phoenixResource ) { Resource mpxjResource = m_projectFile . addResource ( ) ; TimeUnit rateUnits = phoenixResource . getMonetarybase ( ) ; if ( rateUnits == null ) { rateUnits = TimeUnit . HOUR...
This method extracts data for a single resource from a Phoenix file .
143,897
private void readTasks ( Project phoenixProject , Storepoint storepoint ) { processLayouts ( phoenixProject ) ; processActivityCodes ( storepoint ) ; processActivities ( storepoint ) ; updateDates ( ) ; }
Read phases and activities from the Phoenix file to create the task hierarchy .
143,898
private void processActivityCodes ( Storepoint storepoint ) { for ( Code code : storepoint . getActivityCodes ( ) . getCode ( ) ) { int sequence = 0 ; for ( Value value : code . getValue ( ) ) { UUID uuid = getUUID ( value . getUuid ( ) , value . getName ( ) ) ; m_activityCodeValues . put ( uuid , value . getName ( ) )...
Map from an activity code value UUID to the actual value itself and its sequence number .
143,899
private void processLayouts ( Project phoenixProject ) { Layout activeLayout = getActiveLayout ( phoenixProject ) ; for ( CodeOption option : activeLayout . getCodeOptions ( ) . getCodeOption ( ) ) { if ( option . isShown ( ) . booleanValue ( ) ) { m_codeSequence . add ( getUUID ( option . getCodeUuid ( ) , option . ge...
Find the current layout and extract the activity code order and visibility .