public Edit<?> getAddAnnotationChainEdit(Annotated<?> annotated, AnnotationBeanSPI annotation) { List<Edit<?>> editList = new ArrayList<Edit<?>>(); AnnotationAssertion<?> annotationAssertion = new AnnotationAssertionImpl(); editList.add(getAddAnnotationBean(annotationAssertion, annotation)); AnnotationChain annotationChain = new AnnotationChainImpl(); editList.add(getAddAnnotationAssertionEdit(annotationChain, annotationAssertion)); editList.add(annotated.getAddAnnotationEdit(annotationChain)); return new CompoundEdit(editList); }
public boolean isApplied() { return (compoundEdit!=null && compoundEdit.isApplied()); }
@Override public void configure(BiomartActivityConfigurationBean configurationBean) throws ActivityConfigurationException { this.configurationBean = configurationBean; biomartQuery = MartServiceXMLHandler.elementToMartQuery(configurationBean.getMartQuery(), null); String location = biomartQuery.getMartService().getLocation(); List<Edit<?>> editList = new ArrayList<Edit<?>>(); buildInputPorts(editList); buildOutputPorts(editList); try { new CompoundEdit(editList).doEdit(); } catch (EditException e) { throw new ActivityConfigurationException(e); } }
public void undo() { compoundEdit.undo(); }
CompoundEdit compoundEdit = new CompoundEdit(editList); compoundEdits.add(compoundEdit); compoundEdit.doEdit(); linkEditList.add(Tools.getCreateAndConnectDatalinkEdit(dataflow, sourcePort, sinkPort)); CompoundEdit linkEdit = new CompoundEdit(linkEditList); linkEdits.add(linkEdit); linkEdit.doEdit();
public void undo() { compoundEdit.undo(); }
protected Edit<?> makeInsertNestedWorkflowEdit(Dataflow nestedFlow, String name) { List<Edit<?>> editList = new ArrayList<Edit<?>>(); insertedActivity = new DataflowActivity(); editList.add(edits.getConfigureActivityEdit(insertedActivity, nestedFlow)); Processor p = edits.createProcessor(name); editList.add(edits.getDefaultDispatchStackEdit(p)); editList.add(edits.getAddActivityEdit(p, insertedActivity)); editList.add(edits.getAddProcessorEdit(destinationDataflow, p)); CompoundEdit edit = new CompoundEdit(editList); return edit; }
CompoundEdit compoundEdit = new CompoundEdit(editList); subEdits.add(compoundEdit); compoundEdit.doEdit(); linkEditList.add(Tools.getCreateAndConnectDatalinkEdit(dataflow, sourcePort, sinkPort)); CompoundEdit linkEdit = new CompoundEdit(linkEditList); subEdits.add(linkEdit); linkEdit.doEdit();
public boolean isApplied() { return (compoundEdit!=null && compoundEdit.isApplied()); }
public Edit<?> getAddAnnotationChainEdit(Annotated<?> annotated, AnnotationBeanSPI annotation) { List<Edit<?>> editList = new ArrayList<Edit<?>>(); AnnotationAssertion<?> annotationAssertion = new AnnotationAssertionImpl(); editList.add(getAddAnnotationBean(annotationAssertion, annotation)); AnnotationChain annotationChain = new AnnotationChainImpl(); editList.add(getAddAnnotationAssertionEdit(annotationChain, annotationAssertion)); editList.add(annotated.getAddAnnotationEdit(annotationChain)); return new CompoundEdit(editList); }
compoundEdit = new CompoundEdit(edits); compoundEdit.doEdit(); return processor;
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }
public static Edit<?> getMoveDatalinkSinkEdit(Dataflow dataflow, Datalink datalink, EventHandlingInputPort sink, Edits edits) { List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(edits.getDisconnectDatalinkEdit(datalink)); if (datalink.getSink() instanceof ProcessorInputPort) { editList .add(getRemoveProcessorInputPortEdit((ProcessorInputPort) datalink .getSink(), edits)); } editList.add(getCreateAndConnectDatalinkEdit(dataflow, datalink .getSource(), sink, edits)); return new CompoundEdit(editList); }
compoundEdit = new CompoundEdit(edits); compoundEdit.doEdit(); return processor;
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }
@Override protected Edit<?> makeInsertNestedWorkflowEdit(Dataflow nestedFlow, String name) { Edits edits = EditsRegistry.getEdits(); Edit<?> configureActivityEdit = edits.getConfigureActivityEdit(getActivity(), nestedFlow); List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(configureActivityEdit); Processor p = findProcessor(fileManager.getCurrentDataflow(), getActivity()); if (p != null && p.getActivityList().size() == 1) { editList.add(edits.getMapProcessorPortsForActivityEdit(p)); } return new CompoundEdit(editList); }
/** * 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(); } }
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }