/** * Convenience method to get all of this person's attributes that have a PersonAttributeType * equal to <code>personAttributeType</code>. * * @param personAttributeType */ public List<PersonAttribute> getAttributes(PersonAttributeType personAttributeType) { List<PersonAttribute> ret = new ArrayList<>(); for (PersonAttribute attribute : getAttributes()) { if (personAttributeType.equals(attribute.getAttributeType()) && !attribute.getVoided()) { ret.add(attribute); } } return ret; }
/** * Convenience Method to return the first non-voided person attribute matching a person * attribute type. <br> * <br> * Returns null if this person has no non-voided {@link PersonAttribute} with the given * {@link PersonAttributeType}, the given {@link PersonAttributeType} is null, or this person * has no attributes. * * @param pat the PersonAttributeType to look for (can be a stub, see * {@link PersonAttributeType#equals(Object)} for how its compared) * @return PersonAttribute that matches the given type * @should not fail when attribute type is null * @should not return voided attribute * @should return null when existing PersonAttributeType is voided */ public PersonAttribute getAttribute(PersonAttributeType pat) { if (pat != null) { for (PersonAttribute attribute : getAttributes()) { if (pat.equals(attribute.getAttributeType()) && !attribute.getVoided()) { return attribute; } } } return null; }
} else if (currentAttribute.getAttributeType().equals(newAttribute.getAttributeType())) { if (currentAttribute.getValue() != null && currentAttribute.getValue().equals(newAttribute.getValue())) {