private Map<String, Attribute> getAttributes(IdentityContext identityContext, AttributedType identityType) { Map<String, Attribute> attributes = new HashMap<String, Attribute>(); for (Attribute attribute : identityType.getAttributes()) { attributes.put(attribute.getName(), attribute); } List<Property<Object>> properties = PropertyQueries.createQuery(identityType.getClass()) .addCriteria(new AnnotatedPropertyCriteria(AttributeProperty.class)) .getResultList(); for (Property property : properties) { AttributeProperty attributeProperty = property.getAnnotatedElement().getAnnotation(AttributeProperty.class); if (attributeProperty.managed()) { String attributeName = property.getName(); Object attributeValue = property.getValue(identityType); if (attributeValue != null) { attributes.put(attributeName, new Attribute(attributeName, (Serializable) attributeValue)); } else { attributes.remove(attributeName); } } } return attributes; }
private Map<String, Attribute> getAttributes(IdentityContext identityContext, AttributedType identityType) { Map<String, Attribute> attributes = new HashMap<String, Attribute>(); for (Attribute attribute : identityType.getAttributes()) { attributes.put(attribute.getName(), attribute); } List<Property<Object>> properties = PropertyQueries.createQuery(identityType.getClass()) .addCriteria(new AnnotatedPropertyCriteria(AttributeProperty.class)) .getResultList(); for (Property property : properties) { AttributeProperty attributeProperty = property.getAnnotatedElement().getAnnotation(AttributeProperty.class); if (attributeProperty.managed()) { String attributeName = property.getName(); Object attributeValue = property.getValue(identityType); if (attributeValue != null) { attributes.put(attributeName, new Attribute(attributeName, (Serializable) attributeValue)); } else { attributes.remove(attributeName); } } } return attributes; }
private void loadManagedAttributes(AttributedType attributedType) { for (Attribute attribute : attributedType.getAttributes()) { List<Property<Object>> properties = PropertyQueries.createQuery(attributedType.getClass()) .addCriteria(new AnnotatedPropertyCriteria(AttributeProperty.class)) .getResultList(); for (Property property : properties) { AttributeProperty attributeProperty = property.getAnnotatedElement().getAnnotation(AttributeProperty.class); if (property.getName().equals(attribute.getName()) && attributeProperty.managed()) { Object value = null; if (attribute != null) { value = attribute.getValue(); } property.setValue(attributedType, value); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Managed attribute [%s] loaded into type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } } } } }
private void loadManagedAttributes(AttributedType attributedType) { for (Attribute attribute : attributedType.getAttributes()) { List<Property<Object>> properties = PropertyQueries.createQuery(attributedType.getClass()) .addCriteria(new AnnotatedPropertyCriteria(AttributeProperty.class)) .getResultList(); for (Property property : properties) { AttributeProperty attributeProperty = property.getAnnotatedElement().getAnnotation(AttributeProperty.class); if (property.getName().equals(attribute.getName()) && attributeProperty.managed()) { Object value = null; if (attribute != null) { value = attribute.getValue(); } property.setValue(attributedType, value); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Managed attribute [%s] loaded into type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } } } } }