Example usage for org.springframework.dao DataRetrievalFailureException getMessage

List of usage examples for org.springframework.dao DataRetrievalFailureException getMessage

Introduction

In this page you can find the example usage for org.springframework.dao DataRetrievalFailureException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.page.annotation.AnnotationPage.java

private void loadDocumentAction(AjaxRequestTarget aTarget) {
    LOG.info("BEGIN LOAD_DOCUMENT_ACTION");

    // Update dynamic elements in action bar
    aTarget.add(finish);/*from w  w w  .  j a  v  a2s  .c om*/
    aTarget.add(numberOfPages);
    aTarget.add(documentNamePanel);

    String username = SecurityContextHolder.getContext().getAuthentication().getName();
    User user = userRepository.get(username);

    bratAnnotatorModel.setUser(userRepository.get(username));

    try {
        // Check if there is an annotation document entry in the database. If there is none,
        // create one.
        AnnotationDocument annotationDocument = repository
                .createOrGetAnnotationDocument(bratAnnotatorModel.getDocument(), user);

        // Read the CAS
        JCas jcas = repository.readAnnotationCas(annotationDocument);

        // Update the annotation document CAS
        repository.upgradeCas(jcas.getCas(), annotationDocument);

        // After creating an new CAS or upgrading the CAS, we need to save it
        repository.writeAnnotationCas(jcas.getCas().getJCas(), annotationDocument.getDocument(), user);

        // (Re)initialize brat model after potential creating / upgrading CAS
        bratAnnotatorModel.initForDocument(jcas);

        // Load user preferences
        PreferencesUtil.setAnnotationPreference(username, repository, annotationService, bratAnnotatorModel,
                Mode.ANNOTATION);

        // if project is changed, reset some project specific settings
        if (currentprojectId != bratAnnotatorModel.getProject().getId()) {
            bratAnnotatorModel.initForProject();
        }

        currentprojectId = bratAnnotatorModel.getProject().getId();

        LOG.debug("Configured BratAnnotatorModel for user [" + bratAnnotatorModel.getUser() + "] f:["
                + bratAnnotatorModel.getFirstSentenceAddress() + "] l:["
                + bratAnnotatorModel.getLastSentenceAddress() + "] s:["
                + bratAnnotatorModel.getSentenceAddress() + "]");

        gotoPageTextField.setModelObject(1);

        updateSentenceAddress(jcas, aTarget);

        // Wicket-level rendering of annotator because it becomes visible
        // after selecting a document
        aTarget.add(annotator);

        // brat-level initialization and rendering of document
        annotator.bratInit(aTarget);
        annotator.bratRender(aTarget, jcas);
    } catch (DataRetrievalFailureException e) {
        LOG.error("Error", e);
        aTarget.addChildren(getPage(), FeedbackPanel.class);
        error(e.getMessage());
    } catch (IOException e) {
        LOG.error("Error", e);
        aTarget.addChildren(getPage(), FeedbackPanel.class);
        error(e.getMessage());
    } catch (UIMAException e) {
        LOG.error("Error", e);
        aTarget.addChildren(getPage(), FeedbackPanel.class);
        error(ExceptionUtils.getRootCauseMessage(e));
    } catch (ClassNotFoundException e) {
        LOG.error("Error", e);
        aTarget.addChildren(getPage(), FeedbackPanel.class);
        error(e.getMessage());
    }

    LOG.info("END LOAD_DOCUMENT_ACTION");
}

From source file:org.linagora.linshare.core.dao.impl.JackRabbitFileDataStoreImpl.java

@Override
public void remove(FileMetaData metadata) {
    Validate.notNull(metadata);//from  w ww  .  ja  v a 2 s  .com
    String uuid = metadata.getUuid();
    try {
        dao.removeFileByUUID(uuid);
    } catch (org.springmodules.jcr.JcrSystemException e1) {
        logger.warn(e1.getMessage(), e1);
    } catch (org.springframework.dao.DataRetrievalFailureException e) {
        logger.warn(e.getMessage(), e);
    }
}