Package net.sf.mpxj

Examples of net.sf.mpxj.Resource


      Integer[] uniqueid = rscVarMeta.getUniqueIdentifierArray();
      Integer id;
      Integer offset;
      byte[] data;
      byte[] metaData;
      Resource resource;

      RTFUtility rtf = new RTFUtility();
      String notes;

      for (int loop = 0; loop < uniqueid.length; loop++)
      {
         id = uniqueid[loop];
         offset = resourceMap.get(id);
         if (offset == null)
         {
            continue;
         }

         data = rscFixedData.getByteArrayValue(offset.intValue());
         byte[] metaData2 = rscFixed2Meta.getByteArrayValue(offset.intValue());
         byte[] data2 = rscFixed2Data.getByteArrayValue(offset.intValue());
         //metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         //MPPUtility.dataDump(data, true, true, true, true, true, true, true);
         //MPPUtility.dataDump(metaData, true, true, true, true, true, true, true);
         //MPPUtility.varDataDump(rscVarData, id, true, true, true, true, true, true);

         resource = m_file.addResource();

         resource.disableEvents();
         fieldMap.populateContainer(resource, id, new byte[][]
         {
            data,
            data2
         }, rscVarData);
         resource.enableEvents();

         resource.setBudget((metaData2[8] & 0x20) != 0);

         processHyperlinkData(resource, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.HYPERLINK_DATA)));

         resource.setID(Integer.valueOf(MPPUtility.getInt(data, 4)));

         resource.setOutlineCode1(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE1_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode2(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE2_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode3(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE3_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode4(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE4_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode5(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE5_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode6(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE6_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode7(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE7_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode8(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE8_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode9(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE9_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode10(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE10_INDEX))), OUTLINECODE_DATA));

         resource.setType((MPPUtility.getShort(data, 14) == 0 ? ResourceType.WORK : ((metaData2[8] & 0x10) == 0) ? ResourceType.MATERIAL : ResourceType.COST));
         resource.setUniqueID(id);

         metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         resource.setFlag1((metaData[28] & 0x40) != 0);
         resource.setFlag2((metaData[28] & 0x80) != 0);
         resource.setFlag3((metaData[29] & 0x01) != 0);
         resource.setFlag4((metaData[29] & 0x02) != 0);
         resource.setFlag5((metaData[29] & 0x04) != 0);
         resource.setFlag6((metaData[29] & 0x08) != 0);
         resource.setFlag7((metaData[29] & 0x10) != 0);
         resource.setFlag8((metaData[29] & 0x20) != 0);
         resource.setFlag9((metaData[29] & 0x40) != 0);
         resource.setFlag10((metaData[28] & 0x20) != 0);
         resource.setFlag11((metaData[29] & 0x20) != 0);
         resource.setFlag12((metaData[30] & 0x01) != 0);
         resource.setFlag13((metaData[30] & 0x02) != 0);
         resource.setFlag14((metaData[30] & 0x04) != 0);
         resource.setFlag15((metaData[30] & 0x08) != 0);
         resource.setFlag16((metaData[30] & 0x10) != 0);
         resource.setFlag17((metaData[30] & 0x20) != 0);
         resource.setFlag18((metaData[30] & 0x40) != 0);
         resource.setFlag19((metaData[30] & 0x80) != 0);
         resource.setFlag20((metaData[31] & 0x01) != 0);

         notes = resource.getNotes();
         if (notes != null)
         {
            if (m_reader.getPreserveNoteFormatting() == false)
            {
               notes = rtf.strip(notes);
            }

            resource.setNotes(notes);
         }

         //
         // Configure the resource calendar
         //
         resource.setResourceCalendar(m_resourceMap.get(id));

         //
         // Process any enterprise columns
         //        
         processResourceEnterpriseColumns(id, resource, rscVarData, metaData2);

         //
         // Process cost rate tables
         //
         CostRateTableFactory crt = new CostRateTableFactory();
         crt.process(resource, 0, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_A)));
         crt.process(resource, 1, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_B)));
         crt.process(resource, 2, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_C)));
         crt.process(resource, 3, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_D)));
         crt.process(resource, 4, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_E)));

         //
         // Process availability table
         //
         AvailabilityFactory af = new AvailabilityFactory();
         af.process(resource.getAvailability(), rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.AVAILABILITY_DATA)));

         m_file.fireResourceReadEvent(resource);
      }
   }
View Full Code Here


    *
    * @param row resource assignment data
    */
   protected void processAssignment(Row row)
   {
      Resource resource = m_project.getResourceByUniqueID(row.getInteger("RES_UID"));
      Task task = m_project.getTaskByUniqueID(row.getInteger("TASK_UID"));

      if (task != null && resource != null)
      {
         ResourceAssignment assignment = task.addResourceAssignment(resource);
View Full Code Here

    * @param file MPX file
    */
   private static void listAssignments(ProjectFile file)
   {
      Task task;
      Resource resource;
      String taskName;
      String resourceName;

      for (ResourceAssignment assignment : file.getAllResourceAssignments())
      {
         task = assignment.getTask();
         if (task == null)
         {
            taskName = "(null task)";
         }
         else
         {
            taskName = task.getName();
         }

         resource = assignment.getResource();
         if (resource == null)
         {
            resourceName = "(null resource)";
         }
         else
         {
            resourceName = resource.getName();
         }

         System.out.println("Assignment: Task=" + taskName + " Resource=" + resourceName);
      }

View Full Code Here

      {
         System.out.println("Assignments for task " + task.getName() + ":");

         for (ResourceAssignment assignment : task.getResourceAssignments())
         {
            Resource resource = assignment.getResource();
            String resourceName;

            if (resource == null)
            {
               resourceName = "(null resource)";
            }
            else
            {
               resourceName = resource.getName();
            }

            System.out.println("   " + resourceName);
         }
      }
View Full Code Here

   protected void processResource(Row row)
   {
      Integer uniqueID = row.getInteger("RES_UID");
      if (uniqueID != null && uniqueID.intValue() >= 0)
      {
         Resource resource = m_project.addResource();
         resource.setAccrueAt(AccrueType.getInstance(row.getInt("RES_ACCRUE_AT")));
         resource.setActualCost(getDefaultOnNull(row.getCurrency("RES_ACT_COST"), NumberUtility.DOUBLE_ZERO));
         resource.setActualOvertimeCost(row.getCurrency("RES_ACT_OVT_COST"));
         resource.setActualOvertimeWork(row.getDuration("RES_ACT_OVT_WORK"));
         //resource.setActualOvertimeWorkProtected();
         resource.setActualWork(row.getDuration("RES_ACT_WORK"));
         //resource.setActualWorkProtected();
         //resource.setActveDirectoryGUID();
         resource.setACWP(row.getCurrency("RES_ACWP"));
         resource.setAvailableFrom(row.getDate("RES_AVAIL_FROM"));
         resource.setAvailableTo(row.getDate("RES_AVAIL_TO"));
         //resource.setBaseCalendar();
         resource.setBaselineCost(getDefaultOnNull(row.getCurrency("RES_BASE_COST"), NumberUtility.DOUBLE_ZERO));
         resource.setBaselineWork(row.getDuration("RES_BASE_WORK"));
         resource.setBCWP(row.getCurrency("RES_BCWP"));
         resource.setBCWS(row.getCurrency("RES_BCWS"));
         //resource.setBookingType();     
         resource.setCanLevel(row.getBoolean("RES_CAN_LEVEL"));
         //resource.setCode();
         resource.setCost(getDefaultOnNull(row.getCurrency("RES_COST"), NumberUtility.DOUBLE_ZERO));
         //resource.setCost1();
         //resource.setCost2();
         //resource.setCost3();
         //resource.setCost4();
         //resource.setCost5();
         //resource.setCost6();
         //resource.setCost7();
         //resource.setCost8();
         //resource.setCost9();
         //resource.setCost10();
         resource.setCostPerUse(row.getCurrency("RES_COST_PER_USE"));
         //resource.setCreationDate();
         //resource.setCV();     
         //resource.setDate1();
         //resource.setDate2();
         //resource.setDate3();
         //resource.setDate4();
         //resource.setDate5();
         //resource.setDate6();
         //resource.setDate7();
         //resource.setDate8();
         //resource.setDate9();
         //resource.setDate10();
         //resource.setDuration1();
         //resource.setDuration2();
         //resource.setDuration3();
         //resource.setDuration4();
         //resource.setDuration5();
         //resource.setDuration6();
         //resource.setDuration7();
         //resource.setDuration8();
         //resource.setDuration9();
         //resource.setDuration10();
         //resource.setEmailAddress();
         //resource.setFinish();
         //resource.setFinish1();
         //resource.setFinish2();
         //resource.setFinish3();
         //resource.setFinish4();
         //resource.setFinish5();
         //resource.setFinish6();
         //resource.setFinish7();
         //resource.setFinish8();
         //resource.setFinish9();
         //resource.setFinish10();
         //resource.setFlag1();
         //resource.setFlag2();
         //resource.setFlag3();
         //resource.setFlag4();
         //resource.setFlag5();
         //resource.setFlag6();
         //resource.setFlag7();
         //resource.setFlag8();
         //resource.setFlag9();
         //resource.setFlag10();
         //resource.setFlag11();
         //resource.setFlag12();
         //resource.setFlag13();
         //resource.setFlag14();
         //resource.setFlag15();
         //resource.setFlag16();
         //resource.setFlag17();
         //resource.setFlag18();
         //resource.setFlag19();
         //resource.setFlag20();
         //resource.setGroup();
         //resource.setHyperlink();
         //resource.setHyperlinkAddress();
         //resource.setHyperlinkSubAddress();
         resource.setID(row.getInteger("RES_ID"));
         resource.setInitials(row.getString("RES_INITIALS"));
         //resource.setIsEnterprise();
         //resource.setIsGeneric();
         //resource.setIsInactive();
         //resource.setIsNull();
         //resource.setLinkedFields();RES_HAS_LINKED_FIELDS = false ( java.lang.Boolean)
         resource.setMaterialLabel(row.getString("RES_MATERIAL_LABEL"));
         resource.setMaxUnits(Double.valueOf(NumberUtility.getDouble(row.getDouble("RES_MAX_UNITS")) * 100));
         resource.setName(row.getString("RES_NAME"));
         //resource.setNtAccount();
         //resource.setNumber1();
         //resource.setNumber2();
         //resource.setNumber3();
         //resource.setNumber4();
         //resource.setNumber5();
         //resource.setNumber6();
         //resource.setNumber7();
         //resource.setNumber8();
         //resource.setNumber9();
         //resource.setNumber10();
         //resource.setNumber11();
         //resource.setNumber12();
         //resource.setNumber13();
         //resource.setNumber14();
         //resource.setNumber15();
         //resource.setNumber16();
         //resource.setNumber17();
         //resource.setNumber18();
         //resource.setNumber19();
         //resource.setNumber20();
         resource.setObjects(getNullOnValue(row.getInteger("RES_NUM_OBJECTS"), 0));
         //resource.setOutlineCode1();
         //resource.setOutlineCode2();
         //resource.setOutlineCode3();
         //resource.setOutlineCode4();
         //resource.setOutlineCode5();
         //resource.setOutlineCode6();
         //resource.setOutlineCode7();
         //resource.setOutlineCode8();
         //resource.setOutlineCode9();
         //resource.setOutlineCode10();
         resource.setOverAllocated(row.getBoolean("RES_IS_OVERALLOCATED"));
         resource.setOvertimeCost(row.getCurrency("RES_OVT_COST"));
         resource.setOvertimeRate(new Rate(row.getDouble("RES_OVT_RATE"), TimeUnit.HOURS));
         resource.setOvertimeRateUnits(TimeUnit.getInstance(row.getInt("RES_OVT_RATE_FMT") - 1));
         resource.setOvertimeWork(row.getDuration("RES_OVT_WORK"));
         resource.setPeakUnits(Double.valueOf(NumberUtility.getDouble(row.getDouble("RES_PEAK")) * 100));
         //resource.setPercentWorkComplete();
         resource.setPhonetics(row.getString("RES_PHONETICS"));
         resource.setRegularWork(row.getDuration("RES_REG_WORK"));
         resource.setRemainingCost(getDefaultOnNull(row.getCurrency("RES_REM_COST"), NumberUtility.DOUBLE_ZERO));
         resource.setRemainingOvertimeCost(row.getCurrency("RES_REM_OVT_COST"));
         resource.setRemainingOvertimeWork(row.getDuration("RES_REM_OVT_WORK"));
         resource.setRemainingWork(row.getDuration("RES_REM_WORK"));
         //resource.setResourceCalendar();RES_CAL_UID = null ( ) // CHECK THIS
         resource.setStandardRate(new Rate(row.getDouble("RES_STD_RATE"), TimeUnit.HOURS));
         resource.setStandardRateUnits(TimeUnit.getInstance(row.getInt("RES_STD_RATE_FMT") - 1));
         //resource.setStart();
         //resource.setStart1();
         //resource.setStart2();
         //resource.setStart3();
         //resource.setStart4();
         //resource.setStart5();
         //resource.setStart6();
         //resource.setStart7();
         //resource.setStart8();
         //resource.setStart9();
         //resource.setStart10();
         //resource.setText1();
         //resource.setText2();
         //resource.setText3();
         //resource.setText4();
         //resource.setText5();
         //resource.setText6();
         //resource.setText7();
         //resource.setText8();
         //resource.setText9();
         //resource.setText10();
         //resource.setText11();
         //resource.setText12();
         //resource.setText13();
         //resource.setText14();
         //resource.setText15();
         //resource.setText16();
         //resource.setText17();
         //resource.setText18();
         //resource.setText19();
         //resource.setText20();
         //resource.setText21();
         //resource.setText22();
         //resource.setText23();
         //resource.setText24();
         //resource.setText25();
         //resource.setText26();
         //resource.setText27();
         //resource.setText28();
         //resource.setText29();
         //resource.setText30();
         resource.setType(row.getBoolean("RES_TYPE") ? ResourceType.WORK : ResourceType.MATERIAL);
         resource.setUniqueID(uniqueID);
         resource.setWork(row.getDuration("RES_WORK"));
         resource.setWorkGroup(WorkGroup.getInstance(row.getInt("RES_WORKGROUP_MESSAGING")));

         String notes = row.getString("RES_RTF_NOTES");
         if (notes != null)
         {
            if (m_preserveNoteFormatting == false)
            {
               notes = m_rtf.strip(notes);
            }
            resource.setNotes(notes);
         }

         resource.setResourceCalendar(m_project.getBaseCalendarByUniqueID(row.getInteger("RES_CAL_UID")));

         //
         // Calculate the cost variance
         //
         if (resource.getCost() != null && resource.getBaselineCost() != null)
         {
            resource.setCostVariance(NumberUtility.getDouble(resource.getCost().doubleValue() - resource.getBaselineCost().doubleValue()));
         }

         //
         // Calculate the work variance
         //
         if (resource.getWork() != null && resource.getBaselineWork() != null)
         {
            resource.setWorkVariance(Duration.getInstance(resource.getWork().getDuration() - resource.getBaselineWork().getDuration(), TimeUnit.HOURS));
         }

         //
         // Set the overallocated flag
         //
         resource.setOverAllocated(NumberUtility.getDouble(resource.getPeakUnits()) > NumberUtility.getDouble(resource.getMaxUnits()));

         m_project.fireResourceReadEvent(resource);

         //
         // Unused attributes
View Full Code Here

    * @param row result set row
    */
   protected void processResourceBaseline(Row row)
   {
      Integer id = row.getInteger("RES_UID");
      Resource resource = m_project.getResourceByUniqueID(id);
      if (resource != null)
      {
         int index = row.getInt("RB_BASE_NUM");

         resource.setBaselineWork(index, row.getDuration("RB_BASE_WORK"));
         resource.setBaselineCost(index, row.getCurrency("RB_BASE_COST"));
      }
   }
View Full Code Here

         case MPPResourceField.RESOURCE_FIELD_BASE :
         {
            ResourceField field = MPPResourceField.getInstance(index);
            if (field != null && field != ResourceField.NOTES)
            {
               Resource resource = m_project.getResourceByUniqueID(entityID);
               if (resource != null)
               {
                  if (field.getDataType() == DataType.CURRENCY)
                  {
                     value = Double.valueOf(((Double) value).doubleValue() / 100);
                  }
                  resource.set(field, value);
               }
            }
            break;
         }
View Full Code Here

    * @param xml Resource data
    * @param calendarMap Map of calendar UIDs to names
    */
   private void readResource(Project.Resources.Resource xml, HashMap<BigInteger, ProjectCalendar> calendarMap)
   {
      Resource mpx = m_projectFile.addResource();

      mpx.setAccrueAt(xml.getAccrueAt());
      mpx.setActveDirectoryGUID(xml.getActiveDirectoryGUID());
      mpx.setActualCost(DatatypeConverter.parseCurrency(xml.getActualCost()));
      mpx.setActualOvertimeCost(DatatypeConverter.parseCurrency(xml.getActualOvertimeCost()));
      mpx.setActualOvertimeWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getActualOvertimeWork()));
      mpx.setActualOvertimeWorkProtected(DatatypeConverter.parseDuration(m_projectFile, null, xml.getActualOvertimeWorkProtected()));
      mpx.setActualWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getActualWork()));
      mpx.setActualWorkProtected(DatatypeConverter.parseDuration(m_projectFile, null, xml.getActualWorkProtected()));
      mpx.setACWP(DatatypeConverter.parseCurrency(xml.getACWP()));
      mpx.setAvailableFrom(DatatypeConverter.parseDate(xml.getAvailableFrom()));
      mpx.setAvailableTo(DatatypeConverter.parseDate(xml.getAvailableTo()));
      mpx.setBCWS(DatatypeConverter.parseCurrency(xml.getBCWS()));
      mpx.setBCWP(DatatypeConverter.parseCurrency(xml.getBCWP()));
      mpx.setBookingType(xml.getBookingType());
      //mpx.setBaseCalendar ();
      //mpx.setBaselineCost();
      //mpx.setBaselineWork();
      mpx.setBudget(BooleanUtility.getBoolean(xml.isIsBudget()));
      mpx.setCanLevel(BooleanUtility.getBoolean(xml.isCanLevel()));
      mpx.setCode(xml.getCode());
      mpx.setCost(DatatypeConverter.parseCurrency(xml.getCost()));
      mpx.setCostPerUse(DatatypeConverter.parseCurrency(xml.getCostPerUse()));
      mpx.setCostVariance(DatatypeConverter.parseCurrency(xml.getCostVariance()));
      mpx.setCreationDate(DatatypeConverter.parseDate(xml.getCreationDate()));
      mpx.setCV(DatatypeConverter.parseCurrency(xml.getCV()));
      mpx.setEmailAddress(xml.getEmailAddress());
      mpx.setGroup(xml.getGroup());
      mpx.setHyperlink(xml.getHyperlink());
      mpx.setHyperlinkAddress(xml.getHyperlinkAddress());
      mpx.setHyperlinkSubAddress(xml.getHyperlinkSubAddress());
      mpx.setID(NumberUtility.getInteger(xml.getID()));
      mpx.setInitials(xml.getInitials());
      mpx.setIsEnterprise(BooleanUtility.getBoolean(xml.isIsEnterprise()));
      mpx.setIsGeneric(BooleanUtility.getBoolean(xml.isIsGeneric()));
      mpx.setIsInactive(BooleanUtility.getBoolean(xml.isIsInactive()));
      mpx.setIsNull(BooleanUtility.getBoolean(xml.isIsNull()));
      //mpx.setLinkedFields();
      mpx.setMaterialLabel(xml.getMaterialLabel());
      mpx.setMaxUnits(DatatypeConverter.parseUnits(xml.getMaxUnits()));
      mpx.setName(xml.getName());
      if (xml.getNotes() != null && xml.getNotes().length() != 0)
      {
         mpx.setNotes(xml.getNotes());
      }
      mpx.setNtAccount(xml.getNTAccount());
      //mpx.setObjects();     
      mpx.setOvertimeCost(DatatypeConverter.parseCurrency(xml.getOvertimeCost()));
      mpx.setOvertimeRate(DatatypeConverter.parseRate(xml.getOvertimeRate()));
      mpx.setOvertimeRateUnits(DatatypeConverter.parseTimeUnit(xml.getOvertimeRateFormat()));
      mpx.setOvertimeWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getOvertimeWork()));
      mpx.setPeakUnits(DatatypeConverter.parseUnits(xml.getPeakUnits()));
      mpx.setPercentWorkComplete(xml.getPercentWorkComplete());
      mpx.setPhonetics(xml.getPhonetics());
      mpx.setRegularWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getRegularWork()));
      mpx.setRemainingCost(DatatypeConverter.parseCurrency(xml.getRemainingCost()));
      mpx.setRemainingOvertimeCost(DatatypeConverter.parseCurrency(xml.getRemainingOvertimeCost()));
      mpx.setRemainingWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getRemainingWork()));
      mpx.setRemainingOvertimeWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getRemainingOvertimeWork()));
      mpx.setStandardRate(DatatypeConverter.parseRate(xml.getStandardRate()));
      mpx.setStandardRateUnits(DatatypeConverter.parseTimeUnit(xml.getStandardRateFormat()));
      mpx.setSV(DatatypeConverter.parseCurrency(xml.getSV()));
      mpx.setType(xml.getType());
      mpx.setUniqueID(NumberUtility.getInteger(xml.getUID()));
      mpx.setWork(DatatypeConverter.parseDuration(m_projectFile, null, xml.getWork()));
      mpx.setWorkGroup(xml.getWorkGroup());
      mpx.setWorkVariance(DatatypeConverter.parseDurationInThousanthsOfMinutes(xml.getWorkVariance()));

      if (mpx.getType() == ResourceType.MATERIAL && BooleanUtility.getBoolean(xml.isIsCostResource()))
      {
         mpx.setType(ResourceType.COST);
      }

      readResourceExtendedAttributes(xml, mpx);

      readResourceBaselines(xml, mpx);

      mpx.setResourceCalendar(calendarMap.get(xml.getCalendarUID()));

      // ensure that we cache this value
      mpx.setOverAllocated(BooleanUtility.getBoolean(xml.isOverAllocated()));

      readCostRateTables(mpx, xml.getRates());

      readAvailabilityTable(mpx, xml.getAvailabilityPeriods());

View Full Code Here

      Integer[] uniqueid = rscVarMeta.getUniqueIdentifierArray();
      Integer id;
      Integer offset;
      byte[] data;
      byte[] metaData;
      Resource resource;

      RTFUtility rtf = new RTFUtility();
      String notes;

      for (int loop = 0; loop < uniqueid.length; loop++)
      {
         id = uniqueid[loop];
         offset = resourceMap.get(id);
         if (offset == null)
         {
            continue;
         }

         data = rscFixedData.getByteArrayValue(offset.intValue());
         byte[] metaData2 = rscFixed2Meta.getByteArrayValue(offset.intValue());
         byte[] data2 = rscFixed2Data.getByteArrayValue(offset.intValue());
         //metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         //MPPUtility.dataDump(data, true, true, true, true, true, true, true);
         //MPPUtility.dataDump(metaData, true, true, true, true, true, true, true);
         //MPPUtility.varDataDump(rscVarData, id, true, true, true, true, true, true);

         resource = m_file.addResource();

         resource.disableEvents();
         fieldMap.populateContainer(resource, id, new byte[][]
         {
            data,
            data2
         }, rscVarData);
         resource.enableEvents();

         resource.setBudget((metaData2[8] & 0x20) != 0);

         resource.setGUID(MPPUtility.getGUID(data2, 0));

         processHyperlinkData(resource, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.HYPERLINK_DATA)));

         resource.setID(Integer.valueOf(MPPUtility.getInt(data, 4)));

         resource.setOutlineCode1(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE1_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode2(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE2_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode3(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE3_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode4(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE4_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode5(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE5_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode6(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE6_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode7(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE7_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode8(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE8_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode9(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE9_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode10(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE10_INDEX))), OUTLINECODE_DATA));

         resource.setType((resource.getWorkGroup() == WorkGroup.DEFAULT ? ResourceType.WORK : ((metaData2[8] & 0x10) == 0) ? ResourceType.MATERIAL : ResourceType.COST));
         resource.setUniqueID(id);

         metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         resource.setFlag1((metaData[28] & 0x40) != 0);
         resource.setFlag2((metaData[28] & 0x80) != 0);
         resource.setFlag3((metaData[29] & 0x01) != 0);
         resource.setFlag4((metaData[29] & 0x02) != 0);
         resource.setFlag5((metaData[29] & 0x04) != 0);
         resource.setFlag6((metaData[29] & 0x08) != 0);
         resource.setFlag7((metaData[29] & 0x10) != 0);
         resource.setFlag8((metaData[29] & 0x20) != 0);
         resource.setFlag9((metaData[29] & 0x40) != 0);
         resource.setFlag10((metaData[28] & 0x20) != 0);
         resource.setFlag11((metaData[29] & 0x20) != 0);
         resource.setFlag12((metaData[30] & 0x01) != 0);
         resource.setFlag13((metaData[30] & 0x02) != 0);
         resource.setFlag14((metaData[30] & 0x04) != 0);
         resource.setFlag15((metaData[30] & 0x08) != 0);
         resource.setFlag16((metaData[30] & 0x10) != 0);
         resource.setFlag17((metaData[30] & 0x20) != 0);
         resource.setFlag18((metaData[30] & 0x40) != 0);
         resource.setFlag19((metaData[30] & 0x80) != 0);
         resource.setFlag20((metaData[31] & 0x01) != 0);

         notes = resource.getNotes();
         if (notes != null)
         {
            if (m_reader.getPreserveNoteFormatting() == false)
            {
               notes = rtf.strip(notes);
            }

            resource.setNotes(notes);
         }

         //
         // Configure the resource calendar
         //
         resource.setResourceCalendar(m_resourceMap.get(id));

         //
         // Process any enterprise columns
         //        
         processResourceEnterpriseColumns(resource, metaData2);

         //
         // Process cost rate tables
         //
         CostRateTableFactory crt = new CostRateTableFactory();
         crt.process(resource, 0, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_A)));
         crt.process(resource, 1, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_B)));
         crt.process(resource, 2, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_C)));
         crt.process(resource, 3, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_D)));
         crt.process(resource, 4, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_E)));

         //
         // Process availability table
         //
         AvailabilityFactory af = new AvailabilityFactory();
         af.process(resource.getAvailability(), rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.AVAILABILITY_DATA)));

         m_file.fireResourceReadEvent(resource);
      }
   }
View Full Code Here

      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);
      }
   }
View Full Code Here

TOP

Related Classes of net.sf.mpxj.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.