Search in sources :

Example 1 with MDWStatusMessageDocument

use of com.centurylink.mdw.bpm.MDWStatusMessageDocument in project mdw-designer by CenturyLinkCloud.

the class RestfulServer method skipActivityInstance.

public String skipActivityInstance(Long activityId, Long activityInstanceId, String completionCode, boolean oldFormat) throws DataAccessException, XmlException, IOException {
    if (isSchemaVersion61()) {
        return skipActivityInstance(activityInstanceId, ActivityResultCodeConstant.RESULT_PROCEED, completionCode);
    } else {
        String request = buildSkipActivityInstanceRequest(activityId, activityInstanceId, completionCode, oldFormat);
        MDWStatusMessageDocument statusMsgDoc = invokeService(request);
        if (statusMsgDoc.getMDWStatusMessage().getStatusCode() == 0)
            // indicates success
            return "";
        else
            return statusMsgDoc.getMDWStatusMessage().getStatusMessage();
    }
}
Also used : MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument)

Example 2 with MDWStatusMessageDocument

use of com.centurylink.mdw.bpm.MDWStatusMessageDocument in project mdw-designer by CenturyLinkCloud.

the class RestfulServer method retryActivityInstance.

public String retryActivityInstance(Long activityId, Long activityInstanceId, boolean oldFormat) throws DataAccessException, XmlException, IOException {
    if (isSchemaVersion61()) {
        return retryActivityInstance(activityInstanceId, ActivityResultCodeConstant.RESULT_RETRY);
    } else {
        String request = buildRetryActivityInstanceRequest(activityId, activityInstanceId, oldFormat);
        MDWStatusMessageDocument statusMsgDoc = invokeService(request);
        if (statusMsgDoc.getMDWStatusMessage().getStatusCode() == 0)
            // indicates success
            return "";
        else
            return statusMsgDoc.getMDWStatusMessage().getStatusMessage();
    }
}
Also used : MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument)

Example 3 with MDWStatusMessageDocument

use of com.centurylink.mdw.bpm.MDWStatusMessageDocument in project mdw-designer by CenturyLinkCloud.

the class RestfulServer method invokeResourceService.

public String invokeResourceService(String path) throws DataAccessException, IOException {
    String url = getMdwWebUrl() + (path.startsWith("/") ? "Services/" + path : "/Services/" + path);
    String response = null;
    try {
        HttpHelper httpHelper = getHttpHelper(url);
        httpHelper.setConnectTimeout(getConnectTimeout());
        httpHelper.setReadTimeout(getReadTimeout());
        response = httpHelper.get();
    } catch (SocketTimeoutException ex) {
        throw new IOException("Timeout after " + getReadTimeout() + " ms", ex);
    } catch (FileNotFoundException ex) {
        throw ex;
    } catch (IOException ex) {
        throw new IOException("Unable to connect to " + getMdwWebUrl(), ex);
    }
    if (response != null && (response.trim().startsWith("<xs:MDWStatusMessage") || response.trim().startsWith("<bpm:MDWStatusMessage"))) {
        try {
            MDWStatusMessageDocument msgDoc = MDWStatusMessageDocument.Factory.parse(response, Compatibility.namespaceOptions());
            throw new DataAccessException(msgDoc.getMDWStatusMessage().getStatusMessage());
        } catch (Exception ex) {
            throw new DataAccessException(-1, response, ex);
        }
    }
    return response;
}
Also used : SocketTimeoutException(java.net.SocketTimeoutException) FileNotFoundException(java.io.FileNotFoundException) MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument) IOException(java.io.IOException) HttpHelper(com.centurylink.mdw.common.utilities.HttpHelper) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) JSONException(org.json.JSONException) SocketTimeoutException(java.net.SocketTimeoutException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException) XmlException(org.apache.xmlbeans.XmlException)

Example 4 with MDWStatusMessageDocument

use of com.centurylink.mdw.bpm.MDWStatusMessageDocument in project mdw-designer by CenturyLinkCloud.

the class Server method getErrorMessageFromResponse.

public String getErrorMessageFromResponse(String response) throws XmlException {
    MDWStatusMessageDocument statusMessageDoc = MDWStatusMessageDocument.Factory.parse(response, Compatibility.namespaceOptions());
    MDWStatusMessage statusMessage = statusMessageDoc.getMDWStatusMessage();
    if (// indicate success
    statusMessage.getStatusCode() == 0)
        // indicate success
        return "";
    else
        return statusMessage.getStatusMessage();
}
Also used : MDWStatusMessage(com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage) MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument)

Example 5 with MDWStatusMessageDocument

use of com.centurylink.mdw.bpm.MDWStatusMessageDocument in project mdw-designer by CenturyLinkCloud.

the class CacheRefresh method refreshSingle.

public void refreshSingle(String cacheName, boolean silent) {
    try {
        MDWStatusMessageDocument statusMsgDoc = restfulServer.refreshCache("SingleCache", cacheName, workflowProject.isRemote(), workflowProject.isOldNamespaces(), false);
        if (!silent) {
            String message = statusMsgDoc.getMDWStatusMessage().getStatusMessage();
            PluginMessages.uiMessage(workflowProject.getName() + " Refresh Caches:\n" + message, REFRESH_CACHES, workflowProject, PluginMessages.INFO_MESSAGE);
        }
    } catch (Exception ex) {
        if (!silent || MdwPlugin.getSettings().isLogConnectErrors())
            PluginMessages.uiError(ex, ex.getMessage(), REFRESH_CACHES, workflowProject);
    }
}
Also used : MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException)

Aggregations

MDWStatusMessageDocument (com.centurylink.mdw.bpm.MDWStatusMessageDocument)9 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)4 IOException (java.io.IOException)4 RemoteException (java.rmi.RemoteException)4 JSONException (org.json.JSONException)4 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)3 HttpHelper (com.centurylink.mdw.common.utilities.HttpHelper)3 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 XmlException (org.apache.xmlbeans.XmlException)3 JSONObject (org.json.JSONObject)3 StatusMessage (com.centurylink.mdw.common.service.types.StatusMessage)2 FileNotFoundException (java.io.FileNotFoundException)2 SocketTimeoutException (java.net.SocketTimeoutException)2 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)1 MdwSecurityException (com.centurylink.mdw.auth.MdwSecurityException)1 TranslationException (com.centurylink.mdw.common.exception.TranslationException)1 DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)1 AppSummary (com.centurylink.mdw.designer.model.AppSummary)1 DbInfo (com.centurylink.mdw.designer.model.DbInfo)1