public String getDefinitionLSID() { String lsid = workflowModel.getDescription().getLSID(); if (lsid == null) { return ""; } return lsid; }
private static JPopupMenu getWorkflowMenu(ScuflModel model) { JPopupMenu theMenu = new JPopupMenu(); theMenu.add(new ShadedLabel("Workflow : " + model.getDescription().getTitle(), ShadedLabel.TAVERNA_GREEN)); theMenu.addSeparator(); theMenu.add(new RenameAction(model, model)); return theMenu; }
public DescriptionAndDiagram() { super(new BorderLayout()); // FIXME: make description wrap lines JTextArea description = new JTextArea(model.getDescription().getText()); description.setEditable(false); description.setLineWrap(true); description.setOpaque(false); description.setWrapStyleWord(true); description.setFont(Font.getFont("Dialog")); // Avoid stealing all width description.setMinimumSize(new Dimension(25, 10)); // FIXME: detach from model when window is closed diagram.attachToModel(model); add(description, BorderLayout.NORTH); add(diagram, BorderLayout.CENTER); } }
/** * Override toString() */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Workflow '" + workflowInstance.getID() + "' created with " + inputs.size() + " input" + (inputs.size() != 1 ? "s" : "") + "\n"); for (Iterator i = inputs.keySet().iterator(); i.hasNext();) { String inputName = (String) i.next(); DataThing inputValue = (DataThing) inputs.get(inputName); String inputLSID = inputValue.getLSID(inputValue.getDataObject()); sb.append(" '" + inputName + "'->" + inputLSID + "\n"); } sb.append("Created from workflow definition " + model.getDescription().getLSID() + "\n"); UserContext workflowContext = workflowInstance.getUserContext(); if (workflowContext == null) { sb.append("No user context supplied\n"); } else { sb.append("Workflow context :\n"); sb.append(" 'Person'->" + workflowContext.getPersonLSID() + "\n"); sb.append(" 'ExperimentDesign'->" + workflowContext.getExperimentDesignLSID() + "\n"); sb.append(" 'Organization'->" + workflowContext.getOrganizationLSID() + "\n"); } return sb.toString(); }
description = "New name for the port?"; } else if (object instanceof ScuflModel) { name = ((ScuflModel) object).getDescription().getTitle(); description = "New workflow title"; } else { ScuflModel model = (ScuflModel) object; new_name = new_name.trim(); model.getDescription().setTitle(new_name); name = model.getDescription().getTitle(); model.fireModelEvent(new org.embl.ebi.escience.scufl.ScuflModelEvent(this, "Title Changed"));
+ model.getDescription().getTitle() + "?"; int ret = JOptionPane.showConfirmDialog(Workbench.this, msg, "Save workflow?", JOptionPane.YES_NO_CANCEL_OPTION);
/** * Create a new Workflow scavenger, the single parameter should be * resolvable to a location from which the definition could be fetched. */ public WorkflowScavenger(String definitionURL) throws ScavengerCreationException { super(new WorkflowProcessorFactory(definitionURL)); // Get a reference back to the processor factory ProcessorFactory rootPF = (ProcessorFactory) getUserObject(); // Crafty addition of a load of the workflow in offline mode // followed by extraction of all the processors... ScuflModel model = new ScuflModel(); try { model.setOffline(true); XScuflParser.populate(new URL(definitionURL).openStream(), model, null); rootPF.setDescription(model.getDescription().getText()); } catch (Exception ex) { ex.printStackTrace(); } doChildren(model); }
String title = model.getDescription().getTitle(); if (workflowChanges.hasChanged(model)) {
String title = model.getDescription().getTitle(); fc.setDialogTitle(windowTitle + ": " + title); fc.resetChoosableFileFilters(); model.getDescription().setTitle(name);
/** * Construct a new processor from the supplied JDOM element, this element * being the 'scufl' top level workflow element from an inline nested * workflow declaration */ public WorkflowProcessor(ScuflModel model, String name, Element scuflElement) throws ProcessorCreationException, DuplicateProcessorNameException { super(model, name); // Have to clone the element because it already has a parent // so will not work with a new document instance try { Document doc = new Document((Element) scuflElement.clone()); theInternalModel = new ScuflModel(); try { if (model != null) { theInternalModel.setOffline(model.isOffline()); } } catch (SetOnlineException soe) { // } XScuflParser.populate(doc, theInternalModel, null); setDescription(theInternalModel.getDescription().getText()); buildPorts(); } catch (Exception e) { throw new ProcessorCreationException("The workflow processor '" + name + "' caused an exception :\n" + e.getMessage() + "\n during creation. The exception had type :\n" + e.getClass().toString()); } }
/** * Create a new workflow scavenger from a JDOM Document and a name, the name * is required because there's no way to infer this from the document, it's * a property of the storage medium. */ public WorkflowScavenger(Document doc, String workflowName) throws ScavengerCreationException { super(new WorkflowProcessorFactory(doc.getRootElement())); ProcessorFactory rootPF = (ProcessorFactory) getUserObject(); rootPF.setName(workflowName); ScuflModel model = new ScuflModel(); try { model.setOffline(true); XScuflParser.populate(doc, model, null); rootPF.setDescription(model.getDescription().getText()); } catch (Exception ex) { throw new ScavengerCreationException("Cannot create scavenger " + ex); } doChildren(model); }
/** * Add annotations to the dataflow corresponding to the metadata of the workflow * * @param dataflow * @param translator */ private void createAnnotations(Dataflow dataflow, WorkflowModelTranslator translator) { WorkflowDescription wd = scuflModel.getDescription(); String description = wd.getText(); FreeTextDescription ftd = new FreeTextDescription(); ftd.setText(description); Author author = new Author(); author.setText(wd.getAuthor()); DescriptiveTitle title = new DescriptiveTitle(); title.setText(wd.getTitle()); try { List<Edit<?>> listEdits = new ArrayList<Edit<?>> (); listEdits.add(EditsRegistry.getEdits().getAddAnnotationChainEdit( dataflow, ftd)); listEdits.add(EditsRegistry.getEdits().getAddAnnotationChainEdit( dataflow, author)); listEdits.add(EditsRegistry.getEdits().getAddAnnotationChainEdit( dataflow, title)); CompoundEdit edits = new CompoundEdit(listEdits); edits.doEdit(); } catch (EditException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void testStoreWorkflow() throws Exception { ScuflModel storedModel = new ScuflModel(); // The unique LSID for this particular workflow that was run String storedLSID = "urn:example.com:storedLSID" + System.nanoTime(); // The one inside the workflow String wfLSID = "urn:example.com:testLSID" + +System.nanoTime(); storedModel.getDescription().setLSID(wfLSID); assertEquals(wfLSID, storedModel.getDescription().getLSID()); DataService dataService = DataServiceFactory.getInstance(configuration); dataService.storeWorkflow(storedLSID, storedModel); ScuflModel retrievedModel = new ScuflModel(); dataService.populateWorkflowModel(storedLSID, retrievedModel); assertNotSame(storedModel, retrievedModel); assertEquals(storedModel.getDescription().getLSID(), wfLSID); try { dataService.populateWorkflowModel(wfLSID, new ScuflModel()); } catch (DataServiceException e) { // As expected return; } fail("Should not be able to fetch by LSID " + wfLSID); }
} else { m = new ScuflModel(); m.getDescription().setTitle(pf.getName()); Processor p = pf.createProcessor("processor", m);
sanitiseName(scuflModel.getDescription().getTitle())) .doEdit();
public void testConstruction() { ScuflModel model = new ScuflModel(); assertFalse(model.offline); ArrayAssert.assertEquals(new Processor[0], model.getProcessors()); ArrayAssert.assertEquals(new DataConstraint[0], model .getDataConstraints()); ArrayAssert.assertEquals(new ConcurrencyConstraint[0], model .getConcurrencyConstraints()); ArrayAssert.assertEquals(new ScuflModelEventListener[0], model .getListeners()); ArrayAssert.assertEquals(new Port[0], model.getWorkflowSinkPorts()); ArrayAssert.assertEquals(new Port[0], model.getWorkflowSourcePorts()); assertNotNull(model.getDescription()); // NOTE: the log level does not seem to be used for anything assertEquals(0, model.getLogLevel()); }
setText(((ScuflModel) userObject).getDescription().getTitle()); } else if (((DefaultMutableTreeNode) value).isLeaf()) { setIcon(TavernaIcons.folderClosedIcon);