Process project properties.

@param row project properties data.
426509
public void processProjectProperties(Row row)
   {
      ProjectProperties ph = m_project.getProjectProperties();
      ph.setDuration(row.getDuration("DURATIONHOURS"));
      ph.setStartDate(row.getDate("STARU"));
      ph.setFinishDate(row.getDate("ENE"));
      ph.setName(row.getString("SHORT_NAME"));
      ph.setAuthor(row.getString("PROJECT_BY"));
      //DURATION_TIME_UNIT
      ph.setLastSaved(row.getDate("LAST_EDITED_DATE"));
   }
905171
private void readProjectProperties(Project project) throws MPXJException
   {
      ProjectProperties properties = m_projectFile.getProjectProperties();

      properties.setCompany(project.getCompany());
      properties.setManager(project.getManager());
      properties.setName(project.getName());
      properties.setStartDate(getDateTime(project.getProjectStart()));
   }
324934
public void processCalendar(Row row)
   {
      ProjectCalendar calendar = m_project.addCalendar();

      Integer id = row.getInteger("clndr_id");
      m_calMap.put(id, calendar);
      calendar.setName(row.getString("clndr_name"));

      try
      {
         calendar.setMinutesPerDay(Integer.valueOf((int) NumberHelper.getDouble(row.getDouble("day_hr_cnt")) * 60));
         calendar.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("week_hr_cnt")) * 60)));
         calendar.setMinutesPerMonth(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("month_hr_cnt")) * 60)));
         calendar.setMinutesPerYear(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("year_hr_cnt")) * 60)));
      }
      catch (ClassCastException ex)
      {
         // We have seen examples of malformed calendar data where fields have been missing
         // from the record. We'll typically get a class cast exception here as we're trying
         // to process something which isn't a double.
         // We'll just return at this point as it's not clear that we can salvage anything
         // sensible from this record.
         return;
      }

      // Process data
      String calendarData = row.getString("clndr_data");
      if (calendarData != null && !calendarData.isEmpty())
      {
         Record root = Record.getRecord(calendarData);
         if (root != null)
         {
            processCalendarDays(calendar, root);
            processCalendarExceptions(calendar, root);
         }
      }
      else
      {
         // if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00
         DateRange defaultHourRange = new DateRange(DateHelper.getTime(8, 0), DateHelper.getTime(16, 0));
         for (Day day : Day.values())
         {
            if (day != Day.SATURDAY && day != Day.SUNDAY)
            {
               calendar.setWorkingDay(day, true);
               ProjectCalendarHours hours = calendar.addCalendarHours(day);
               hours.addRange(defaultHourRange);
            }
            else
            {
               calendar.setWorkingDay(day, false);
            }
         }
      }

      m_eventManager.fireCalendarReadEvent(calendar);
   }
1249747
private void process() {
    Entity entity = entityClass.getAnnotation(Entity.class);
    ProjectedEntity projectedEntity = entityClass.getAnnotation(ProjectedEntity.class);
    if (entity != null) {
      initEntityMetadata(entity);
    } else if (projectedEntity != null) {
      initEntityMetadata(projectedEntity);
    } else {
      String message = String.format("Class %s must either have %s or %s annotation",
          entityClass.getName(), Entity.class.getName(), ProjectedEntity.class.getName());
      throw new EntityManagerException(message);
    }

    processPropertyOverrides();

    processFields();
    // If we did not find valid Identifier...
    if (entityMetadata.getIdentifierMetadata() == null) {
      throw new EntityManagerException(
          String.format("Class %s requires a field with annotation of %s", entityClass.getName(),
              Identifier.class.getName()));
    }
    entityMetadata.setEntityListenersMetadata(EntityListenersIntrospector.introspect(entityClass));
    entityMetadata.ensureUniqueProperties();
    entityMetadata.cleanup();
  }
705486
public void processPredecessors(List<Row> rows, List<Row> completedSections)
   {
      Map<Integer, Integer> completedSectionMap = new HashMap<Integer, Integer>();
      for (Row section : completedSections)
      {
         completedSectionMap.put(section.getInteger("TASK_COMPLETED_SECTIONID"), section.getInteger("TASK"));
      }

      for (Row row : rows)
      {
         Integer startTaskID = row.getInteger("START_TASK");                 
         Task startTask = m_project.getTaskByUniqueID(startTaskID);
         if (startTask == null)
         {
            startTaskID = completedSectionMap.get(startTaskID);            
            if (startTaskID != null)
            {
               startTask = m_project.getTaskByUniqueID(startTaskID);
            }   
         }
         
         Integer endTaskID = row.getInteger("END_TASK");
         Task endTask = m_project.getTaskByUniqueID(endTaskID);
         if (endTask == null)
         {
            endTaskID = completedSectionMap.get(endTaskID);            
            if (endTaskID != null)
            {
               endTask = m_project.getTaskByUniqueID(endTaskID);
            }   
         }

         if (startTask != null && endTask != null)
         {
            RelationType type = getRelationType(row.getInt("TYPI"));

            double startLag = row.getDuration("START_LAG_TIMEHOURS").getDuration();
            double endLag = row.getDuration("END_LAG_TIMEHOURS").getDuration();
            double totalLag = startLag - endLag;

            Relation relation = endTask.addPredecessor(startTask, type, Duration.getInstance(totalLag, TimeUnit.HOURS));
            relation.setUniqueID(row.getInteger("LINKID"));
         }

         //PROJID
         //LINKID
         //START_LAG_TIMETYPF
         //START_LAG_TIMEELA_MONTHS
         //START_LAG_TIMEHOURS
         //END_LAG_TIMETYPF
         //END_LAG_TIMEELA_MONTHS
         //END_LAG_TIMEHOURS
         //MAXIMUM_LAGTYPF
         //MAXIMUM_LAGELA_MONTHS
         //MAXIMUM_LAGHOURS
         //STARV_DATE
         //ENF_DATE
         //CURVATURE_PERCENTAGE
         //START_LAG_PERCENT_FLOAT
         //END_LAG_PERCENT_FLOAT
         //COMMENTS
         //LINK_CATEGORY
         //START_LAG_TIME_UNIT
         //END_LAG_TIME_UNIT
         //MAXIMUM_LAG_TIME_UNIT
         //START_TASK
         //END_TASK
         //TYPI
         //START_LAG_TYPE
         //END_LAG_TYPE
         //MAINTAIN_TASK_OFFSETS
         //UNSCHEDULABLF
         //CRITICAL
         //ON_LOOP
         //MAXIMUM_LAG_MODE
         //ANNOTATE_LEAD_LAG
         //START_REPOSITION_ON_TAS_MOVE
         //END_REPOSITION_ON_TASK_MOVE
         //DRAW_CURVED_IF_VERTICAL
         //AUTOMATIC_CURVED_LI_SETTINGS
         //DRAW_CURVED_LINK_TO_LEFT
         //LOCAL_LINK
         //DRIVING
         //ALT_ID
         //LAST_EDITED_DATE
         //LAST_EDITED_BY
      }
   }
612456
private void processSchedulingProjectProperties() throws SQLException
   {
      List<Row> rows = getRows("select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'", m_projectID);
      if (!rows.isEmpty())
      {
         Row row = rows.get(0);
         Record record = Record.getRecord(row.getString("prop_value"));
         if (record != null)
         {
            String[] keyValues = record.getValue().split("\\|");
            for (int i = 0; i < keyValues.length - 1; ++i)
            {
               if ("sched_calendar_on_relationship_lag".equals(keyValues[i]))
               {
                  Map<String, Object> customProperties = new HashMap<String, Object>();
                  customProperties.put("LagCalendar", keyValues[i + 1]);
                  m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
                  break;
               }
            }
         }
      }
   }
512742
public void putBuildRow(BaseRow row) throws IOException {
		final int hashCode = hash(this.buildSideProjection.apply(row).hashCode(), 0);
		// TODO: combine key projection and build side conversion to code gen.
		insertIntoTable(originBuildSideSerializer.baseRowToBinary(row), hashCode);
	}
207668
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)
      {
         ResourceAssignment assignment = task.addResourceAssignment(resource);
         m_assignmentMap.put(row.getInteger("ASSN_UID"), assignment);

         assignment.setActualCost(row.getCurrency("ASSN_ACT_COST"));
         assignment.setActualFinish(row.getDate("ASSN_ACT_FINISH"));
         assignment.setActualOvertimeCost(row.getCurrency("ASSN_ACT_OVT_COST"));
         assignment.setActualOvertimeWork(row.getDuration("ASSN_ACT_OVT_WORK"));
         assignment.setActualStart(row.getDate("ASSN_ACT_START"));
         assignment.setActualWork(row.getDuration("ASSN_ACT_WORK"));
         assignment.setACWP(row.getCurrency("ASSN_ACWP"));
         assignment.setBaselineCost(row.getCurrency("ASSN_BASE_COST"));
         assignment.setBaselineFinish(row.getDate("ASSN_BASE_FINISH"));
         assignment.setBaselineStart(row.getDate("ASSN_BASE_START"));
         assignment.setBaselineWork(row.getDuration("ASSN_BASE_WORK"));
         assignment.setBCWP(row.getCurrency("ASSN_BCWP"));
         assignment.setBCWS(row.getCurrency("ASSN_BCWS"));
         assignment.setCost(row.getCurrency("ASSN_COST"));
         assignment.setCostRateTableIndex(row.getInt("ASSN_COST_RATE_TABLE"));
         //assignment.setCostVariance();
         //assignment.setCreateDate(row.getDate("ASSN_CREATION_DATE")); - not present in some MPD files?
         //assignment.setCV();
         assignment.setDelay(row.getDuration("ASSN_DELAY"));
         assignment.setFinish(row.getDate("ASSN_FINISH_DATE"));
         assignment.setFinishVariance(MPDUtility.getAdjustedDuration(m_project, row.getInt("ASSN_FINISH_VAR"), TimeUnit.DAYS));

         //assignment.setGUID();
         assignment.setLevelingDelay(MPDUtility.getAdjustedDuration(m_project, row.getInt("ASSN_LEVELING_DELAY"), MPDUtility.getDurationTimeUnits(row.getInt("ASSN_DELAY_FMT"))));
         assignment.setLinkedFields(row.getBoolean("ASSN_HAS_LINKED_FIELDS"));
         //assignment.setOvertimeCost();
         assignment.setOvertimeWork(row.getDuration("ASSN_OVT_WORK"));
         //assignment.setPercentageWorkComplete();
         assignment.setRemainingCost(row.getCurrency("ASSN_REM_COST"));
         assignment.setRemainingOvertimeCost(row.getCurrency("ASSN_REM_OVT_COST"));
         assignment.setRemainingOvertimeWork(row.getDuration("ASSN_REM_OVT_WORK"));
         assignment.setRegularWork(row.getDuration("ASSN_REG_WORK"));
         assignment.setRemainingWork(row.getDuration("ASSN_REM_WORK"));
         assignment.setResponsePending(row.getBoolean("ASSN_RESPONSE_PENDING"));
         assignment.setStart(row.getDate("ASSN_START_DATE"));
         assignment.setStartVariance(MPDUtility.getAdjustedDuration(m_project, row.getInt("ASSN_START_VAR"), TimeUnit.DAYS));

         //assignment.setSV();
         assignment.setTeamStatusPending(row.getBoolean("ASSN_TEAM_STATUS_PENDING"));
         assignment.setUniqueID(row.getInteger("ASSN_UID"));
         assignment.setUnits(Double.valueOf(row.getDouble("ASSN_UNITS").doubleValue() * 100.0d));
         assignment.setUpdateNeeded(row.getBoolean("ASSN_UPDATE_NEEDED"));
         //assignment.setVAC(v);
         assignment.setWork(row.getDuration("ASSN_WORK"));
         assignment.setWorkContour(WorkContour.getInstance(row.getInt("ASSN_WORK_CONTOUR")));
         //assignment.setWorkVariance();

         String notes = row.getString("ASSN_RTF_NOTES");
         if (notes != null)
         {
            if (m_preserveNoteFormatting == false)
            {
               notes = RtfHelper.strip(notes);
            }
            assignment.setNotes(notes);
         }

         m_eventManager.fireAssignmentReadEvent(assignment);
      }
   }
58484
protected void processCalendar(Row row)
   {
      Integer uniqueID = row.getInteger("CAL_UID");
      if (NumberHelper.getInt(uniqueID) > 0)
      {
         boolean baseCalendar = row.getBoolean("CAL_IS_BASE_CAL");
         ProjectCalendar cal;
         if (baseCalendar == true)
         {
            cal = m_project.addCalendar();
            cal.setName(row.getString("CAL_NAME"));
         }
         else
         {
            Integer resourceID = row.getInteger("RES_UID");
            cal = m_project.addCalendar();
            m_baseCalendarReferences.add(new Pair<ProjectCalendar, Integer>(cal, row.getInteger("CAL_BASE_UID")));
            m_resourceMap.put(resourceID, cal);
         }

         cal.setUniqueID(uniqueID);
         m_calendarMap.put(uniqueID, cal);
         m_eventManager.fireCalendarReadEvent(cal);
      }
   }
527712
public function processRow($row)
    {
        if (!$this->colsprinted && $this->showheaders) {
            $first = true;
            foreach ($row as $fieldName => $ignore) {
                if ($first) {
                    $first = false;
                } else {
                    $line .= ",";
                }
                $line .= $fieldName;
            }

            $this->out->write($line);
            $this->out->write(PHP_EOL);

            $line = "";
            $colsprinted = true;
        } // if show headers

        $first = true;
        foreach ($row as $columnValue) {
            if ($columnValue != null) {
                $columnValue = trim($columnValue);
            }

            if ($first) {
                $first = false;
            } else {
                $line .= $this->coldelimiter;
            }
            $line .= $columnValue;
        }

        $this->out->write($line);
        $this->out->write($this->rowdelimiter);
    }
767790
private void processProject() throws SQLException
   {
      ProjectProperties props = m_project.getProjectProperties();
      Row row = getRows("select * from zproject where z_pk=?", m_projectID).get(0);
      props.setWeekStartDay(Day.getInstance(row.getInt("ZFIRSTDAYOFWEEK") + 1));
      props.setScheduleFrom(row.getInt("ZSCHEDULINGDIRECTION") == 1 ? ScheduleFrom.START : ScheduleFrom.FINISH);
      props.setMinutesPerDay(Integer.valueOf(row.getInt("ZHOURSPERDAY") * 60));
      props.setDaysPerMonth(row.getInteger("ZDAYSPERMONTH"));
      props.setMinutesPerWeek(Integer.valueOf(row.getInt("ZHOURSPERWEEK") * 60));
      props.setStatusDate(row.getTimestamp("ZGIVENSTATUSDATE"));
      props.setCurrencySymbol(row.getString("ZCURRENCYSYMBOL"));
      props.setName(row.getString("ZTITLE"));
      props.setUniqueID(row.getUUID("ZUNIQUEID").toString());
   }
589596
public void update(final T row)
	{
		final int index = data.indexOf(row);
		if (index != -1)
		{
			data.set(index, row);
			fireTableDataChanged();
		}
	}
1282175
private void processAssignments(ProjectType project)
   {
      List<ResourceAssignmentType> assignments = project.getResourceAssignment();
      for (ResourceAssignmentType row : assignments)
      {
         Task task = m_projectFile.getTaskByUniqueID(mapTaskID(row.getActivityObjectId()));
         Resource resource = m_projectFile.getResourceByUniqueID(row.getResourceObjectId());
         if (task != null && resource != null)
         {
            ResourceAssignment assignment = task.addResourceAssignment(resource);

            assignment.setUniqueID(row.getObjectId());
            assignment.setRemainingWork(getDuration(row.getRemainingUnits()));
            assignment.setBaselineWork(getDuration(row.getPlannedUnits()));
            assignment.setActualWork(getDuration(row.getActualUnits()));
            assignment.setRemainingCost(row.getRemainingCost());
            assignment.setBaselineCost(row.getPlannedCost());
            assignment.setActualCost(row.getActualCost());
            assignment.setActualStart(row.getActualStartDate());
            assignment.setActualFinish(row.getActualFinishDate());
            assignment.setBaselineStart(row.getPlannedStartDate());
            assignment.setBaselineFinish(row.getPlannedFinishDate());
            assignment.setGUID(DatatypeConverter.parseUUID(row.getGUID()));

            task.setActualCost(Double.valueOf(NumberHelper.getDouble(task.getActualCost()) + NumberHelper.getDouble(assignment.getActualCost())));
            task.setRemainingCost(Double.valueOf(NumberHelper.getDouble(task.getRemainingCost()) + NumberHelper.getDouble(assignment.getRemainingCost())));
            task.setBaselineCost(Double.valueOf(NumberHelper.getDouble(task.getBaselineCost()) + NumberHelper.getDouble(assignment.getBaselineCost())));

            populateField(assignment, AssignmentField.WORK, AssignmentField.ACTUAL_WORK, AssignmentField.BASELINE_WORK);
            populateField(assignment, AssignmentField.COST, AssignmentField.ACTUAL_COST, AssignmentField.BASELINE_COST);
            populateField(assignment, AssignmentField.START, AssignmentField.ACTUAL_START, AssignmentField.BASELINE_START);
            populateField(assignment, AssignmentField.FINISH, AssignmentField.ACTUAL_FINISH, AssignmentField.BASELINE_FINISH);

            readUDFTypes(assignment, row.getUDF());

            m_eventManager.fireAssignmentReadEvent(assignment);
         }
      }
   }
227333
private void processResources() throws IOException
   {
      CompanyReader reader = new CompanyReader(m_data.getTableData("Companies"));
      reader.read();
      for (MapRow companyRow : reader.getRows())
      {
         // TODO: need to sort by type as well as by name!
         for (MapRow resourceRow : sort(companyRow.getRows("RESOURCES"), "NAME"))
         {
            processResource(resourceRow);
         }
      }
   }
101718
public void processResourceRates(List<Row> rows)
   {
      // Primavera defines resource cost tables by start dates so sort and define end by next
      Collections.sort(rows, new Comparator<Row>()
      {
         @Override public int compare(Row r1, Row r2)
         {
            Integer id1 = r1.getInteger("rsrc_id");
            Integer id2 = r2.getInteger("rsrc_id");
            int cmp = NumberHelper.compare(id1, id2);
            if (cmp != 0)
            {
               return cmp;
            }
            Date d1 = r1.getDate("start_date");
            Date d2 = r2.getDate("start_date");
            return DateHelper.compare(d1, d2);
         }
      });

      for (int i = 0; i < rows.size(); ++i)
      {
         Row row = rows.get(i);

         Integer resourceID = row.getInteger("rsrc_id");
         Rate standardRate = new Rate(row.getDouble("cost_per_qty"), TimeUnit.HOURS);
         TimeUnit standardRateFormat = TimeUnit.HOURS;
         Rate overtimeRate = new Rate(0, TimeUnit.HOURS); // does this exist in Primavera?
         TimeUnit overtimeRateFormat = TimeUnit.HOURS;
         Double costPerUse = NumberHelper.getDouble(0.0);
         Double maxUnits = NumberHelper.getDouble(NumberHelper.getDouble(row.getDouble("max_qty_per_hr")) * 100); // adjust to be % as in MS Project
         Date startDate = row.getDate("start_date");
         Date endDate = DateHelper.LAST_DATE;

         if (i + 1 < rows.size())
         {
            Row nextRow = rows.get(i + 1);
            int nextResourceID = nextRow.getInt("rsrc_id");
            if (resourceID.intValue() == nextResourceID)
            {
               endDate = nextRow.getDate("start_date");
            }
         }

         Resource resource = m_project.getResourceByUniqueID(resourceID);
         if (resource != null)
         {
            CostRateTable costRateTable = resource.getCostRateTable(0);
            if (costRateTable == null)
            {
               costRateTable = new CostRateTable();
               resource.setCostRateTable(0, costRateTable);
            }
            CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate);
            costRateTable.add(entry);

            AvailabilityTable availabilityTable = resource.getAvailability();
            Availability newAvailability = new Availability(startDate, endDate, maxUnits);
            availabilityTable.add(newAvailability);
         }
      }
   }
1167317
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      try
      {
         populateMemberData(reader, file, root);
         processProjectProperties();

         if (!reader.getReadPropertiesOnly())
         {
            processCalendarData();
            processResourceData();
            processTaskData();
            processConstraintData();
            processAssignmentData();

            if (reader.getReadPresentationData())
            {
               processViewPropertyData();
               processViewData();
               processTableData();
            }
         }
      }

      finally
      {
         clearMemberData();
      }
   }
803427
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());
   }