Search in sources :

Example 6 with DataAccessOfflineException

use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.

the class RuntimeDataAccessRest method getProcessInstanceList.

public ProcessList getProcessInstanceList(Map<String, String> criteria, Map<String, String> variables, int pageIndex, int pageSize, String orderBy) throws DataAccessException {
    try {
        String pathWithArgs = "Processes?mdw-app=designer";
        if (!getServer().isSchemaVersion61())
            pathWithArgs = "ProcessInstances?format=json";
        String criteriaParams = queryParams(criteria);
        if (criteriaParams.length() > 0)
            pathWithArgs += "&" + criteriaParams;
        String varParams = queryParams(variables);
        if (varParams.length() > 0)
            pathWithArgs += "&" + varParams;
        if (pageIndex > 0)
            pathWithArgs += "&pageIndex=" + pageIndex;
        if (pageSize != 0)
            pathWithArgs += "&pageSize=" + pageSize;
        if (orderBy != null) {
            pathWithArgs += "&orderBy=" + URLEncoder.encode(orderBy.trim(), "UTF-8");
        }
        String response = invokeResourceService(pathWithArgs);
        return new ProcessList(ProcessList.PROCESS_INSTANCES, response);
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) ProcessList(com.centurylink.mdw.model.value.process.ProcessList) IOException(java.io.IOException) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 7 with DataAccessOfflineException

use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.

the class RuntimeDataAccessRest method getProcessInstanceAll.

public ProcessInstanceVO getProcessInstanceAll(Long processInstanceId) throws DataAccessException {
    try {
        String pathWithArgs = "Processes/" + processInstanceId;
        if (!getServer().isSchemaVersion61())
            pathWithArgs = "ProcessInstance?format=json&instanceId=" + processInstanceId;
        String response = invokeResourceService(pathWithArgs);
        return new ProcessInstanceVO(new JSONObject(response));
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) JSONObject(org.json.JSONObject) IOException(java.io.IOException) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 8 with DataAccessOfflineException

use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.

the class RuntimeDataAccessRest method getTaskInstancesForProcessInstance.

public List<TaskInstanceVO> getTaskInstancesForProcessInstance(Long processInstanceId) throws DataAccessException {
    try {
        if (getServer().getSchemaVersion() >= 6000) {
            String path = "Tasks?processInstanceId=" + processInstanceId;
            String response = invokeResourceService(path);
            return new TaskList(TaskList.TASKS, response).getItems();
        } else {
            String path = "ProcessTasks?format=json&processInstanceId=" + processInstanceId;
            String response = invokeResourceService(path);
            return new TaskList(TaskList.PROCESS_TASKS, response).getItems();
        }
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) TaskList(com.centurylink.mdw.common.task.TaskList) IOException(java.io.IOException) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 9 with DataAccessOfflineException

use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.

the class RuntimeDataAccessRest method getProcessInstanceCallHierarchy.

public LinkedProcessInstance getProcessInstanceCallHierarchy(Long processInstanceId) throws DataAccessException {
    try {
        String pathWithArgs = "Processes?mdw-app=designer&callHierarchyFor=" + processInstanceId;
        String response;
        if (!getServer().isSchemaVersion61())
            pathWithArgs = "ProcessInstances?format=json&callHierarchyFor=" + processInstanceId;
        response = invokeResourceService(pathWithArgs);
        return new LinkedProcessInstance(response);
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) IOException(java.io.IOException) LinkedProcessInstance(com.centurylink.mdw.model.value.process.LinkedProcessInstance) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 10 with DataAccessOfflineException

use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.

the class ImportExportWizard method performFinish.

@Override
public boolean performFinish() {
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            ProgressMonitor progressMonitor = new SwtProgressMonitor(monitor);
            try {
                progressMonitor.start((page.isExport ? "Exporting from " : "Importing into ") + "'" + getProject().getLabel() + "'");
                progressMonitor.progress(5);
                performImportExport(progressMonitor);
                progressMonitor.done();
            } catch (ActionCancelledException ex) {
                throw new OperationCanceledException();
            } catch (Exception ex) {
                PluginMessages.log(ex);
                throw new InvocationTargetException(ex);
            }
        }
    };
    try {
        getContainer().run(true, true, op);
        postRunUpdates();
        return true;
    } catch (InvocationTargetException ex) {
        if (ex.getCause() instanceof DataAccessOfflineException)
            MessageDialog.openError(getShell(), "Export Attributes", "Server appears to be offline: " + ex.getMessage());
        else
            PluginMessages.uiError(getShell(), ex, page.getTitle(), getProject());
        return false;
    } catch (Exception ex) {
        PluginMessages.uiError(getShell(), ex, page.getTitle(), getProject());
        return false;
    }
}
Also used : ProgressMonitor(com.centurylink.mdw.common.utilities.timer.ProgressMonitor) SwtProgressMonitor(com.centurylink.mdw.plugin.designer.SwtProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SwtProgressMonitor(com.centurylink.mdw.plugin.designer.SwtProgressMonitor) ActionCancelledException(com.centurylink.mdw.common.utilities.timer.ActionCancelledException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) XmlException(org.apache.xmlbeans.XmlException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) ActionCancelledException(com.centurylink.mdw.common.utilities.timer.ActionCancelledException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)21 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)19 IOException (java.io.IOException)19 XmlException (org.apache.xmlbeans.XmlException)14 JSONException (org.json.JSONException)14 JSONObject (org.json.JSONObject)7 FileNotFoundException (java.io.FileNotFoundException)4 RemoteException (java.rmi.RemoteException)4 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)3 ProcessList (com.centurylink.mdw.model.value.process.ProcessList)3 ActionRequestMessage (com.centurylink.mdw.common.service.types.ActionRequestMessage)2 ActionCancelledException (com.centurylink.mdw.common.utilities.timer.ActionCancelledException)2 ProgressMonitor (com.centurylink.mdw.common.utilities.timer.ProgressMonitor)2 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)2 SwtProgressMonitor (com.centurylink.mdw.plugin.designer.SwtProgressMonitor)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArrayList (java.util.ArrayList)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2