Backend API
interface FlowInterface
Interface describing the methods a Flow must have.
Most of the methods corresponds to messages exchanged on the Flow Based Programming Network Protocol.
Created by antoine on 30/05/17.
boolean addNode (String id, String component, JSONObject metadata, String graph, boolean executable)
Add a node to the flow
- Parameters:
id— The id of the nodecomponent— The component of the nodemetadata— The metadata object of the nodegraph— The graph in which to add the nodeexecutable— Whether the node is executable or not
- Returns: True if the node has been added
boolean removeNode (String id, String graph)
Remove a node from the flow
- Parameters:
id— The id of the node to removegraph— The graph from which to remove the node
- Returns:
boolean renameNode (String from, String to, String graph)
Change the id of a node
- Parameters:
from— : the previous idto— : the new idgraph— : the graph where the node is
- Returns: True if successfully done
boolean changeNode (String id, JSONObject metadata, String graph)
Update the metadata of a node.
- Parameters:
id— the id of the nodemetadata— the new metadatagraph— the graph where the node is
- Returns: True if successfully done
boolean addEdge (String id, JSONObject src, JSONObject tgt, JSONObject metadata, String graph)
Add an edge, connecting two nodes on the graph.
- Parameters:
id— the id of the new edgesrc— the src node of the edgetgt— the tgt node of the edgemetadata— the metadata of the edgegraph— the graph where the edge is
- Returns: True if successfully added and connected.
boolean removeEdge (String id, String graph, JSONObject src, JSONObject tgt)
Remove an existing edge from the graph.
- Parameters:
id— the id of the edgegraph— the graph where the edge issrc— the src node of the edgetgt— the tgt node of the edge
- Returns: True if successfully removed
boolean changeEdge (String id, String graph, JSONObject metadata, JSONObject src, JSONObject tgt)
Modify the src, tgt and metadata of an edge
- Parameters:
id— the unique id of the edgegraph— the graph where the edge ismetadata— the new metadata of the edgesrc— the new src object of the edgetgt— the tgt object of the edge
- Returns: True if the modification has successfully be done
boolean addGroup (String name, JSONArray nodes, JSONObject metadata, String graph)
Create a new group that is a kind of subgraph user can run independently.
- Parameters:
name— the name of the new groupnodes— the nodes in this groupmetadata— the metadata of the new groupgraph— the graph where the group is (can be another group)
- Returns: True if successfully created
boolean removeGroup (String name, String graph)
Remove an existing group
- Parameters:
name— name of the group to deletegraph— the graph where the group is
- Returns: True if successfully deleted
boolean renameGroup (String from, String to, String graph)
Rename a group.
- Parameters:
from— the old nameto— the new namegraph— the graph where the group is
- Returns: True if successfully changed
boolean changeGroup (String name, JSONObject metadata, String graph)
Change the metadata of a group.
- Parameters:
name— name of the groupmetadata— new metadata of the groupgraph— the graph where the group is
- Returns: True if successfully changed
String serialize ()
Serialize the flow as json
- Returns: the serialized flow