Package org.libreplan.business.orders.entities

Examples of org.libreplan.business.orders.entities.OrderElement


        treeController.remove(element);
    }

    @Override
    protected void showEditElement(Treeitem item) {
        OrderElement orderElement = (OrderElement) item.getValue();
        treeController.markModifiedTreeitem(item.getTreerow());
        IOrderElementModel model = orderModel
                .getOrderElementModel(orderElement);
        orderElementController.openWindow(model);
        treeController.refreshRow(item);
View Full Code Here


        return calendar;
    }

    public BaseCalendar getCalendar() {
        if (calendar == null) {
            OrderElement orderElement = getOrderElement();
            return orderElement != null ? orderElement.getOrder().getCalendar()
                    : null;
        }
        return calendar;
    }
View Full Code Here

        }
        Executions.getCurrent().sendRedirect(url);
    }

    public void addOrderElement() {
        OrderElement orderElement = (OrderElement) orderElementBandboxSearch
                .getSelectedElement();
        if (orderElement != null) {
            personalTimesheetModel.addOrderElement(orderElement);
            orderElementBandboxSearch.setSelectedElement(null);
            Util.reloadBindings(timesheet);
View Full Code Here

        OrderVersion orderVersion = OrderVersion.createInitialVersion(current);

        Validate.notNull(orderVersion);

        OrderElement orderElement;

        orderElement = Order.createUnvalidated(code);

        orderElement.setCodeAutogenerated(true);

        ((Order) orderElement).setVersionForScenario(current, orderVersion);

        ((Order) orderElement).setDependenciesConstraintsHavePriority(true);

        BaseCalendar calendar = configurationDAO.getConfiguration()
                .getDefaultCalendar();

        if (importCalendar & project.calendarName != null) {
            ((Order) orderElement).setCalendar(findBaseCalendar(
project.calendarName));
        } else {
            ((Order) orderElement).setCalendar(calendar);
        }

        orderElement.useSchedulingDataFor(orderVersion);

        List<OrderElement> children = new ArrayList<OrderElement>();

        for (OrderElementDTO task : project.tasks) {
            children.add(convertImportTaskToOrderElement(orderVersion, task));
        }

        for (OrderElement child : children) {
            ((OrderLineGroup) orderElement).add(child);
        }

        orderElement.setName(project.name + ": " + project.hashCode());
        orderElement.setCode(code);

        orderElement.setInitDate(project.startDate);

        orderElement.setDeadline(project.deadline);

        ((Order) orderElement).calculateAndSetTotalHours();

        project.order = (Order) orderElement;
View Full Code Here

     */
    private OrderElement convertImportTaskToOrderElement(
            OrderVersion orderVersion, OrderElementDTO task) {

        Validate.notNull(orderVersion);
        OrderElement orderElement;

        if (task.children.size() == 0) {
            orderElement = OrderLine.createUnvalidatedWithUnfixedPercentage(
                    UUID.randomUUID().toString(), task.totalHours);

            if (!orderElement.getHoursGroups().isEmpty()) {
                orderElement.getHoursGroups().get(0)
                        .setCode(UUID.randomUUID().toString());
            }

        } else {

            orderElement = OrderLineGroup.createUnvalidated(UUID.randomUUID()
                    .toString());

            orderElement.useSchedulingDataFor(orderVersion);
        }

        List<OrderElement> children = new ArrayList<OrderElement>();

        for (OrderElementDTO childrenTask : task.children) {
            children.add(convertImportTaskToOrderElement(orderVersion,
                    childrenTask));
        }

        for (OrderElement child : children) {

            ((OrderLineGroup) orderElement).add(child);
        }

        orderElement.setName(task.name);

        orderElement.setDeadline(task.deadline);

        task.orderElement = orderElement;

        return orderElement;
    }
View Full Code Here

     *
     * @return TaskElement TaskElement that represent the data.
     */
    private TaskElement createTask(OrderElementDTO task, boolean importCalendar) {

        OrderElement orderElement = task.orderElement;

        TaskElement taskElement;

        TaskSource taskSource;

        if (task.children.size() == 0) {

            taskSource = TaskSource.create(
                    orderElement.getCurrentSchedulingDataForVersion(),
                    orderElement.getHoursGroups());

            taskElement = taskSource
                    .createTaskWithoutDatesInitializedAndLinkItToTaskSource();

            if (importCalendar && task.calendarName != null) {
                taskElement.setCalendar(findBaseCalendar(task.calendarName));
            }

            setPositionConstraint((Task) taskElement, task);

        } else {

            taskSource = TaskSource.createForGroup(orderElement
                    .getCurrentSchedulingDataForVersion());

            taskElement = taskSource
                    .createTaskGroupWithoutDatesInitializedAndLinkItToTaskSource();

View Full Code Here

    protected List<HoursGroup> getHoursGroups(OrderElement orderElement) {
        return orderElement.getHoursGroups();
    }

    public boolean isEditableHoursGroup() {
        OrderElement element = getElement();
        return element != null && element instanceof OrderLine
                && !element.isJiraIssue();
    }
View Full Code Here

        return assignedHours.divide(estimatedHours, RoundingMode.DOWN);
    }

    @Override
    public void remove(Long id) throws InstanceNotFoundException {
        OrderElement orderElement = find(id);
        removeTaskSourcesFor(this.taskSourceDAO, orderElement);
        for (WorkReport each : getWorkReportsPointingTo(orderElement)) {
            workReportDAO.remove(each.getId());
        }
        super.remove(id);
View Full Code Here

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(null, getEntityClass()
                    .getName());
        }

        OrderElement entity = (OrderElement) getSession().createCriteria(
                getEntityClass())
                .add(
                        Restrictions.eq("infoComponent.code", code.trim())
                                .ignoreCase()).uniqueResult();
View Full Code Here

    public OrderElement findUniqueByCode(String code)
            throws InstanceNotFoundException {
        Criteria c = getSession().createCriteria(OrderElement.class);
        c.add(Restrictions.eq("infoComponent.code", code));

        OrderElement orderElement = (OrderElement) c.uniqueResult();
        if (orderElement == null) {
            throw new InstanceNotFoundException(code, OrderElement.class
                    .getName());
        } else {
            return orderElement;
View Full Code Here

TOP

Related Classes of org.libreplan.business.orders.entities.OrderElement

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.