@Override public Dataflow getActivityConfiguration() { return EditsRegistry.getEdits().createDataflow(); }
@Override public Object getConfigBean() { return EditsRegistry.getEdits().createDataflow(); }
private Edit<?> addAnnotation(AnnotationBeanSPI a) { return EditsRegistry.getEdits().getAddAnnotationChainEdit(annotated, a); }
/** * Creates and adds a new input port with the provided properties. * * @param portName - * the name of the port to be created. * @param portDepth - * the depth of the port to be created. */ protected void addInput(String portName, int portDepth, boolean allowsLiteralValues, List<Class<? extends ReferenceScheme<?>>> handledReferenceSchemes, Class<?> translatedElementClass) { inputPorts.add(EditsRegistry.getEdits().buildActivityInputPort( portName, portDepth, allowsLiteralValues, handledReferenceSchemes, translatedElementClass)); }
/** * Creates and adds a new output port with the provided properties. * * @param portName - * the name of the port to be created. * @param portDepth - * the depth of the port to be created * @param granularDepth - * the granular depth of the port to be created * @param mimeTypes - * a List of String representations of the MIME type this port * will emit as outputs. */ protected void addOutput(String portName, int portDepth, int granularDepth) { outputPorts.add(EditsRegistry.getEdits().buildActivityOutputPort( portName, portDepth, granularDepth)); }
/** * Creates and adds a new output port with the provided properties. * * @see #removeOutputs() * @param portName - * the name of the port to be created. * @param portDepth - * the depth of the port to be created * @param granularDepth - * the granular depth of the port to be created * @param mimeTypes - * a List of String representations of the MIME type this port * will emit as outputs. */ protected void addOutput(String portName, int portDepth, int granularDepth) { outputPorts.add(EditsRegistry.getEdits().createActivityOutputPort( portName, portDepth, granularDepth)); }
/** * Creates and adds a new input port with the provided properties. * * @see #removeInputs() * @param portName - * the name of the port to be created. * @param portDepth - * the depth of the port to be created. */ protected void addInput( String portName, int portDepth, boolean allowsLiteralValues, List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes, Class<?> translatedElementClass) { if (handledReferenceSchemes == null) { handledReferenceSchemes = Collections.emptyList(); } inputPorts.add(EditsRegistry.getEdits().createActivityInputPort( portName, portDepth, allowsLiteralValues, handledReferenceSchemes, translatedElementClass)); }
@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); }
public void actionPerformed(ActionEvent e) { Edits edits = EditsRegistry.getEdits(); Edit<?> reorderMergeInputPortsEdit = edits .getReorderMergeInputPortsEdit(merge, reorderedInputPortsList); Dataflow currentDataflow = FileManager.getInstance() .getCurrentDataflow(); try { EditManager.getInstance().doDataflowEdit(currentDataflow, reorderMergeInputPortsEdit); } catch (IllegalStateException ex1) { logger.error("Could not configure merge", ex1); } catch (EditException ex2) { logger.error("Could not configure merge", ex2); } }
public static void configureActivityStatic(Dataflow df, Activity a, Object bean) { Edits edits = EditsRegistry.getEdits(); Edit<?> configureActivityEdit = edits.getConfigureActivityEdit(a, bean); try { List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(configureActivityEdit); Processor p = findProcessor(df, a); if (p != null && p.getActivityList().size() == 1) { editList.add(edits.getMapProcessorPortsForActivityEdit(p)); } EditManager.getInstance().doDataflowEdit(df, new CompoundEdit(editList)); } catch (IllegalStateException e) { // TODO Auto-generated catch block logger.error(e); } catch (EditException e) { logger.error(e); } }
/** * Adds the selected dataflow to the currently opened one. Create a * processor with the same name as the nested dataflow (ie. the one just * opened). Add the configured dataflow activity to this processor. Then use * the {@link EditManager} to add the processor to the main dataflow so that * any GUI updates are forced * * @param dataflow */ private void addSelectedDataflowToCurrentDataflow(Dataflow dataflow) { createProcessor = EditsRegistry.getEdits().createProcessor( dataflow.getLocalName()); try { EditsRegistry.getEdits().getAddActivityEdit(createProcessor, dataflowActivity).doEdit(); EditManager.getInstance().doDataflowEdit( (Dataflow) ModelMap.getInstance().getModel( ModelMapConstants.CURRENT_DATAFLOW), EditsRegistry.getEdits() .getMapProcessorPortsForActivityEdit( createProcessor)); } catch (EditException e) { logger.error("Could not add nested workflow", e); } }
public void configureActivity(Dataflow df, Activity a, Object bean) { Edits edits = EditsRegistry.getEdits(); Edit<?> configureActivityEdit = edits.getConfigureActivityEdit(a, bean); try { List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(configureActivityEdit); Processor p = findProcessor(df, a); if (p != null && p.getActivityList().size() == 1) { editList.add(edits.getMapProcessorPortsForActivityEdit(p)); } Edit e = Tools.getEnableDisabledActivityEdit(super.owningProcessor, activity); if (e != null) { editList.add(e); EditManager.getInstance().doDataflowEdit(df, new CompoundEdit(editList)); ReportManager.getInstance().updateObjectReport(super.owningDataflow, super.owningProcessor); } } catch (IllegalStateException e) { // TODO Auto-generated catch block logger.error(e); } catch (EditException e) { logger.error(e); } }
/** * Adds the selected dataflow to the currently opened one. Create a * processor with the same name as the nested dataflow (ie. the one just * opened). Add the configured dataflow activity to this processor. Then use * the {@link EditManager} to add the processor to the main dataflow so that * any GUI updates are forced * * @param dataflow */ private void addSelectedDataflowToCurrentDataflow(Dataflow dataflow) { createProcessor = EditsRegistry.getEdits().createProcessor( dataflow.getLocalName()); try { EditsRegistry.getEdits().getAddActivityEdit(createProcessor, dataflowActivity).doEdit(); EditManager.getInstance().doDataflowEdit( (Dataflow) ModelMap.getInstance().getModel( ModelMapConstants.CURRENT_DATAFLOW), EditsRegistry.getEdits() .getMapProcessorPortsForActivityEdit( createProcessor)); } catch (EditException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Test public void testImplFound() { Edits edits = EditsRegistry.getEdits(); assertTrue("The edit should be an instance of EditsImpl",edits instanceof EditsImpl); } }
private void insertLoopLayer(DispatchStack dispatchStack, Loop loopLayer) throws EditException { Edits edits = EditsRegistry.getEdits(); // TODO: Make a real Edit for inserting layer List<DispatchLayer<?>> layers = dispatchStack.getLayers(); int loopLayerPosition = 0; for (int layerPosition = 0; layerPosition < layers.size(); layerPosition++) { DispatchLayer<?> dispatchLayer = layers.get(layerPosition); if (dispatchLayer instanceof Parallelize) { // At least below Parallelize loopLayerPosition = layerPosition + 1; } if (dispatchLayer instanceof ErrorBounce) { // But preferably below ErrorBounce loopLayerPosition = layerPosition + 1; break; } } final EditManager editManager = EditManager.getInstance(); final FileManager fileManager = FileManager.getInstance(); Edit<DispatchStack> edit = edits.getAddDispatchLayerEdit(dispatchStack, loopLayer, loopLayerPosition); editManager.doDataflowEdit(fileManager.getCurrentDataflow(), edit); }
protected void configureActivity(ConfigurationBean configurationBean) { Edits edits = EditsRegistry.getEdits(); Edit<?> configureActivityEdit = edits.getConfigureActivityEdit( getActivity(), configurationBean); Dataflow currentDataflow = FileManager.getInstance() .getCurrentDataflow(); try { List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(configureActivityEdit); Processor p = findProcessor(currentDataflow); if (p != null && p.getActivityList().size() == 1) { editList.add(edits.getMapProcessorPortsForActivityEdit(p)); } EditManager.getInstance().doDataflowEdit(currentDataflow, new CompoundEdit(editList)); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (EditException e) { e.printStackTrace(); } }
@Before public void setUp() throws Exception { bean = new DataflowActivityConfigurationBean(); dataflow = EditsRegistry.getEdits().createDataflow(); }
/** * Annotate the Activity with the name of the Institution or person who * created the activity. Useful for Localworkers that have been altered by a * user */ private void addAnnotation() { // FIXME use a more useful name or a different type of annotation, this // is just here as a marker so that // the colour manager works HostInstitution hostInstitutionAnnotation = new HostInstitution(); hostInstitutionAnnotation.setText("UserNameHere"); try { // force the dataflow view to update with the annotation added, // therefore triggering the localworker to be coloured as a // beanshell EditManager.getInstance().doDataflowEdit( (Dataflow) ModelMap.getInstance().getModel( ModelMapConstants.CURRENT_DATAFLOW), EditsRegistry.getEdits().getAddAnnotationChainEdit( activity, hostInstitutionAnnotation)); ActivityIconManager.getInstance().resetIcon(activity); } catch (EditException e) { logger.error(e); } }
@Before public void makeDataflow() throws EditException { List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>(); dataflow = fileManager.newDataflow(); Edits edits = EditsRegistry.getEdits(); proc1 = edits.createProcessor("processor1"); compoundEdit.add(edits.getAddProcessorEdit(dataflow, proc1)); Processor proc2 = edits.createProcessor("processor2"); compoundEdit.add(edits.getAddProcessorEdit(dataflow, proc2)); ProcessorInputPort in1 = edits.createProcessorInputPort(proc1, "in1", 0); compoundEdit.add(edits.getAddProcessorInputPortEdit(proc1, in1)); ProcessorInputPort in2 = edits .createProcessorInputPort(proc1, "in2", 0); compoundEdit.add(edits.getAddProcessorInputPortEdit(proc1, in2)); Activity<EchoConfig> activity = new AsynchEchoActivity(); compoundEdit.add(edits.getConfigureActivityEdit(activity, new EchoConfig())); compoundEdit.add(edits.getAddActivityEdit(proc1, activity)); compoundEdit.add(edits.getDefaultDispatchStackEdit(proc1)); editManager.doDataflowEdit(dataflow, new CompoundEdit(compoundEdit)); activityInputPort = activity.getInputPorts().iterator().next(); } }
@Before public void setUp() throws Exception { activity = new DataflowActivity(); configurationBean = new DataflowActivityConfigurationBean(); Edits edits = EditsRegistry.getEdits(); dataflow = edits.createDataflow(); edits.getCreateDataflowInputPortEdit(dataflow, "input", 0, 0).doEdit(); edits.getCreateDataflowOutputPortEdit(dataflow, "output").doEdit(); configurationBean.setDataflow(dataflow); }