Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.Alternative


     *
     * @param alternativeName
     *            Alternative name of the recommended alternative
     */
    private void updateAlternativeRecommendation(String alternativeName) {
        Alternative recommendedAlternative = null;

        for (Alternative a : plan.getAlternativesDefinition().getAlternatives()) {
            if (a.getName().equals(alternativeName)) {
                recommendedAlternative = a;
                break;
View Full Code Here


                    actionDefinition.getParams().add(new Parameter(p.getName(), ""));
                }
            }

            String uniqueName = plan.getAlternativesDefinition().createUniqueName(actionDefinition.getShortname());
            Alternative a = Alternative.createAlternative(uniqueName, actionDefinition);
            defineAlternatives.addAlternative(a);
        } catch (PlanningException e) {
            facesMessages.addError("Could not create an alternative from the service you selected.");
        }
    }
View Full Code Here

        l.setName("test");
        l.setSingle(false);
        l.changeScale(new PositiveIntegerScale());
        // to properly initialize the value list, we need alternatives
        List<Alternative> alternatives = new ArrayList<Alternative>();
        alternatives.add(new Alternative("a", "alternative a"));
        alternatives.add(new Alternative("x", "alternative x"));
        alternatives.add(new Alternative("b", "alternative b"));
        l.initValues(alternatives, 4, true);

        // set values from 4 down to 1, so the order can be checked afterwards
        for (Alternative a : alternatives) {
            int i = 4;
View Full Code Here

        defineAlternativesView.setLog(mock(Logger.class));
    }

    @Test
    public void tryRemoveAlternative_clickAlternativeRemovesTheAlternative_notCurrentRecommendationNoMessage() {
        Alternative clickedAlternative = new Alternative("alt1", "alt1");
        clickedAlternative.setId(1);

        when(defineAlternativesView.getPlan().isGivenAlternativeTheCurrentRecommendation(clickedAlternative))
            .thenReturn(false);

        defineAlternativesView.removeAlternative(clickedAlternative);
View Full Code Here

        verify(defineAlternativesView.getFacesMessages(), times(0)).addInfo(anyString());
    }

    @Test
    public void tryRemoveAlternative_clickAlternativeRemovesTheAlternative_currentRecommendationShowMessage() {
        Alternative clickedAlternative = new Alternative("alt1", "alt1");
        clickedAlternative.setId(1);

        when(defineAlternativesView.getPlan().isGivenAlternativeTheCurrentRecommendation(clickedAlternative))
            .thenReturn(true);

        defineAlternativesView.removeAlternative(clickedAlternative);
View Full Code Here

    @Asynchronous
    public void startExperiments(Plan plan, ExperimentStatus experimentStatus) {
        this.plan = plan;
        this.experimentStatus = experimentStatus;

        Alternative alt = experimentStatus.getNextAlternative();
        while (alt != null && !experimentStatus.isCanceled()) {
            if (alt.isExecutable()) {
                runPreservationAction(alt);
            }

            alt = experimentStatus.getNextAlternative();
        }
View Full Code Here

        actionDefinition.setDescriptor(actionInfo.getDescriptor());
        actionDefinition.setUrl(actionInfo.getUrl());
        actionDefinition.setInfo(actionInfo.getInfo());

        String uniqueName = plan.getAlternativesDefinition().createUniqueName(actionDefinition.getShortname());
        Alternative a = Alternative.createAlternative(uniqueName, actionDefinition);
        plan.getAlternativesDefinition().addAlternative(a);
        return a;
    }
View Full Code Here

        actionDefinition.setTargetFormat(actionInfo.getTargetFormat());
        actionDefinition.setEmulated(actionInfo.isEmulated());
        actionDefinition.setExecutable(actionInfo.isExecutable());

        String uniqueName = plan.getAlternativesDefinition().createUniqueName(actionDefinition.getShortname());
        Alternative a = Alternative.createAlternative(uniqueName, actionDefinition);
        plan.getAlternativesDefinition().addAlternative(a);
        return a;
    }
View Full Code Here

     * @throws PlanningException
     *             if the alternative could not be added
     */
    @SuppressWarnings("deprecation")
    public Alternative addAlternative(String name, String description) throws PlanningException {
        Alternative a = Alternative.createAlternative();
        a.setName(plan.getAlternativesDefinition().createUniqueName(name));
        a.setDescription(description);
        plan.getAlternativesDefinition().addAlternative(a);
        return a;
    }
View Full Code Here

     *            Experiment alternative.
     * @param sampleObj
     *            Experiment sample object.
     */
    public void updateSelectedDetailedExperimentInfo(Object alt, Object sampleObj) {
        Alternative alternative = (Alternative) alt;
        SampleObject sampleObject = (SampleObject) sampleObj;

        selectedDetailedExperimentInfo = alternative.getExperiment().getDetailedInfo().get(sampleObject);
    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.Alternative

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.