ExtendedData rscExtData = null;
int resources = rscFixedData.getItemCount();
byte[] data;
int id;
Resource resource;
String notes;
RTFUtility rtf = new RTFUtility();
ProjectCalendar calendar;
for (int loop = 0; loop < resources; loop++)
{
data = rscFixedData.getByteArrayValue(loop);
//
// Test for a valid unique id
//
id = MPPUtility.getInt(data, 0);
if (id < 1)
{
continue;
}
//
// Blank rows can be present in MPP files. The following flag
// appears to indicate that a row is blank, and should be
// ignored.
//
if ((data[8] & 0x01) != 0)
{
continue;
}
//
// Test to ensure this resource has not been deleted
// This may be an array of bit flags, as per the task
// record. I have yet to see data to support this, so
// the simple non-zero test remains.
//
if (MPPUtility.getShort(data, 164) != 0)
{
continue;
}
//
// Load the var data if we have not already done so
//
if (rscVarData == null)
{
rscVarData = new FixDeferFix(new DocumentInputStream(((DocumentEntry) rscDir.getEntry("FixDeferFix 0"))));
}
rscExtData = new ExtendedData(rscVarData, getOffset(data, 192));
resource = m_file.addResource();
resource.setAccrueAt(AccrueType.getInstance(MPPUtility.getShort(data, 20)));
resource.setActualCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 114)) / 100));
resource.setActualOvertimeCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 144)) / 100));
resource.setActualWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 62)) / 100, TimeUnit.HOURS));
resource.setAvailableFrom(MPPUtility.getTimestamp(data, 28));
resource.setAvailableTo(MPPUtility.getTimestamp(data, 32));
//resource.setBaseCalendar();
resource.setBaselineCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 126)) / 100));
resource.setBaselineWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 68)) / 100, TimeUnit.HOURS));
resource.setCode(rscExtData.getUnicodeString(RESOURCE_CODE));
resource.setCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 120)) / 100));
resource.setCost1(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST1)) / 100));
resource.setCost2(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST2)) / 100));
resource.setCost3(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST3)) / 100));
resource.setCost4(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST4)) / 100));
resource.setCost5(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST5)) / 100));
resource.setCost6(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST6)) / 100));
resource.setCost7(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST7)) / 100));
resource.setCost8(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST8)) / 100));
resource.setCost9(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST9)) / 100));
resource.setCost10(NumberUtility.getDouble(((double) rscExtData.getLong(RESOURCE_COST10)) / 100));
resource.setCostPerUse(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 80)) / 100));
resource.setDate1(rscExtData.getTimestamp(RESOURCE_DATE1));
resource.setDate2(rscExtData.getTimestamp(RESOURCE_DATE2));
resource.setDate3(rscExtData.getTimestamp(RESOURCE_DATE3));
resource.setDate4(rscExtData.getTimestamp(RESOURCE_DATE4));
resource.setDate5(rscExtData.getTimestamp(RESOURCE_DATE5));
resource.setDate6(rscExtData.getTimestamp(RESOURCE_DATE6));
resource.setDate7(rscExtData.getTimestamp(RESOURCE_DATE7));
resource.setDate8(rscExtData.getTimestamp(RESOURCE_DATE8));
resource.setDate9(rscExtData.getTimestamp(RESOURCE_DATE9));
resource.setDate10(rscExtData.getTimestamp(RESOURCE_DATE10));
resource.setDuration1(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION1), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION1_UNITS))));
resource.setDuration2(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION2), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION2_UNITS))));
resource.setDuration3(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION3), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION3_UNITS))));
resource.setDuration4(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION4), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION4_UNITS))));
resource.setDuration5(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION5), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION5_UNITS))));
resource.setDuration6(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION6), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION6_UNITS))));
resource.setDuration7(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION7), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION7_UNITS))));
resource.setDuration8(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION8), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION8_UNITS))));
resource.setDuration9(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION9), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION9_UNITS))));
resource.setDuration10(MPPUtility.getDuration(rscExtData.getInt(RESOURCE_DURATION10), MPPUtility.getDurationTimeUnits(rscExtData.getShort(RESOURCE_DURATION10_UNITS))));
resource.setEmailAddress(rscExtData.getUnicodeString(RESOURCE_EMAIL));
resource.setFinish1(rscExtData.getTimestamp(RESOURCE_FINISH1));
resource.setFinish2(rscExtData.getTimestamp(RESOURCE_FINISH2));
resource.setFinish3(rscExtData.getTimestamp(RESOURCE_FINISH3));
resource.setFinish4(rscExtData.getTimestamp(RESOURCE_FINISH4));
resource.setFinish5(rscExtData.getTimestamp(RESOURCE_FINISH5));
resource.setFinish6(rscExtData.getTimestamp(RESOURCE_FINISH6));
resource.setFinish7(rscExtData.getTimestamp(RESOURCE_FINISH7));
resource.setFinish8(rscExtData.getTimestamp(RESOURCE_FINISH8));
resource.setFinish9(rscExtData.getTimestamp(RESOURCE_FINISH9));
resource.setFinish10(rscExtData.getTimestamp(RESOURCE_FINISH10));
resource.setGroup(rscExtData.getUnicodeString(RESOURCE_GROUP));
resource.setID(Integer.valueOf(MPPUtility.getInt(data, 4)));
resource.setInitials(rscVarData.getUnicodeString(getOffset(data, 160)));
//resource.setLinkedFields(); // Calculated value
resource.setMaxUnits(NumberUtility.getDouble(((double) MPPUtility.getInt(data, 52)) / 100));
resource.setName(rscVarData.getUnicodeString(getOffset(data, 156)));
resource.setNumber1(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER1)));
resource.setNumber2(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER2)));
resource.setNumber3(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER3)));
resource.setNumber4(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER4)));
resource.setNumber5(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER5)));
resource.setNumber6(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER6)));
resource.setNumber7(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER7)));
resource.setNumber8(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER8)));
resource.setNumber9(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER9)));
resource.setNumber10(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER10)));
resource.setNumber11(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER11)));
resource.setNumber12(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER12)));
resource.setNumber13(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER13)));
resource.setNumber14(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER14)));
resource.setNumber15(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER15)));
resource.setNumber16(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER16)));
resource.setNumber17(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER17)));
resource.setNumber18(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER18)));
resource.setNumber19(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER19)));
resource.setNumber20(NumberUtility.getDouble(rscExtData.getDouble(RESOURCE_NUMBER20)));
//resource.setObjects(); // Calculated value
//resource.setOverallocated(); // Calculated value
resource.setOvertimeCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 138)) / 100));
resource.setOvertimeRate(new Rate(MPPUtility.getDouble(data, 44), TimeUnit.HOURS));
resource.setOvertimeWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 74)) / 100, TimeUnit.HOURS));
resource.setPeakUnits(NumberUtility.getDouble(((double) MPPUtility.getInt(data, 110)) / 100));
//resource.setPercentageWorkComplete(); // Calculated value
resource.setRegularWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 92)) / 100, TimeUnit.HOURS));
resource.setRemainingCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 132)) / 100));
resource.setRemainingOvertimeCost(NumberUtility.getDouble(((double) MPPUtility.getLong6(data, 150)) / 100));
resource.setRemainingWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 86)) / 100, TimeUnit.HOURS));
resource.setStandardRate(new Rate(MPPUtility.getDouble(data, 36), TimeUnit.HOURS));
resource.setStart1(rscExtData.getTimestamp(RESOURCE_START1));
resource.setStart2(rscExtData.getTimestamp(RESOURCE_START2));
resource.setStart3(rscExtData.getTimestamp(RESOURCE_START3));
resource.setStart4(rscExtData.getTimestamp(RESOURCE_START4));
resource.setStart5(rscExtData.getTimestamp(RESOURCE_START5));
resource.setStart6(rscExtData.getTimestamp(RESOURCE_START6));
resource.setStart7(rscExtData.getTimestamp(RESOURCE_START7));
resource.setStart8(rscExtData.getTimestamp(RESOURCE_START8));
resource.setStart9(rscExtData.getTimestamp(RESOURCE_START9));
resource.setStart10(rscExtData.getTimestamp(RESOURCE_START10));
resource.setText1(rscExtData.getUnicodeString(RESOURCE_TEXT1));
resource.setText2(rscExtData.getUnicodeString(RESOURCE_TEXT2));
resource.setText3(rscExtData.getUnicodeString(RESOURCE_TEXT3));
resource.setText4(rscExtData.getUnicodeString(RESOURCE_TEXT4));
resource.setText5(rscExtData.getUnicodeString(RESOURCE_TEXT5));
resource.setText6(rscExtData.getUnicodeString(RESOURCE_TEXT6));
resource.setText7(rscExtData.getUnicodeString(RESOURCE_TEXT7));
resource.setText8(rscExtData.getUnicodeString(RESOURCE_TEXT8));
resource.setText9(rscExtData.getUnicodeString(RESOURCE_TEXT9));
resource.setText10(rscExtData.getUnicodeString(RESOURCE_TEXT10));
resource.setText11(rscExtData.getUnicodeString(RESOURCE_TEXT11));
resource.setText12(rscExtData.getUnicodeString(RESOURCE_TEXT12));
resource.setText13(rscExtData.getUnicodeString(RESOURCE_TEXT13));
resource.setText14(rscExtData.getUnicodeString(RESOURCE_TEXT14));
resource.setText15(rscExtData.getUnicodeString(RESOURCE_TEXT15));
resource.setText16(rscExtData.getUnicodeString(RESOURCE_TEXT16));
resource.setText17(rscExtData.getUnicodeString(RESOURCE_TEXT17));
resource.setText18(rscExtData.getUnicodeString(RESOURCE_TEXT18));
resource.setText19(rscExtData.getUnicodeString(RESOURCE_TEXT19));
resource.setText20(rscExtData.getUnicodeString(RESOURCE_TEXT20));
resource.setText21(rscExtData.getUnicodeString(RESOURCE_TEXT21));
resource.setText22(rscExtData.getUnicodeString(RESOURCE_TEXT22));
resource.setText23(rscExtData.getUnicodeString(RESOURCE_TEXT23));
resource.setText24(rscExtData.getUnicodeString(RESOURCE_TEXT24));
resource.setText25(rscExtData.getUnicodeString(RESOURCE_TEXT25));
resource.setText26(rscExtData.getUnicodeString(RESOURCE_TEXT26));
resource.setText27(rscExtData.getUnicodeString(RESOURCE_TEXT27));
resource.setText28(rscExtData.getUnicodeString(RESOURCE_TEXT28));
resource.setText29(rscExtData.getUnicodeString(RESOURCE_TEXT29));
resource.setText30(rscExtData.getUnicodeString(RESOURCE_TEXT30));
resource.setUniqueID(Integer.valueOf(id));
resource.setWork(MPPUtility.getDuration(((double) MPPUtility.getLong6(data, 56)) / 100, TimeUnit.HOURS));
//
// Attach the resource calendar
//
calendar = m_calendarMap.get(Integer.valueOf(MPPUtility.getInt(data, 24)));
resource.setResourceCalendar(calendar);
//
// Retrieve the resource notes.
//
notes = rscExtData.getString(RESOURCE_NOTES);
if (notes != null)
{
if (m_reader.getPreserveNoteFormatting() == false)
{
notes = rtf.strip(notes);
}
resource.setNotes(notes);
}
m_file.fireResourceReadEvent(resource);
}
}