public ProjectStatusReportDTO(OrderElement orderElement, Order orderToAppendName) {
    code = orderElement.getCode();

    if (orderToAppendName != null) {
      name = orderElement.getName() + " (" + orderToAppendName.getName() + ")";
    } else {
      name = Util.getPrefixSpacesDependingOnDepth(orderElement) + orderElement.getName();
    }

    Integer estimatedHours = orderElement.getWorkHours();
    this.estimatedHours = estimatedHours != null ? EffortDuration.hours(estimatedHours) : null;

    TaskSource taskSource = orderElement.getTaskSource();
    if (taskSource != null) {
      plannedHours = taskSource.getTask().getSumOfAssignedEffort();
    }

    SumChargedEffort sumChargedEffort = orderElement.getSumChargedEffort();
    if (sumChargedEffort != null) {
      imputedHours = sumChargedEffort.getTotalChargedEffort();
    }

    setBudget(orderElement.getSubstractedBudget());

    setExpensesBudget(orderElement.getBudget());
    setResourcesBudget(orderElement.getResourcesBudget());
  }
Пример #2
0
    private static String createTooltiptext(LimitingResourceQueueElement element) {
        final Task task = element.getResourceAllocation().getTask();
        final OrderElement order = getRootOrder(task);

        StringBuilder result = new StringBuilder();
        result.append(_("Project: {0}", order.getName())).append(" ");
        result.append(_("Task: {0}", task.getName())).append(" ");
        result.append(_("Completed: {0}%", element.getAdvancePercentage().multiply(new BigDecimal(100)))).append(" ");

        final ResourceAllocation<?> resourceAllocation = element.getResourceAllocation();

        if ( resourceAllocation instanceof SpecificResourceAllocation ) {

            final SpecificResourceAllocation specific = (SpecificResourceAllocation) resourceAllocation;
            result.append(_("Resource: {0}", specific.getResource().getName())).append(" ");

        } else if ( resourceAllocation instanceof GenericResourceAllocation ) {

            final GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;

            /* TODO resolve deprecated */
            result.append(_("Criteria: {0}", Criterion.getCaptionFor(generic.getCriterions()))).append(" ");

        }
        result.append(_("Allocation: [{0},{1}]", element.getStartDate().toString(), element.getEndDate()));

        return result.toString();
    }
 private void initialize(OrderElement orderElement) {
   orderElement.getName();
   (orderDAO.loadOrderAvoidingProxyFor(orderElement)).getName();
 }