protected FileAttribute(AttributedType identityType) { super(VERSION, Collections.synchronizedList(new ArrayList<Attribute<? extends Serializable>>(identityType .getAttributes()))); this.identityTypeId = identityType.getId(); }
protected FileAttribute(AttributedType identityType) { super(VERSION, Collections.synchronizedList(new ArrayList<Attribute<? extends Serializable>>(identityType .getAttributes()))); this.identityTypeId = identityType.getId(); }
private Map<String, Serializable> getAttributes(AttributedType attributedType) { HashMap<String, Serializable> attributes = new HashMap<String, Serializable>(); for (Attribute attribute : attributedType.getAttributes()) { attributes.put(attribute.getName(), attribute.getValue()); } return attributes; } }
private Map<String, Serializable> getAttributes(AttributedType attributedType) { HashMap<String, Serializable> attributes = new HashMap<String, Serializable>(); for (Attribute attribute : attributedType.getAttributes()) { attributes.put(attribute.getName(), attribute.getValue()); } return attributes; } }
private Map<String, Serializable> getAttributes(AttributedType attributedType) { HashMap<String, Serializable> attributes = new HashMap<String, Serializable>(); for (Attribute attribute : attributedType.getAttributes()) { attributes.put(attribute.getName(), attribute.getValue()); } return attributes; } }
protected void removeAllAttributes(AttributedType storedType) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(identityContext); if (attributeStore != null) { for (Attribute<? extends Serializable> attribute : storedType.getAttributes()) { attributeStore.removeAttribute(identityContext, storedType, attribute.getName()); } } }
protected void removeAllAttributes(AttributedType storedType) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(identityContext); if (attributeStore != null) { for (Attribute<? extends Serializable> attribute : storedType.getAttributes()) { attributeStore.removeAttribute(identityContext, storedType, attribute.getName()); } } }
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; }
protected void removeAttributes(IdentityContext identityContext, AttributedType identityType, AttributedType storedType) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(identityContext); if (attributeStore != null) { if (storedType != null) { Map<String, Attribute> attributes = getAttributes(identityContext, identityType); for (Attribute<? extends Serializable> attribute : storedType.getAttributes()) { if (attributes.get(attribute.getName()) == null) { attributeStore.removeAttribute(identityContext, identityType, attribute.getName()); } } } } }
protected void removeAttributes(IdentityContext identityContext, AttributedType identityType, AttributedType storedType) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(identityContext); if (attributeStore != null) { if (storedType != null) { Map<String, Attribute> attributes = getAttributes(identityContext, identityType); for (Attribute<? extends Serializable> attribute : storedType.getAttributes()) { if (attributes.get(attribute.getName()) == null) { attributeStore.removeAttribute(identityContext, identityType, attribute.getName()); } } } } }
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()); } } } } }