Exemplo n.º 1
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 initializeCriteria(Task task) {
     for (ResourceAllocation<?> each: task.getLimitingResourceAllocations()) {
         if (isGeneric(each)) {
             initializeCriteria((GenericResourceAllocation) each);
         }
     }
 }
 /**
  * Re-attach {@link TaskSource}
  */
 private void reattachTaskSource() {
     TaskSource taskSource = task.getTaskSource();
     taskSourceDAO.reattach(taskSource);
     Set<HoursGroup> hoursGroups = taskSource.getHoursGroups();
     for (HoursGroup hoursGroup : hoursGroups) {
         reattachHoursGroup(hoursGroup);
     }
 }
 @Override
 @Transactional(readOnly = true)
 public List<AggregatedHoursGroup> getHoursAggregatedByCriteria() {
     reattachTaskSource();
     List<AggregatedHoursGroup> result = task.getTaskSource()
             .getAggregatedByCriterions();
     ensuringAccesedPropertiesAreLoaded(result);
     return result;
 }
Exemplo n.º 5
0
    private static OrderElement getRootOrder(Task task) {
        OrderElement order = task.getOrderElement();

        while (order.getParent() != null) {
            order = order.getParent();
        }

        return order;
    }
 private void addAssociatedLimitingResourceQueueElement(Task task, ResourceAllocation<?> resourceAllocation) {
     LimitingResourceQueueElement element = LimitingResourceQueueElement.create();
     resourceAllocation.setLimitingResourceQueueElement(element);
     task.setResourceAllocation(resourceAllocation);
 }
Exemplo n.º 7
0
 private void forceLoadHoursGroup(Task task) {
   task.getHoursGroup();
 }
Exemplo n.º 8
0
    private static QueueTask createDivForElement(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) {

        final Task task = queueElement.getResourceAllocation().getTask();
        final OrderElement order = getRootOrder(task);

        QueueTask result = new QueueTask(queueElement);
        String cssClass = "queue-element";
        result.setTooltiptext(createTooltiptext(queueElement));

        int startPixels = getStartPixels(datesMapper, queueElement);
        result.setLeft(forCSS(startPixels));

        if ( startPixels < 0 ) {
            cssClass += " truncated-start ";
        }

        int taskWidth = getWidthPixels(datesMapper, queueElement);

        if ( (startPixels + taskWidth) > datesMapper.getHorizontalSize() ) {
            taskWidth = datesMapper.getHorizontalSize() - startPixels;
            cssClass += " truncated-end ";
        } else {
            result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
        }
        result.setWidth(forCSS(taskWidth));

        LocalDate deadlineDate = task.getDeadline();
        boolean isOrderDeadline = false;

        if ( deadlineDate == null ) {

            Date orderDate = order.getDeadline();

            if ( orderDate != null ) {

                deadlineDate = LocalDate.fromDateFields(orderDate);
                isOrderDeadline = true;

            }
        }

        if ( deadlineDate != null ) {

            int deadlinePosition = getDeadlinePixels(datesMapper, deadlineDate);

            if ( deadlinePosition < datesMapper.getHorizontalSize() ) {
                Div deadline = new Div();
                deadline.setSclass(isOrderDeadline ? "deadline order-deadline" : "deadline");
                deadline.setLeft((deadlinePosition - startPixels - DEADLINE_MARK_HALF_WIDTH) + "px");
                result.appendChild(deadline);
                result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
            }

            if ( deadlineDate.isBefore(queueElement.getEndDate()) ) {
                cssClass += " unmet-deadline ";
            }
        }

        result.setClass(cssClass);
        result.appendChild(generateCompletionShade(datesMapper, queueElement));
        Component progressBar = generateProgressBar(datesMapper, queueElement);

        if ( progressBar != null ) {
            result.appendChild(progressBar);
        }

        return result;
    }
 public void visit(Task task) {
   TaskStatusEnum status = task.getTaskStatus();
   Integer currentValue = getTaskStatusData().get(status);
   taskStatusData.put(status, Integer.valueOf(currentValue.intValue() + 1));
 }