@Override public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof AttributeDefinition)) return false; final AttributeDefinition other = (AttributeDefinition) obj; return this.getId() == other.getId() && (this.friendlyName == null ? other.friendlyName == null : this.friendlyName.equals(other.friendlyName)) && (this.namespace == null ? other.namespace == null : this.namespace.equals(other.namespace)); }
@Override public String toString() { return this.getClass().getSimpleName() + ":[" + "id='" + getId() + "'" + ", friendlyName='" + friendlyName + "'" + ", namespace='" + namespace + "'" + ", type='" + type + "'" + ", unique='" + unique + "'" + ']'; } }
@Override public int hashCode() { int hash = 7; hash = 53 * hash + getId(); hash = 53 * hash + (friendlyName == null ? 0 : friendlyName.hashCode()); hash = 53 * hash + (namespace == null ? 0 : namespace.hashCode()); return hash; }
@Override public String serializeToString() { return this.getClass().getSimpleName() + ":[" + "id=<" + getId() + ">" + ", friendlyName=<" + (getFriendlyName() == null ? "\\0" : BeansUtils.createEscaping(getFriendlyName())) + ">" + ", namespace=<" + (getNamespace() == null ? "\\0" : BeansUtils.createEscaping(getNamespace())) + ">" + ", type=<" + (getType() == null ? "\\0" : BeansUtils.createEscaping(getType())) + ">" + ", unique=<" + unique + ">" + ']'; }
public int compareTo(PerunBean perunBean) { if (perunBean == null) throw new NullPointerException("PerunBean to compare with is null."); if (perunBean instanceof AttributeDefinition) { AttributeDefinition attrDef = (AttributeDefinition) perunBean; if (this.getFriendlyName() == null && attrDef.getFriendlyName() != null) return -1; if (attrDef.getFriendlyName() == null && this.getFriendlyName() != null) return 1; if (this.getFriendlyName() == null && attrDef.getFriendlyName() == null) return 0; return this.getFriendlyName().compareToIgnoreCase(attrDef.getFriendlyName()); } else { return (this.getId() - perunBean.getId()); } }
public AttributeHolders(AttributeDefinition attribute, SavedBy savedBy) { super(attribute); this.nameForSearch = attribute.getNamespace() + ":" + attribute.getFriendlyName(); this.namespaceForSearch = attribute.getNamespace(); this.friendlyNameForSearch = attribute.getFriendlyName(); this.typeForSearch = attribute.getType(); this.idForSearch = attribute.getId(); this.valueForSearch = null; this.savedBy = savedBy; }
rights.add(new AttributeRights(attrDef.getId(), Role.SELF, Arrays.asList(ActionType.READ))); perun.getAttributesManager().setAttributeRights(cabinetSession, rights); } catch (PerunException pe) { rights.add(new AttributeRights(attrDef2.getId(), Role.SELF, Arrays.asList(ActionType.READ))); perun.getAttributesManager().setAttributeRights(cabinetSession, rights); } catch (PerunException pe) {
rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); rights.add(new AttributeRights(attrDef.getId(), Role.GROUPADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); rights.add(new AttributeRights(attrDef.getId(), Role.GROUPADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); rights.add(new AttributeRights(attrDef.getId(), Role.GROUPADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); rights.add(new AttributeRights(attrDef.getId(), Role.GROUPADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE))); perun.getAttributesManager().setAttributeRights(registrarSession, rights); rights.add(new AttributeRights(attrDef.getId(), Role.VOADMIN, Arrays.asList(ActionType.READ, ActionType.WRITE)));
/** * Copy constructor. New attribute will be exactly the same as attribute from parameter. * * @param attributeDefinition attribute to copy */ public AttributeDefinition(AttributeDefinition attributeDefinition) { super(attributeDefinition.getId(), attributeDefinition.getCreatedAt(), attributeDefinition.getCreatedBy(), attributeDefinition.getModifiedAt(), attributeDefinition.getModifiedBy(), attributeDefinition.getCreatedByUid(), attributeDefinition.getModifiedByUid()); this.friendlyName = attributeDefinition.getFriendlyName(); this.namespace = attributeDefinition.getNamespace(); this.description = attributeDefinition.getDescription(); this.type = attributeDefinition.getType(); this.displayName = attributeDefinition.getDisplayName(); this.writable = attributeDefinition.getWritable(); this.unique = attributeDefinition.isUnique(); }