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 .