Search in sources :

Example 11 with VariableTypeVO

use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.

the class PluginDataAccess method getVariableTypes.

public List<VariableTypeVO> getVariableTypes(boolean reload) {
    if (reload || varTypes == null) {
        try {
            if (MdwPlugin.getActiveWorkbenchWindow() != null)
                designerDataModel.reloadVariableTypes(designerDataAccess);
            List<VariableTypeVO> cleanedUpVarTypes = new ArrayList<>();
            if (workflowProject.checkRequiredVersion(6, 0)) {
                for (VariableTypeVO varType : designerDataModel.getVariableTypes()) {
                    switch(varType.getVariableType()) {
                        case "java.lang.String[]":
                        case "java.lang.Integer[]":
                        case "java.lang.Long[]":
                        case "java.util.Map":
                        case "com.centurylink.mdw.model.FormDataDocument":
                        case "com.centurylink.mdw.common.service.Jsonable":
                            break;
                        default:
                            cleanedUpVarTypes.add(varType);
                    }
                }
            } else {
                for (VariableTypeVO varType : designerDataModel.getVariableTypes()) {
                    switch(varType.getVariableType()) {
                        case "java.lang.Exception":
                        case "com.centurylink.mdw.model.Jsonable":
                            break;
                        default:
                            cleanedUpVarTypes.add(varType);
                    }
                }
            }
            designerDataModel.setVariableTypes(cleanedUpVarTypes);
            varTypes = designerDataModel.getVariableTypes();
            Collections.sort(varTypes, new Comparator<VariableTypeVO>() {

                public int compare(VariableTypeVO varType1, VariableTypeVO varType2) {
                    return varType1.getVariableTypeId().compareTo(varType2.getVariableTypeId());
                }
            });
        } catch (Exception ex) {
            PluginMessages.uiError(ex, "Load Variable Types", workflowProject);
        }
    }
    return varTypes;
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) ArrayList(java.util.ArrayList) SQLException(java.sql.SQLException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException)

Example 12 with VariableTypeVO

use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.

the class VariableHelper method isDocumentVariable.

/**
 * Check if the variable type is of a document.
 * Custom variable translators must be loaded from server to make
 * the decision precise.
 *
 * @param vartype
 * @param dao
 * @return
 */
public static boolean isDocumentVariable(String vartype, DesignerDataAccess dao) {
    VariableTranslator translator;
    VariableTypeVO vo = VariableTypeCache.getVariableTypeVO(vartype);
    if (vo == null)
        return false;
    try {
        Class<?> cl = Class.forName(vo.getTranslatorClass());
        translator = (VariableTranslator) cl.newInstance();
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return (translator instanceof DocumentReferenceTranslator);
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) DocumentReferenceTranslator(com.centurylink.mdw.common.translator.DocumentReferenceTranslator) VariableTranslator(com.centurylink.mdw.common.translator.VariableTranslator)

Example 13 with VariableTypeVO

use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.

the class WorkflowAccessRest method getVariableTypes.

public List<VariableTypeVO> getVariableTypes() throws DataAccessException {
    try {
        String variableTypesJson = getServer().invokeResourceService("BaseData/VariableTypes?format=json");
        JSONArray jsonArray = new JSONArray(variableTypesJson);
        List<VariableTypeVO> variableTypes = new ArrayList<VariableTypeVO>();
        for (int i = 0; i < jsonArray.length(); i++) variableTypes.add(new VariableTypeVO(jsonArray.getJSONObject(i)));
        return variableTypes;
    } catch (Exception ex) {
        throw new DataAccessException("Error retrieving variable types", ex);
    }
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Aggregations

VariableTypeVO (com.centurylink.mdw.model.value.variable.VariableTypeVO)13 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)5 VariableTranslator (com.centurylink.mdw.common.translator.VariableTranslator)5 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)5 IOException (java.io.IOException)4 RemoteException (java.rmi.RemoteException)4 JSONException (org.json.JSONException)4 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)3 TranslationException (com.centurylink.mdw.common.exception.TranslationException)3 DocumentReferenceTranslator (com.centurylink.mdw.common.translator.DocumentReferenceTranslator)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)3 FileNotFoundException (java.io.FileNotFoundException)3 ArrayList (java.util.ArrayList)3 ZipException (java.util.zip.ZipException)3 XmlException (org.apache.xmlbeans.XmlException)3 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)2 CoreException (org.eclipse.core.runtime.CoreException)2 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1