Example usage for org.springframework.data.mongodb LazyLoadingException getLocalizedMessage

List of usage examples for org.springframework.data.mongodb LazyLoadingException getLocalizedMessage

Introduction

In this page you can find the example usage for org.springframework.data.mongodb LazyLoadingException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:de.steilerdev.myVerein.server.model.Division.java

/**
 * This function is comparable to other divisions according to their distance to the root node.
 * @param o The division which is compared to the current division.
 * @return A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. If o is null, 0 is returned.
 *///ww w .  j  a  v  a  2  s . c  o  m
@Override
public int compareTo(Division o) {
    if (o != null) {
        try {
            List<Division> thisAncestors = this.getAncestors(), otherAncestors = o.getAncestors();

            if (thisAncestors == null || thisAncestors.isEmpty()) {
                return 1;
            } else if (otherAncestors == null || otherAncestors.isEmpty()) {
                return -1;
            } else {
                return Integer.compare(thisAncestors.size(), otherAncestors.size());
            }
        } catch (LazyLoadingException e) {
            logger.error("Unable to compare divisions {} {}: {}", o, this, e.getLocalizedMessage());
            return 0;
        }
    } else {
        logger.error("Comparing {} with null division", this);
        return 0;
    }
}