Class DrawflowGraphFormat
java.lang.Object
de.iip_ecosphere.platform.configuration.DrawflowGraphFormat
- All Implemented Interfaces:
GraphFormat
Writes a graph in the "drawflow" format.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classImplements a graph reader.private static classInstance to map and write a graph. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromString(String graph, GraphFactory factory, DecisionVariableProvider varProvider) Parsesgraphfrom this format into an IVML graph structure.Returns the kind of format produced.private static intgetInteger(org.json.simple.JSONObject object, String field, int dflt) Obtains an int fromobject.private static <T> TgetJson(org.json.simple.JSONObject object, String field, Class<T> cls, Supplier<T> dflt, Function<Object, T> converter) Obtains a JSON object fromobject.private static org.json.simple.JSONArraygetJsonArray(org.json.simple.JSONObject object, String field) Obtains a JSON array fromobject.private static org.json.simple.JSONObjectgetJsonObject(org.json.simple.JSONObject object, String field) Obtains a JSON object fromobject.getName()Returns the name to address/access this format.private static StringObtains a string fromobject.Turnsgraphinto this format.
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
DrawflowGraphFormat
public DrawflowGraphFormat()
-
-
Method Details
-
getName
Description copied from interface:GraphFormatReturns the name to address/access this format.- Specified by:
getNamein interfaceGraphFormat- Returns:
- the unique name
-
getFormatKind
Description copied from interface:GraphFormatReturns the kind of format produced.- Specified by:
getFormatKindin interfaceGraphFormat- Returns:
- the format kind, e.g., XML, JSON, ...
-
toString
Description copied from interface:GraphFormatTurnsgraphinto this format.- Specified by:
toStringin interfaceGraphFormat- Parameters:
graph- the graph, may be null- Returns:
- the formatted graph, an empty graph if
graphis null - Throws:
ExecutionException- if the translation fails
-
fromString
public IvmlGraphMapper.IvmlGraph fromString(String graph, GraphFactory factory, DecisionVariableProvider varProvider) throws ExecutionException Description copied from interface:GraphFormatParsesgraphfrom this format into an IVML graph structure.- Specified by:
fromStringin interfaceGraphFormat- Parameters:
graph- the graph, may be nullfactory- a factory to be used to create graph instancesvarProvider- the provider allowing to access variables- Returns:
- the IVML graph structure, an empty graph if
graphis null - Throws:
ExecutionException- if the translation fails
-
getJson
private static <T> T getJson(org.json.simple.JSONObject object, String field, Class<T> cls, Supplier<T> dflt, Function<Object, T> converter) Obtains a JSON object fromobject.- Type Parameters:
T- the type to be returned- Parameters:
object- the object to read fromfield- the field name to read from withinobjectcls- the type as classdflt- the default value iffielddoes not existconverter- optional converter if the found value is not compliant withcls, may be null- Returns:
- returns the JSON object or, if not found, an empty JSON object
-
getJsonObject
private static org.json.simple.JSONObject getJsonObject(org.json.simple.JSONObject object, String field) Obtains a JSON object fromobject.- Parameters:
object- the object to read fromfield- the field name- Returns:
- returns the JSON object or, if not found, an empty JSON object
-
getJsonArray
private static org.json.simple.JSONArray getJsonArray(org.json.simple.JSONObject object, String field) Obtains a JSON array fromobject.- Parameters:
object- the object to read fromfield- the field name- Returns:
- returns the JSON array, or, if not found, an empty JSON array
-
getString
Obtains a string fromobject.- Parameters:
object- the object to read fromfield- the field namedflt- the default value- Returns:
- returns the string or, if not found,
dflt
-
getInteger
Obtains an int fromobject.- Parameters:
object- the object to read fromfield- the field namedflt- the default value- Returns:
- returns the int value or, if not found,
dflt
-