use of org.apache.airavata.workflow.core.dag.nodes.OutputNodeImpl in project airavata by apache.
the class JsonWorkflowParser method readWorkflowOutputs.
private void readWorkflowOutputs(JsonReader jsonReader) throws IOException, ParserException {
JsonToken peek = jsonReader.peek();
OutputNode outputNode;
NodeModel nodeModel;
ComponentStatus status;
String name;
if (peek == JsonToken.NULL) {
throw new ParserException("Error! workflow outputs can't be null");
} else if (peek == JsonToken.BEGIN_ARRAY) {
jsonReader.beginArray();
while (jsonReader.hasNext()) {
jsonReader.beginObject();
nodeModel = new NodeModel();
status = new ComponentStatus();
status.setState(ComponentState.CREATED);
status.setReason("Created");
nodeModel.setStatus(status);
outputNode = new OutputNodeImpl(nodeModel);
while (jsonReader.hasNext()) {
name = jsonReader.nextName();
if (name.equals(NAME)) {
nodeModel.setName(jsonReader.nextString());
} else if (name.equals(ID)) {
nodeModel.setNodeId(jsonReader.nextString());
} else if (name.equals(DATATYPE)) {
jsonReader.skipValue();
} else if (name.equals(DESCRIPTION)) {
nodeModel.setDescription(jsonReader.nextString());
} else if (name.equals(POSITION)) {
readPosition(jsonReader);
} else if (name.equals(NODE_ID)) {
jsonReader.skipValue();
// nodeModel.setNodeId(jsonReader.nextString());
} else if (name.equals(DEFAULT_VALUE)) {
jsonReader.skipValue();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
outputs.add(outputNode);
}
jsonReader.endArray();
} else {
throw new ParserException("Error! Unsupported value for Workflow Outputs, exptected " + getTokenString(JsonToken.BEGIN_OBJECT) + " but found" + getTokenString(peek));
}
}
Aggregations