private void readCostRateTables ( Resource resource , Rates rates ) { if ( rates == null ) { CostRateTable table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 0 , table ) ; table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 1 , table ) ; table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 2 , table ) ; table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 3 , table ) ; table = new CostRateTable ( ) ; table . add ( CostRateTableEntry . DEFAULT_ENTRY ) ; resource . setCostRateTable ( 4 , table ) ; } else { Set < CostRateTable > tables = new HashSet < CostRateTable > ( ) ; for ( net . sf . mpxj . mspdi . schema . Project . Resources . Resource . Rates . Rate rate : rates . getRate ( ) ) { Rate standardRate = DatatypeConverter . parseRate ( rate . getStandardRate ( ) ) ; TimeUnit standardRateFormat = DatatypeConverter . parseTimeUnit ( rate . getStandardRateFormat ( ) ) ; Rate overtimeRate = DatatypeConverter . parseRate ( rate . getOvertimeRate ( ) ) ; TimeUnit overtimeRateFormat = DatatypeConverter . parseTimeUnit ( rate . getOvertimeRateFormat ( ) ) ; Double costPerUse = DatatypeConverter . parseCurrency ( rate . getCostPerUse ( ) ) ; Date endDate = rate . getRatesTo ( ) ; CostRateTableEntry entry = new CostRateTableEntry ( standardRate , standardRateFormat , overtimeRate , overtimeRateFormat , costPerUse , endDate ) ; int tableIndex = rate . getRateTable ( ) . intValue ( ) ; CostRateTable table = resource . getCostRateTable ( tableIndex ) ; if ( table == null ) { table = new CostRateTable ( ) ; resource . setCostRateTable ( tableIndex , table ) ; } table . add ( entry ) ; tables . add ( table ) ; } for ( CostRateTable table : tables ) { Collections . sort ( table ) ; } } }
Reads the cost rate tables from the file .