@Override public Object getConfigBean() { return EditsRegistry.getEdits().createDataflow(); }
public static Edits getEdits() { List<Edits> instances = getInstance().getInstances(); Edits result = null; if (instances.size() == 0) { System.out.println("No Edits implementation defined"); } else { if (instances.size() > 1) System.out .println("More that 1 Edits implementation defined, using the first"); result=instances.get(0); } return result; } }
public static synchronized EditsRegistry getInstance() { if (instance == null) { instance = new EditsRegistry(); } return instance; }
@Override public Dataflow getActivityConfiguration() { return EditsRegistry.getEdits().createDataflow(); }
public static Edits getEdits() { List<Edits> instances = getInstance().getInstances(); Edits result = null; if (instances.size() == 0) { System.out.println("No Edits implementation defined"); } else { if (instances.size() > 1) System.out .println("More that 1 Edits implementation defined, using the first"); result=instances.get(0); } return result; } }
public static synchronized EditsRegistry getInstance() { if (instance == null) { instance = new EditsRegistry(); } return instance; }
private Edit<?> addAnnotation(AnnotationBeanSPI a) { return EditsRegistry.getEdits().getAddAnnotationChainEdit(annotated, a); }
@Test public void testOneAndOnlyOne() throws Exception { assertEquals("There should be 1 instance",1,EditsRegistry.getInstance().getInstances().size()); } @Test
/** * 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 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); } }
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 void focusLost(FocusEvent e) { String currentValue = area.getText(); if (currentValue.equals("") || currentValue.equals(MISSING_VALUE)) { currentValue = MISSING_VALUE; area.setText(currentValue); } if (!currentValue.equals(oldValue)) { if (currentValue == MISSING_VALUE) { currentValue = ""; } try { Edits edits = EditsRegistry.getEdits(); Dataflow currentDataflow = fileManager.getCurrentDataflow(); List<Edit<?>> editList = new ArrayList<Edit<?>>(); editList.add(annotationTools.setAnnotationString(annotated, annotationClass, currentValue)); if ((annotated == currentDataflow) && (prb.getString(annotationClass.getCanonicalName()).equals("Title")) &&!currentValue.isEmpty()) { editList.add(edits.getUpdateDataflowNameEdit(currentDataflow, sanitiseName(currentValue))); } if (!isStandalone) { ContextualViewComponent.selfGenerated = true; } editManager.doDataflowEdit(currentDataflow, new CompoundEdit(editList)); ContextualViewComponent.selfGenerated = false; } catch (EditException e1) { logger.warn("Can't set annotation", e1); } oldValue = area.getText(); } }
/** * 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); } }