idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
20,500
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 .
20,501
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 .
20,502
private void processCalendarData ( ProjectCalendar calendar , List < ResultSetRow > calendarData ) { for ( ResultSetRow row : calendarData ) { processCalendarData ( calendar , row ) ; } }
Process the hours and exceptions for an individual calendar .
20,503
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 .
20,504
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 .
20,505
private void allocateConnection ( ) throws SQLException { if ( m_connection == null ) { m_connection = m_dataSource . getConnection ( ) ; m_allocatedConnection = true ; queryDatabaseMetaData ( ) ; } }
Allocates a database connection .
20,506
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 .
20,507
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 .
20,508
public static String printUUID ( UUID guid ) { return guid == null ? null : "{" + guid . toString ( ) . toUpperCase ( ) + "}" ; }
Retrieve a UUID in the form required by Primavera PMXML .
20,509
public static final String printTime ( Date value ) { return ( value == null ? null : TIME_FORMAT . get ( ) . format ( value ) ) ; }
Print a time value .
20,510
public void renumberUniqueIDs ( ) { int uid = firstUniqueID ( ) ; for ( T entity : this ) { entity . setUniqueID ( Integer . valueOf ( uid ++ ) ) ; } }
Renumbers all entity unique IDs .
20,511
public void validateUniqueIDsForMicrosoftProject ( ) { if ( ! isEmpty ( ) ) { for ( T entity : this ) { if ( NumberHelper . getInt ( entity . getUniqueID ( ) ) > MS_PROJECT_MAX_UNIQUE_ID ) { renumberUniqueIDs ( ) ; break ; } } } }
Validate that the Unique IDs for the entities in this container are valid for MS Project . If they are not valid i . e one or more of them are too large renumber them .
20,512
private void readDefinitions ( ) { for ( MapRow row : m_tables . get ( "TTL" ) ) { Integer id = row . getInteger ( "DEFINITION_ID" ) ; List < MapRow > list = m_definitions . get ( id ) ; if ( list == null ) { list = new ArrayList < MapRow > ( ) ; m_definitions . put ( id , list ) ; } list . add ( row ) ; } List < MapRo...
Extract definition records from the table and divide into groups .
20,513
private void readCalendars ( ) { Table cal = m_tables . get ( "CAL" ) ; for ( MapRow row : cal ) { ProjectCalendar calendar = m_projectFile . addCalendar ( ) ; m_calendarMap . put ( row . getInteger ( "CALENDAR_ID" ) , calendar ) ; Integer [ ] days = { row . getInteger ( "SUNDAY_HOURS" ) , row . getInteger ( "MONDAY_HO...
Read project calendars .
20,514
private void readHours ( ProjectCalendar calendar , Day day , Integer hours ) { int value = hours . intValue ( ) ; int startHour = 0 ; ProjectCalendarHours calendarHours = null ; Calendar cal = DateHelper . popCalendar ( ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Ca...
Reads the integer representation of calendar hours for a given day and populates the calendar .
20,515
private int countHours ( Integer hours ) { int value = hours . intValue ( ) ; int hoursPerDay = 0 ; int hour = 0 ; while ( value > 0 ) { while ( hour < 24 ) { if ( ( value & 0x1 ) != 0 ) { ++ hoursPerDay ; } value = value >> 1 ; ++ hour ; } } return hoursPerDay ; }
Count the number of working hours in a day based in the integer representation of the working hours .
20,516
private void readHolidays ( ) { for ( MapRow row : m_tables . get ( "HOL" ) ) { ProjectCalendar calendar = m_calendarMap . get ( row . getInteger ( "CALENDAR_ID" ) ) ; if ( calendar != null ) { Date date = row . getDate ( "DATE" ) ; ProjectCalendarException exception = calendar . addCalendarException ( date , date ) ; ...
Read holidays from the database and create calendar exceptions .
20,517
private void readActivities ( ) { List < MapRow > items = new ArrayList < MapRow > ( ) ; for ( MapRow row : m_tables . get ( "ACT" ) ) { items . add ( row ) ; } final AlphanumComparator comparator = new AlphanumComparator ( ) ; Collections . sort ( items , new Comparator < MapRow > ( ) { public int compare ( MapRow o1 ...
Read activities .
20,518
public void process ( Resource resource , int index , byte [ ] data ) { CostRateTable result = new CostRateTable ( ) ; if ( data != null ) { for ( int i = 16 ; i + 44 <= data . length ; i += 44 ) { Rate standardRate = new Rate ( MPPUtility . getDouble ( data , i ) , TimeUnit . HOURS ) ; TimeUnit standardRateFormat = ge...
Creates a CostRateTable instance from a block of data .
20,519
private TimeUnit getFormat ( int format ) { TimeUnit result ; if ( format == 0xFFFF ) { result = TimeUnit . HOURS ; } else { result = MPPUtility . getWorkTimeUnits ( format ) ; } return result ; }
Converts an integer into a time format .
20,520
public static ConstraintType getInstance ( Locale locale , String type ) { int index = 0 ; String [ ] constraintTypes = LocaleData . getStringArray ( locale , LocaleData . CONSTRAINT_TYPES ) ; for ( int loop = 0 ; loop < constraintTypes . length ; loop ++ ) { if ( constraintTypes [ loop ] . equalsIgnoreCase ( type ) ==...
This method takes the textual version of a constraint name and returns an appropriate class instance . Note that unrecognised values are treated as As Soon As Possible constraints .
20,521
private static void query ( String filename ) throws Exception { ProjectFile mpx = new UniversalProjectReader ( ) . read ( filename ) ; listProjectProperties ( mpx ) ; listResources ( mpx ) ; listTasks ( mpx ) ; listAssignments ( mpx ) ; listAssignmentsByTask ( mpx ) ; listAssignmentsByResource ( mpx ) ; listHierarchy ...
This method performs a set of queries to retrieve information from the an MPP or an MPX file .
20,522
private static void listProjectProperties ( ProjectFile file ) { SimpleDateFormat df = new SimpleDateFormat ( "dd/MM/yyyy HH:mm z" ) ; ProjectProperties properties = file . getProjectProperties ( ) ; Date startDate = properties . getStartDate ( ) ; Date finishDate = properties . getFinishDate ( ) ; String formattedStar...
Reads basic summary details from the project properties .
20,523
private static void listResources ( ProjectFile file ) { for ( Resource resource : file . getResources ( ) ) { System . out . println ( "Resource: " + resource . getName ( ) + " (Unique ID=" + resource . getUniqueID ( ) + ") Start=" + resource . getStart ( ) + " Finish=" + resource . getFinish ( ) ) ; } System . out . ...
This method lists all resources defined in the file .
20,524
private static void listTasks ( ProjectFile file ) { SimpleDateFormat df = new SimpleDateFormat ( "dd/MM/yyyy HH:mm z" ) ; for ( Task task : file . getTasks ( ) ) { Date date = task . getStart ( ) ; String text = task . getStartText ( ) ; String startDate = text != null ? text : ( date != null ? df . format ( date ) : ...
This method lists all tasks defined in the file .
20,525
private static void listHierarchy ( ProjectFile file ) { for ( Task task : file . getChildTasks ( ) ) { System . out . println ( "Task: " + task . getName ( ) + "\t" + task . getStart ( ) + "\t" + task . getFinish ( ) ) ; listHierarchy ( task , " " ) ; } System . out . println ( ) ; }
This method lists all tasks defined in the file in a hierarchical format reflecting the parent - child relationships between them .
20,526
private static void listHierarchy ( Task task , String indent ) { for ( Task child : task . getChildTasks ( ) ) { System . out . println ( indent + "Task: " + child . getName ( ) + "\t" + child . getStart ( ) + "\t" + child . getFinish ( ) ) ; listHierarchy ( child , indent + " " ) ; } }
Helper method called recursively to list child tasks .
20,527
private static void listAssignments ( ProjectFile file ) { Task task ; Resource resource ; String taskName ; String resourceName ; for ( ResourceAssignment assignment : file . getResourceAssignments ( ) ) { task = assignment . getTask ( ) ; if ( task == null ) { taskName = "(null task)" ; } else { taskName = task . get...
This method lists all resource assignments defined in the file .
20,528
private static void listTimephasedWork ( ResourceAssignment assignment ) { Task task = assignment . getTask ( ) ; int days = ( int ) ( ( task . getFinish ( ) . getTime ( ) - task . getStart ( ) . getTime ( ) ) / ( 1000 * 60 * 60 * 24 ) ) + 1 ; if ( days > 1 ) { SimpleDateFormat df = new SimpleDateFormat ( "dd/MM/yy" ) ...
Dump timephased work for an assignment .
20,529
private static void listAssignmentsByTask ( ProjectFile file ) { for ( Task task : file . getTasks ( ) ) { System . out . println ( "Assignments for task " + task . getName ( ) + ":" ) ; for ( ResourceAssignment assignment : task . getResourceAssignments ( ) ) { Resource resource = assignment . getResource ( ) ; String...
This method displays the resource assignments for each task . This time rather than just iterating through the list of all assignments in the file we extract the assignments on a task - by - task basis .
20,530
private static void listAssignmentsByResource ( ProjectFile file ) { for ( Resource resource : file . getResources ( ) ) { System . out . println ( "Assignments for resource " + resource . getName ( ) + ":" ) ; for ( ResourceAssignment assignment : resource . getTaskAssignments ( ) ) { Task task = assignment . getTask ...
This method displays the resource assignments for each resource . This time rather than just iterating through the list of all assignments in the file we extract the assignments on a resource - by - resource basis .
20,531
private static void listTaskNotes ( ProjectFile file ) { for ( Task task : file . getTasks ( ) ) { String notes = task . getNotes ( ) ; if ( notes . length ( ) != 0 ) { System . out . println ( "Notes for " + task . getName ( ) + ": " + notes ) ; } } System . out . println ( ) ; }
This method lists any notes attached to tasks .
20,532
private static void listResourceNotes ( ProjectFile file ) { for ( Resource resource : file . getResources ( ) ) { String notes = resource . getNotes ( ) ; if ( notes . length ( ) != 0 ) { System . out . println ( "Notes for " + resource . getName ( ) + ": " + notes ) ; } } System . out . println ( ) ; }
This method lists any notes attached to resources .
20,533
private static void listRelationships ( ProjectFile file ) { for ( Task task : file . getTasks ( ) ) { System . out . print ( task . getID ( ) ) ; System . out . print ( '\t' ) ; System . out . print ( task . getName ( ) ) ; System . out . print ( '\t' ) ; dumpRelationList ( task . getPredecessors ( ) ) ; System . out ...
This method lists task predecessor and successor relationships .
20,534
private static void dumpRelationList ( List < Relation > relations ) { if ( relations != null && relations . isEmpty ( ) == false ) { if ( relations . size ( ) > 1 ) { System . out . print ( '"' ) ; } boolean first = true ; for ( Relation relation : relations ) { if ( ! first ) { System . out . print ( ',' ) ; } first ...
Internal utility to dump relationship lists in a structured format that can easily be compared with the tabular data in MS Project .
20,535
private static void listSlack ( ProjectFile file ) { for ( Task task : file . getTasks ( ) ) { System . out . println ( task . getName ( ) + " Total Slack=" + task . getTotalSlack ( ) + " Start Slack=" + task . getStartSlack ( ) + " Finish Slack=" + task . getFinishSlack ( ) ) ; } }
List the slack values for each task .
20,536
private static void listCalendars ( ProjectFile file ) { for ( ProjectCalendar cal : file . getCalendars ( ) ) { System . out . println ( cal . toString ( ) ) ; } }
List details of all calendars in the file .
20,537
public ProjectCalendar addDefaultBaseCalendar ( ) { ProjectCalendar calendar = add ( ) ; calendar . setName ( ProjectCalendar . DEFAULT_BASE_CALENDAR_NAME ) ; calendar . setWorkingDay ( Day . SUNDAY , false ) ; calendar . setWorkingDay ( Day . MONDAY , true ) ; calendar . setWorkingDay ( Day . TUESDAY , true ) ; calend...
This is a convenience method used to add a calendar called Standard to the project and populate it with a default working week and default working hours .
20,538
public ProjectCalendar addDefaultDerivedCalendar ( ) { ProjectCalendar calendar = add ( ) ; calendar . setWorkingDay ( Day . SUNDAY , DayType . DEFAULT ) ; calendar . setWorkingDay ( Day . MONDAY , DayType . DEFAULT ) ; calendar . setWorkingDay ( Day . TUESDAY , DayType . DEFAULT ) ; calendar . setWorkingDay ( Day . WE...
This is a convenience method to add a default derived calendar to the project .
20,539
public ProjectCalendar getByName ( String calendarName ) { ProjectCalendar calendar = null ; if ( calendarName != null && calendarName . length ( ) != 0 ) { Iterator < ProjectCalendar > iter = iterator ( ) ; while ( iter . hasNext ( ) == true ) { calendar = iter . next ( ) ; String name = calendar . getName ( ) ; if ( ...
Retrieves the named calendar . This method will return null if the named calendar is not located .
20,540
public ProjectFile read ( ) throws MPXJException { MPD9DatabaseReader reader = new MPD9DatabaseReader ( ) ; reader . setProjectID ( m_projectID ) ; reader . setPreserveNoteFormatting ( m_preserveNoteFormatting ) ; reader . setDataSource ( m_dataSource ) ; reader . setConnection ( m_connection ) ; ProjectFile project = ...
Read project data from a database .
20,541
public ProjectFile read ( String accessDatabaseFileName ) throws MPXJException { try { Class . forName ( "sun.jdbc.odbc.JdbcOdbcDriver" ) ; String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + accessDatabaseFileName ; m_connection = DriverManager . getConnection ( url ) ; m_projectID = Integer . value...
This is a convenience method which reads the first project from the named MPD file using the JDBC - ODBC bridge driver .
20,542
public static ProjectWriter getProjectWriter ( String name ) throws InstantiationException , IllegalAccessException { int index = name . lastIndexOf ( '.' ) ; if ( index == - 1 ) { throw new IllegalArgumentException ( "Filename has no extension: " + name ) ; } String extension = name . substring ( index + 1 ) . toUpper...
Retrieves a ProjectWriter instance which can write a file of the type specified by the supplied file name .
20,543
private void processCustomFieldValues ( ) { byte [ ] data = m_projectProps . getByteArray ( Props . TASK_FIELD_ATTRIBUTES ) ; if ( data != null ) { int index = 0 ; int offset = 0 ; int length = MPPUtility . getInt ( data , offset ) ; offset += 4 ; int numberOfValueLists = MPPUtility . getInt ( data , offset ) ; offset ...
Reads non outline code custom field values and populates container .
20,544
private void processOutlineCodeValues ( ) throws IOException { DirectoryEntry outlineCodeDir = ( DirectoryEntry ) m_projectDir . getEntry ( "TBkndOutlCode" ) ; FixedMeta fm = new FixedMeta ( new DocumentInputStream ( ( ( DocumentEntry ) outlineCodeDir . getEntry ( "FixedMeta" ) ) ) , 10 ) ; FixedData fd = new FixedData...
Reads outline code custom field values and populates container .
20,545
private void populateContainer ( FieldType field , byte [ ] values , byte [ ] descriptions ) { CustomField config = m_container . getCustomField ( field ) ; CustomFieldLookupTable table = config . getLookupTable ( ) ; List < Object > descriptionList = convertType ( DataType . STRING , descriptions ) ; List < Object > v...
Populate the container converting raw data into Java types .
20,546
private void populateContainer ( FieldType field , List < Pair < String , String > > items ) { CustomField config = m_container . getCustomField ( field ) ; CustomFieldLookupTable table = config . getLookupTable ( ) ; for ( Pair < String , String > pair : items ) { CustomFieldValueItem item = new CustomFieldValueItem (...
Populate the container from outline code data .
20,547
private List < Object > convertType ( DataType type , byte [ ] data ) { List < Object > result = new ArrayList < Object > ( ) ; int index = 0 ; while ( index < data . length ) { switch ( type ) { case STRING : { String value = MPPUtility . getUnicodeString ( data , index ) ; result . add ( value ) ; index += ( ( value ...
Convert raw data into Java types .
20,548
public boolean getBoolean ( FastTrackField type ) { boolean result = false ; Object value = getObject ( type ) ; if ( value != null ) { result = BooleanHelper . getBoolean ( ( Boolean ) value ) ; } return result ; }
Retrieve a boolean field .
20,549
public Date getTimestamp ( FastTrackField dateName , FastTrackField timeName ) { Date result = null ; Date date = getDate ( dateName ) ; if ( date != null ) { Calendar dateCal = DateHelper . popCalendar ( date ) ; Date time = getDate ( timeName ) ; if ( time != null ) { Calendar timeCal = DateHelper . popCalendar ( tim...
Retrieve a timestamp field .
20,550
public Duration getDuration ( FastTrackField type ) { Double value = ( Double ) getObject ( type ) ; return value == null ? null : Duration . getInstance ( value . doubleValue ( ) , m_table . getDurationTimeUnit ( ) ) ; }
Retrieve a duration field .
20,551
public Duration getWork ( FastTrackField type ) { Double value = ( Double ) getObject ( type ) ; return value == null ? null : Duration . getInstance ( value . doubleValue ( ) , m_table . getWorkTimeUnit ( ) ) ; }
Retrieve a work field .
20,552
public UUID getUUID ( FastTrackField type ) { String value = getString ( type ) ; UUID result = null ; if ( value != null && ! value . isEmpty ( ) && value . length ( ) >= 36 ) { if ( value . startsWith ( "{" ) ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } if ( value . length ( ) > 16 ) { value = val...
Retrieve a UUID field .
20,553
public static CurrencySymbolPosition getSymbolPosition ( int value ) { CurrencySymbolPosition result ; switch ( value ) { case 1 : { result = CurrencySymbolPosition . AFTER ; break ; } case 2 : { result = CurrencySymbolPosition . BEFORE_WITH_SPACE ; break ; } case 3 : { result = CurrencySymbolPosition . AFTER_WITH_SPAC...
This method maps the currency symbol position from the representation used in the MPP file to the representation used by MPX .
20,554
public static final Duration getDuration ( double value , TimeUnit type ) { double duration ; switch ( type ) { case MINUTES : case ELAPSED_MINUTES : { duration = value / 10 ; break ; } case HOURS : case ELAPSED_HOURS : { duration = value / 600 ; break ; } case DAYS : { duration = value / 4800 ; break ; } case ELAPSED_...
Reads a duration value . This method relies on the fact that the units of the duration have been specified elsewhere .
20,555
public static void dumpRow ( Map < String , Object > row ) { for ( Entry < String , Object > entry : row . entrySet ( ) ) { Object value = entry . getValue ( ) ; System . out . println ( entry . getKey ( ) + " = " + value + " ( " + ( value == null ? "" : value . getClass ( ) . getName ( ) ) + ")" ) ; } }
Dump the contents of a row from an MPD file .
20,556
public void generateMapFile ( File jarFile , String mapFileName , boolean mapClassMethods ) throws XMLStreamException , IOException , ClassNotFoundException , IntrospectionException { m_responseList = new LinkedList < String > ( ) ; writeMapFile ( mapFileName , jarFile , mapClassMethods ) ; }
Generate a map file from a jar file .
20,557
private void writeMapFile ( String mapFileName , File jarFile , boolean mapClassMethods ) throws IOException , XMLStreamException , ClassNotFoundException , IntrospectionException { FileWriter fw = new FileWriter ( mapFileName ) ; XMLOutputFactory xof = XMLOutputFactory . newInstance ( ) ; XMLStreamWriter writer = xof ...
Generate an IKVM map file .
20,558
private void addClasses ( XMLStreamWriter writer , File jarFile , boolean mapClassMethods ) throws IOException , ClassNotFoundException , XMLStreamException , IntrospectionException { ClassLoader currentThreadClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; URLClassLoader loader = new URLClassLoad...
Add classes to the map file .
20,559
private void addClass ( URLClassLoader loader , JarEntry jarEntry , XMLStreamWriter writer , boolean mapClassMethods ) throws ClassNotFoundException , XMLStreamException , IntrospectionException { String className = jarEntry . getName ( ) . replaceAll ( "\\.class" , "" ) . replaceAll ( "/" , "." ) ; writer . writeStart...
Add an individual class to the map file .
20,560
private void processProperties ( XMLStreamWriter writer , Set < Method > methodSet , Class < ? > aClass ) throws IntrospectionException , XMLStreamException { BeanInfo beanInfo = Introspector . getBeanInfo ( aClass , aClass . getSuperclass ( ) ) ; PropertyDescriptor [ ] propertyDescriptors = beanInfo . getPropertyDescr...
Process class properties .
20,561
private void addProperty ( XMLStreamWriter writer , String name , Class < ? > propertyType , String readMethod , String writeMethod ) throws XMLStreamException { if ( name . length ( ) != 0 ) { writer . writeStartElement ( "property" ) ; String propertyName = name . substring ( 0 , 1 ) . toUpperCase ( ) + name . substr...
Add a simple property to the map file .
20,562
private String getTypeString ( Class < ? > c ) { String result = TYPE_MAP . get ( c ) ; if ( result == null ) { result = c . getName ( ) ; if ( ! result . endsWith ( ";" ) && ! result . startsWith ( "[" ) ) { result = "L" + result + ";" ; } } return result ; }
Converts a class into a signature token .
20,563
private void processClassMethods ( XMLStreamWriter writer , Class < ? > aClass , Set < Method > methodSet ) throws XMLStreamException { Method [ ] methods = aClass . getDeclaredMethods ( ) ; for ( Method method : methods ) { if ( ! methodSet . contains ( method ) && Modifier . isPublic ( method . getModifiers ( ) ) && ...
Hides the original Java - style method name using an attribute which should be respected by Visual Studio the creates a new wrapper method using a . Net style method name .
20,564
private boolean ignoreMethod ( String name ) { boolean result = false ; for ( String ignoredName : IGNORED_METHODS ) { if ( name . matches ( ignoredName ) ) { result = true ; break ; } } return result ; }
Used to determine if the current method should be ignored .
20,565
private String createMethodSignature ( Method method ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "(" ) ; for ( Class < ? > type : method . getParameterTypes ( ) ) { sb . append ( getTypeString ( type ) ) ; } sb . append ( ")" ) ; Class < ? > type = method . getReturnType ( ) ; if ( type . getName ( ) ....
Creates a method signature .
20,566
public boolean contains ( Date date ) { boolean result = false ; if ( date != null ) { result = ( DateHelper . compare ( getFromDate ( ) , getToDate ( ) , date ) == 0 ) ; } return ( result ) ; }
This method determines whether the given date falls in the range of dates covered by this exception . Note that this method assumes that both the start and end date of this exception have been set .
20,567
public void setModel ( TableModel model ) { super . setModel ( model ) ; int columns = model . getColumnCount ( ) ; TableColumnModel tableColumnModel = getColumnModel ( ) ; for ( int index = 0 ; index < columns ; index ++ ) { tableColumnModel . getColumn ( index ) . setPreferredWidth ( m_columnWidth ) ; } }
Updates the model . Ensures that we reset the columns widths .
20,568
public void process ( MPPReader reader , ProjectFile file , DirectoryEntry root ) throws MPXJException , IOException { try { populateMemberData ( reader , file , root ) ; processProjectProperties ( ) ; if ( ! reader . getReadPropertiesOnly ( ) ) { processSubProjectData ( ) ; processGraphicalIndicators ( ) ; processCust...
This method is used to process an MPP14 file . This is the file format used by Project 14 .
20,569
private void processGraphicalIndicators ( ) { GraphicalIndicatorReader graphicalIndicatorReader = new GraphicalIndicatorReader ( ) ; graphicalIndicatorReader . process ( m_file . getCustomFields ( ) , m_file . getProjectProperties ( ) , m_projectProps ) ; }
Process the graphical indicator data .
20,570
private void readSubProjects ( byte [ ] data , int uniqueIDOffset , int filePathOffset , int fileNameOffset , int subprojectIndex ) { while ( uniqueIDOffset < filePathOffset ) { readSubProject ( data , uniqueIDOffset , filePathOffset , fileNameOffset , subprojectIndex ++ ) ; uniqueIDOffset += 4 ; } }
Read a list of sub projects .
20,571
private void processBaseFonts ( byte [ ] data ) { int offset = 0 ; int blockCount = MPPUtility . getShort ( data , 0 ) ; offset += 2 ; int size ; String name ; for ( int loop = 0 ; loop < blockCount ; loop ++ ) { offset += 2 ; size = MPPUtility . getShort ( data , offset ) ; offset += 2 ; name = MPPUtility . getUnicode...
Create an index of base font numbers and their associated base font instances .
20,572
private TreeMap < Integer , Integer > createTaskMap ( FieldMap fieldMap , FixedMeta taskFixedMeta , FixedData taskFixedData , Var2Data taskVarData ) { TreeMap < Integer , Integer > taskMap = new TreeMap < Integer , Integer > ( ) ; int uniqueIdOffset = fieldMap . getFixedDataOffset ( TaskField . UNIQUE_ID ) ; Integer ta...
This method maps the task unique identifiers to their index number within the FixedData block .
20,573
private void postProcessTasks ( ) throws MPXJException { TreeMap < Integer , Integer > taskMap = new TreeMap < Integer , Integer > ( ) ; int nextIDIncrement = 102000 ; int nextID = ( m_file . getTaskByUniqueID ( Integer . valueOf ( 0 ) ) == null ? nextIDIncrement : 0 ) ; for ( Map . Entry < Long , Integer > entry : m_t...
MPP14 files seem to exhibit some occasional weirdness with duplicate ID values which leads to the task structure being reported incorrectly . The following method attempts to correct this . The method uses ordering data embedded in the file to reconstruct the correct ID order of the tasks .
20,574
private void processHyperlinkData ( Resource resource , byte [ ] data ) { if ( data != null ) { int offset = 12 ; String hyperlink ; String address ; String subaddress ; offset += 12 ; hyperlink = MPPUtility . getUnicodeString ( data , offset ) ; offset += ( ( hyperlink . length ( ) + 1 ) * 2 ) ; offset += 12 ; address...
This method is used to extract the resource hyperlink attributes from a block of data and call the appropriate modifier methods to configure the specified task object .
20,575
private void readBitFields ( MppBitFlag [ ] flags , FieldContainer container , byte [ ] data ) { for ( MppBitFlag flag : flags ) { flag . setValue ( container , data ) ; } }
Iterate through a set of bit field flags and set the value for each one in the supplied container .
20,576
public void read ( InputStream is ) throws IOException { byte [ ] headerBlock = new byte [ 20 ] ; is . read ( headerBlock ) ; int headerLength = PEPUtility . getShort ( headerBlock , 8 ) ; int recordCount = PEPUtility . getInt ( headerBlock , 10 ) ; int recordLength = PEPUtility . getInt ( headerBlock , 16 ) ; StreamHe...
Reads the table data from an input stream and breaks it down into rows .
20,577
protected void addRow ( int uniqueID , Map < String , Object > map ) { m_rows . put ( Integer . valueOf ( uniqueID ) , new MapRow ( map ) ) ; }
Adds a row to the internal storage indexed by primary key .
20,578
public List < TimephasedWork > getCompleteWork ( ProjectCalendar calendar , ResourceAssignment resourceAssignment , byte [ ] data ) { LinkedList < TimephasedWork > list = new LinkedList < TimephasedWork > ( ) ; if ( calendar != null && data != null && data . length > 2 && MPPUtility . getShort ( data , 0 ) > 0 ) { Date...
Given a block of data representing completed work this method will retrieve a set of TimephasedWork instances which represent the day by day work carried out for a specific resource assignment .
20,579
public boolean getWorkModified ( List < TimephasedWork > list ) { boolean result = false ; for ( TimephasedWork assignment : list ) { result = assignment . getModified ( ) ; if ( result ) { break ; } } return result ; }
Test the list of TimephasedWork instances to see if any of them have been modified .
20,580
public TimephasedWorkContainer getBaselineWork ( ResourceAssignment assignment , ProjectCalendar calendar , TimephasedWorkNormaliser normaliser , byte [ ] data , boolean raw ) { TimephasedWorkContainer result = null ; if ( data != null && data . length > 0 ) { LinkedList < TimephasedWork > list = null ; int index = 8 ;...
Extracts baseline work from the MPP file for a specific baseline . Returns null if no baseline work is present otherwise returns a list of timephased work items .
20,581
public TimephasedCostContainer getBaselineCost ( ProjectCalendar calendar , TimephasedCostNormaliser normaliser , byte [ ] data , boolean raw ) { TimephasedCostContainer result = null ; if ( data != null && data . length > 0 ) { LinkedList < TimephasedCost > list = null ; int index = 16 ; int blockSize = 20 ; double pr...
Extracts baseline cost from the MPP file for a specific baseline . Returns null if no baseline cost is present otherwise returns a list of timephased work items .
20,582
public void processSplitData ( Task task , List < TimephasedWork > timephasedComplete , List < TimephasedWork > timephasedPlanned ) { Date splitsComplete = null ; TimephasedWork lastComplete = null ; TimephasedWork firstPlanned = null ; if ( ! timephasedComplete . isEmpty ( ) ) { lastComplete = timephasedComplete . get...
Process the timephased resource assignment data to work out the split structure of the task .
20,583
private void updateScheduleSource ( ProjectProperties properties ) { if ( properties . getCompany ( ) != null && properties . getCompany ( ) . equals ( "Synchro Software Ltd" ) ) { properties . setFileApplication ( "Synchro" ) ; } else { if ( properties . getAuthor ( ) != null && properties . getAuthor ( ) . equals ( "...
Populate the properties indicating the source of this schedule .
20,584
private void readCalendars ( Project project , HashMap < BigInteger , ProjectCalendar > map ) { Project . Calendars calendars = project . getCalendars ( ) ; if ( calendars != null ) { LinkedList < Pair < ProjectCalendar , BigInteger > > baseCalendars = new LinkedList < Pair < ProjectCalendar , BigInteger > > ( ) ; for ...
This method extracts calendar data from an MSPDI file .
20,585
private static void updateBaseCalendarNames ( List < Pair < ProjectCalendar , BigInteger > > baseCalendars , HashMap < BigInteger , ProjectCalendar > map ) { for ( Pair < ProjectCalendar , BigInteger > pair : baseCalendars ) { ProjectCalendar cal = pair . getFirst ( ) ; BigInteger baseCalendarID = pair . getSecond ( ) ...
The way calendars are stored in an MSPDI 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...
20,586
private void readCalendar ( Project . Calendars . Calendar calendar , HashMap < BigInteger , ProjectCalendar > map , List < Pair < ProjectCalendar , BigInteger > > baseCalendars ) { ProjectCalendar bc = m_projectFile . addCalendar ( ) ; bc . setUniqueID ( NumberHelper . getInteger ( calendar . getUID ( ) ) ) ; bc . set...
This method extracts data for a single calendar from an MSPDI file .
20,587
private void readDay ( ProjectCalendar calendar , Project . Calendars . Calendar . WeekDays . WeekDay day , boolean readExceptionsFromDays ) { BigInteger dayType = day . getDayType ( ) ; if ( dayType != null ) { if ( dayType . intValue ( ) == 0 ) { if ( readExceptionsFromDays ) { readExceptionDay ( calendar , day ) ; }...
This method extracts data for a single day from an MSPDI file .
20,588
private void readNormalDay ( ProjectCalendar calendar , Project . Calendars . Calendar . WeekDays . WeekDay weekDay ) { int dayNumber = weekDay . getDayType ( ) . intValue ( ) ; Day day = Day . getInstance ( dayNumber ) ; calendar . setWorkingDay ( day , BooleanHelper . getBoolean ( weekDay . isDayWorking ( ) ) ) ; Pro...
This method extracts data for a normal working day from an MSPDI file .
20,589
private void readExceptionDay ( ProjectCalendar calendar , Project . Calendars . Calendar . WeekDays . WeekDay day ) { Project . Calendars . Calendar . WeekDays . WeekDay . TimePeriod timePeriod = day . getTimePeriod ( ) ; Date fromDate = timePeriod . getFromDate ( ) ; Date toDate = timePeriod . getToDate ( ) ; Project...
This method extracts data for an exception day from an MSPDI file .
20,590
private void readExceptions ( Project . Calendars . Calendar calendar , ProjectCalendar bc ) { Project . Calendars . Calendar . Exceptions exceptions = calendar . getExceptions ( ) ; if ( exceptions != null ) { for ( Project . Calendars . Calendar . Exceptions . Exception exception : exceptions . getException ( ) ) { r...
Reads any exceptions present in the file . This is only used in MSPDI file versions saved by Project 2007 and later .
20,591
private void readException ( ProjectCalendar bc , Project . Calendars . Calendar . Exceptions . Exception exception ) { Date fromDate = exception . getTimePeriod ( ) . getFromDate ( ) ; Date toDate = exception . getTimePeriod ( ) . getToDate ( ) ; if ( fromDate != null && toDate != null ) { ProjectCalendarException bce...
Read a single calendar exception .
20,592
private void readRecurringData ( ProjectCalendarException bce , Project . Calendars . Calendar . Exceptions . Exception exception ) { RecurrenceType rt = getRecurrenceType ( NumberHelper . getInt ( exception . getType ( ) ) ) ; if ( rt != null ) { RecurringData rd = new RecurringData ( ) ; rd . setStartDate ( bce . get...
Read recurring data for a calendar exception .
20,593
private Integer getFrequency ( Project . Calendars . Calendar . Exceptions . Exception exception ) { Integer period = NumberHelper . getInteger ( exception . getPeriod ( ) ) ; if ( period == null ) { period = Integer . valueOf ( 1 ) ; } return period ; }
Retrieve the frequency of an exception .
20,594
private void readWorkWeeks ( Project . Calendars . Calendar xmlCalendar , ProjectCalendar mpxjCalendar ) { WorkWeeks ww = xmlCalendar . getWorkWeeks ( ) ; if ( ww != null ) { for ( WorkWeek xmlWeek : ww . getWorkWeek ( ) ) { ProjectCalendarWeek week = mpxjCalendar . addWorkWeek ( ) ; week . setName ( xmlWeek . getName ...
Read the work weeks associated with this calendar .
20,595
private void readProjectExtendedAttributes ( Project project ) { Project . ExtendedAttributes attributes = project . getExtendedAttributes ( ) ; if ( attributes != null ) { for ( Project . ExtendedAttributes . ExtendedAttribute ea : attributes . getExtendedAttribute ( ) ) { readFieldAlias ( ea ) ; } } }
This method extracts project extended attribute data from an MSPDI file .
20,596
private void readFieldAlias ( Project . ExtendedAttributes . ExtendedAttribute attribute ) { String alias = attribute . getAlias ( ) ; if ( alias != null && alias . length ( ) != 0 ) { FieldType field = FieldTypeHelper . getInstance ( Integer . parseInt ( attribute . getFieldID ( ) ) ) ; m_projectFile . getCustomFields...
Read a single field alias from an extended attribute .
20,597
private void readResources ( Project project , HashMap < BigInteger , ProjectCalendar > calendarMap ) { Project . Resources resources = project . getResources ( ) ; if ( resources != null ) { for ( Project . Resources . Resource resource : resources . getResource ( ) ) { readResource ( resource , calendarMap ) ; } } }
This method extracts resource data from an MSPDI file .
20,598
private void readResourceBaselines ( Project . Resources . Resource xmlResource , Resource mpxjResource ) { for ( Project . Resources . Resource . Baseline baseline : xmlResource . getBaseline ( ) ) { int number = NumberHelper . getInt ( baseline . getNumber ( ) ) ; Double cost = DatatypeConverter . parseCurrency ( bas...
Reads baseline values for the current resource .
20,599
private void readResourceExtendedAttributes ( Project . Resources . Resource xml , Resource mpx ) { for ( Project . Resources . Resource . ExtendedAttribute attrib : xml . getExtendedAttribute ( ) ) { int xmlFieldID = Integer . parseInt ( attrib . getFieldID ( ) ) & 0x0000FFFF ; ResourceField mpxFieldID = MPPResourceFi...
This method processes any extended attributes associated with a resource .