idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
144,100
public ProjectCalendarException getException ( Date date ) { ProjectCalendarException exception = null ; populateExpandedExceptions ( ) ; if ( ! m_expandedExceptions . isEmpty ( ) ) { sortExceptions ( ) ; int low = 0 ; int high = m_expandedExceptions . size ( ) - 1 ; long targetDate = date . getTime ( ) ; while ( low <...
Retrieve a calendar exception which applies to this date .
144,101
public ProjectCalendarWeek getWorkWeek ( Date date ) { ProjectCalendarWeek week = null ; if ( ! m_workWeeks . isEmpty ( ) ) { sortWorkWeeks ( ) ; int low = 0 ; int high = m_workWeeks . size ( ) - 1 ; long targetDate = date . getTime ( ) ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; ProjectCalendarWeek midV...
Retrieve a work week which applies to this date .
144,102
public Duration getWork ( Date date , TimeUnit format ) { ProjectCalendarDateRanges ranges = getRanges ( date , null , null ) ; long time = getTotalTime ( ranges ) ; return convertFormat ( time , format ) ; }
Retrieves the amount of work on a given day and returns it in the specified format .
144,103
public Duration getWork ( Date startDate , Date endDate , TimeUnit format ) { DateRange range = new DateRange ( startDate , endDate ) ; Long cachedResult = m_workingDateCache . get ( range ) ; long totalTime = 0 ; if ( cachedResult == null ) { boolean invert = false ; if ( startDate . getTime ( ) > endDate . getTime ( ...
This method retrieves a Duration instance representing the amount of work between two dates based on this calendar .
144,104
private Duration convertFormat ( long totalTime , TimeUnit format ) { double duration = totalTime ; switch ( format ) { case MINUTES : case ELAPSED_MINUTES : { duration /= ( 60 * 1000 ) ; break ; } case HOURS : case ELAPSED_HOURS : { duration /= ( 60 * 60 * 1000 ) ; break ; } case DAYS : { double minutesPerDay = getMin...
Utility method used to convert an integer time representation into a Duration instance .
144,105
private long getTotalTime ( ProjectCalendarDateRanges exception , Date date , boolean after ) { long currentTime = DateHelper . getCanonicalTime ( date ) . getTime ( ) ; long total = 0 ; for ( DateRange range : exception ) { total += getTime ( range . getStart ( ) , range . getEnd ( ) , currentTime , after ) ; } return...
Retrieves the amount of time represented by a calendar exception before or after an intersection point .
144,106
private long getTotalTime ( ProjectCalendarDateRanges exception ) { long total = 0 ; for ( DateRange range : exception ) { total += getTime ( range . getStart ( ) , range . getEnd ( ) ) ; } return ( total ) ; }
Retrieves the amount of working time represented by a calendar exception .
144,107
private long getTotalTime ( ProjectCalendarDateRanges hours , Date startDate , Date endDate ) { long total = 0 ; if ( startDate . getTime ( ) != endDate . getTime ( ) ) { Date start = DateHelper . getCanonicalTime ( startDate ) ; Date end = DateHelper . getCanonicalTime ( endDate ) ; for ( DateRange range : hours ) { D...
This method calculates the total amount of working time in a single day which intersects with the supplied time range .
144,108
private long getTime ( Date start , Date end , long target , boolean after ) { long total = 0 ; if ( start != null && end != null ) { Date startTime = DateHelper . getCanonicalTime ( start ) ; Date endTime = DateHelper . getCanonicalTime ( end ) ; Date startDay = DateHelper . getDayStartDate ( start ) ; Date finishDay ...
Calculates how much of a time range is before or after a target intersection point .
144,109
private long getTime ( Date start , Date end ) { long total = 0 ; if ( start != null && end != null ) { Date startTime = DateHelper . getCanonicalTime ( start ) ; Date endTime = DateHelper . getCanonicalTime ( end ) ; Date startDay = DateHelper . getDayStartDate ( start ) ; Date finishDay = DateHelper . getDayStartDate...
Retrieves the amount of time between two date time values . Note that these values are converted into canonical values to remove the date component .
144,110
private long getTime ( Date start1 , Date end1 , Date start2 , Date end2 ) { long total = 0 ; if ( start1 != null && end1 != null && start2 != null && end2 != null ) { long start ; long end ; if ( start1 . getTime ( ) < start2 . getTime ( ) ) { start = start2 . getTime ( ) ; } else { start = start1 . getTime ( ) ; } if...
This method returns the length of overlapping time between two time ranges .
144,111
public void copy ( ProjectCalendar cal ) { setName ( cal . getName ( ) ) ; setParent ( cal . getParent ( ) ) ; System . arraycopy ( cal . getDays ( ) , 0 , getDays ( ) , 0 , getDays ( ) . length ) ; for ( ProjectCalendarException ex : cal . m_exceptions ) { addCalendarException ( ex . getFromDate ( ) , ex . getToDate (...
Copy the settings from another calendar to this calendar .
144,112
private void clearWorkingDateCache ( ) { m_workingDateCache . clear ( ) ; m_startTimeCache . clear ( ) ; m_getDateLastResult = null ; for ( ProjectCalendar calendar : m_derivedCalendars ) { calendar . clearWorkingDateCache ( ) ; } }
Utility method to clear cached calendar data .
144,113
private ProjectCalendarDateRanges getRanges ( Date date , Calendar cal , Day day ) { ProjectCalendarDateRanges ranges = getException ( date ) ; if ( ranges == null ) { ProjectCalendarWeek week = getWorkWeek ( date ) ; if ( week == null ) { week = this ; } if ( day == null ) { if ( cal == null ) { cal = Calendar . getIn...
Retrieves the working hours on the given date .
144,114
private void populateExpandedExceptions ( ) { if ( ! m_exceptions . isEmpty ( ) && m_expandedExceptions . isEmpty ( ) ) { for ( ProjectCalendarException exception : m_exceptions ) { RecurringData recurring = exception . getRecurring ( ) ; if ( recurring == null ) { m_expandedExceptions . add ( exception ) ; } else { fo...
Populate the expanded exceptions list based on the main exceptions list . Where we find recurring exception definitions we generate individual exceptions for each recurrence to ensure that we account for them correctly .
144,115
private Map < String , Table > getIndex ( Table table ) { Map < String , Table > result ; if ( ! table . getResourceFlag ( ) ) { result = m_taskTablesByName ; } else { result = m_resourceTablesByName ; } return result ; }
Retrieve the correct index for the supplied Table instance .
144,116
public void saveFile ( File file , String type ) { if ( file != null ) { m_treeController . saveFile ( file , type ) ; } }
Saves the project file displayed in this panel .
144,117
public void addFilter ( Filter filter ) { if ( filter . isTaskFilter ( ) ) { m_taskFilters . add ( filter ) ; } if ( filter . isResourceFilter ( ) ) { m_resourceFilters . add ( filter ) ; } m_filtersByName . put ( filter . getName ( ) , filter ) ; m_filtersByID . put ( filter . getID ( ) , filter ) ; }
Adds a filter definition to this project file .
144,118
public void removeFilter ( String filterName ) { Filter filter = getFilterByName ( filterName ) ; if ( filter != null ) { if ( filter . isTaskFilter ( ) ) { m_taskFilters . remove ( filter ) ; } if ( filter . isResourceFilter ( ) ) { m_resourceFilters . remove ( filter ) ; } m_filtersByName . remove ( filterName ) ; m_...
Removes a filter from this project file .
144,119
private void writeProjectProperties ( ) { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; m_plannerProject . setCompany ( properties . getCompany ( ) ) ; m_plannerProject . setManager ( properties . getManager ( ) ) ; m_plannerProject . setName ( getString ( properties . getName ( ) ) ) ; m_pl...
This method writes project properties to a Planner file .
144,120
private void writeCalendars ( ) throws JAXBException { Calendars calendars = m_factory . createCalendars ( ) ; m_plannerProject . setCalendars ( calendars ) ; writeDayTypes ( calendars ) ; List < net . sf . mpxj . planner . schema . Calendar > calendar = calendars . getCalendar ( ) ; for ( ProjectCalendar mpxjCalendar ...
This method writes calendar data to a Planner file .
144,121
private void writeDayTypes ( Calendars calendars ) { DayTypes dayTypes = m_factory . createDayTypes ( ) ; calendars . setDayTypes ( dayTypes ) ; List < DayType > typeList = dayTypes . getDayType ( ) ; DayType dayType = m_factory . createDayType ( ) ; typeList . add ( dayType ) ; dayType . setId ( "0" ) ; dayType . setN...
Write the standard set of day types .
144,122
private void writeCalendar ( ProjectCalendar mpxjCalendar , net . sf . mpxj . planner . schema . Calendar plannerCalendar ) throws JAXBException { plannerCalendar . setId ( getIntegerString ( mpxjCalendar . getUniqueID ( ) ) ) ; plannerCalendar . setName ( getString ( mpxjCalendar . getName ( ) ) ) ; DefaultWeek dw = m...
This method writes data for a single calendar to a Planner file .
144,123
private void processWorkingHours ( ProjectCalendar mpxjCalendar , Sequence uniqueID , Day day , List < OverriddenDayType > typeList ) { if ( isWorkingDay ( mpxjCalendar , day ) ) { ProjectCalendarHours mpxjHours = mpxjCalendar . getCalendarHours ( day ) ; if ( mpxjHours != null ) { OverriddenDayType odt = m_factory . c...
Process the standard working hours for a given day .
144,124
private void writeResources ( ) { Resources resources = m_factory . createResources ( ) ; m_plannerProject . setResources ( resources ) ; List < net . sf . mpxj . planner . schema . Resource > resourceList = resources . getResource ( ) ; for ( Resource mpxjResource : m_projectFile . getResources ( ) ) { net . sf . mpxj...
This method writes resource data to a Planner file .
144,125
private void writeResource ( Resource mpxjResource , net . sf . mpxj . planner . schema . Resource plannerResource ) { ProjectCalendar resourceCalendar = mpxjResource . getResourceCalendar ( ) ; if ( resourceCalendar != null ) { plannerResource . setCalendar ( getIntegerString ( resourceCalendar . getUniqueID ( ) ) ) ;...
This method writes data for a single resource to a Planner file .
144,126
private void writeTasks ( ) throws JAXBException { Tasks tasks = m_factory . createTasks ( ) ; m_plannerProject . setTasks ( tasks ) ; List < net . sf . mpxj . planner . schema . Task > taskList = tasks . getTask ( ) ; for ( Task task : m_projectFile . getChildTasks ( ) ) { writeTask ( task , taskList ) ; } }
This method writes task data to a Planner file .
144,127
private void writeTask ( Task mpxjTask , List < net . sf . mpxj . planner . schema . Task > taskList ) throws JAXBException { net . sf . mpxj . planner . schema . Task plannerTask = m_factory . createTask ( ) ; taskList . add ( plannerTask ) ; plannerTask . setEnd ( getDateTimeString ( mpxjTask . getFinish ( ) ) ) ; pl...
This method writes data for a single task to a Planner file .
144,128
private void writePredecessors ( Task mpxjTask , net . sf . mpxj . planner . schema . Task plannerTask ) { Predecessors plannerPredecessors = m_factory . createPredecessors ( ) ; plannerTask . setPredecessors ( plannerPredecessors ) ; List < Predecessor > predecessorList = plannerPredecessors . getPredecessor ( ) ; int...
This method writes predecessor data to a Planner file . We have to deal with a slight anomaly in this method that is introduced by the MPX file format . It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated ... which means that we must process...
144,129
private void writeAssignments ( ) { Allocations allocations = m_factory . createAllocations ( ) ; m_plannerProject . setAllocations ( allocations ) ; List < Allocation > allocationList = allocations . getAllocation ( ) ; for ( ResourceAssignment mpxjAssignment : m_projectFile . getResourceAssignments ( ) ) { Allocation...
This method writes assignment data to a Planner file .
144,130
private String getIntegerString ( Number value ) { return ( value == null ? null : Integer . toString ( value . intValue ( ) ) ) ; }
Convert an Integer value into a String .
144,131
private boolean isWorkingDay ( ProjectCalendar mpxjCalendar , Day day ) { boolean result = false ; net . sf . mpxj . DayType type = mpxjCalendar . getWorkingDay ( day ) ; if ( type == null ) { type = net . sf . mpxj . DayType . DEFAULT ; } switch ( type ) { case WORKING : { result = true ; break ; } case NON_WORKING : ...
Used to determine if a particular day of the week is normally a working day .
144,132
private String getWorkingDayString ( ProjectCalendar mpxjCalendar , Day day ) { String result = null ; net . sf . mpxj . DayType type = mpxjCalendar . getWorkingDay ( day ) ; if ( type == null ) { type = net . sf . mpxj . DayType . DEFAULT ; } switch ( type ) { case WORKING : { result = "0" ; break ; } case NON_WORKING...
Returns a flag represented as a String indicating if the supplied day is a working day .
144,133
private String getTimeString ( Date value ) { Calendar cal = DateHelper . popCalendar ( value ) ; int hours = cal . get ( Calendar . HOUR_OF_DAY ) ; int minutes = cal . get ( Calendar . MINUTE ) ; DateHelper . pushCalendar ( cal ) ; StringBuilder sb = new StringBuilder ( 4 ) ; sb . append ( m_twoDigitFormat . format ( ...
Convert a Java date into a Planner time .
144,134
private String getDateString ( Date value ) { Calendar cal = DateHelper . popCalendar ( value ) ; int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; int day = cal . get ( Calendar . DAY_OF_MONTH ) ; DateHelper . pushCalendar ( cal ) ; StringBuilder sb = new StringBuilder ( 8 ) ;...
Convert a Java date into a Planner date .
144,135
private String getDateTimeString ( Date value ) { String result = null ; if ( value != null ) { Calendar cal = DateHelper . popCalendar ( value ) ; StringBuilder sb = new StringBuilder ( 16 ) ; sb . append ( m_fourDigitFormat . format ( cal . get ( Calendar . YEAR ) ) ) ; sb . append ( m_twoDigitFormat . format ( cal ....
Convert a Java date into a Planner date - time string .
144,136
private String getDurationString ( Duration value ) { String result = null ; if ( value != null ) { double seconds = 0 ; switch ( value . getUnits ( ) ) { case MINUTES : case ELAPSED_MINUTES : { seconds = value . getDuration ( ) * 60 ; break ; } case HOURS : case ELAPSED_HOURS : { seconds = value . getDuration ( ) * ( ...
Converts an MPXJ Duration instance into the string representation of a Planner duration .
144,137
private void readProjectProperties ( Project project ) throws MPXJException { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; properties . setCompany ( project . getCompany ( ) ) ; properties . setManager ( project . getManager ( ) ) ; properties . setName ( project . getName ( ) ) ; propertie...
This method extracts project properties from a Planner file .
144,138
private void readCalendars ( Project project ) throws MPXJException { Calendars calendars = project . getCalendars ( ) ; if ( calendars != null ) { for ( net . sf . mpxj . planner . schema . Calendar cal : calendars . getCalendar ( ) ) { readCalendar ( cal , null ) ; } Integer defaultCalendarID = getInteger ( project ....
This method extracts calendar data from a Planner file .
144,139
private void readCalendar ( net . sf . mpxj . planner . schema . Calendar plannerCalendar , ProjectCalendar parentMpxjCalendar ) throws MPXJException { ProjectCalendar mpxjCalendar = m_projectFile . addCalendar ( ) ; mpxjCalendar . setUniqueID ( getInteger ( plannerCalendar . getId ( ) ) ) ; mpxjCalendar . setName ( pl...
This method extracts data for a single calendar from a Planner file .
144,140
private void readResources ( Project plannerProject ) throws MPXJException { Resources resources = plannerProject . getResources ( ) ; if ( resources != null ) { for ( net . sf . mpxj . planner . schema . Resource res : resources . getResource ( ) ) { readResource ( res ) ; } } }
This method extracts resource data from a Planner file .
144,141
private void readResource ( net . sf . mpxj . planner . schema . Resource plannerResource ) throws MPXJException { Resource mpxjResource = m_projectFile . addResource ( ) ; mpxjResource . setEmailAddress ( plannerResource . getEmail ( ) ) ; mpxjResource . setUniqueID ( getInteger ( plannerResource . getId ( ) ) ) ; mpx...
This method extracts data for a single resource from a Planner file .
144,142
private void readTasks ( Project plannerProject ) throws MPXJException { Tasks tasks = plannerProject . getTasks ( ) ; if ( tasks != null ) { for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask ( ) ) { readTask ( null , task ) ; } for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask...
This method extracts task data from a Planner file .
144,143
private void readPredecessors ( net . sf . mpxj . planner . schema . Task plannerTask ) { Task mpxjTask = m_projectFile . getTaskByUniqueID ( getInteger ( plannerTask . getId ( ) ) ) ; Predecessors predecessors = plannerTask . getPredecessors ( ) ; if ( predecessors != null ) { List < Predecessor > predecessorList = pr...
This method extracts predecessor data from a Planner file .
144,144
private void readAssignments ( Project plannerProject ) { Allocations allocations = plannerProject . getAllocations ( ) ; List < Allocation > allocationList = allocations . getAllocation ( ) ; Set < Task > tasksWithAssignments = new HashSet < Task > ( ) ; for ( Allocation allocation : allocationList ) { Integer taskID ...
This method extracts assignment data from a Planner file .
144,145
private Date getDateTime ( String value ) throws MPXJException { try { Number year = m_fourDigitFormat . parse ( value . substring ( 0 , 4 ) ) ; Number month = m_twoDigitFormat . parse ( value . substring ( 4 , 6 ) ) ; Number day = m_twoDigitFormat . parse ( value . substring ( 6 , 8 ) ) ; Number hours = m_twoDigitForm...
Convert a Planner date - time value into a Java date .
144,146
private Date getTime ( String value ) throws MPXJException { try { Number hours = m_twoDigitFormat . parse ( value . substring ( 0 , 2 ) ) ; Number minutes = m_twoDigitFormat . parse ( value . substring ( 2 , 4 ) ) ; Calendar cal = DateHelper . popCalendar ( ) ; cal . set ( Calendar . HOUR_OF_DAY , hours . intValue ( )...
Convert a Planner time into a Java date .
144,147
private Duration getDuration ( String value ) { Duration result = null ; if ( value != null && value . length ( ) != 0 ) { double seconds = getLong ( value ) ; double hours = seconds / ( 60 * 60 ) ; double days = hours / 8 ; if ( days < 1 ) { result = Duration . getInstance ( hours , TimeUnit . HOURS ) ; } else { doubl...
Converts the string representation of a Planner duration into an MPXJ Duration instance .
144,148
public ArrayList < Duration > segmentWork ( ProjectCalendar projectCalendar , List < TimephasedWork > work , TimescaleUnits rangeUnits , List < DateRange > dateList ) { ArrayList < Duration > result = new ArrayList < Duration > ( dateList . size ( ) ) ; int lastStartIndex = 0 ; for ( DateRange range : dateList ) { int ...
This is the main entry point used to convert the internal representation of timephased work into an external form which can be displayed to the user .
144,149
public ArrayList < Duration > segmentBaselineWork ( ProjectFile file , List < TimephasedWork > work , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { return segmentWork ( file . getBaselineCalendar ( ) , work , rangeUnits , dateList ) ; }
This is the main entry point used to convert the internal representation of timephased baseline work into an external form which can be displayed to the user .
144,150
public ArrayList < Double > segmentCost ( ProjectCalendar projectCalendar , List < TimephasedCost > cost , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { ArrayList < Double > result = new ArrayList < Double > ( dateList . size ( ) ) ; int lastStartIndex = 0 ; for ( DateRange range : dateList ) { int s...
This is the main entry point used to convert the internal representation of timephased cost into an external form which can be displayed to the user .
144,151
public ArrayList < Double > segmentBaselineCost ( ProjectFile file , List < TimephasedCost > cost , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { return segmentCost ( file . getBaselineCalendar ( ) , cost , rangeUnits , dateList ) ; }
This is the main entry point used to convert the internal representation of timephased baseline cost into an external form which can be displayed to the user .
144,152
private < T extends TimephasedItem < ? > > int getStartIndex ( DateRange range , List < T > assignments , int startIndex ) { int result = - 1 ; if ( assignments != null ) { long rangeStart = range . getStart ( ) . getTime ( ) ; long rangeEnd = range . getEnd ( ) . getTime ( ) ; for ( int loop = startIndex ; loop < assi...
Used to locate the first timephased resource assignment block which intersects with the target date range .
144,153
private void processCalendarHours ( byte [ ] data , ProjectCalendar defaultCalendar , ProjectCalendar cal , boolean isBaseCalendar ) { int offset ; ProjectCalendarHours hours ; int periodIndex ; int index ; int defaultFlag ; int periodCount ; Date start ; long duration ; Day day ; List < DateRange > dateRanges = new Ar...
For a given set of calendar data this method sets the working day status for each day and if present sets the hours for that day .
144,154
private void updateBaseCalendarNames ( List < Pair < ProjectCalendar , Integer > > baseCalendars , HashMap < Integer , ProjectCalendar > map ) { for ( Pair < ProjectCalendar , Integer > pair : baseCalendars ) { ProjectCalendar cal = pair . getFirst ( ) ; Integer baseCalendarID = pair . getSecond ( ) ; ProjectCalendar b...
The way calendars are stored in an MPP14 file means that there can be forward references between the base calendar unique ID for a derived calendar and the base calendar itself . To get around this we initially populate the base calendar name attribute with the base calendar unique ID and now in this method we can conv...
144,155
public void fireTaskReadEvent ( Task task ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . taskRead ( task ) ; } } }
This method is called to alert project listeners to the fact that a task has been read from a project file .
144,156
public void fireTaskWrittenEvent ( Task task ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . taskWritten ( task ) ; } } }
This method is called to alert project listeners to the fact that a task has been written to a project file .
144,157
public void fireResourceReadEvent ( Resource resource ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . resourceRead ( resource ) ; } } }
This method is called to alert project listeners to the fact that a resource has been read from a project file .
144,158
public void fireResourceWrittenEvent ( Resource resource ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . resourceWritten ( resource ) ; } } }
This method is called to alert project listeners to the fact that a resource has been written to a project file .
144,159
public void fireCalendarReadEvent ( ProjectCalendar calendar ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . calendarRead ( calendar ) ; } } }
This method is called to alert project listeners to the fact that a calendar has been read from a project file .
144,160
public void fireAssignmentReadEvent ( ResourceAssignment resourceAssignment ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . assignmentRead ( resourceAssignment ) ; } } }
This method is called to alert project listeners to the fact that a resource assignment has been read from a project file .
144,161
public void fireAssignmentWrittenEvent ( ResourceAssignment resourceAssignment ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . assignmentWritten ( resourceAssignment ) ; } } }
This method is called to alert project listeners to the fact that a resource assignment has been written to a project file .
144,162
public void fireRelationReadEvent ( Relation relation ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . relationRead ( relation ) ; } } }
This method is called to alert project listeners to the fact that a relation has been read from a project file .
144,163
public void fireRelationWrittenEvent ( Relation relation ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . relationWritten ( relation ) ; } } }
This method is called to alert project listeners to the fact that a relation has been written to a project file .
144,164
public void fireCalendarWrittenEvent ( ProjectCalendar calendar ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . calendarWritten ( calendar ) ; } } }
This method is called to alert project listeners to the fact that a calendar has been written to a project file .
144,165
public void addProjectListeners ( List < ProjectListener > listeners ) { if ( listeners != null ) { for ( ProjectListener listener : listeners ) { addProjectListener ( listener ) ; } } }
Adds a collection of listeners to the current project .
144,166
public < E extends Enum < E > & FieldType > E nextField ( Class < E > clazz , UserFieldDataType type ) { for ( String name : m_names [ type . ordinal ( ) ] ) { int i = NumberHelper . getInt ( m_counters . get ( name ) ) + 1 ; try { E e = Enum . valueOf ( clazz , name + i ) ; m_counters . put ( name , Integer . valueOf ...
Generate the next available field for a user defined field .
144,167
private ProjectFile read ( ) throws Exception { m_project = new ProjectFile ( ) ; m_eventManager = m_project . getEventManager ( ) ; ProjectConfig config = m_project . getProjectConfig ( ) ; config . setAutoCalendarUniqueID ( false ) ; config . setAutoTaskID ( false ) ; config . setAutoTaskUniqueID ( false ) ; config ....
Read FTS file data from the configured source and return a populated ProjectFile instance .
144,168
private void processDependencies ( ) { Set < Task > tasksWithBars = new HashSet < Task > ( ) ; FastTrackTable table = m_data . getTable ( FastTrackTableType . ACTBARS ) ; for ( MapRow row : table ) { Task task = m_project . getTaskByUniqueID ( row . getInteger ( ActBarField . _ACTIVITY ) ) ; if ( task == null || tasksW...
Process task dependencies .
144,169
private Integer getOutlineLevel ( Task task ) { String value = task . getWBS ( ) ; Integer result = Integer . valueOf ( 1 ) ; if ( value != null && value . length ( ) > 0 ) { String [ ] path = WBS_SPLIT_REGEX . split ( value ) ; result = Integer . valueOf ( path . length ) ; } return result ; }
Extract the outline level from a task s WBS attribute .
144,170
public void setWeeklyDay ( Day day , boolean value ) { if ( value ) { m_days . add ( day ) ; } else { m_days . remove ( day ) ; } }
Set the state of an individual day in a weekly recurrence .
144,171
public void setWeeklyDaysFromBitmap ( Integer days , int [ ] masks ) { if ( days != null ) { int value = days . intValue ( ) ; for ( Day day : Day . values ( ) ) { setWeeklyDay ( day , ( ( value & masks [ day . getValue ( ) ] ) != 0 ) ) ; } } }
Converts from a bitmap to individual day flags for a weekly recurrence using the array of masks .
144,172
public Day getDayOfWeek ( ) { Day result = null ; if ( ! m_days . isEmpty ( ) ) { result = m_days . iterator ( ) . next ( ) ; } return result ; }
Retrieves the monthly or yearly relative day of the week .
144,173
public Date [ ] getDates ( ) { int frequency = NumberHelper . getInt ( m_frequency ) ; if ( frequency < 1 ) { frequency = 1 ; } Calendar calendar = DateHelper . popCalendar ( m_startDate ) ; List < Date > dates = new ArrayList < Date > ( ) ; switch ( m_recurrenceType ) { case DAILY : { getDailyDates ( calendar , freque...
Retrieve the set of start dates represented by this recurrence data .
144,174
private boolean moreDates ( Calendar calendar , List < Date > dates ) { boolean result ; if ( m_finishDate == null ) { int occurrences = NumberHelper . getInt ( m_occurrences ) ; if ( occurrences < 1 ) { occurrences = 1 ; } result = dates . size ( ) < occurrences ; } else { result = calendar . getTimeInMillis ( ) <= m_...
Determines if we need to calculate more dates . If we do not have a finish date this method falls back on using the occurrences attribute . If we have a finish date we ll use that instead . We re assuming that the recurring data has one or other of those values .
144,175
private void getDailyDates ( Calendar calendar , int frequency , List < Date > dates ) { while ( moreDates ( calendar , dates ) ) { dates . add ( calendar . getTime ( ) ) ; calendar . add ( Calendar . DAY_OF_YEAR , frequency ) ; } }
Calculate start dates for a daily recurrence .
144,176
private void getWeeklyDates ( Calendar calendar , int frequency , List < Date > dates ) { int currentDay = calendar . get ( Calendar . DAY_OF_WEEK ) ; while ( moreDates ( calendar , dates ) ) { int offset = 0 ; for ( int dayIndex = 0 ; dayIndex < 7 ; dayIndex ++ ) { if ( getWeeklyDay ( Day . getInstance ( currentDay ) ...
Calculate start dates for a weekly recurrence .
144,177
private void getMonthlyDates ( Calendar calendar , int frequency , List < Date > dates ) { if ( m_relative ) { getMonthlyRelativeDates ( calendar , frequency , dates ) ; } else { getMonthlyAbsoluteDates ( calendar , frequency , dates ) ; } }
Calculate start dates for a monthly recurrence .
144,178
private void getMonthlyRelativeDates ( Calendar calendar , int frequency , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; int dayNumber = NumberHelper . getInt ( m_dayNumber ) ; while ( moreDates ( calendar , dates ) ) { if ( dayNumber > 4 ) { ...
Calculate start dates for a monthly relative recurrence .
144,179
private void getMonthlyAbsoluteDates ( Calendar calendar , int frequency , List < Date > dates ) { int currentDayNumber = calendar . get ( Calendar . DAY_OF_MONTH ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; int requiredDayNumber = NumberHelper . getInt ( m_dayNumber ) ; if ( requiredDayNumber < currentDayNumbe...
Calculate start dates for a monthly absolute recurrence .
144,180
private void getYearlyDates ( Calendar calendar , List < Date > dates ) { if ( m_relative ) { getYearlyRelativeDates ( calendar , dates ) ; } else { getYearlyAbsoluteDates ( calendar , dates ) ; } }
Calculate start dates for a yearly recurrence .
144,181
private void getYearlyRelativeDates ( Calendar calendar , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; calendar . set ( Calendar . MONTH , NumberHelper . getInt ( m_monthNumber ) - 1 ) ; int dayNumber = NumberHelper . getInt ( m_dayNumber ) ;...
Calculate start dates for a yearly relative recurrence .
144,182
private void getYearlyAbsoluteDates ( Calendar calendar , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; calendar . set ( Calendar . MONTH , NumberHelper . getInt ( m_monthNumber ) - 1 ) ; int requiredDayNumber = NumberHelper . getInt ( m_dayNu...
Calculate start dates for a yearly absolute recurrence .
144,183
private void setCalendarToOrdinalRelativeDay ( Calendar calendar , int dayNumber ) { int currentDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int requiredDayOfWeek = getDayOfWeek ( ) . getValue ( ) ; int dayOfWeekOffset = 0 ; if ( requiredDayOfWeek > currentDayOfWeek ) { dayOfWeekOffset = requiredDayOfWeek - ...
Moves a calendar to the nth named day of the month .
144,184
private void setCalendarToLastRelativeDay ( Calendar calendar ) { calendar . set ( Calendar . DAY_OF_MONTH , calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; int currentDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int requiredDayOfWeek = getDayOfWeek ( ) . getValue ( ) ; int dayOfWeekOffset = 0 ; ...
Moves a calendar to the last named day of the month .
144,185
public void setYearlyAbsoluteFromDate ( Date date ) { if ( date != null ) { Calendar cal = DateHelper . popCalendar ( date ) ; m_dayNumber = Integer . valueOf ( cal . get ( Calendar . DAY_OF_MONTH ) ) ; m_monthNumber = Integer . valueOf ( cal . get ( Calendar . MONTH ) + 1 ) ; DateHelper . pushCalendar ( cal ) ; } }
Sets the yearly absolute date .
144,186
private String getOrdinal ( Integer value ) { String result ; int index = value . intValue ( ) ; if ( index >= ORDINAL . length ) { result = "every " + index + "th" ; } else { result = ORDINAL [ index ] ; } return result ; }
Retrieve the ordinal text for a given integer .
144,187
public static Priority getInstance ( Locale locale , String priority ) { int index = DEFAULT_PRIORITY_INDEX ; if ( priority != null ) { String [ ] priorityTypes = LocaleData . getStringArray ( locale , LocaleData . PRIORITY_TYPES ) ; for ( int loop = 0 ; loop < priorityTypes . length ; loop ++ ) { if ( priorityTypes [ ...
This method takes the textual version of a priority and returns an appropriate instance of this class . Note that unrecognised values are treated as medium priority .
144,188
public static Duration add ( Duration a , Duration b , ProjectProperties defaults ) { if ( a == null && b == null ) { return null ; } if ( a == null ) { return b ; } if ( b == null ) { return a ; } TimeUnit unit = a . getUnits ( ) ; if ( b . getUnits ( ) != unit ) { b = b . convertUnits ( unit , defaults ) ; } return D...
If a and b are not null returns a new duration of a + b . If a is null and b is not null returns b . If a is not null and b is null returns a . If a and b are null returns null . If needed b is converted to a s time unit using the project properties .
144,189
public static ProjectReader getProjectReader ( String name ) throws MPXJException { int index = name . lastIndexOf ( '.' ) ; if ( index == - 1 ) { throw new IllegalArgumentException ( "Filename has no extension: " + name ) ; } String extension = name . substring ( index + 1 ) . toUpperCase ( ) ; Class < ? extends Proje...
Retrieves a ProjectReader instance which can read a file of the type specified by the supplied file name .
144,190
private void processCalendars ( ) throws SQLException { for ( ResultSetRow row : getRows ( "SELECT * FROM MSP_CALENDARS WHERE PROJ_ID=?" , m_projectID ) ) { processCalendar ( row ) ; } updateBaseCalendarNames ( ) ; processCalendarData ( m_project . getCalendars ( ) ) ; }
Select calendar data from the database .
144,191
private void processCalendarData ( List < ProjectCalendar > calendars ) throws SQLException { for ( ProjectCalendar calendar : calendars ) { processCalendarData ( calendar , getRows ( "SELECT * FROM MSP_CALENDAR_DATA WHERE PROJ_ID=? AND CAL_UID=?" , m_projectID , calendar . getUniqueID ( ) ) ) ; } }
Process calendar hours and exception data from the database .
144,192
private void processCalendarData ( ProjectCalendar calendar , List < ResultSetRow > calendarData ) { for ( ResultSetRow row : calendarData ) { processCalendarData ( calendar , row ) ; } }
Process the hours and exceptions for an individual calendar .
144,193
private void processSubProjects ( ) { int subprojectIndex = 1 ; for ( Task task : m_project . getTasks ( ) ) { String subProjectFileName = task . getSubprojectName ( ) ; if ( subProjectFileName != null ) { String fileName = subProjectFileName ; int offset = 0x01000000 + ( subprojectIndex * 0x00400000 ) ; int index = su...
The only indication that a task is a SubProject is the contents of the subproject file name field . We test these here then add a skeleton subproject structure to match the way we do things with MPP files .
144,194
private void processOutlineCodeFields ( Row parentRow ) throws SQLException { Integer entityID = parentRow . getInteger ( "CODE_REF_UID" ) ; Integer outlineCodeEntityID = parentRow . getInteger ( "CODE_UID" ) ; for ( ResultSetRow row : getRows ( "SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?" , outlineCodeEntityID )...
Process a single outline code .
144,195
private void allocateConnection ( ) throws SQLException { if ( m_connection == null ) { m_connection = m_dataSource . getConnection ( ) ; m_allocatedConnection = true ; queryDatabaseMetaData ( ) ; } }
Allocates a database connection .
144,196
private void queryDatabaseMetaData ( ) { ResultSet rs = null ; try { Set < String > tables = new HashSet < String > ( ) ; DatabaseMetaData dmd = m_connection . getMetaData ( ) ; rs = dmd . getTables ( null , null , null , null ) ; while ( rs . next ( ) ) { tables . add ( rs . getString ( "TABLE_NAME" ) ) ; } m_hasResou...
Queries database meta data to check for the existence of specific tables .
144,197
public static final UUID parseUUID ( String value ) { UUID result = null ; if ( value != null && ! value . isEmpty ( ) ) { if ( value . charAt ( 0 ) == '{' ) { result = UUID . fromString ( value . substring ( 1 , value . length ( ) - 1 ) ) ; } else { byte [ ] data = javax . xml . bind . DatatypeConverter . parseBase64B...
Convert the Primavera string representation of a UUID into a Java UUID instance .
144,198
public static String printUUID ( UUID guid ) { return guid == null ? null : "{" + guid . toString ( ) . toUpperCase ( ) + "}" ; }
Retrieve a UUID in the form required by Primavera PMXML .
144,199
public static final String printTime ( Date value ) { return ( value == null ? null : TIME_FORMAT . get ( ) . format ( value ) ) ; }
Print a time value .