public class Tools extends Object
Not to be confused with the @deprecated
org.apache.taverna.workflowmodel.impl.Tools
Constructor and Description |
---|
Tools() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addDataflowIdentification(Dataflow dataflow,
String internalId,
Edits edits)
Add the identification of a Dataflow into its identification annotation
chain (if necessary)
|
static boolean |
containsNestedWorkflow(Processor processor)
Returns true if processor contains a nested workflow.
|
protected static EventHandlingInputPort |
findEventHandlingInputPort(List<Edit<?>> editList,
Dataflow dataflow,
InputPort inputPort,
Edits edits)
Find (and possibly create) an EventHandlingInputPort.
|
protected static EventForwardingOutputPort |
findEventHandlingOutputPort(List<Edit<?>> editList,
Dataflow dataflow,
OutputPort outputPort,
Edits edits)
Find (and possibly create) an EventForwardingOutputPort.
|
static ActivityInputPort |
getActivityInputPort(Activity<?> activity,
String portName) |
static OutputPort |
getActivityOutputPort(Activity<?> activity,
String portName) |
static Edit<?> |
getCreateAndConnectDatalinkEdit(Dataflow dataflow,
EventForwardingOutputPort source,
EventHandlingInputPort sink,
Edits edits)
Creates an Edit that creates a Datalink between a source and sink port
and connects the Datalink.
|
static Edit<?> |
getCreateAndConnectDatalinkEdit(Dataflow dataflow,
OutputPort outputPort,
InputPort inputPort,
Edits edits)
Get an
Edit that will link the given output port to the given
input port. |
static Edit<?> |
getDisconnectDatalinkAndRemovePortsEdit(Datalink datalink,
Edits edits) |
static Edit<?> |
getEnableDisabledActivityEdit(Processor processor,
DisabledActivity disabledActivity,
Edits edits) |
static Processor |
getFirstProcessorWithActivityInputPort(Dataflow dataflow,
ActivityInputPort targetPort)
Find the first processor that contains an activity that has the given
activity input port.
|
static Processor |
getFirstProcessorWithActivityOutputPort(Dataflow dataflow,
ActivityOutputPort targetPort) |
static Edit<?> |
getMoveDatalinkSinkEdit(Dataflow dataflow,
Datalink datalink,
EventHandlingInputPort sink,
Edits edits) |
static List<Processor> |
getNestedPathForProcessor(Processor processor,
Dataflow dataflow)
Return a path of processors where the last element is this processor and
previous ones are nested processors that contain this one all the way to
the top but excluding the top level workflow as this is only a list of
processors.
|
static ProcessorInputPort |
getProcessorInputPort(Processor processor,
Activity<?> activity,
InputPort activityInputPort) |
static ProcessorOutputPort |
getProcessorOutputPort(Processor processor,
Activity<?> activity,
OutputPort activityOutputPort) |
static Collection<Processor> |
getProcessorsWithActivity(Dataflow dataflow,
Activity<?> activity) |
static Collection<Processor> |
getProcessorsWithActivityInputPort(Dataflow dataflow,
ActivityInputPort inputPort) |
static Collection<Processor> |
getProcessorsWithActivityOutputPort(Dataflow dataflow,
OutputPort outputPort) |
static Edit<?> |
getRemoveProcessorInputPortEdit(ProcessorInputPort port,
Edits edits) |
static Edit<?> |
getRemoveProcessorOutputPortEdit(ProcessorOutputPort port,
Edits edits) |
static TokenProcessingEntity |
getTokenProcessingEntityWithEventForwardingOutputPort(EventForwardingOutputPort port,
Dataflow workflow)
Get the TokenProcessingEntity (Processor, Merge or Dataflow) from the
workflow that contains the given EventForwardingOutputPort.
|
static TokenProcessingEntity |
getTokenProcessingEntityWithEventHandlingInputPort(EventHandlingInputPort port,
Dataflow workflow)
Get the TokenProcessingEntity (Processor, Merge or Dataflow) from the
workflow that contains the given target EventHandlingInputPort.
|
static String |
getUniqueMergeInputPortName(Merge merge,
String name,
int count) |
static String |
sanitiseName(String name)
Checks that the name does not have any characters that are invalid for a
Taverna name.
|
static String |
uniqueObjectName(String preferredName,
Set<String> existingNames) |
static String |
uniquePortName(String suggestedPortName,
Collection<? extends Port> existingPorts)
Find a unique port name given a list of existing ports.
|
static String |
uniqueProcessorName(String preferredName,
Dataflow dataflow)
Find a unique processor name for the supplied Dataflow, based upon the
preferred name.
|
protected static EventHandlingInputPort findEventHandlingInputPort(List<Edit<?>> editList, Dataflow dataflow, InputPort inputPort, Edits edits)
If the given inputPort is an instance of EventHandlingInputPort
,
it is returned directly. If it is an ActivityInputPort - the owning
processors (found by searching the dataflow) will be searced for a mapped
input port. If this cannot be found, one will be created and mapped. The
edits for this will be added to the editList and needs to be executed by
the caller.
editList
- List of Edit
s to append any required edits (yet to be
performed) todataflow
- Dataflow containing the processorsinputPort
- An EventHandlingInputPort or ActivityInputPort#findEventHandlingOutputPort(List, Dataflow, OutputPort)
protected static EventForwardingOutputPort findEventHandlingOutputPort(List<Edit<?>> editList, Dataflow dataflow, OutputPort outputPort, Edits edits)
If the given outputPort is an instance of
EventForwardingOutputPort
, it is returned directly. If it is an
ActivityOutputPort - the owning processors (found by searching the
dataflow) will be searced for a mapped output port. If this cannot be
found, one will be created and mapped. The edits for this will be added
to the editList and needs to be executed by the caller.
editList
- List of Edit
s to append any required edits (yet to be
performed) todataflow
- Dataflow containing the processorsoutputPort
- An EventForwardingOutputPort or ActivityOutputPort#findEventHandlingInputPort(List, Dataflow, InputPort)
public static Edit<?> getCreateAndConnectDatalinkEdit(Dataflow dataflow, EventForwardingOutputPort source, EventHandlingInputPort sink, Edits edits)
dataflow
- the Dataflow to add the Datalink tosource
- the source of the Datalinksink
- the source of the Datalinkpublic static Edit<?> getCreateAndConnectDatalinkEdit(Dataflow dataflow, OutputPort outputPort, InputPort inputPort, Edits edits)
Edit
that will link the given output port to the given
input port.
The output port can be an EventForwardingOutputPort
(such as an
ProcessorOutputPort
, or an ActivityOutputPort
. The input
port can be an EventHandlingInputPort
(such as an
ProcessorInputPort
, or an ActivityInputPort
.
If an input and/or output port is an activity port, processors in the given dataflow will be searched for matching mappings, create the processor port and mapping if needed, before constructing the edits for adding the datalink.
dataflow
- Dataflow (indirectly) containing portsoutputPort
- An EventForwardingOutputPort
or an
ActivityOutputPort
inputPort
- An EventHandlingInputPort
or an
ActivityInputPort
public static String uniquePortName(String suggestedPortName, Collection<? extends Port> existingPorts)
If needed, the returned port name will be prefixed with an underscore and a number, starting from 2. (The original being 'number 1')
Although not strictly needed by Taverna, for added user friendliness the case of the existing port names are ignored when checking for uniqueness.
suggestedPortName
- Port name suggested for new portexistingPorts
- Collection of existing Port
suniqueProcessorName(String, Dataflow)
public static Edit<?> getMoveDatalinkSinkEdit(Dataflow dataflow, Datalink datalink, EventHandlingInputPort sink, Edits edits)
public static Edit<?> getDisconnectDatalinkAndRemovePortsEdit(Datalink datalink, Edits edits)
public static Edit<?> getRemoveProcessorOutputPortEdit(ProcessorOutputPort port, Edits edits)
public static Edit<?> getRemoveProcessorInputPortEdit(ProcessorInputPort port, Edits edits)
public static Edit<?> getEnableDisabledActivityEdit(Processor processor, DisabledActivity disabledActivity, Edits edits)
public static ProcessorInputPort getProcessorInputPort(Processor processor, Activity<?> activity, InputPort activityInputPort)
public static ProcessorOutputPort getProcessorOutputPort(Processor processor, Activity<?> activity, OutputPort activityOutputPort)
public static ActivityInputPort getActivityInputPort(Activity<?> activity, String portName)
public static OutputPort getActivityOutputPort(Activity<?> activity, String portName)
public static String getUniqueMergeInputPortName(Merge merge, String name, int count)
public static Collection<Processor> getProcessorsWithActivity(Dataflow dataflow, Activity<?> activity)
public static Collection<Processor> getProcessorsWithActivityInputPort(Dataflow dataflow, ActivityInputPort inputPort)
public static Collection<Processor> getProcessorsWithActivityOutputPort(Dataflow dataflow, OutputPort outputPort)
public static TokenProcessingEntity getTokenProcessingEntityWithEventForwardingOutputPort(EventForwardingOutputPort port, Dataflow workflow)
port
- workflow
- public static TokenProcessingEntity getTokenProcessingEntityWithEventHandlingInputPort(EventHandlingInputPort port, Dataflow workflow)
port
- workflow
- public static boolean containsNestedWorkflow(Processor processor)
public static Processor getFirstProcessorWithActivityInputPort(Dataflow dataflow, ActivityInputPort targetPort)
dataflow
- targetPort
- public static Processor getFirstProcessorWithActivityOutputPort(Dataflow dataflow, ActivityOutputPort targetPort)
public static String uniqueProcessorName(String preferredName, Dataflow dataflow)
Note that this method checks the uniqueness against the names of all
NamedWorkflowEntity
s, including Merge
s.
Although not strictly needed by Taverna, for added user friendliness the case of the existing port names are ignored when checking for uniqueness.
preferredName
- the preferred name for the Processordataflow
- the dataflow for which the Processor name needs to be uniquepublic static String sanitiseName(String name)
name
- the original namepublic static String uniqueObjectName(String preferredName, Set<String> existingNames)
public static boolean addDataflowIdentification(Dataflow dataflow, String internalId, Edits edits)
public static List<Processor> getNestedPathForProcessor(Processor processor, Dataflow dataflow)
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.