@Override public int hashCode() { int hash = 7; hash = 53 * hash + getId(); hash = 53 * hash + (getFriendlyName() == null ? 0 : getFriendlyName().hashCode()); hash = 53 * hash + (getNamespace() == null ? 0 : getNamespace().hashCode()); hash = 53 * hash + (value == null ? 0 : value.hashCode()); return hash; }
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); String stringValue; if(getValue() == null) stringValue = null; else try { stringValue = BeansUtils.attributeValueToString(this); } catch (InternalErrorException ex) { //WARNING: This error is not catched. There is very low chance to occur. //When this happens, error is logged and there is need to look on attributeValueToString script above. log.error("Attribute value can't be serialize! {}",ex); stringValue = null; } return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", friendlyName=<").append(getFriendlyName() == null ? "\\0" : BeansUtils.createEscaping(getFriendlyName())).append(">").append( ", namespace=<").append(getNamespace() == null ? "\\0" : BeansUtils.createEscaping(getNamespace())).append(">").append( ", type=<").append(getType() == null ? "\\0" : BeansUtils.createEscaping(getType())).append(">").append( ", unique=<").append(isUnique()).append(">").append( ", value=<").append(BeansUtils.createEscaping(stringValue)).append(">").append( ']').toString(); }
@Override public String toString() { return this.getClass().getSimpleName() + ":[" + "id='" + getId() + '\'' + ", friendlyName='" + getFriendlyName() + '\'' + ", namespace='" + getNamespace() + '\'' + ", type='" + getType() + '\'' + ", unique='" + isUnique() + '\'' + ", value='" + getValue() + '\'' + ']'; } }
public AttributeHolders(Attribute attribute, Holder primaryHolder, Holder secondaryHolder, SavedBy savedBy) throws InternalErrorException { super(attribute, true); if (primaryHolder != null && secondaryHolder != null) { if (secondaryHolder.getType().equals(Holder.HolderType.GROUP) && (!primaryHolder.getType().equals(Holder.HolderType.MEMBER)) || (secondaryHolder.getType().equals(Holder.HolderType.MEMBER)) || (secondaryHolder.getType().equals(Holder.HolderType.USER))) { this.primaryHolder = secondaryHolder; this.secondaryHolder = primaryHolder; } else { this.primaryHolder = primaryHolder; this.secondaryHolder = secondaryHolder; } } else { this.primaryHolder = primaryHolder; this.secondaryHolder = secondaryHolder; } this.nameForSearch = attribute.getNamespace() + ":" + attribute.getFriendlyName(); this.namespaceForSearch = attribute.getNamespace(); this.friendlyNameForSearch = attribute.getFriendlyName(); this.typeForSearch = attribute.getType(); this.idForSearch = attribute.getId(); this.valueForSearch = BeansUtils.attributeValueToString(attribute); this.savedBy = savedBy; }