use of com.centurylink.mdw.common.translator.SelfSerializable in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method getVariableInfo.
/**
* Must be called from the UI thread.
*/
public VariableTypeVO getVariableInfo(final VariableInstanceInfo varInstInfo) {
String varType = varInstInfo.getType();
VariableTranslator varTrans = getVariableTranslator(varType);
final VariableTypeVO varTypeVO = new VariableTypeVO(0L, varType, varTrans == null ? null : varTrans.getClass().getName());
if (varInstInfo.getStringValue() != null && varTypeVO.isJavaObjectType()) {
BusyIndicator.showWhile(MdwPlugin.getShell().getDisplay(), new Runnable() {
public void run() {
DocumentReference docRef = new DocumentReference(varInstInfo.getStringValue());
try {
Object obj = new JavaObjectTranslator().realToObject(getDocument(docRef).getContent());
varTypeVO.setVariableType(obj.getClass().getName());
varTypeVO.setUpdateable(obj instanceof SelfSerializable);
} catch (TranslationException ex) {
if (MdwPlugin.getSettings().isLogConnectErrors())
PluginMessages.log(ex);
try {
if (!project.checkRequiredVersion(6, 1, 1)) {
String path = "DocumentValue?format=xml&id=" + docRef.getDocumentId() + "&type=" + varTypeVO.getVariableType();
String resp = getRestfulServer().invokeResourceService(path);
Resource res = Resource.Factory.parse(resp, Compatibility.namespaceOptions());
for (Parameter param : res.getParameterList()) {
if ("className".equals(param.getName()))
varTypeVO.setVariableType(param.getStringValue());
else if ("isUpdateable".equals(param.getName()))
varTypeVO.setUpdateable(Boolean.parseBoolean(param.getStringValue()));
}
}
} catch (Exception ex2) {
throw new RuntimeException(ex2.getMessage(), ex2);
}
}
}
});
}
return varTypeVO;
}
Aggregations