@Override public String toString() { StringBuilder str = new StringBuilder(); return str.append(getClass().getSimpleName()).append(":[").append( "id='").append(getId()).append('\'').append( ", login='").append(login).append('\'').append( ", source='").append(extSource).append('\'').append( ", userId='").append(getUserId()).append('\'').append( ", loa='").append(loa).append('\'').append( ']').toString(); }
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", login=<").append(getLogin() == null ? "\\0" : BeansUtils.createEscaping(getLogin())).append(">").append( ", source=<").append(extSource == null ? "\\0" : getExtSource().serializeToString()).append(">").append( ", userId=<").append(getUserId()).append(">").append( ", loa=<").append(getLoa()).append(">").append( ']').toString(); }
@Override public int compareTo(PerunBean perunBean) { if(perunBean == null) throw new NullPointerException("PerunBean to compare with is null."); if(perunBean instanceof UserExtSource) { UserExtSource userExtSource = (UserExtSource) perunBean; int compare; //Compare on extSource if (this.getExtSource() == null && userExtSource.getExtSource() != null) compare = -1; else if (userExtSource.getExtSource() == null && this.getExtSource() != null) compare = 1; else if (this.getExtSource() == null && userExtSource.getExtSource() == null) compare = 0; else compare = this.getExtSource().compareTo(userExtSource.getExtSource()); if(compare != 0) return compare; //Compare on login if (this.getLogin()== null && userExtSource.getLogin() != null) compare = -1; else if (userExtSource.getLogin() == null && this.getLogin() != null) compare = 1; else if (this.getLogin()== null && userExtSource.getLogin() == null) compare = 0; else compare = this.getLogin().compareToIgnoreCase(userExtSource.getLogin()); if(compare != 0) return compare; //Compare to id if not return (this.getId() - perunBean.getId()); } else { return (this.getId() - perunBean.getId()); } } }