Examples of OrderVersion


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

    public void useSchedulingDataFor(Scenario scenario) {
        useSchedulingDataFor(scenario, true);
    }

    public void useSchedulingDataFor(Scenario scenario, boolean recursive) {
        OrderVersion orderVersion = scenarios.get(scenario);
        currentVersionInfo = CurrentVersionInfo.create(scenario, orderVersion);
        useSchedulingDataFor(orderVersion, recursive);
    }
View Full Code Here

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

     * @param scenario
     * @return <code>null</code> if there is no order version for the scenario;
     *         the order version associated to the supplied scenario
     */
    public OrderVersion disassociateFrom(Scenario scenario) {
        OrderVersion existentVersion = scenarios.remove(scenario);
        if (existentVersion != null && !isVersionUsed(existentVersion)) {
            removeVersion(existentVersion);
        }
        return existentVersion;
    }
View Full Code Here

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

        return destinationScenario.getOrders().keySet();
    }

    @Override
    public String getVersion(Order order, Scenario scenario) {
        OrderVersion orderVersion = scenario.getOrderVersion(order);
        return orderVersion.getId().toString();
    }
View Full Code Here

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

            throw new ValidationException(
                    _("Source and destination scenarios should be different"));
        }

        orderDAO.save(order);
        OrderVersion sourceOrderVersion = order
                .getOrderVersionFor(sourceScenario);
        if (sourceOrderVersion == null) {
            throw new RuntimeException(
                    "Project version must not be null for source scenario");
        }

        OrderVersion destinationOrderVersion = order
                .getOrderVersionFor(destinationScenario);
        if ((destinationOrderVersion != null)
                && (sourceOrderVersion.getId().equals(destinationOrderVersion
                        .getId()))) {
            throw new ValidationException(
                    _("Project version is the same in source and destination scenarios"));
        }

        order.useSchedulingDataFor(sourceOrderVersion);

        OrderVersion newOrderVersion = OrderVersion
                .createInitialVersion(destinationScenario);
        order.setOrderVersion(destinationScenario, newOrderVersion);
        order
                .writeSchedulingDataChangesTo(destinationScenario,
                        newOrderVersion);
View Full Code Here

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

    private void givenOrderLineGroupWithTwoLines() {
        OrderLineGroup orderLineGroup = OrderLineGroup.create();
        orderLineGroup.setCode("default-order-line-group-" + UUID.randomUUID());
        orderLineGroup.setName("default-order-line-group-" + UUID.randomUUID());

        OrderVersion orderVersion = OrderVersion
                .createInitialVersion(scenarioManager.getCurrent());
        orderVersionDAO.save(orderVersion);
        orderLineGroup.useSchedulingDataFor(orderVersion);

        OrderLine orderLine1 = OrderLine
View Full Code Here

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

        order.setName(randomize("order-name"));
        order.setInitDate(new Date());
        order.setCalendar(configurationDAO.getConfiguration()
                .getDefaultCalendar());

        OrderVersion orderVersion = scenario.addOrder(order);
        order.setVersionForScenario(scenario, orderVersion);
        order.useSchedulingDataFor(orderVersion);
        OrderLine orderLine = OrderLine
                .createOrderLineWithUnfixedPercentage(1000);
        order.add(orderLine);
View Full Code Here

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

        Order order = givenStoredOrderInDefaultScenario();
        Scenario scenario = givenStoredScenario();

        int previous = scenarioModel.getScenarios().size();

        OrderVersion orderVersion = scenario.getOrderVersion(order);

        scenarioModel.remove(scenario, false);
        assertThat(scenarioModel.getScenarios().size(), equalTo(previous - 1));

        assertNotNull(orderDAO.find(order.getId()));
        assertNotNull(orderVersionDAO.find(orderVersion.getId()));
    }
View Full Code Here

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

        // Reload scenario information
        sessionFactory.getCurrentSession().evict(scenario);
        scenario = scenarioDAO.find(scenario.getId());

        OrderVersion orderVersion = scenario.getOrderVersion(order);

        scenarioModel.remove(scenario, false);
        assertThat(scenarioModel.getScenarios().size(), equalTo(previous - 1));

        try {
            orderDAO.find(order.getId());
            fail("Order should be removed");
        } catch (InstanceNotFoundException e) {
            // Ok
        }

        try {
            orderVersionDAO.find(orderVersion.getId());
            fail("Order version should be removed");
        } catch (InstanceNotFoundException e) {
            // Ok
        }
    }
View Full Code Here

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

public class OrderModelTest {

    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

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

        Order order = Order.create();
        order.setCode(UUID.randomUUID().toString());
        order.setName("Order name " + UUID.randomUUID());
        order.setInitDate(new Date());
        order.setCalendar(configurationDAO.getConfiguration().getDefaultCalendar());
        OrderVersion version = OrderModelTest.setupVersionUsing(scenarioManager, order);
        order.useSchedulingDataFor(version);

        OrderLine orderLine = OrderLine.createOrderLineWithUnfixedPercentage(1000);
        orderLine.useSchedulingDataFor(version);
        order.add(orderLine);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.