use of org.apache.airavata.workflow.core.dag.nodes.InputNodeImpl in project airavata by apache.
the class JsonWorkflowParser method readWorkflowInputs.
private void readWorkflowInputs(JsonReader jsonReader) throws ParserException, IOException {
JsonToken peek = jsonReader.peek();
InputNode inputNode;
NodeModel nodeModel;
ComponentStatus status;
String name;
if (peek == JsonToken.NULL) {
throw new ParserException("Error! workflow inputs 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);
inputNode = new InputNodeImpl(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)) {
inputNode.setDataType(DataType.valueOf(jsonReader.nextString()));
} 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)) {
inputNode.setValue(jsonReader.nextString());
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
inputs.add(inputNode);
}
jsonReader.endArray();
} else {
throw new ParserException("Error! Unsupported value for Workflow Inputs, exptected " + getTokenString(JsonToken.BEGIN_OBJECT) + " but found" + getTokenString(peek));
}
}
Aggregations