public static Edit<?> addAnnotation(Annotated<?> annotated, AnnotationBeanSPI a, Edits edits) { return edits.getAddAnnotationChainEdit(annotated, a); }
private Edit<?> addAnnotation(AnnotationBeanSPI a) { return EditsRegistry.getEdits().getAddAnnotationChainEdit(annotated, a); }
private Edit<?> createAddMimeTypeAnnotationEdit(Annotated<?> annotated, String type) { MimeType mimeType = new MimeType(); mimeType.setText(type); return edits.getAddAnnotationChainEdit(annotated, mimeType); }
protected void addOutput(String portName, int portDepth, String type) { OutputPort port = edits.createActivityOutputPort( portName, portDepth, portDepth); MimeType mimeType = new MimeType(); mimeType.setText(type); try { edits.getAddAnnotationChainEdit(port, mimeType).doEdit(); } catch (EditException e) { logger.debug("Error adding MimeType annotation to port", e); } outputPorts.add(port); }
/** * Add the given MIME types to the given input/output port. * * @param annotated * The port to which to add the MIME types. * @param mimeTypes * A list of Strings specifying the MIME types to add. */ private void addMimeTypes(Annotated<?> annotated, List<String> mimeTypes) { for (String mimeType : mimeTypes) { MimeType mimeTypeAnnotation = new MimeType(); mimeTypeAnnotation.setText(mimeType); try { edits.getAddAnnotationChainEdit(annotated, mimeTypeAnnotation).doEdit(); } catch (EditException e) { Logger.getLogger(ExternalToolActivity.class).error(e); } } }
protected void addOutput(String portName, int portDepth, String type) { OutputPort port = edits.createActivityOutputPort( portName, portDepth, portDepth); MimeType mimeType = null; if (type != null) { mimeType = new MimeType(); mimeType.setText(type); } try { edits.getAddAnnotationChainEdit(port, mimeType).doEdit(); } catch (EditException e) { logger.debug("Error adding MimeType annotation to port", e); } outputPorts.add(port); }
public void updateSemanticAnnotation() { try { editManager.doDataflowEdit(fileManager.getCurrentDataflow(), edits .getAddAnnotationChainEdit(annotated, createSemanticAnnotation(getModel()))); } catch (EditException e) { logger.warn("Can't set semantic annotation", e); } }
public void updateSemanticAnnotation() { try { editManager.doDataflowEdit(fileManager.getCurrentDataflow(), edits .getAddAnnotationChainEdit(annotated, createSemanticAnnotation(getModel()))); } catch (EditException e) { logger.warn("Can't set semantic annotation", e); } }
/** * 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(); } }
/** * 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); } }
@SuppressWarnings("unchecked") private void createOutputs(Dataflow dataflow) throws EditException { for (Port sinkPort : scuflModel.getWorkflowSinkPorts()) { List<String> typeList = sinkPort.getMetadata().getMIMETypeList(); edits.getCreateDataflowOutputPortEdit(dataflow, sinkPort.getName()) .doEdit(); for (DataflowOutputPort outputPort : dataflow.getOutputPorts()) { // firstly add the mime types to the new port if (outputPort.getName().equals(sinkPort.getName())) { for (String mimeType : typeList) { MimeType mimeTypeAnnotation = new MimeType(); mimeTypeAnnotation.setText(mimeType); try { EditsRegistry.getEdits().getAddAnnotationChainEdit( outputPort, mimeTypeAnnotation).doEdit(); } catch (EditException e) { // TODO Auto-generated catch block e.printStackTrace(); } } outputMap.put(sinkPort, outputPort); break; } } } }
@SuppressWarnings("unchecked") private void createInputs(Dataflow dataflow) throws EditException { for (Port sourcePort : scuflModel.getWorkflowSourcePorts()) { List<String> typeList = sourcePort.getMetadata().getMIMETypeList(); int portDepth = getPortDepth(sourcePort); edits.getCreateDataflowInputPortEdit(dataflow, sourcePort.getName(), portDepth, portDepth).doEdit(); for (DataflowInputPort inputPort : dataflow.getInputPorts()) { if (inputPort.getName().equals(sourcePort.getName())) { // add mime types as annotations for (String mimeType : typeList) { MimeType mimeTypeAnnotation = new MimeType(); mimeTypeAnnotation.setText(mimeType); try { EditsRegistry.getEdits().getAddAnnotationChainEdit( inputPort, mimeTypeAnnotation).doEdit(); } catch (EditException e) { // TODO Auto-generated catch block e.printStackTrace(); } } inputMap.put(sourcePort, inputPort); break; } } } }
mimeTypeAnnotation.setText(mimeType); try { edits.getAddAnnotationChainEdit(createActivityOutputPort, mimeTypeAnnotation).doEdit(); } catch (EditException e) { logger.error(e);
mimeTypeAnnotation.setText(mimeType); try { EditsRegistry.getEdits().getAddAnnotationChainEdit(createActivityOutputPort, mimeTypeAnnotation).doEdit(); } catch (EditException e) {