Example usage for javax.xml.ws WebServiceException getCause

List of usage examples for javax.xml.ws WebServiceException getCause

Introduction

In this page you can find the example usage for javax.xml.ws WebServiceException getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:com.docdoku.client.data.MainModel.java

public DocumentMasterTemplate[] getDocMTemplates() {
    DocumentMasterTemplate[] templates = mCache.getDocMTemplates();

    if (templates == null) {
        try {/*from   w w  w . j  a v a 2s .c  o  m*/
            System.out.println("Retrieving templates");
            //templates = Tools.resetParentReferences(mDocumentService.getDocumentMasterTemplates(getWorkspace().getId()));
            templates = mDocumentService.getDocumentMasterTemplates(getWorkspace().getId());
            mCache.cacheDocMTemplates(templates);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            showContinueOrExitDialog(message);
        }
    }
    return templates;
}

From source file:com.docdoku.client.data.MainModel.java

public DocumentMaster getDocM(DocumentMasterKey pDocMPK) {
    DocumentMaster docM = mCache.getDocM(pDocMPK);

    if (docM == null) {
        try {/*from  w  ww .  j a v a 2 s . com*/
            System.out.println("Retrieving document master " + pDocMPK);
            docM = Tools.resetParentReferences(mDocumentService.getDocumentMaster(pDocMPK));
            mCache.cacheDocM(docM);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            JOptionPane.showMessageDialog(null, message, I18N.BUNDLE.getString("Error_title"),
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    return docM;
}

From source file:com.docdoku.client.data.MainModel.java

public DocumentMaster[] getCheckedOutDocMs() {
    DocumentMaster[] docMs = mCache.getCheckedOutDocMs();

    if (docMs == null) {
        try {//from w ww  .  java2s .  c  o m
            System.out.println("Retrieving personnal checked out document masters");
            docMs = Tools.resetParentReferences(
                    mDocumentService.getCheckedOutDocumentMasters(getWorkspace().getId()));
            mCache.cacheCheckedOutDocMs(docMs);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            showContinueOrExitDialog(message);
        }
    }
    return docMs;
}

From source file:com.docdoku.client.data.MainModel.java

public DocumentMaster[] findDocMsByTag(String pTag) {
    DocumentMaster[] docMs = mCache.findDocMsByTag(pTag);

    if (docMs == null) {
        try {/*from   w w w . j a va2s  .co  m*/
            System.out.println("Searching document masters by tag " + pTag);
            docMs = Tools.resetParentReferences(
                    mDocumentService.findDocumentMastersByTag(new TagKey(getWorkspace().getId(), pTag)));
            mCache.cacheDocMsByTag(pTag, docMs);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            showContinueOrExitDialog(message);
        }
    }
    return docMs;
}

From source file:com.docdoku.client.data.MainModel.java

public User getUser() {
    User user = mCache.getUser();/*  ww  w .ja  va2s.com*/

    if (user == null) {
        try {
            System.out.println("Retrieving personnal informations");
            user = mDocumentService.whoAmI(getWorkspace().getId());
            mCache.cacheUser(user);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            JOptionPane.showMessageDialog(null, message, I18N.BUNDLE.getString("Error_title"),
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    return user;
}

From source file:com.docdoku.client.data.MainModel.java

public User[] getUsers() {
    User[] users = mCache.getUsers();/* ww w.  j ava2  s  .  c o  m*/

    if (users == null) {
        try {
            System.out.println("Retrieving users");
            users = mDocumentService.getUsers(getWorkspace().getId());
            mCache.cacheUsers(users);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            JOptionPane.showMessageDialog(null, message, I18N.BUNDLE.getString("Error_title"),
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    return users;
}

From source file:com.docdoku.client.data.MainModel.java

public WorkflowModel getWorkflowModel(String pId) {
    WorkflowModel workflowModel = mCache.getWorkflowModel(pId);

    if (workflowModel == null) {
        try {//from   ww w. ja  v a  2s.  com
            System.out.println("Retrieving workflow model " + pId);
            workflowModel = Tools.resetParentReferences(
                    mWorkflowService.getWorkflowModel(new WorkflowModelKey(getWorkspace().getId(), pId)));
            mCache.cacheWorkflowModel(workflowModel);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            JOptionPane.showMessageDialog(null, message, I18N.BUNDLE.getString("Error_title"),
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    return workflowModel;
}

From source file:com.docdoku.client.data.MainModel.java

public File getFile(Component pParent, DocumentIteration pDocument, BinaryResource pBin) throws Exception {
    DocumentMaster docM = pDocument.getDocumentMaster();
    File folder = null;/*from   w  ww.ja va 2 s .c o m*/
    boolean readOnly;
    if (!docM.isCheckedOut() || !docM.getCheckOutUser().equals(getUser())
            || !docM.getLastIteration().equals(pDocument)) {
        folder = new File(Config.getCacheFolder(docM), pDocument.getIteration() + "");
        readOnly = true;
    } else {
        folder = Config.getCheckOutFolder(docM);
        readOnly = false;
    }

    File localFile = new File(folder, pBin.getName());

    if (!localFile.exists()) {
        folder.mkdirs();
        try {
            Map<String, Object> ctxt = ((BindingProvider) mFileService).getRequestContext();
            try {
                if (ctxt.containsKey(Config.HTTP_CLIENT_STREAMING_CHUNK_SIZE)) {
                    DataHandler dh = mFileService.downloadFromDocument(getWorkspace().getId(),
                            pDocument.getDocumentMasterId(), pDocument.getDocumentMasterVersion(),
                            pDocument.getIteration(), pBin.getName());
                    downloadFile(pParent, localFile, (int) pBin.getContentLength(), dh.getInputStream());
                } else {
                    //workaround mode
                    downloadFileWithServlet(pParent, localFile, getServletURL(pDocument, pBin.getName()));
                }
            } catch (Exception ex) {
                if (ex.getCause() instanceof InterruptedIOException) {
                    throw ex;
                }
                if (ctxt.containsKey(Config.HTTP_CLIENT_STREAMING_CHUNK_SIZE)) {
                    System.out.println("Disabling chunked mode");
                    ctxt.remove(Config.HTTP_CLIENT_STREAMING_CHUNK_SIZE);
                    downloadFileWithServlet(pParent, localFile, getServletURL(pDocument, pBin.getName()));
                } else {
                    //we were already not using the chunked mode
                    //there's not much to do...
                    throw ex;
                }

            }
        } catch (WebServiceException pWSEx) {
            Throwable t = pWSEx.getCause();
            if (t instanceof Exception) {
                throw (Exception) t;
            } else {
                throw pWSEx;
            }
        }

        if (readOnly) {
            localFile.setReadOnly();
            localFile.deleteOnExit();
        } else {
            Prefs.storeDocInfo(docM, localFile.getName(), localFile.lastModified());
        }
    }

    return localFile;
}

From source file:com.docdoku.client.data.MainModel.java

public FolderTreeNode[] getFolderTreeNodes(FolderTreeNode pParent) {
    String completePath = pParent.getCompletePath();
    FolderTreeNode[] folderTreeNodes = mCache.getFolderTreeNodes(completePath);
    if (folderTreeNodes == null) {
        try {/*from  w ww . j  a  v  a 2  s  .c o m*/
            System.out.println("Retrieving folders in " + completePath);
            String[] folders = mDocumentService.getFolders(completePath);
            folderTreeNodes = new FolderTreeNode[folders.length];
            for (int i = 0; i < folderTreeNodes.length; i++) {
                folderTreeNodes[i] = new FolderTreeNode(completePath + "/" + folders[i], pParent);
            }

            mCache.cacheFolderTreeNodes(completePath, folderTreeNodes);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            showContinueOrExitDialog(message);
        }
    }
    return folderTreeNodes;
}

From source file:com.docdoku.client.data.MainModel.java

public DocumentMasterTemplate getDocMTemplate(String pId) {
    DocumentMasterTemplate template = mCache.getDocMTemplate(pId);

    if (template == null) {
        try {//from   w w  w.  j  av a2 s.co  m
            System.out.println("Retrieving document template " + pId);

            //template = Tools.resetParentReferences(mDocumentService.getDocumentMasterTemplate(new DocumentMasterTemplateKey(getWorkspace().getId(), pId)));
            template = mDocumentService
                    .getDocumentMasterTemplate(new DocumentMasterTemplateKey(getWorkspace().getId(), pId));

            mCache.cacheDocMTemplate(template);
        } catch (WebServiceException pWSEx) {
            String message;
            Throwable t = pWSEx.getCause();
            if (t != null) {
                message = t.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown") : t.getMessage();
            } else {
                message = pWSEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                        : pWSEx.getMessage();
            }

            showContinueOrExitDialog(message);
        } catch (Exception pEx) {
            String message = pEx.getMessage() == null ? I18N.BUNDLE.getString("Error_unknown")
                    : pEx.getMessage();
            JOptionPane.showMessageDialog(null, message, I18N.BUNDLE.getString("Error_title"),
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    return template;
}