protected void createVariableNode(ProcessVariable variable, Record variableNode, boolean isSource){
if(variable.getType() == ComplexType.class){
ComplexType metaValue = (ComplexType)(variable.getDefaultValue());
try {
Class testcls = metaValue.getTypeClass();
ObjectType objType = new ObjectType(testcls);
FieldDescriptor[] fieldDescriptors = objType.getFieldDescriptors();
for(int j=0; j<fieldDescriptors.length; j++){
FieldDescriptor fd = fieldDescriptors[j];
variableNode.add(createRecord(fd.getName(),variable.getName() + "." + fd.getName(), isSource));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(variable.getType() == HtmlFormContext.class){
HtmlFormContext metaValue = (HtmlFormContext)(variable.getDefaultValue());
if(metaValue.getFormDefId()==null)
variableNode.add(createRecord("No form template is set", null, isSource));;
String formDefId = ProcessDefinition.splitDefinitionAndVersionId(metaValue.getFormDefId())[0];
try {
InputStream is = ProcessDesigner.getClientProxy().showFormDefinitionWithDefinitionId(formDefId);
ArrayList formFieldList = (ArrayList) GlobalContext.deserialize(is, ArrayList.class);
for(int k=0; k<formFieldList.size(); k++){
Object element = formFieldList.get(k);
if(element instanceof String){//that means the field parts are started.
String fieldName = (String)element;
variableNode.add(createRecord(fieldName, variable.getName() + "." + fieldName, isSource));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(variable.getType() == OfficeDocumentInstance.class){
OfficeDocumentInstance metaValue = (OfficeDocumentInstance)(variable.getDefaultValue());
if(metaValue.getDocumentDefId()==null)
variableNode.add(createRecord("No form template is set", null, isSource));;
String formDefId = ProcessDefinition.splitDefinitionAndVersionId(metaValue.getDocumentDefId())[0];
try {
InputStream is = ProcessDesigner.getClientProxy().showObjectDefinitionWithDefinitionId(formDefId);
OfficeDocumentDefinition odd = (OfficeDocumentDefinition) GlobalContext.deserialize(is, OfficeDocumentDefinition.class);