Examples of AlternativesDefinition


Examples of eu.planets_project.pp.plato.model.AlternativesDefinition

        if (alt == null) {
            log
                    .error("No alternative selected. This method should not have been called.");
            return;
        }
        AlternativesDefinition alternativesDefinition = selectedPlan.getAlternativesDefinition();
        // its a new alternative and the alternative is not yet in list of
        // alternatives
        // note: the user can also edit an alternative that has already been added to the list
        if ((alt.getId() == 0) &&
            (!alternativesDefinition.getAlternatives().contains(alt))) {
            String altName = alt.getName();
            if ((altName.length() > 20)||
                (null != alternativesDefinition.alternativeByName(altName))){
                FacesMessages.instance()
                    .add(FacesMessage.SEVERITY_ERROR,
                        "Please provide a unique name which has no more than 20 characters.");
                return;
            }

            // add it to the preservation planning project
            alternativesDefinition.addAlternative(alt);
            // refresh the datamodel list
            alternativeList = alternativesDefinition.getAlternatives();
            // the alternativesdefinition has been changed
            alternativesDefinition.touch();
        }
        // this alternative has been changed
        alt.touch();

        // exit editing mode
View Full Code Here

Examples of eu.scape_project.planning.model.AlternativesDefinition

    @Test
    public void exportToXml_alternative() throws PlanningException {
        Plan p = generateBasicPlan();

        AlternativesDefinition alternativesDefinition = new AlternativesDefinition();
        alternativesDefinition.setDescription("Description");
        Alternative alt1 = generateAlternative("Alternative 1");
        alternativesDefinition.addAlternative(alt1);
        Alternative alt2 = generateAlternative("Alternative 2");
        alternativesDefinition.addAlternative(alt2);
        p.setAlternativesDefinition(alternativesDefinition);

        Document doc = exporter.exportToXml(p);

        assertThat(getNodes(doc, "/plans/p:plan/p:alternatives/p:alternative").size(), is(2));
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.