idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
143,600 | 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 r : udf ) { addUDFValue ( type , container , r ) ; } } } } | Populate the UDF values for this entity . | 108 | 10 |
143,601 | 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 . setCurrencyDigits ( row . getInteger ( "decimal_digit_cnt" ) ) ; properties . setThousandsSeparator ( row . getString ( "digit_group_symbol" ) . charAt ( 0 ) ) ; properties . setDecimalSeparator ( row . getString ( "decimal_symbol" ) . charAt ( 0 ) ) ; } | Code common to both XER and database readers to extract currency format data . | 178 | 15 |
143,602 | 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 : { value = row . getInteger ( name ) ; break ; } case BOOLEAN : { value = Boolean . valueOf ( row . getBoolean ( name ) ) ; break ; } case DATE : { value = row . getDate ( name ) ; break ; } case CURRENCY : case NUMERIC : case PERCENTAGE : { value = row . getDouble ( name ) ; break ; } case DELAY : case WORK : case DURATION : { value = row . getDuration ( name ) ; break ; } case RESOURCE_TYPE : { value = RESOURCE_TYPE_MAP . get ( row . getString ( name ) ) ; break ; } case TASK_TYPE : { value = TASK_TYPE_MAP . get ( row . getString ( name ) ) ; break ; } case CONSTRAINT : { value = CONSTRAINT_TYPE_MAP . get ( row . getString ( name ) ) ; break ; } case PRIORITY : { value = PRIORITY_MAP . get ( row . getString ( name ) ) ; break ; } case GUID : { value = row . getUUID ( name ) ; break ; } default : { value = row . getString ( name ) ; break ; } } container . set ( field , value ) ; } } | Generic method to extract Primavera fields and assign to MPXJ fields . | 367 | 17 |
143,603 | 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 . | 80 | 8 |
143,604 | 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 ; } default : { result = calculatePhysicalPercentComplete ( row ) ; break ; } } return result ; } | Determine which type of percent complete is used on on this task and calculate the required value . | 98 | 20 |
143,605 | 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 + actualEquipmentQuantity ; if ( numerator != 0 ) { double remainingWorkQuantity = NumberHelper . getDouble ( row . getDouble ( "remain_work_qty" ) ) ; double remainingEquipmentQuantity = NumberHelper . getDouble ( row . getDouble ( "remain_equip_qty" ) ) ; double denominator = remainingWorkQuantity + actualWorkQuantity + remainingEquipmentQuantity + actualEquipmentQuantity ; result = denominator == 0 ? 0 : ( ( numerator * 100 ) / denominator ) ; } return NumberHelper . getDouble ( result ) ; } | Calculate the units percent complete . | 207 | 8 |
143,606 | 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 ) { if ( "TK_Complete" . equals ( row . getString ( "status_code" ) ) ) { result = 100 ; } } } else { if ( remainingDuration < targetDuration ) { result = ( ( targetDuration - remainingDuration ) * 100 ) / targetDuration ; } } return NumberHelper . getDouble ( result ) ; } | Calculate the duration percent complete . | 160 | 8 |
143,607 | 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 ( ResourceField . CODE , "employee_code" ) ; map . put ( ResourceField . EMAIL_ADDRESS , "email_addr" ) ; map . put ( ResourceField . NOTES , "rsrc_notes" ) ; map . put ( ResourceField . CREATED , "create_date" ) ; map . put ( ResourceField . TYPE , "rsrc_type" ) ; map . put ( ResourceField . INITIALS , "rsrc_short_name" ) ; map . put ( ResourceField . PARENT_ID , "parent_rsrc_id" ) ; return map ; } | Retrieve the default mapping between MPXJ resource fields and Primavera resource field names . | 233 | 20 |
143,608 | 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_COST , "orig_cost" ) ; map . put ( TaskField . REMAINING_COST , "indep_remain_total_cost" ) ; map . put ( TaskField . REMAINING_WORK , "indep_remain_work_qty" ) ; map . put ( TaskField . DEADLINE , "anticip_end_date" ) ; map . put ( TaskField . DATE1 , "suspend_date" ) ; map . put ( TaskField . DATE2 , "resume_date" ) ; map . put ( TaskField . TEXT1 , "task_code" ) ; map . put ( TaskField . WBS , "wbs_short_name" ) ; return map ; } | Retrieve the default mapping between MPXJ task fields and Primavera wbs field names . | 269 | 21 |
143,609 | 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_DURATION , "act_drtn_hr_cnt" ) ; map . put ( TaskField . REMAINING_DURATION , "remain_drtn_hr_cnt" ) ; map . put ( TaskField . ACTUAL_WORK , "act_work_qty" ) ; map . put ( TaskField . REMAINING_WORK , "remain_work_qty" ) ; map . put ( TaskField . BASELINE_WORK , "target_work_qty" ) ; map . put ( TaskField . BASELINE_DURATION , "target_drtn_hr_cnt" ) ; map . put ( TaskField . DURATION , "target_drtn_hr_cnt" ) ; map . put ( TaskField . CONSTRAINT_DATE , "cstr_date" ) ; map . put ( TaskField . ACTUAL_START , "act_start_date" ) ; map . put ( TaskField . ACTUAL_FINISH , "act_end_date" ) ; map . put ( TaskField . LATE_START , "late_start_date" ) ; map . put ( TaskField . LATE_FINISH , "late_end_date" ) ; map . put ( TaskField . EARLY_START , "early_start_date" ) ; map . put ( TaskField . EARLY_FINISH , "early_end_date" ) ; map . put ( TaskField . REMAINING_EARLY_START , "restart_date" ) ; map . put ( TaskField . REMAINING_EARLY_FINISH , "reend_date" ) ; map . put ( TaskField . BASELINE_START , "target_start_date" ) ; map . put ( TaskField . BASELINE_FINISH , "target_end_date" ) ; map . put ( TaskField . CONSTRAINT_TYPE , "cstr_type" ) ; map . put ( TaskField . PRIORITY , "priority_type" ) ; map . put ( TaskField . CREATED , "create_date" ) ; map . put ( TaskField . TYPE , "duration_type" ) ; map . put ( TaskField . FREE_SLACK , "free_float_hr_cnt" ) ; map . put ( TaskField . TOTAL_SLACK , "total_float_hr_cnt" ) ; map . put ( TaskField . TEXT1 , "task_code" ) ; map . put ( TaskField . TEXT2 , "task_type" ) ; map . put ( TaskField . TEXT3 , "status_code" ) ; map . put ( TaskField . NUMBER1 , "rsrc_id" ) ; return map ; } | Retrieve the default mapping between MPXJ task fields and Primavera task field names . | 715 | 20 |
143,610 | 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_qty" ) ; map . put ( AssignmentField . BASELINE_WORK , "target_qty" ) ; map . put ( AssignmentField . ACTUAL_OVERTIME_WORK , "act_ot_qty" ) ; map . put ( AssignmentField . BASELINE_COST , "target_cost" ) ; map . put ( AssignmentField . ACTUAL_OVERTIME_COST , "act_ot_cost" ) ; map . put ( AssignmentField . REMAINING_COST , "remain_cost" ) ; map . put ( AssignmentField . ACTUAL_START , "act_start_date" ) ; map . put ( AssignmentField . ACTUAL_FINISH , "act_end_date" ) ; map . put ( AssignmentField . BASELINE_START , "target_start_date" ) ; map . put ( AssignmentField . BASELINE_FINISH , "target_end_date" ) ; map . put ( AssignmentField . ASSIGNMENT_DELAY , "target_lag_drtn_hr_cnt" ) ; return map ; } | Retrieve the default mapping between MPXJ assignment fields and Primavera assignment field names . | 341 | 20 |
143,611 | 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 , "Activity Type" ) ; map . put ( TaskField . TEXT3 , "Status" ) ; map . put ( TaskField . NUMBER1 , "Primary Resource Unique ID" ) ; return map ; } | Retrieve the default aliases to be applied to MPXJ task and resource fields . | 143 | 17 |
143,612 | 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 . println ( filter ) ; System . out . println ( ) ; if ( filter . isTaskFilter ( ) ) { processTaskFilter ( project , filter ) ; } else { processResourceFilter ( project , filter ) ; } } } | 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 . | 123 | 36 |
143,613 | 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 ( ) ) ; } System . out . println ( "Available resource filters:" ) ; for ( Filter filter : project . getFilters ( ) . getResourceFilters ( ) ) { System . out . println ( " " + filter . getName ( ) ) ; } } | This utility displays a list of available task filters and a list of available resource filters . | 132 | 17 |
143,614 | 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 . | 79 | 14 |
143,615 | 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 . | 78 | 14 |
143,616 | 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 ( "Reading input file completed in " + elapsed + "ms." ) ; System . out . println ( "Writing output file started." ) ; start = System . currentTimeMillis ( ) ; ProjectWriter writer = ProjectWriterUtility . getProjectWriter ( outputFile ) ; writer . write ( projectFile , outputFile ) ; elapsed = System . currentTimeMillis ( ) - start ; System . out . println ( "Writing output completed in " + elapsed + "ms." ) ; } | Convert one project file format to another . | 175 | 9 |
143,617 | 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 . | 69 | 22 |
143,618 | private void readProjectProperties ( Settings phoenixSettings , Storepoint storepoint ) { ProjectProperties mpxjProperties = m_projectFile . getProjectProperties ( ) ; mpxjProperties . setName ( phoenixSettings . getTitle ( ) ) ; mpxjProperties . setDefaultDurationUnits ( phoenixSettings . getBaseunit ( ) ) ; mpxjProperties . setStatusDate ( storepoint . getDataDate ( ) ) ; } | This method extracts project properties from a Phoenix file . | 102 | 10 |
143,619 | 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 . getDefaultCalendar ( ) ) ; if ( defaultCalendar != null ) { m_projectFile . getProjectProperties ( ) . setDefaultCalendarName ( defaultCalendar . getName ( ) ) ; } } } | This method extracts calendar data from a Phoenix file . | 126 | 10 |
143,620 | private void readCalendar ( Calendar calendar ) { // Create the calendar ProjectCalendar mpxjCalendar = m_projectFile . addCalendar ( ) ; mpxjCalendar . setName ( calendar . getName ( ) ) ; // Default all days to working for ( Day day : Day . values ( ) ) { mpxjCalendar . setWorkingDay ( day , true ) ; } // Mark non-working days List < NonWork > nonWorkingDays = calendar . getNonWork ( ) ; for ( NonWork nonWorkingDay : nonWorkingDays ) { // TODO: handle recurring exceptions if ( nonWorkingDay . getType ( ) . equals ( "internal_weekly" ) ) { mpxjCalendar . setWorkingDay ( nonWorkingDay . getWeekday ( ) , false ) ; } } // Add default working hours for working days for ( Day day : Day . values ( ) ) { if ( mpxjCalendar . isWorkingDay ( day ) ) { ProjectCalendarHours hours = mpxjCalendar . addCalendarHours ( day ) ; hours . addRange ( ProjectCalendarWeek . DEFAULT_WORKING_MORNING ) ; hours . addRange ( ProjectCalendarWeek . DEFAULT_WORKING_AFTERNOON ) ; } } } | This method extracts data for a single calendar from a Phoenix file . | 276 | 13 |
143,621 | 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 ( res ) ; readAssignments ( resource , res ) ; } } } | This method extracts resource data from a Phoenix file . | 90 | 10 |
143,622 | 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 . HOURS ; } // phoenixResource.getMaximum() mpxjResource . setCostPerUse ( phoenixResource . getMonetarycostperuse ( ) ) ; mpxjResource . setStandardRate ( new Rate ( phoenixResource . getMonetaryrate ( ) , rateUnits ) ) ; mpxjResource . setStandardRateUnits ( rateUnits ) ; mpxjResource . setName ( phoenixResource . getName ( ) ) ; mpxjResource . setType ( phoenixResource . getType ( ) ) ; mpxjResource . setMaterialLabel ( phoenixResource . getUnitslabel ( ) ) ; //phoenixResource.getUnitsperbase() mpxjResource . setGUID ( phoenixResource . getUuid ( ) ) ; m_eventManager . fireResourceReadEvent ( mpxjResource ) ; return mpxjResource ; } | This method extracts data for a single resource from a Phoenix file . | 276 | 13 |
143,623 | 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 . | 50 | 14 |
143,624 | 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 ( ) ) ; m_activityCodeSequence . put ( uuid , Integer . valueOf ( ++ sequence ) ) ; } } } | Map from an activity code value UUID to the actual value itself and its sequence number . | 121 | 18 |
143,625 | private void processLayouts ( Project phoenixProject ) { // // Find the active layout // Layout activeLayout = getActiveLayout ( phoenixProject ) ; // // Create a list of the visible codes in the correct order // for ( CodeOption option : activeLayout . getCodeOptions ( ) . getCodeOption ( ) ) { if ( option . isShown ( ) . booleanValue ( ) ) { m_codeSequence . add ( getUUID ( option . getCodeUuid ( ) , option . getCode ( ) ) ) ; } } } | Find the current layout and extract the activity code order and visibility . | 117 | 13 |
143,626 | private Layout getActiveLayout ( Project phoenixProject ) { // // Start with the first layout we find // Layout activeLayout = phoenixProject . getLayouts ( ) . getLayout ( ) . get ( 0 ) ; // // If this isn't active, find one which is... and if none are, // we'll just use the first. // if ( ! activeLayout . isActive ( ) . booleanValue ( ) ) { for ( Layout layout : phoenixProject . getLayouts ( ) . getLayout ( ) ) { if ( layout . isActive ( ) . booleanValue ( ) ) { activeLayout = layout ; break ; } } } return activeLayout ; } | Find the current active layout . | 141 | 6 |
143,627 | private void processActivities ( Storepoint phoenixProject ) { final AlphanumComparator comparator = new AlphanumComparator ( ) ; List < Activity > activities = phoenixProject . getActivities ( ) . getActivity ( ) ; Collections . sort ( activities , new Comparator < Activity > ( ) { @ Override public int compare ( Activity o1 , Activity o2 ) { Map < UUID , UUID > codes1 = getActivityCodes ( o1 ) ; Map < UUID , UUID > codes2 = getActivityCodes ( o2 ) ; for ( UUID code : m_codeSequence ) { UUID codeValue1 = codes1 . get ( code ) ; UUID codeValue2 = codes2 . get ( code ) ; if ( codeValue1 == null || codeValue2 == null ) { if ( codeValue1 == null && codeValue2 == null ) { continue ; } if ( codeValue1 == null ) { return - 1 ; } if ( codeValue2 == null ) { return 1 ; } } if ( ! codeValue1 . equals ( codeValue2 ) ) { Integer sequence1 = m_activityCodeSequence . get ( codeValue1 ) ; Integer sequence2 = m_activityCodeSequence . get ( codeValue2 ) ; return NumberHelper . compare ( sequence1 , sequence2 ) ; } } return comparator . compare ( o1 . getId ( ) , o2 . getId ( ) ) ; } } ) ; for ( Activity activity : activities ) { processActivity ( activity ) ; } } | Process the set of activities from the Phoenix file . | 334 | 10 |
143,628 | private void processActivity ( Activity activity ) { Task task = getParentTask ( activity ) . addTask ( ) ; task . setText ( 1 , activity . getId ( ) ) ; task . setActualDuration ( activity . getActualDuration ( ) ) ; task . setActualFinish ( activity . getActualFinish ( ) ) ; task . setActualStart ( activity . getActualStart ( ) ) ; //activity.getBaseunit() //activity.getBilled() //activity.getCalendar() //activity.getCostAccount() task . setCreateDate ( activity . getCreationTime ( ) ) ; task . setFinish ( activity . getCurrentFinish ( ) ) ; task . setStart ( activity . getCurrentStart ( ) ) ; task . setName ( activity . getDescription ( ) ) ; task . setDuration ( activity . getDurationAtCompletion ( ) ) ; task . setEarlyFinish ( activity . getEarlyFinish ( ) ) ; task . setEarlyStart ( activity . getEarlyStart ( ) ) ; task . setFreeSlack ( activity . getFreeFloat ( ) ) ; task . setLateFinish ( activity . getLateFinish ( ) ) ; task . setLateStart ( activity . getLateStart ( ) ) ; task . setNotes ( activity . getNotes ( ) ) ; task . setBaselineDuration ( activity . getOriginalDuration ( ) ) ; //activity.getPathFloat() task . setPhysicalPercentComplete ( activity . getPhysicalPercentComplete ( ) ) ; task . setRemainingDuration ( activity . getRemainingDuration ( ) ) ; task . setCost ( activity . getTotalCost ( ) ) ; task . setTotalSlack ( activity . getTotalFloat ( ) ) ; task . setMilestone ( activityIsMilestone ( activity ) ) ; //activity.getUserDefined() task . setGUID ( activity . getUuid ( ) ) ; if ( task . getMilestone ( ) ) { if ( activityIsStartMilestone ( activity ) ) { task . setFinish ( task . getStart ( ) ) ; } else { task . setStart ( task . getFinish ( ) ) ; } } if ( task . getActualStart ( ) == null ) { task . setPercentageComplete ( Integer . valueOf ( 0 ) ) ; } else { if ( task . getActualFinish ( ) != null ) { task . setPercentageComplete ( Integer . valueOf ( 100 ) ) ; } else { Duration remaining = activity . getRemainingDuration ( ) ; Duration total = activity . getDurationAtCompletion ( ) ; if ( remaining != null && total != null && total . getDuration ( ) != 0 ) { double percentComplete = ( ( total . getDuration ( ) - remaining . getDuration ( ) ) * 100.0 ) / total . getDuration ( ) ; task . setPercentageComplete ( Double . valueOf ( percentComplete ) ) ; } } } m_activityMap . put ( activity . getId ( ) , task ) ; } | Create a Task instance from a Phoenix activity . | 641 | 9 |
143,629 | private boolean activityIsMilestone ( Activity activity ) { String type = activity . getType ( ) ; return type != null && type . indexOf ( "Milestone" ) != - 1 ; } | Returns true if the activity is a milestone . | 41 | 9 |
143,630 | private boolean activityIsStartMilestone ( Activity activity ) { String type = activity . getType ( ) ; return type != null && type . indexOf ( "StartMilestone" ) != - 1 ; } | Returns true if the activity is a start milestone . | 43 | 10 |
143,631 | private ChildTaskContainer getParentTask ( Activity activity ) { // // Make a map of activity codes and their values for this activity // Map < UUID , UUID > map = getActivityCodes ( activity ) ; // // Work through the activity codes in sequence // ChildTaskContainer parent = m_projectFile ; StringBuilder uniqueIdentifier = new StringBuilder ( ) ; for ( UUID activityCode : m_codeSequence ) { UUID activityCodeValue = map . get ( activityCode ) ; String activityCodeText = m_activityCodeValues . get ( activityCodeValue ) ; if ( activityCodeText != null ) { if ( uniqueIdentifier . length ( ) != 0 ) { uniqueIdentifier . append ( ' ' ) ; } uniqueIdentifier . append ( activityCodeValue . toString ( ) ) ; UUID uuid = UUID . nameUUIDFromBytes ( uniqueIdentifier . toString ( ) . getBytes ( ) ) ; Task newParent = findChildTaskByUUID ( parent , uuid ) ; if ( newParent == null ) { newParent = parent . addTask ( ) ; newParent . setGUID ( uuid ) ; newParent . setName ( activityCodeText ) ; } parent = newParent ; } } return parent ; } | Retrieves the parent task for a Phoenix activity . | 270 | 11 |
143,632 | private Task findChildTaskByUUID ( ChildTaskContainer parent , UUID uuid ) { Task result = null ; for ( Task task : parent . getChildTasks ( ) ) { if ( uuid . equals ( task . getGUID ( ) ) ) { result = task ; break ; } } return result ; } | Locates a task within a child task container which matches the supplied UUID . | 69 | 16 |
143,633 | private void readAssignments ( Resource mpxjResource , net . sf . mpxj . phoenix . schema . Project . Storepoints . Storepoint . Resources . Resource res ) { for ( Assignment assignment : res . getAssignment ( ) ) { readAssignment ( mpxjResource , assignment ) ; } } | Reads Phoenix resource assignments . | 69 | 6 |
143,634 | private void readAssignment ( Resource resource , Assignment assignment ) { Task task = m_activityMap . get ( assignment . getActivity ( ) ) ; if ( task != null ) { task . addResourceAssignment ( resource ) ; } } | Read a single resource assignment . | 50 | 6 |
143,635 | private void readRelationships ( Storepoint phoenixProject ) { for ( Relationship relation : phoenixProject . getRelationships ( ) . getRelationship ( ) ) { readRelation ( relation ) ; } } | Read task relationships from a Phoenix file . | 44 | 8 |
143,636 | private void readRelation ( Relationship relation ) { Task predecessor = m_activityMap . get ( relation . getPredecessor ( ) ) ; Task successor = m_activityMap . get ( relation . getSuccessor ( ) ) ; if ( predecessor != null && successor != null ) { Duration lag = relation . getLag ( ) ; RelationType type = relation . getType ( ) ; successor . addPredecessor ( predecessor , type , lag ) ; } } | Read an individual Phoenix task relationship . | 99 | 7 |
143,637 | Map < UUID , UUID > getActivityCodes ( Activity activity ) { Map < UUID , UUID > map = m_activityCodeCache . get ( activity ) ; if ( map == null ) { map = new HashMap < UUID , UUID > ( ) ; m_activityCodeCache . put ( activity , map ) ; for ( CodeAssignment ca : activity . getCodeAssignment ( ) ) { UUID code = getUUID ( ca . getCodeUuid ( ) , ca . getCode ( ) ) ; UUID value = getUUID ( ca . getValueUuid ( ) , ca . getValue ( ) ) ; map . put ( code , value ) ; } } return map ; } | For a given activity retrieve a map of the activity code values which have been assigned to it . | 155 | 19 |
143,638 | private Storepoint getCurrentStorepoint ( Project phoenixProject ) { List < Storepoint > storepoints = phoenixProject . getStorepoints ( ) . getStorepoint ( ) ; Collections . sort ( storepoints , new Comparator < Storepoint > ( ) { @ Override public int compare ( Storepoint o1 , Storepoint o2 ) { return DateHelper . compare ( o2 . getCreationTime ( ) , o1 . getCreationTime ( ) ) ; } } ) ; return storepoints . get ( 0 ) ; } | Retrieve the most recent storepoint . | 114 | 8 |
143,639 | public TableReader read ( ) throws IOException { int tableHeader = m_stream . readInt ( ) ; if ( tableHeader != 0x39AF547A ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } int recordCount = m_stream . readInt ( ) ; for ( int loop = 0 ; loop < recordCount ; loop ++ ) { int rowMagicNumber = m_stream . readInt ( ) ; if ( rowMagicNumber != rowMagicNumber ( ) ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map < String , Object > map = new LinkedHashMap < String , Object > ( ) ; if ( hasUUID ( ) ) { readUUID ( m_stream , map ) ; } readRow ( m_stream , map ) ; SynchroLogger . log ( "READER" , getClass ( ) , map ) ; m_rows . add ( new MapRow ( map ) ) ; } int tableTrailer = m_stream . readInt ( ) ; if ( tableTrailer != 0x6F99E416 ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } postTrailer ( m_stream ) ; return this ; } | Read data from the table . Return a reference to the current instance to allow method chaining . | 293 | 19 |
143,640 | protected void readUUID ( StreamReader stream , Map < String , Object > map ) throws IOException { int unknown0Size = stream . getMajorVersion ( ) > 5 ? 8 : 16 ; map . put ( "UNKNOWN0" , stream . readBytes ( unknown0Size ) ) ; map . put ( "UUID" , stream . readUUID ( ) ) ; } | Read the optional row header and UUID . | 81 | 9 |
143,641 | protected int readShort ( int offset , byte [ ] data ) { int result = 0 ; int i = offset + m_offset ; for ( int shiftBy = 0 ; shiftBy < 16 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; } | Read a two byte integer from the data . | 73 | 9 |
143,642 | public void loadObject ( Object object , Set < String > excludedMethods ) { m_model . setTableModel ( createTableModel ( object , excludedMethods ) ) ; } | Populate the model with the object s properties . | 36 | 10 |
143,643 | private TableModel createTableModel ( Object object , Set < String > excludedMethods ) { List < Method > methods = new ArrayList < Method > ( ) ; for ( Method method : object . getClass ( ) . getMethods ( ) ) { if ( ( method . getParameterTypes ( ) . length == 0 ) || ( method . getParameterTypes ( ) . length == 1 && method . getParameterTypes ( ) [ 0 ] == int . class ) ) { String name = method . getName ( ) ; if ( ! excludedMethods . contains ( name ) && ( name . startsWith ( "get" ) || name . startsWith ( "is" ) ) ) { methods . add ( method ) ; } } } Map < String , String > map = new TreeMap < String , String > ( ) ; for ( Method method : methods ) { if ( method . getParameterTypes ( ) . length == 0 ) { getSingleValue ( method , object , map ) ; } else { getMultipleValues ( method , object , map ) ; } } String [ ] headings = new String [ ] { "Property" , "Value" } ; String [ ] [ ] data = new String [ map . size ( ) ] [ 2 ] ; int rowIndex = 0 ; for ( Entry < String , String > entry : map . entrySet ( ) ) { data [ rowIndex ] [ 0 ] = entry . getKey ( ) ; data [ rowIndex ] [ 1 ] = entry . getValue ( ) ; ++ rowIndex ; } TableModel tableModel = new DefaultTableModel ( data , headings ) { @ Override public boolean isCellEditable ( int r , int c ) { return false ; } } ; return tableModel ; } | Create a table model from an object s properties . | 365 | 10 |
143,644 | private Object filterValue ( Object value ) { if ( value instanceof Boolean && ! ( ( Boolean ) value ) . booleanValue ( ) ) { value = null ; } if ( value instanceof String && ( ( String ) value ) . isEmpty ( ) ) { value = null ; } if ( value instanceof Double && ( ( Double ) value ) . doubleValue ( ) == 0.0 ) { value = null ; } if ( value instanceof Integer && ( ( Integer ) value ) . intValue ( ) == 0 ) { value = null ; } if ( value instanceof Duration && ( ( Duration ) value ) . getDuration ( ) == 0.0 ) { value = null ; } return value ; } | Replace default values will null allowing them to be ignored . | 149 | 12 |
143,645 | private void getSingleValue ( Method method , Object object , Map < String , String > map ) { Object value ; try { value = filterValue ( method . invoke ( object ) ) ; } catch ( Exception ex ) { value = ex . toString ( ) ; } if ( value != null ) { map . put ( getPropertyName ( method ) , String . valueOf ( value ) ) ; } } | Retrieve a single value property . | 85 | 7 |
143,646 | private void getMultipleValues ( Method method , Object object , Map < String , String > map ) { try { int index = 1 ; while ( true ) { Object value = filterValue ( method . invoke ( object , Integer . valueOf ( index ) ) ) ; if ( value != null ) { map . put ( getPropertyName ( method , index ) , String . valueOf ( value ) ) ; } ++ index ; } } catch ( Exception ex ) { // Reached the end of the valid indexes } } | Retrieve multiple properties . | 106 | 5 |
143,647 | private String getPropertyName ( Method method ) { String result = method . getName ( ) ; if ( result . startsWith ( "get" ) ) { result = result . substring ( 3 ) ; } return result ; } | Convert a method name into a property name . | 48 | 10 |
143,648 | public void setLocale ( Locale locale ) { List < SimpleDateFormat > formats = new ArrayList < SimpleDateFormat > ( ) ; for ( SimpleDateFormat format : m_formats ) { formats . add ( new SimpleDateFormat ( format . toPattern ( ) , locale ) ) ; } m_formats = formats . toArray ( new SimpleDateFormat [ formats . size ( ) ] ) ; } | This method is called when the locale of the parent file is updated . It resets the locale specific date attributes to the default values for the new locale . | 88 | 31 |
143,649 | public Map < String , Table > process ( File directory , String prefix ) throws IOException { String filePrefix = prefix . toUpperCase ( ) ; Map < String , Table > tables = new HashMap < String , Table > ( ) ; File [ ] files = directory . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { String name = file . getName ( ) . toUpperCase ( ) ; if ( ! name . startsWith ( filePrefix ) ) { continue ; } int typeIndex = name . lastIndexOf ( ' ' ) - 3 ; String type = name . substring ( typeIndex , typeIndex + 3 ) ; TableDefinition definition = TABLE_DEFINITIONS . get ( type ) ; if ( definition != null ) { Table table = new Table ( ) ; TableReader reader = new TableReader ( definition ) ; reader . read ( file , table ) ; tables . put ( type , table ) ; //dumpCSV(type, definition, table); } } } return tables ; } | Main entry point . Reads a directory containing a P3 Btrieve database files and returns a map of table names and table content . | 224 | 28 |
143,650 | public static void openLogFile ( ) throws IOException { if ( LOG_FILE != null ) { System . out . println ( "SynchroLogger Configured" ) ; LOG = new PrintWriter ( new FileWriter ( LOG_FILE ) ) ; } } | Open the log file for writing . | 56 | 7 |
143,651 | public static void log ( String label , byte [ ] data ) { if ( LOG != null ) { LOG . write ( label ) ; LOG . write ( ": " ) ; LOG . println ( ByteArrayHelper . hexdump ( data , true ) ) ; LOG . flush ( ) ; } } | Log a byte array . | 62 | 5 |
143,652 | public static void log ( String label , String data ) { if ( LOG != null ) { LOG . write ( label ) ; LOG . write ( ": " ) ; LOG . println ( data ) ; LOG . flush ( ) ; } } | Log a string . | 50 | 4 |
143,653 | public static void log ( byte [ ] data ) { if ( LOG != null ) { LOG . println ( ByteArrayHelper . hexdump ( data , true , 16 , "" ) ) ; LOG . flush ( ) ; } } | Log a byte array as a hex dump . | 47 | 9 |
143,654 | public static void log ( String label , Class < ? > klass , Map < String , Object > map ) { if ( LOG != null ) { LOG . write ( label ) ; LOG . write ( ": " ) ; LOG . println ( klass . getSimpleName ( ) ) ; for ( Map . Entry < String , Object > entry : map . entrySet ( ) ) { LOG . println ( entry . getKey ( ) + ": " + entry . getValue ( ) ) ; } LOG . println ( ) ; LOG . flush ( ) ; } } | Log table contents . | 119 | 4 |
143,655 | public void setValue ( FieldContainer container , byte [ ] data ) { if ( data != null ) { container . set ( m_type , ( ( MPPUtility . getInt ( data , m_offset ) & m_mask ) == 0 ) ? m_zeroValue : m_nonZeroValue ) ; } } | Extracts the value of this bit flag from the supplied byte array and sets the value in the supplied container . | 69 | 23 |
143,656 | private void setFieldType ( FastTrackTableType tableType ) { switch ( tableType ) { case ACTBARS : { m_type = ActBarField . getInstance ( m_header . getColumnType ( ) ) ; break ; } case ACTIVITIES : { m_type = ActivityField . getInstance ( m_header . getColumnType ( ) ) ; break ; } case RESOURCES : { m_type = ResourceField . getInstance ( m_header . getColumnType ( ) ) ; break ; } } } | Set the enum representing the type of this column . | 114 | 10 |
143,657 | public void process ( File file ) throws Exception { openLogFile ( ) ; int blockIndex = 0 ; int length = ( int ) file . length ( ) ; m_buffer = new byte [ length ] ; FileInputStream is = new FileInputStream ( file ) ; try { int bytesRead = is . read ( m_buffer ) ; if ( bytesRead != length ) { throw new RuntimeException ( "Read count different" ) ; } } finally { is . close ( ) ; } List < Integer > blocks = new ArrayList < Integer > ( ) ; for ( int index = 64 ; index < m_buffer . length - 11 ; index ++ ) { if ( matchPattern ( PARENT_BLOCK_PATTERNS , index ) ) { blocks . add ( Integer . valueOf ( index ) ) ; } } int startIndex = 0 ; for ( int endIndex : blocks ) { int blockLength = endIndex - startIndex ; readBlock ( blockIndex , startIndex , blockLength ) ; startIndex = endIndex ; ++ blockIndex ; } int blockLength = m_buffer . length - startIndex ; readBlock ( blockIndex , startIndex , blockLength ) ; closeLogFile ( ) ; } | Read a FastTrack file . | 256 | 6 |
143,658 | public FastTrackTable getTable ( FastTrackTableType type ) { FastTrackTable result = m_tables . get ( type ) ; if ( result == null ) { result = EMPTY_TABLE ; } return result ; } | Retrieve a table of data . | 48 | 7 |
143,659 | private void readBlock ( int blockIndex , int startIndex , int blockLength ) throws Exception { logBlock ( blockIndex , startIndex , blockLength ) ; if ( blockLength < 128 ) { readTableBlock ( startIndex , blockLength ) ; } else { readColumnBlock ( startIndex , blockLength ) ; } } | Read a block of data from the FastTrack file and determine if it contains a table definition or columns . | 68 | 21 |
143,660 | private void readTableBlock ( int startIndex , int blockLength ) { for ( int index = startIndex ; index < ( startIndex + blockLength - 11 ) ; index ++ ) { if ( matchPattern ( TABLE_BLOCK_PATTERNS , index ) ) { int offset = index + 7 ; int nameLength = FastTrackUtility . getInt ( m_buffer , offset ) ; offset += 4 ; String name = new String ( m_buffer , offset , nameLength , CharsetHelper . UTF16LE ) . toUpperCase ( ) ; FastTrackTableType type = REQUIRED_TABLES . get ( name ) ; if ( type != null ) { m_currentTable = new FastTrackTable ( type , this ) ; m_tables . put ( type , m_currentTable ) ; } else { m_currentTable = null ; } m_currentFields . clear ( ) ; break ; } } } | Read the name of a table and prepare to populate it with column data . | 202 | 15 |
143,661 | private void readColumnBlock ( int startIndex , int blockLength ) throws Exception { int endIndex = startIndex + blockLength ; List < Integer > blocks = new ArrayList < Integer > ( ) ; for ( int index = startIndex ; index < endIndex - 11 ; index ++ ) { if ( matchChildBlock ( index ) ) { int childBlockStart = index - 2 ; blocks . add ( Integer . valueOf ( childBlockStart ) ) ; } } blocks . add ( Integer . valueOf ( endIndex ) ) ; int childBlockStart = - 1 ; for ( int childBlockEnd : blocks ) { if ( childBlockStart != - 1 ) { int childblockLength = childBlockEnd - childBlockStart ; try { readColumn ( childBlockStart , childblockLength ) ; } catch ( UnexpectedStructureException ex ) { logUnexpectedStructure ( ) ; } } childBlockStart = childBlockEnd ; } } | Read multiple columns from a block . | 197 | 7 |
143,662 | private void readColumn ( int startIndex , int length ) throws Exception { if ( m_currentTable != null ) { int value = FastTrackUtility . getByte ( m_buffer , startIndex ) ; Class < ? > klass = COLUMN_MAP [ value ] ; if ( klass == null ) { klass = UnknownColumn . class ; } FastTrackColumn column = ( FastTrackColumn ) klass . newInstance ( ) ; m_currentColumn = column ; logColumnData ( startIndex , length ) ; column . read ( m_currentTable . getType ( ) , m_buffer , startIndex , length ) ; FastTrackField type = column . getType ( ) ; // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if ( type != null && ! m_currentFields . contains ( type ) ) { m_currentFields . add ( type ) ; m_currentTable . addColumn ( column ) ; updateDurationTimeUnit ( column ) ; updateWorkTimeUnit ( column ) ; logColumn ( column ) ; } } } | Read data for a single column . | 246 | 7 |
143,663 | private final boolean matchPattern ( byte [ ] [ ] patterns , int bufferIndex ) { boolean match = false ; for ( byte [ ] pattern : patterns ) { int index = 0 ; match = true ; for ( byte b : pattern ) { if ( b != m_buffer [ bufferIndex + index ] ) { match = false ; break ; } ++ index ; } if ( match ) { break ; } } return match ; } | Locate a feature in the file by match a byte pattern . | 89 | 13 |
143,664 | private final boolean matchChildBlock ( int bufferIndex ) { // // Match the pattern we see at the start of the child block // int index = 0 ; for ( byte b : CHILD_BLOCK_PATTERN ) { if ( b != m_buffer [ bufferIndex + index ] ) { return false ; } ++ index ; } // // The first step will produce false positives. To handle this, we should find // the name of the block next, and check to ensure that the length // of the name makes sense. // int nameLength = FastTrackUtility . getInt ( m_buffer , bufferIndex + index ) ; // System.out.println("Name length: " + nameLength); // // if (nameLength > 0 && nameLength < 100) // { // String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE); // System.out.println("Name: " + name); // } return nameLength > 0 && nameLength < 100 ; } | Locate a child block by byte pattern and validate by checking the length of the string we are expecting to follow the pattern . | 221 | 25 |
143,665 | private void updateDurationTimeUnit ( FastTrackColumn column ) { if ( m_durationTimeUnit == null && isDurationColumn ( column ) ) { int value = ( ( DurationColumn ) column ) . getTimeUnitValue ( ) ; if ( value != 1 ) { m_durationTimeUnit = FastTrackUtility . getTimeUnit ( value ) ; } } } | Update the default time unit for durations based on data read from the file . | 77 | 16 |
143,666 | private void updateWorkTimeUnit ( FastTrackColumn column ) { if ( m_workTimeUnit == null && isWorkColumn ( column ) ) { int value = ( ( DurationColumn ) column ) . getTimeUnitValue ( ) ; if ( value != 1 ) { m_workTimeUnit = FastTrackUtility . getTimeUnit ( value ) ; } } } | Update the default time unit for work based on data read from the file . | 77 | 15 |
143,667 | private void logBlock ( int blockIndex , int startIndex , int blockLength ) { if ( m_log != null ) { m_log . println ( "Block Index: " + blockIndex ) ; m_log . println ( "Length: " + blockLength + " (" + Integer . toHexString ( blockLength ) + ")" ) ; m_log . println ( ) ; m_log . println ( FastTrackUtility . hexdump ( m_buffer , startIndex , blockLength , true , 16 , "" ) ) ; m_log . flush ( ) ; } } | Log block data . | 125 | 4 |
143,668 | private void logColumnData ( int startIndex , int length ) { if ( m_log != null ) { m_log . println ( ) ; m_log . println ( FastTrackUtility . hexdump ( m_buffer , startIndex , length , true , 16 , "" ) ) ; m_log . println ( ) ; m_log . flush ( ) ; } } | Log the data for a single column . | 80 | 8 |
143,669 | private void logUnexpectedStructure ( ) { if ( m_log != null ) { m_log . println ( "ABORTED COLUMN - unexpected structure: " + m_currentColumn . getClass ( ) . getSimpleName ( ) + " " + m_currentColumn . getName ( ) ) ; } } | Log unexpected column structure . | 70 | 5 |
143,670 | private void logColumn ( FastTrackColumn column ) { if ( m_log != null ) { m_log . println ( "TABLE: " + m_currentTable . getType ( ) ) ; m_log . println ( column . toString ( ) ) ; m_log . flush ( ) ; } } | Log column data . | 66 | 4 |
143,671 | private void populateCurrencySettings ( Record record , ProjectProperties properties ) { properties . setCurrencySymbol ( record . getString ( 0 ) ) ; properties . setSymbolPosition ( record . getCurrencySymbolPosition ( 1 ) ) ; properties . setCurrencyDigits ( record . getInteger ( 2 ) ) ; Character c = record . getCharacter ( 3 ) ; if ( c != null ) { properties . setThousandsSeparator ( c . charValue ( ) ) ; } c = record . getCharacter ( 4 ) ; if ( c != null ) { properties . setDecimalSeparator ( c . charValue ( ) ) ; } } | Populates currency settings . | 141 | 5 |
143,672 | private void populateDefaultSettings ( Record record , ProjectProperties properties ) throws MPXJException { properties . setDefaultDurationUnits ( record . getTimeUnit ( 0 ) ) ; properties . setDefaultDurationIsFixed ( record . getNumericBoolean ( 1 ) ) ; properties . setDefaultWorkUnits ( record . getTimeUnit ( 2 ) ) ; properties . setMinutesPerDay ( Double . valueOf ( NumberHelper . getDouble ( record . getFloat ( 3 ) ) * 60 ) ) ; properties . setMinutesPerWeek ( Double . valueOf ( NumberHelper . getDouble ( record . getFloat ( 4 ) ) * 60 ) ) ; properties . setDefaultStandardRate ( record . getRate ( 5 ) ) ; properties . setDefaultOvertimeRate ( record . getRate ( 6 ) ) ; properties . setUpdatingTaskStatusUpdatesResourceStatus ( record . getNumericBoolean ( 7 ) ) ; properties . setSplitInProgressTasks ( record . getNumericBoolean ( 8 ) ) ; } | Populates default settings . | 220 | 5 |
143,673 | private void populateDateTimeSettings ( Record record , ProjectProperties properties ) { properties . setDateOrder ( record . getDateOrder ( 0 ) ) ; properties . setTimeFormat ( record . getTimeFormat ( 1 ) ) ; Date time = getTimeFromInteger ( record . getInteger ( 2 ) ) ; if ( time != null ) { properties . setDefaultStartTime ( time ) ; } Character c = record . getCharacter ( 3 ) ; if ( c != null ) { properties . setDateSeparator ( c . charValue ( ) ) ; } c = record . getCharacter ( 4 ) ; if ( c != null ) { properties . setTimeSeparator ( c . charValue ( ) ) ; } properties . setAMText ( record . getString ( 5 ) ) ; properties . setPMText ( record . getString ( 6 ) ) ; properties . setDateFormat ( record . getDateFormat ( 7 ) ) ; properties . setBarTextDateFormat ( record . getDateFormat ( 8 ) ) ; } | Populates date time settings . | 217 | 6 |
143,674 | private Date getTimeFromInteger ( Integer time ) { Date result = null ; if ( time != null ) { int minutes = time . intValue ( ) ; int hours = minutes / 60 ; minutes -= ( hours * 60 ) ; Calendar cal = DateHelper . popCalendar ( ) ; cal . set ( Calendar . MILLISECOND , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MINUTE , minutes ) ; cal . set ( Calendar . HOUR_OF_DAY , hours ) ; result = cal . getTime ( ) ; DateHelper . pushCalendar ( cal ) ; } return ( result ) ; } | Converts a time represented as an integer to a Date instance . | 140 | 13 |
143,675 | private void populateProjectHeader ( Record record , ProjectProperties properties ) throws MPXJException { properties . setProjectTitle ( record . getString ( 0 ) ) ; properties . setCompany ( record . getString ( 1 ) ) ; properties . setManager ( record . getString ( 2 ) ) ; properties . setDefaultCalendarName ( record . getString ( 3 ) ) ; properties . setStartDate ( record . getDateTime ( 4 ) ) ; properties . setFinishDate ( record . getDateTime ( 5 ) ) ; properties . setScheduleFrom ( record . getScheduleFrom ( 6 ) ) ; properties . setCurrentDate ( record . getDateTime ( 7 ) ) ; properties . setComments ( record . getString ( 8 ) ) ; properties . setCost ( record . getCurrency ( 9 ) ) ; properties . setBaselineCost ( record . getCurrency ( 10 ) ) ; properties . setActualCost ( record . getCurrency ( 11 ) ) ; properties . setWork ( record . getDuration ( 12 ) ) ; properties . setBaselineWork ( record . getDuration ( 13 ) ) ; properties . setActualWork ( record . getDuration ( 14 ) ) ; properties . setWork2 ( record . getPercentage ( 15 ) ) ; properties . setDuration ( record . getDuration ( 16 ) ) ; properties . setBaselineDuration ( record . getDuration ( 17 ) ) ; properties . setActualDuration ( record . getDuration ( 18 ) ) ; properties . setPercentageComplete ( record . getPercentage ( 19 ) ) ; properties . setBaselineStart ( record . getDateTime ( 20 ) ) ; properties . setBaselineFinish ( record . getDateTime ( 21 ) ) ; properties . setActualStart ( record . getDateTime ( 22 ) ) ; properties . setActualFinish ( record . getDateTime ( 23 ) ) ; properties . setStartVariance ( record . getDuration ( 24 ) ) ; properties . setFinishVariance ( record . getDuration ( 25 ) ) ; properties . setSubject ( record . getString ( 26 ) ) ; properties . setAuthor ( record . getString ( 27 ) ) ; properties . setKeywords ( record . getString ( 28 ) ) ; } | Populates the project header . | 478 | 6 |
143,676 | private void populateCalendarHours ( Record record , ProjectCalendarHours hours ) throws MPXJException { hours . setDay ( Day . getInstance ( NumberHelper . getInt ( record . getInteger ( 0 ) ) ) ) ; addDateRange ( hours , record . getTime ( 1 ) , record . getTime ( 2 ) ) ; addDateRange ( hours , record . getTime ( 3 ) , record . getTime ( 4 ) ) ; addDateRange ( hours , record . getTime ( 5 ) , record . getTime ( 6 ) ) ; } | Populates a calendar hours instance . | 119 | 7 |
143,677 | private void addDateRange ( ProjectCalendarHours hours , Date start , Date end ) { if ( start != null && end != null ) { Calendar cal = DateHelper . popCalendar ( end ) ; // If the time ends on midnight, the date should be the next day. Otherwise problems occur. if ( cal . get ( Calendar . HOUR_OF_DAY ) == 0 && cal . get ( Calendar . MINUTE ) == 0 && cal . get ( Calendar . SECOND ) == 0 && cal . get ( Calendar . MILLISECOND ) == 0 ) { cal . add ( Calendar . DAY_OF_YEAR , 1 ) ; } end = cal . getTime ( ) ; DateHelper . pushCalendar ( cal ) ; hours . addRange ( new DateRange ( start , end ) ) ; } } | Get a date range that correctly handles the case where the end time is midnight . In this instance the end time should be the start of the next day . | 173 | 31 |
143,678 | private void populateCalendarException ( Record record , ProjectCalendar calendar ) throws MPXJException { Date fromDate = record . getDate ( 0 ) ; Date toDate = record . getDate ( 1 ) ; boolean working = record . getNumericBoolean ( 2 ) ; // I have found an example MPX file where a single day exception is expressed with just the start date set. // If we find this for we assume that the end date is the same as the start date. if ( fromDate != null && toDate == null ) { toDate = fromDate ; } ProjectCalendarException exception = calendar . addCalendarException ( fromDate , toDate ) ; if ( working ) { addExceptionRange ( exception , record . getTime ( 3 ) , record . getTime ( 4 ) ) ; addExceptionRange ( exception , record . getTime ( 5 ) , record . getTime ( 6 ) ) ; addExceptionRange ( exception , record . getTime ( 7 ) , record . getTime ( 8 ) ) ; } } | Populates a calendar exception instance . | 218 | 7 |
143,679 | private void addExceptionRange ( ProjectCalendarException exception , Date start , Date finish ) { if ( start != null && finish != null ) { exception . addRange ( new DateRange ( start , finish ) ) ; } } | Add a range to an exception ensure that we don t try to add null ranges . | 47 | 17 |
143,680 | private void populateCalendar ( Record record , ProjectCalendar calendar , boolean isBaseCalendar ) { if ( isBaseCalendar == true ) { calendar . setName ( record . getString ( 0 ) ) ; } else { calendar . setParent ( m_projectFile . getCalendarByName ( record . getString ( 0 ) ) ) ; } calendar . setWorkingDay ( Day . SUNDAY , DayType . getInstance ( record . getInteger ( 1 ) ) ) ; calendar . setWorkingDay ( Day . MONDAY , DayType . getInstance ( record . getInteger ( 2 ) ) ) ; calendar . setWorkingDay ( Day . TUESDAY , DayType . getInstance ( record . getInteger ( 3 ) ) ) ; calendar . setWorkingDay ( Day . WEDNESDAY , DayType . getInstance ( record . getInteger ( 4 ) ) ) ; calendar . setWorkingDay ( Day . THURSDAY , DayType . getInstance ( record . getInteger ( 5 ) ) ) ; calendar . setWorkingDay ( Day . FRIDAY , DayType . getInstance ( record . getInteger ( 6 ) ) ) ; calendar . setWorkingDay ( Day . SATURDAY , DayType . getInstance ( record . getInteger ( 7 ) ) ) ; m_eventManager . fireCalendarReadEvent ( calendar ) ; } | Populates a calendar instance . | 287 | 6 |
143,681 | private void populateResource ( Resource resource , Record record ) throws MPXJException { String falseText = LocaleData . getString ( m_locale , LocaleData . NO ) ; int length = record . getLength ( ) ; int [ ] model = m_resourceModel . getModel ( ) ; for ( int i = 0 ; i < length ; i ++ ) { int mpxFieldType = model [ i ] ; if ( mpxFieldType == - 1 ) { break ; } String field = record . getString ( i ) ; if ( field == null || field . length ( ) == 0 ) { continue ; } ResourceField resourceField = MPXResourceField . getMpxjField ( mpxFieldType ) ; switch ( resourceField ) { case OBJECTS : { resource . set ( resourceField , record . getInteger ( i ) ) ; break ; } case ID : { resource . setID ( record . getInteger ( i ) ) ; break ; } case UNIQUE_ID : { resource . setUniqueID ( record . getInteger ( i ) ) ; break ; } case MAX_UNITS : { resource . set ( resourceField , record . getUnits ( i ) ) ; break ; } case PERCENT_WORK_COMPLETE : case PEAK : { resource . set ( resourceField , record . getPercentage ( i ) ) ; break ; } case COST : case COST_PER_USE : case COST_VARIANCE : case BASELINE_COST : case ACTUAL_COST : case REMAINING_COST : { resource . set ( resourceField , record . getCurrency ( i ) ) ; break ; } case OVERTIME_RATE : case STANDARD_RATE : { resource . set ( resourceField , record . getRate ( i ) ) ; break ; } case REMAINING_WORK : case OVERTIME_WORK : case BASELINE_WORK : case ACTUAL_WORK : case WORK : case WORK_VARIANCE : { resource . set ( resourceField , record . getDuration ( i ) ) ; break ; } case ACCRUE_AT : { resource . set ( resourceField , record . getAccrueType ( i ) ) ; break ; } case LINKED_FIELDS : case OVERALLOCATED : { resource . set ( resourceField , record . getBoolean ( i , falseText ) ) ; break ; } default : { resource . set ( resourceField , field ) ; break ; } } } if ( m_projectConfig . getAutoResourceUniqueID ( ) == true ) { resource . setUniqueID ( Integer . valueOf ( m_projectConfig . getNextResourceUniqueID ( ) ) ) ; } if ( m_projectConfig . getAutoResourceID ( ) == true ) { resource . setID ( Integer . valueOf ( m_projectConfig . getNextResourceID ( ) ) ) ; } // // Handle malformed MPX files - ensure we have a unique ID // if ( resource . getUniqueID ( ) == null ) { resource . setUniqueID ( resource . getID ( ) ) ; } } | Populates a resource . | 671 | 5 |
143,682 | private void populateRelationList ( Task task , TaskField field , String data ) { DeferredRelationship dr = new DeferredRelationship ( ) ; dr . setTask ( task ) ; dr . setField ( field ) ; dr . setData ( data ) ; m_deferredRelationships . add ( dr ) ; } | Populates a relation list . | 69 | 6 |
143,683 | private void processDeferredRelationship ( DeferredRelationship dr ) throws MPXJException { String data = dr . getData ( ) ; Task task = dr . getTask ( ) ; int length = data . length ( ) ; if ( length != 0 ) { int start = 0 ; int end = 0 ; while ( end != length ) { end = data . indexOf ( m_delimiter , start ) ; if ( end == - 1 ) { end = length ; } populateRelation ( dr . getField ( ) , task , data . substring ( start , end ) . trim ( ) ) ; start = end + 1 ; } } } | This method processes a single deferred relationship list . | 139 | 9 |
143,684 | private void populateRelation ( TaskField field , Task sourceTask , String relationship ) throws MPXJException { int index = 0 ; int length = relationship . length ( ) ; // // Extract the identifier // while ( ( index < length ) && ( Character . isDigit ( relationship . charAt ( index ) ) == true ) ) { ++ index ; } Integer taskID ; try { taskID = Integer . valueOf ( relationship . substring ( 0 , index ) ) ; } catch ( NumberFormatException ex ) { throw new MPXJException ( MPXJException . INVALID_FORMAT + " '" + relationship + "'" ) ; } // // Now find the task, so we can extract the unique ID // Task targetTask ; if ( field == TaskField . PREDECESSORS ) { targetTask = m_projectFile . getTaskByID ( taskID ) ; } else { targetTask = m_projectFile . getTaskByUniqueID ( taskID ) ; } // // If we haven't reached the end, we next expect to find // SF, SS, FS, FF // RelationType type = null ; Duration lag = null ; if ( index == length ) { type = RelationType . FINISH_START ; lag = Duration . getInstance ( 0 , TimeUnit . DAYS ) ; } else { if ( ( index + 1 ) == length ) { throw new MPXJException ( MPXJException . INVALID_FORMAT + " '" + relationship + "'" ) ; } type = RelationTypeUtility . getInstance ( m_locale , relationship . substring ( index , index + 2 ) ) ; index += 2 ; if ( index == length ) { lag = Duration . getInstance ( 0 , TimeUnit . DAYS ) ; } else { if ( relationship . charAt ( index ) == ' ' ) { ++ index ; } lag = DurationUtility . getInstance ( relationship . substring ( index ) , m_formats . getDurationDecimalFormat ( ) , m_locale ) ; } } if ( type == null ) { throw new MPXJException ( MPXJException . INVALID_FORMAT + " '" + relationship + "'" ) ; } // We have seen at least one example MPX file where an invalid task ID // is present. We'll ignore this as the schedule is otherwise valid. if ( targetTask != null ) { Relation relation = sourceTask . addPredecessor ( targetTask , type , lag ) ; m_eventManager . fireRelationReadEvent ( relation ) ; } } | Creates and populates a new task relationship . | 553 | 10 |
143,685 | private void populateRecurringTask ( Record record , RecurringTask task ) throws MPXJException { //System.out.println(record); task . setStartDate ( record . getDateTime ( 1 ) ) ; task . setFinishDate ( record . getDateTime ( 2 ) ) ; task . setDuration ( RecurrenceUtility . getDuration ( m_projectFile . getProjectProperties ( ) , record . getInteger ( 3 ) , record . getInteger ( 4 ) ) ) ; task . setOccurrences ( record . getInteger ( 5 ) ) ; task . setRecurrenceType ( RecurrenceUtility . getRecurrenceType ( record . getInteger ( 6 ) ) ) ; task . setUseEndDate ( NumberHelper . getInt ( record . getInteger ( 8 ) ) == 1 ) ; task . setWorkingDaysOnly ( NumberHelper . getInt ( record . getInteger ( 9 ) ) == 1 ) ; task . setWeeklyDaysFromBitmap ( RecurrenceUtility . getDays ( record . getString ( 10 ) ) , RecurrenceUtility . RECURRING_TASK_DAY_MASKS ) ; RecurrenceType type = task . getRecurrenceType ( ) ; if ( type != null ) { switch ( task . getRecurrenceType ( ) ) { case DAILY : { task . setFrequency ( record . getInteger ( 13 ) ) ; break ; } case WEEKLY : { task . setFrequency ( record . getInteger ( 14 ) ) ; break ; } case MONTHLY : { task . setRelative ( NumberHelper . getInt ( record . getInteger ( 11 ) ) == 1 ) ; if ( task . getRelative ( ) ) { task . setFrequency ( record . getInteger ( 17 ) ) ; task . setDayNumber ( record . getInteger ( 15 ) ) ; task . setDayOfWeek ( RecurrenceUtility . getDay ( record . getInteger ( 16 ) ) ) ; } else { task . setFrequency ( record . getInteger ( 19 ) ) ; task . setDayNumber ( record . getInteger ( 18 ) ) ; } break ; } case YEARLY : { task . setRelative ( NumberHelper . getInt ( record . getInteger ( 12 ) ) != 1 ) ; if ( task . getRelative ( ) ) { task . setDayNumber ( record . getInteger ( 20 ) ) ; task . setDayOfWeek ( RecurrenceUtility . getDay ( record . getInteger ( 21 ) ) ) ; task . setMonthNumber ( record . getInteger ( 22 ) ) ; } else { task . setYearlyAbsoluteFromDate ( record . getDateTime ( 23 ) ) ; } break ; } } } //System.out.println(task); } | Populates a recurring task . | 590 | 6 |
143,686 | private void populateResourceAssignment ( Record record , ResourceAssignment assignment ) throws MPXJException { // // Handle malformed MPX files - ensure that we can locate the resource // using either the Unique ID attribute or the ID attribute. // Resource resource = m_projectFile . getResourceByUniqueID ( record . getInteger ( 12 ) ) ; if ( resource == null ) { resource = m_projectFile . getResourceByID ( record . getInteger ( 0 ) ) ; } assignment . setUnits ( record . getUnits ( 1 ) ) ; assignment . setWork ( record . getDuration ( 2 ) ) ; assignment . setBaselineWork ( record . getDuration ( 3 ) ) ; assignment . setActualWork ( record . getDuration ( 4 ) ) ; assignment . setOvertimeWork ( record . getDuration ( 5 ) ) ; assignment . setCost ( record . getCurrency ( 6 ) ) ; assignment . setBaselineCost ( record . getCurrency ( 7 ) ) ; assignment . setActualCost ( record . getCurrency ( 8 ) ) ; assignment . setStart ( record . getDateTime ( 9 ) ) ; assignment . setFinish ( record . getDateTime ( 10 ) ) ; assignment . setDelay ( record . getDuration ( 11 ) ) ; // // Calculate the remaining work // Duration work = assignment . getWork ( ) ; Duration actualWork = assignment . getActualWork ( ) ; if ( work != null && actualWork != null ) { if ( work . getUnits ( ) != actualWork . getUnits ( ) ) { actualWork = actualWork . convertUnits ( work . getUnits ( ) , m_projectFile . getProjectProperties ( ) ) ; } assignment . setRemainingWork ( Duration . getInstance ( work . getDuration ( ) - actualWork . getDuration ( ) , work . getUnits ( ) ) ) ; } if ( resource != null ) { assignment . setResourceUniqueID ( resource . getUniqueID ( ) ) ; resource . addResourceAssignment ( assignment ) ; } m_eventManager . fireAssignmentReadEvent ( assignment ) ; } | Populate a resource assignment . | 457 | 6 |
143,687 | private void populateResourceAssignmentWorkgroupFields ( Record record , ResourceAssignmentWorkgroupFields workgroup ) throws MPXJException { workgroup . setMessageUniqueID ( record . getString ( 0 ) ) ; workgroup . setConfirmed ( NumberHelper . getInt ( record . getInteger ( 1 ) ) == 1 ) ; workgroup . setResponsePending ( NumberHelper . getInt ( record . getInteger ( 1 ) ) == 1 ) ; workgroup . setUpdateStart ( record . getDateTime ( 3 ) ) ; workgroup . setUpdateFinish ( record . getDateTime ( 4 ) ) ; workgroup . setScheduleID ( record . getString ( 5 ) ) ; } | Populate a resource assignment workgroup instance . | 150 | 9 |
143,688 | static void populateFileCreationRecord ( Record record , ProjectProperties properties ) { properties . setMpxProgramName ( record . getString ( 0 ) ) ; properties . setMpxFileVersion ( FileVersion . getInstance ( record . getString ( 1 ) ) ) ; properties . setMpxCodePage ( record . getCodePage ( 2 ) ) ; } | Populate a file creation record . | 77 | 7 |
143,689 | public static RelationType getInstance ( Locale locale , String type ) { int index = - 1 ; String [ ] relationTypes = LocaleData . getStringArray ( locale , LocaleData . RELATION_TYPES ) ; for ( int loop = 0 ; loop < relationTypes . length ; loop ++ ) { if ( relationTypes [ loop ] . equalsIgnoreCase ( type ) == true ) { index = loop ; break ; } } RelationType result = null ; if ( index != - 1 ) { result = RelationType . getInstance ( index ) ; } return ( result ) ; } | This method takes the textual version of a relation type and returns an appropriate class instance . Note that unrecognised values will cause this method to return null . | 129 | 30 |
143,690 | public static final Duration parseDuration ( String value ) { Duration result = null ; if ( value != null ) { int split = value . indexOf ( ' ' ) ; if ( split != - 1 ) { double durationValue = Double . parseDouble ( value . substring ( 0 , split ) ) ; TimeUnit durationUnits = parseTimeUnits ( value . substring ( split + 1 ) ) ; result = Duration . getInstance ( durationValue , durationUnits ) ; } } return result ; } | Convert the Phoenix representation of a duration into a Duration instance . | 106 | 13 |
143,691 | public static final String printDuration ( Duration duration ) { String result = null ; if ( duration != null ) { result = duration . getDuration ( ) + " " + printTimeUnits ( duration . getUnits ( ) ) ; } return result ; } | Retrieve a duration in the form required by Phoenix . | 54 | 11 |
143,692 | public static final String printFinishDateTime ( Date value ) { if ( value != null ) { value = DateHelper . addDays ( value , 1 ) ; } return ( value == null ? null : DATE_FORMAT . get ( ) . format ( value ) ) ; } | Retrieve a finish date time in the form required by Phoenix . | 59 | 13 |
143,693 | public static final Date parseFinishDateTime ( String value ) { Date result = parseDateTime ( value ) ; if ( result != null ) { result = DateHelper . addDays ( result , - 1 ) ; } return result ; } | Convert the Phoenix representation of a finish date time into a Date instance . | 49 | 15 |
143,694 | private FieldType getFieldType ( byte [ ] data , int offset ) { int fieldIndex = MPPUtility . getInt ( data , offset ) ; return FieldTypeHelper . mapTextFields ( FieldTypeHelper . getInstance14 ( fieldIndex ) ) ; } | Retrieves a field type from a location in a data block . | 57 | 14 |
143,695 | private ProjectFile readFile ( File file ) throws MPXJException { try { String url = "jdbc:sqlite:" + file . getAbsolutePath ( ) ; Properties props = new Properties ( ) ; m_connection = org . sqlite . JDBC . createConnection ( url , props ) ; m_documentBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; XPathFactory xPathfactory = XPathFactory . newInstance ( ) ; XPath xpath = xPathfactory . newXPath ( ) ; m_dayTimeIntervals = xpath . compile ( "/array/dayTimeInterval" ) ; m_entityMap = new HashMap < String , Integer > ( ) ; return read ( ) ; } catch ( Exception ex ) { throw new MPXJException ( MPXJException . INVALID_FORMAT , ex ) ; } finally { if ( m_connection != null ) { try { m_connection . close ( ) ; } catch ( SQLException ex ) { // silently ignore exceptions when closing connection } } m_documentBuilder = null ; m_dayTimeIntervals = null ; m_entityMap = null ; } } | By the time we reach this method we should be looking at the SQLite database file itself . | 257 | 19 |
143,696 | private ProjectFile read ( ) throws Exception { m_project = new ProjectFile ( ) ; m_eventManager = m_project . getEventManager ( ) ; ProjectConfig config = m_project . getProjectConfig ( ) ; config . setAutoCalendarUniqueID ( false ) ; config . setAutoTaskUniqueID ( false ) ; config . setAutoResourceUniqueID ( false ) ; m_project . getProjectProperties ( ) . setFileApplication ( "Merlin" ) ; m_project . getProjectProperties ( ) . setFileType ( "SQLITE" ) ; m_eventManager . addProjectListeners ( m_projectListeners ) ; populateEntityMap ( ) ; processProject ( ) ; processCalendars ( ) ; processResources ( ) ; processTasks ( ) ; processAssignments ( ) ; processDependencies ( ) ; return m_project ; } | Read the project data and return a ProjectFile instance . | 189 | 11 |
143,697 | private void populateEntityMap ( ) throws SQLException { for ( Row row : getRows ( "select * from z_primarykey" ) ) { m_entityMap . put ( row . getString ( "Z_NAME" ) , row . getInteger ( "Z_ENT" ) ) ; } } | Create a mapping from entity names to entity ID values . | 68 | 11 |
143,698 | private void processCalendars ( ) throws Exception { List < Row > rows = getRows ( "select * from zcalendar where zproject=?" , m_projectID ) ; for ( Row row : rows ) { ProjectCalendar calendar = m_project . addCalendar ( ) ; calendar . setUniqueID ( row . getInteger ( "Z_PK" ) ) ; calendar . setName ( row . getString ( "ZTITLE" ) ) ; processDays ( calendar ) ; processExceptions ( calendar ) ; m_eventManager . fireCalendarReadEvent ( calendar ) ; } } | Read calendar data . | 128 | 4 |
143,699 | private void processDays ( ProjectCalendar calendar ) throws Exception { // Default all days to non-working for ( Day day : Day . values ( ) ) { calendar . setWorkingDay ( day , false ) ; } List < Row > rows = getRows ( "select * from zcalendarrule where zcalendar1=? and z_ent=?" , calendar . getUniqueID ( ) , m_entityMap . get ( "CalendarWeekDayRule" ) ) ; for ( Row row : rows ) { Day day = row . getDay ( "ZWEEKDAY" ) ; String timeIntervals = row . getString ( "ZTIMEINTERVALS" ) ; if ( timeIntervals == null ) { calendar . setWorkingDay ( day , false ) ; } else { ProjectCalendarHours hours = calendar . addCalendarHours ( day ) ; NodeList nodes = getNodeList ( timeIntervals , m_dayTimeIntervals ) ; calendar . setWorkingDay ( day , nodes . getLength ( ) > 0 ) ; for ( int loop = 0 ; loop < nodes . getLength ( ) ; loop ++ ) { NamedNodeMap attributes = nodes . item ( loop ) . getAttributes ( ) ; Date startTime = m_calendarTimeFormat . parse ( attributes . getNamedItem ( "startTime" ) . getTextContent ( ) ) ; Date endTime = m_calendarTimeFormat . parse ( attributes . getNamedItem ( "endTime" ) . getTextContent ( ) ) ; if ( startTime . getTime ( ) >= endTime . getTime ( ) ) { endTime = DateHelper . addDays ( endTime , 1 ) ; } hours . addRange ( new DateRange ( startTime , endTime ) ) ; } } } } | Process normal calendar working and non - working days . | 381 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.