Package org.libreplan.business.scenarios.entities

Examples of org.libreplan.business.scenarios.entities.Scenario


        for (OrderElementWithAdvanceMeasurementsOrEndDateDTO orderElementWithAdvanceMeasurementsOrEndDateDTO : orderElements) {
            try {
                OrderElement orderElement = orderElementDAO
                        .findUniqueByCode(orderElementWithAdvanceMeasurementsOrEndDateDTO.code);

                Scenario scenarioMaster = PredefinedScenarios.MASTER.getScenario();
                Order order = orderDAO.loadOrderAvoidingProxyFor(orderElement);
                OrderVersion orderVersion = order.getScenarios().get(scenarioMaster);

                if (orderElementWithAdvanceMeasurementsOrEndDateDTO.advanceMeasurements != null
                        && !orderElementWithAdvanceMeasurementsOrEndDateDTO.advanceMeasurements
View Full Code Here


        } catch (InstanceNotFoundException e) {
            throw new UsernameNotFoundException(MessageFormat.format(
                    "User with username {0}: not found", loginName));
        }

        Scenario scenario = user.getLastConnectedScenario();
        if (scenario == null) {
            scenario = PredefinedScenarios.MASTER.getScenario();
        }

        String password = user.getPassword();
View Full Code Here

    @Test
    @Transactional
    public void theCurrentScenarioIsTheMain() {
        scenariosBootstrap.loadRequiredData();
        Scenario current = onlyMainScenarioAware.getCurrent();
        assertEquals(PredefinedScenarios.MASTER.getName(), current.getName());
        assertEquals(scenariosBootstrap.getMain(), current);
    }
View Full Code Here

        defaultAdvanceTypesBootstrapListener.loadRequiredData();
    }

    @Test
    public void afterSavingScenarioWithOrderNewlyRetrievedOrderHasScenariosInfo() {
        final Scenario scenario = createNewScenario();
        final Long orderId = transactionService
                .runOnTransaction(new IOnTransaction<Long>() {

            @Override
            public Long execute() {
                Order order = givenOrderStored();
                scenario.addOrder(order);
                scenarioDAO.save(scenario);
                return order.getId();
            }
        });

        transactionService.runOnTransaction(new IOnTransaction<Void>() {

            @Override
            public Void execute() {
                Order order = orderDAO.findExistingEntity(orderId);
                Map<Scenario, OrderVersion> scenarios = order.getScenarios();
                assertTrue(isAt(scenario, scenarios.keySet()));
                return null;
            }

            private boolean isAt(Scenario scenario, Set<Scenario> scenarios) {
                for (Scenario each : scenarios) {
                    if (scenario.getId().equals(each.getId())) {
                        return true;
                    }
                }
                return false;
            }
View Full Code Here

    @Test
    @Transactional
    public void checkNewDerivedScenario() {
        String predecessorScenarioName = "parent";
        Scenario predecessor = Scenario.create(predecessorScenarioName);

        Order order = Order.create();
        String orderName = "order1";
        order.setName(orderName);
        predecessor.addOrder(order);

        Scenario child = predecessor.newDerivedScenario();
        assertThat(child.getPredecessor().getName(), equalTo(predecessor
                .getName()));

        assertThat(child.getOrders().size(), equalTo(1));
        assertThat(child.getOrders().keySet().iterator().next().getName(),
                equalTo(orderName));
    }
View Full Code Here

            throws InstanceNotFoundException {
        removeCurrentScenarios();
        scenariosBootstrap.loadRequiredData();

        assertFalse(scenarioDAO.getAll().isEmpty());
        Scenario scenario = PredefinedScenarios.MASTER.getScenario();
        assertNotNull(scenario);

        Order orderAssociated = givenOrderStored();
        scenario.addOrder(orderAssociated);
        scenarioDAO.save(scenario);

        assertTrue(isAt(orderAssociated, scenario.getTrackedOrders()));
    }
View Full Code Here

*/
public class ResourceAllocationDAOTest {

    public static OrderVersion setupVersionUsing(
            IScenarioManager scenarioManager, Order order) {
        Scenario current = scenarioManager.getCurrent();
        OrderVersion result = OrderVersion.createInitialVersion(current);
        order.setVersionForScenario(current, result);
        return result;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testFindAllocationsRelatedToResourcesWithDateFilter() {
        Scenario current = scenarioManager.getCurrent();
        ResourceAllocation<?> resourceAllocation1 = createValidSpecificResourceAllocation();
        resourceAllocationDAO.save(resourceAllocation1);

        LocalDate intervalInitDate = resourceAllocation1.getTask()
                .getStartAsLocalDate();
View Full Code Here

        } catch (InstanceNotFoundException e) {
            throw new UsernameNotFoundException(MessageFormat.format(
                    "User with username {0}: not found", loginName));
        }

        Scenario scenario = user.getLastConnectedScenario();
        if (scenario == null) {
            scenario = PredefinedScenarios.MASTER.getScenario();
        }

        return new CustomUser(
View Full Code Here

    void setupScenario(Order order) {
        if (!order.hasNoVersions()) {
            return;
        }
        Scenario currentScenario = scenarioManager.getCurrent();
        OrderVersion orderVersion = currentScenario.addOrder(order);
        order.setVersionForScenario(currentScenario, orderVersion);
        order.useSchedulingDataFor(currentScenario);
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.scenarios.entities.Scenario

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.