@Override protected Collection<Attribute<? extends Serializable>> getAttributes(IdentityContext context, AttributedType attributedType) { Collection<Attribute<? extends Serializable>> attributes = new HashSet<Attribute<? extends Serializable>>(); FileAttribute fileAttribute = getFileAttribute(attributedType); if (fileAttribute != null) { for (Attribute<? extends Serializable> attribute : fileAttribute.getEntry()) { attributes.add(attribute); } } return attributes; }
@Override protected Collection<Attribute<? extends Serializable>> getAttributes(IdentityContext context, AttributedType attributedType) { Collection<Attribute<? extends Serializable>> attributes = new HashSet<Attribute<? extends Serializable>>(); FileAttribute fileAttribute = getFileAttribute(attributedType); if (fileAttribute != null) { for (Attribute<? extends Serializable> attribute : fileAttribute.getEntry()) { attributes.add(attribute); } } return attributes; }
@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(); }
@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(); }
@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(); }