use of io.automatiko.engine.workflow.base.core.datatype.impl.type.FloatDataType in project automatiko-engine by automatiko-io.
the class DefinitionsHandler method setVariableDataType.
private void setVariableDataType(Variable variable, Map<String, ItemDefinition> itemDefinitions, ClassLoader cl) {
// retrieve type from item definition
String itemSubjectRef = (String) variable.getMetaData("ItemSubjectRef");
if (UndefinedDataType.getInstance().equals(variable.getType()) && itemDefinitions != null && itemSubjectRef != null) {
DataType dataType = new ObjectDataType();
ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
if (itemDefinition != null) {
String structureRef = itemDefinition.getStructureRef();
if ("java.lang.Boolean".equals(structureRef) || "Boolean".equals(structureRef)) {
dataType = new BooleanDataType();
} else if ("java.lang.Integer".equals(structureRef) || "Integer".equals(structureRef)) {
dataType = new IntegerDataType();
} else if ("java.lang.Float".equals(structureRef) || "Float".equals(structureRef)) {
dataType = new FloatDataType();
} else if ("java.lang.String".equals(structureRef) || "String".equals(structureRef)) {
dataType = new StringDataType();
} else if ("java.lang.Object".equals(structureRef) || "Object".equals(structureRef)) {
// use FQCN of Object
dataType = new ObjectDataType(java.lang.Object.class, structureRef);
} else {
dataType = new ObjectDataType(constructClass(structureRef, cl), structureRef);
}
}
variable.setType(dataType);
}
}
use of io.automatiko.engine.workflow.base.core.datatype.impl.type.FloatDataType in project automatiko-engine by automatiko-io.
the class DataObjectHandler method start.
@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String id = attrs.getValue("id");
final String name = attrs.getValue("name");
final String itemSubjectRef = attrs.getValue("itemSubjectRef");
Object parent = parser.getParent();
if (parent instanceof ContextContainer) {
ContextContainer contextContainer = (ContextContainer) parent;
VariableScope variableScope = (VariableScope) contextContainer.getDefaultContext(VariableScope.VARIABLE_SCOPE);
if (variableScope == null) {
return null;
}
List variables = variableScope.getVariables();
Variable variable = new Variable();
variable.setMetaData("DataObject", "true");
variable.setId(id);
variable.setName(name);
variable.setMetaData(id, variable.getName());
if (localName.equals("dataInput")) {
variable.setMetaData("DataInput", true);
} else if (localName.equals("dataOutput")) {
variable.setMetaData("DataOutput", true);
}
// retrieve type from item definition
DataType dataType = new ObjectDataType();
Map<String, ItemDefinition> itemDefinitions = (Map<String, ItemDefinition>) ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
if (itemDefinitions != null) {
ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
if (itemDefinition != null) {
String structureRef = itemDefinition.getStructureRef();
if ("java.lang.Boolean".equals(structureRef) || "Boolean".equals(structureRef)) {
dataType = new BooleanDataType();
} else if ("java.lang.Integer".equals(structureRef) || "Integer".equals(structureRef)) {
dataType = new IntegerDataType();
} else if ("java.lang.Float".equals(structureRef) || "Float".equals(structureRef)) {
dataType = new FloatDataType();
} else if ("java.lang.String".equals(structureRef) || "String".equals(structureRef)) {
dataType = new StringDataType();
} else if ("java.lang.Object".equals(structureRef) || "Object".equals(structureRef)) {
// use FQCN of Object
dataType = new ObjectDataType(java.lang.Object.class, structureRef);
} else {
dataType = new ObjectDataType(constructClass(structureRef, parser.getClassLoader()), structureRef);
}
}
}
variable.setType(dataType);
variables.add(variable);
return variable;
}
return new Variable();
}
use of io.automatiko.engine.workflow.base.core.datatype.impl.type.FloatDataType in project automatiko-engine by automatiko-io.
the class AbstractNodeHandler method getDataType.
protected DataType getDataType(String itemSubjectRef, Map<String, ItemDefinition> itemDefinitions, ClassLoader cl) {
DataType dataType = new ObjectDataType();
if (itemDefinitions == null) {
return dataType;
}
ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
if (itemDefinition != null) {
String structureRef = itemDefinition.getStructureRef();
if ("java.lang.Boolean".equals(structureRef) || "Boolean".equals(structureRef)) {
dataType = new BooleanDataType();
} else if ("java.lang.Integer".equals(structureRef) || "Integer".equals(structureRef)) {
dataType = new IntegerDataType();
} else if ("java.lang.Float".equals(structureRef) || "Float".equals(structureRef)) {
dataType = new FloatDataType();
} else if ("java.lang.String".equals(structureRef) || "String".equals(structureRef)) {
dataType = new StringDataType();
} else if ("java.lang.Object".equals(structureRef) || "Object".equals(structureRef)) {
dataType = new ObjectDataType(constructClass(structureRef), structureRef);
} else {
dataType = new ObjectDataType(constructClass(structureRef, cl), structureRef);
}
}
return dataType;
}
Aggregations