Package org.libreplan.business.scenarios.entities

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


        }
    }

    private 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


        }
    }

    private 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

        }
    }

    private 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

    }

    @Override
    @Transactional
    public void transfer(Order order) throws ValidationException {
        Scenario sourceScenario = getSourceScenario();
        Scenario destinationScenario = getDestinationScenario();

        if (sourceScenario == null) {
            throw new ValidationException(
                    _("Please select a source scenario"));
        }
        if (destinationScenario == null) {
            throw new ValidationException(
                    _("Please, select a destination scenario"));
        }

        if (sourceScenario.getId().equals(destinationScenario.getId())) {
            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);
        scenarioDAO.updateDerivedScenariosWithNewVersion(
                destinationOrderVersion, order, destinationScenario,
                newOrderVersion);

        List<TaskSource> taskSourcesFromBottomToTop = order
                .getTaskSourcesFromBottomToTop();
        for (TaskSource taskSource : taskSourcesFromBottomToTop) {
            taskSourceDAO.save(taskSource);
        }

        try {
            setDestinationScenario(scenarioDAO
                    .find(destinationScenario.getId()));
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                    }
                });
    }

    private void setSourceScenario() {
        Scenario sourceScenario = (Scenario) sourceScenarioBandboxSearch
                .getSelectedElement();
        transferOrdersModel.setSourceScenario(sourceScenario);
        Util.reloadBindings(sourceScenarioOrders);
        sourceScenarioBandboxSearch.close();
    }
View Full Code Here

        Util.reloadBindings(sourceScenarioOrders);
        sourceScenarioBandboxSearch.close();
    }

    private void setDestinationScenario() {
        Scenario destinationScenario = (Scenario) destinationScenarioBandboxSearch
                .getSelectedElement();
        transferOrdersModel.setDestinationScenario(destinationScenario);
        Util.reloadBindings(destinationScenarioOrders);
        destinationScenarioBandboxSearch.close();
    }
View Full Code Here

            Order order = (Order) data;
            item.setValue(data);

            item.appendChild(new Listcell(order.getCode()));
            item.appendChild(new Listcell(order.getName()));
            Scenario scenario = source ? transferOrdersModel
                    .getSourceScenario() : transferOrdersModel
                    .getDestinationScenario();
            item.appendChild(new Listcell(transferOrdersModel.getVersion(order,
                    scenario)));
View Full Code Here

        if (isMainScenario) {
            throw new IllegalArgumentException(
                    _("You cannot remove the default scenario \"{0}\"", PredefinedScenarios.MASTER.getName()));
        }

        Scenario currentScenario = scenarioManager.getCurrent();
        boolean isCurrentScenario = currentScenario.getId().equals(
                scenario.getId());
        if (isCurrentScenario) {
            throw new IllegalArgumentException(
                    _("You cannot remove the current scenario"));
        }
View Full Code Here

    private IOrderDAO orderDAO;

    @Override
    @Transactional(readOnly = true)
    public Scenario getCurrent() {
        Scenario scenario = scenarioAssociatedToLoggedUser();
        return reload(scenario);
    }
View Full Code Here

        messagesForUser.showMessage(Level.ERROR, _(
                "error doing reassignment: {0}", exceptionHappened));
    }

    public Set<Order> getOrders() {
        Scenario scenario = scenarioModel.getScenario();
        if (scenario == null) {
            return Collections.emptySet();
        }
        return scenario.getOrders().keySet();
    }
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.