public String getDefinitionLSID() { String lsid = workflowModel.getDescription().getLSID(); if (lsid == null) { return ""; } return lsid; }
/** * 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(); }
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); }