Examples of Alternative


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

   
    private void generateEprintsExecutablePlan() {
       
        IPreservationActionRegistry registry = getMiniMeeRegistry();
       
        Alternative recommendedAlternative = selectedPlan.getRecommendation().getAlternative();
       
        Element eprintsPlan = new Element("eprintsPlan");
       
        Element tool = new Element("tool");
       
        eprintsPlan.addContent(tool);
       
        String id = getToolIdentifier(registry);
       
        Element toolIdentifier = new Element("toolIdentifier").setAttribute("uri", id);
       
        tool.addContent(toolIdentifier);
       
        String settings = selectedPlan.getRecommendation().getAlternative().getExperiment().getSettings();
       
        String toolParameters = registry.getToolParameters(recommendedAlternative.getAction().getUrl());
       
        if (settings != null) {
            toolParameters += (" " + settings);   
        }
       
        // TODO: we shouldn't need that here, this should come from the registry
        //       at the moment we only have the OUTFILE which is not enough. we anticipate
        //       that the tool can work with the structure <params> <input file> <output file>
        // CB: from the minimee experience, you CANNOT always assume that!
        // e.g. -i IN -o OUT etc.! or even TOOL -param IN > OUT etc.
        toolParameters += (" " + "%INFILE% %OUTFILE%");
       
        Element parameters = new Element("parameters").setAttribute("toolParameters", toolParameters);
        tool.addContent(parameters);
       
        Element targetFormat = new Element("targetFormat").setText(recommendedAlternative.getAction().getTargetFormat());
        tool.addContent(targetFormat);
       
        XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
       
        ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
View Full Code Here

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

Examples of eu.scape_project.planning.model.Alternative

                    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

Examples of eu.scape_project.planning.model.Alternative

        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

Examples of eu.scape_project.planning.model.Alternative

        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

Examples of eu.scape_project.planning.model.Alternative

        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

Examples of eu.scape_project.planning.model.Alternative

    @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

Examples of eu.scape_project.planning.model.Alternative

        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

Examples of eu.scape_project.planning.model.Alternative

        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

Examples of eu.scape_project.planning.model.Alternative

     * @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
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.