Package org.libreplan.business.orders.entities

Examples of org.libreplan.business.orders.entities.TaskSource$IOptionalPersistence


    @Transactional
    public TaskGroup createTask(OrderDTO project, boolean importCalendar) {

        Order order = project.order;

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

        TaskGroup taskGroup = taskSource
                .createTaskGroupWithoutDatesInitializedAndLinkItToTaskSource();

        BaseCalendar calendar = configurationDAO.getConfiguration()
                .getDefaultCalendar();
View Full Code Here


        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();

            List<TaskElement> taskElements = new ArrayList<TaskElement>();

            for (OrderElementDTO importTask : task.children) {
View Full Code Here

        line.setName(UUID.randomUUID().toString());
        line.setCode(UUID.randomUUID().toString());
        assert line.getSchedulingState().isSomewhatScheduled();
        orderModel.save();
        assertTrue(orderDAO.exists(order.getId()));
        TaskSource lineTaskSource = line.getTaskSource();
        assertTrue(taskSourceDAO.exists(lineTaskSource.getId()));
    }
View Full Code Here

        orderLine.addHoursGroup(associatedHoursGroup);
        SchedulingDataForVersion schedulingDataForVersion = orderLine
                .getCurrentSchedulingDataForVersion();

        TaskSource taskSource = TaskSource.create(schedulingDataForVersion,
                Arrays.asList(associatedHoursGroup));

        orderLine.getCurrentSchedulingData().requestedCreationOf(taskSource);

        TaskSourceSynchronization mustAdd = TaskSource.mustAdd(taskSource);
        mustAdd.apply(TaskSource.persistTaskSources(taskSourceDAO));

        Task task = (Task) taskSource.getTask();
        return task;
    }
View Full Code Here

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

    public static GanttDiagramGraph<TaskElement, DependencyWithVisibility> createForcingDependencies(
            Order order, IAdapter<TaskElement, DependencyWithVisibility> adapter) {
        GanttDiagramGraph<TaskElement, DependencyWithVisibility> graph = createFor(
                order, adapter);
        TaskSource taskSource = order.getTaskSource();
        if (taskSource == null) {
            return graph;
        }
        graph.addTopLevel(taskSource.getTask());
        for (Dependency each : getAllDependencies(order)) {
            graph.addWithoutEnforcingConstraints(DependencyWithVisibility
                    .existent(each));
        }
        return graph;
View Full Code Here

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

        order.setInitDate(new Date());
        OrderLine orderLine = OrderLine.create();
        order.add(orderLine);
        SchedulingDataForVersion version = TaskElementTest
                .mockSchedulingDataForVersion(orderLine);
        TaskSource taskSource = TaskSource.create(version, Arrays
                .asList(hoursGroup));
        TaskGroup result = TaskGroup.create(taskSource);
        result.setIntraDayEndDate(IntraDayDate.startOfDay(result
                .getIntraDayStartDate().getDate().plusDays(10)));
        return result;
View Full Code Here

    public void theDeadlineOfTheOrderElementIsCopied() {
        OrderLine orderLine = OrderLine.create();
        addOrderTo(orderLine);
        LocalDate deadline = new LocalDate(2007, 4, 4);
        orderLine.setDeadline(asDate(deadline));
        TaskSource taskSource = asTaskSource(orderLine);
        Task task = Task.createTask(taskSource);
        assertThat(task.getDeadline(), equalTo(deadline));
    }
View Full Code Here

    }

    public static SchedulingDataForVersion mockSchedulingDataForVersion(
            OrderElement orderElement) {
        SchedulingDataForVersion result = createNiceMock(SchedulingDataForVersion.class);
        TaskSource taskSource = createNiceMock(TaskSource.class);
        expect(result.getOrderElement()).andReturn(orderElement).anyTimes();
        expect(taskSource.getOrderElement()).andReturn(orderElement).anyTimes();
        expect(result.getTaskSource()).andReturn(taskSource).anyTimes();
        replay(result, taskSource);
        return result;
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.orders.entities.TaskSource$IOptionalPersistence

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.