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; } }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { for (Attribute attribute: new ArrayList<Attribute>(getEntry())) { properties.put(attribute.getName(), attribute.getValue()); } } }
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; } }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { for (Attribute attribute: new ArrayList<Attribute>(getEntry())) { properties.put(attribute.getName(), attribute.getValue()); } } }
@Override public void removeAttribute(IdentityContext context, AttributedType type, String attributeName) { FileAttribute fileAttribute = getFileAttribute(type); if (fileAttribute != null) { for (Attribute<? extends Serializable> attribute : new ArrayList<Attribute<? extends Serializable>> (fileAttribute.getEntry())) { if (attribute.getName().equals(attributeName)) { fileAttribute.getEntry().remove(attribute); } } } this.fileDataSource.flushAttributes(); }
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()); } } } } }
@Override public void removeAttribute(IdentityContext context, AttributedType type, String attributeName) { FileAttribute fileAttribute = getFileAttribute(type); if (fileAttribute != null) { for (Attribute<? extends Serializable> attribute : new ArrayList<Attribute<? extends Serializable>> (fileAttribute.getEntry())) { if (attribute.getName().equals(attributeName)) { fileAttribute.getEntry().remove(attribute); } } } this.fileDataSource.flushAttributes(); }
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()); } } } } }
@Override public void doSetAttribute(IdentityContext context, AttributedType type, Attribute<? extends Serializable> attribute) { FileAttribute fileAttribute = getFileAttribute(type); if (fileAttribute == null) { fileAttribute = new FileAttribute(type); } removeAttribute(context, type, attribute.getName()); fileAttribute.getEntry().add(attribute); this.fileDataSource.getAttributes().put(type.getId(), fileAttribute); this.fileDataSource.flushAttributes(); }
@Override public void doSetAttribute(IdentityContext context, AttributedType type, Attribute<? extends Serializable> attribute) { FileAttribute fileAttribute = getFileAttribute(type); if (fileAttribute == null) { fileAttribute = new FileAttribute(type); } removeAttribute(context, type, attribute.getName()); fileAttribute.getEntry().add(attribute); this.fileDataSource.getAttributes().put(type.getId(), fileAttribute); this.fileDataSource.flushAttributes(); }
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()); } } }
@Override public void setAttribute(IdentityContext context, AttributedType attributedType, Attribute<? extends Serializable> attribute) { doSetAttribute(context, attributedType, attribute); attributedType.setAttribute(attribute); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Ad-hoc attribute [%s] stored for type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } }
@Override public void setAttribute(IdentityContext context, AttributedType attributedType, Attribute<? extends Serializable> attribute) { doSetAttribute(context, attributedType, attribute); attributedType.setAttribute(attribute); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Ad-hoc attribute [%s] stored for type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } }
@Override public void setAttribute(Attribute<? extends Serializable> attribute) { if (type == null) { throw IDMMessages.MESSAGES.nullArgument("type"); } removeAttribute(attribute.getName()); AttributeStorageUtil attributeStorageUtil = new AttributeStorageUtil(); attributeStorageUtil.setAttribute(dataSource, type.getId(), attribute); }
@Override public void setAttribute(Attribute<? extends Serializable> attribute) { if (type == null) { throw IDMMessages.MESSAGES.nullArgument("type"); } removeAttribute(attribute.getName()); AttributeStorageUtil attributeStorageUtil = new AttributeStorageUtil(); attributeStorageUtil.setAttribute(dataSource, type.getId(), attribute); }
@Override public void loadAttributes(IdentityContext identityContext, AttributedType attributedType) { Collection<Attribute<? extends Serializable>> attributes = getAttributes(identityContext, attributedType); for (Attribute attribute : attributes) { attributedType.setAttribute(attribute); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Ad-hoc attribute [%s] loaded into type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } } loadManagedAttributes(attributedType); }
@Override public void loadAttributes(IdentityContext identityContext, AttributedType attributedType) { Collection<Attribute<? extends Serializable>> attributes = getAttributes(identityContext, attributedType); for (Attribute attribute : attributes) { attributedType.setAttribute(attribute); if (isTraceEnabled()) { IDENTITY_STORE_LOGGER.tracef("Ad-hoc attribute [%s] loaded into type [%s] with identifier [%s] and value [%s]", attribute.getName(), attributedType.getClass(), attributedType.getId(), attribute.getValue()); } } loadManagedAttributes(attributedType); }