Package org.libreplan.business.planner.entities

Examples of org.libreplan.business.planner.entities.Task$WithPotentiallyNewResources


                .getCurrentSchedulingDataForVersion();
        TaskSource taskSource = TaskSource.create(schedulingDataForVersion,
                Arrays.asList(associatedHoursGroup));
        TaskSourceSynchronization mustAdd = TaskSource.mustAdd(taskSource);
        mustAdd.apply(TaskSource.persistTaskSources(taskSourceDAO));
        Task task = (Task) taskSource.getTask();
        return task;
    }
View Full Code Here


        Task task = (Task) taskSource.getTask();
        return task;
    }

    public SubcontractedTaskData createValidSubcontractedTaskData(String name) {
        Task task = createValidTask();
        SubcontractedTaskData subcontractedTaskData = SubcontractedTaskData
                .create(task);
        subcontractedTaskData.addRequiredDeliveringDates(SubcontractorDeliverDate
                .create(new Date(),new Date(), null));
        subcontractedTaskData.setExternalCompany(getSubcontractorExternalCompanySaved());

        task.setSubcontractedTaskData(subcontractedTaskData);
        taskElementDAO.save(task);
        taskElementDAO.flush();
        sessionFactory.getCurrentSession().evict(task);
        sessionFactory.getCurrentSession().evict(subcontractedTaskData);
View Full Code Here

                .getCurrentSchedulingDataForVersion();
        TaskSource taskSource = TaskSource.create(schedulingDataForVersion,
                Arrays.asList(associatedHoursGroup));
        TaskSourceSynchronization mustAdd = TaskSource.mustAdd(taskSource);
        mustAdd.apply(TaskSource.persistTaskSources(taskSourceDAO));
        Task task = (Task) taskSource.getTask();
        return task;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void canSaveTask() {
        Task task = createValidTask();
        taskElementDAO.save(task);
        flushAndEvict(task);
        TaskElement fromDB;
        try {
            fromDB = taskElementDAO.find(task.getId());
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
        assertThat(fromDB.getId(), equalTo(task.getId()));
        assertThat(fromDB, instanceOf(Task.class));
        checkProperties(task, fromDB);
        HoursGroup reloaded = ((Task) fromDB).getHoursGroup();
        assertThat(reloaded.getId(), equalTo(reloaded.getId()));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void afterSavingTheVersionIsIncreased() {
        Task task = createValidTask();
        assertNull(task.getVersion());
        taskElementDAO.save(task);
        task.dontPoseAsTransientObjectAnymore();
        assertNotNull(task.getVersion());
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void savingGroupSavesAssociatedTaskElements() {
        Task child1 = createValidTask();
        Task child2 = createValidTask();
        TaskGroup taskGroup = createValidTaskGroup();
        taskGroup.addTaskElement(child1);
        taskGroup.addTaskElement(child2);
        taskElementDAO.save(taskGroup);
        flushAndEvict(taskGroup);
        TaskGroup reloaded;
        try {
            reloaded = (TaskGroup) taskElementDAO.find(taskGroup.getId());
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
        List<TaskElement> taskElements = reloaded.getChildren();
        assertThat(taskElements.size(), equalTo(2));
        assertThat(taskElements.get(0).getId(), equalTo(child1.getId()));
        assertThat(taskElements.get(1).getId(), equalTo(child2.getId()));

    }
View Full Code Here

                    @Override
                    public Task execute() {
                        return createValidTask();
                    }
                };
        final Task child1 = transactionService
                .runOnTransaction(createValidTask);
        final Task child2 = transactionService
                .runOnTransaction(createValidTask);
        IOnTransaction<Void> createDependency = new IOnTransaction<Void>() {

            @Override
            public Void execute() {
                child1.dontPoseAsTransientObjectAnymore();
                child2.dontPoseAsTransientObjectAnymore();
                Dependency.create(child1, child2, Type.START_END);
                taskElementDAO.save(child1);
                return null;
            }
        };
        transactionService.runOnTransaction(createDependency);
        assertThat(child2.getDependenciesWithThisDestination().size(),
                equalTo(1));
        assertTrue(child2.getDependenciesWithThisOrigin().isEmpty());
        IOnTransaction<Void> checkDependencyWasSaved = new IOnTransaction<Void>() {

            @Override
            public Void execute() {
                TaskElement fromDB = (TaskElement) taskElementDAO
View Full Code Here

        };
        transactionService.runOnTransaction(checkDependencyWasSaved);
    }

    public void aTaskCanBeRemoved() {
        Task task = createValidTask();
        taskElementDAO.save(task);
        flushAndEvict(task);
        try {
            taskElementDAO.remove(task.getId());
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
        sessionFactory.getCurrentSession().flush();
        assertNull(sessionFactory.getCurrentSession().get(TaskElement.class,
                task.getId()));
    }
View Full Code Here

                task.getId()));
    }

    @Test
    public void aTaskCanBeRemovedFromItsTaskSource() {
        final Task task = transactionService.runOnTransaction(new IOnTransaction<Task>(){

            @Override
            public Task execute() {
                Task task = createValidTask();
                taskElementDAO.save(task);
                return task;
            }});
        transactionService.runOnTransaction(new IOnTransaction<Void>() {

            @Override
            public Void execute() {
                try {
                    taskSourceDAO.remove(task.getTaskSource().getId());
                } catch (InstanceNotFoundException e) {
                    throw new RuntimeException(e);
                }
                sessionFactory.getCurrentSession().flush();
                assertNull(sessionFactory.getCurrentSession().get(TaskElement.class,
                        task.getId()));
                return null;
            }});
    }
View Full Code Here

                .runOnTransaction(new IOnTransaction<TaskGroup>() {

                    @Override
                    public TaskGroup execute() {
                        TaskGroup taskGroup = createValidTaskGroup();
                        Task task = createValidTask();
                        taskGroup.addTaskElement(task);
                        return taskGroup;
                    }
                });
        transactionService.runOnTransaction(new IOnTransaction<Void>() {
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.Task$WithPotentiallyNewResources

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.