protected FileAttribute(AttributedType identityType) { super(VERSION, Collections.synchronizedList(new ArrayList<Attribute<? extends Serializable>>(identityType .getAttributes()))); this.identityTypeId = identityType.getId(); }
@Override public void delete(AttributedType attributedType) { RelationshipStorageUtil relationshipStorageUtil = new RelationshipStorageUtil(); if (attributedType instanceof Grant) { relationshipStorageUtil.deleteGrant(dataSource, attributedType.getId()); } else if (attributedType instanceof GroupMembership) { relationshipStorageUtil.deleteGroupMembership(dataSource, attributedType.getId()); } else { throw IDMMessages.MESSAGES.unexpectedType(attributedType.getClass()); } }
@Override public void delete(AttributedType attributedType) { RelationshipStorageUtil relationshipStorageUtil = new RelationshipStorageUtil(); if (attributedType instanceof Grant) { relationshipStorageUtil.deleteGrant(dataSource, attributedType.getId()); } else if (attributedType instanceof GroupMembership) { relationshipStorageUtil.deleteGroupMembership(dataSource, attributedType.getId()); } else { throw IDMMessages.MESSAGES.unexpectedType(attributedType.getClass()); } }
@Override public void removeAttributedType(IdentityContext context, AttributedType attributedType) { if (Relationship.class.isInstance(attributedType)) { removeRelationship((Relationship) attributedType); } else { LDAPMappingConfiguration mappingConfig = getMappingConfig(attributedType.getClass()); this.operationManager.removeEntryById(getBaseDN(attributedType), attributedType.getId(), mappingConfig); } }
@Override public void removeAttributedType(IdentityContext context, AttributedType attributedType) { if (Relationship.class.isInstance(attributedType)) { removeRelationship((Relationship) attributedType); } else { LDAPMappingConfiguration mappingConfig = getMappingConfig(attributedType.getClass()); this.operationManager.removeEntryById(getBaseDN(attributedType), attributedType.getId(), mappingConfig); } }
@Override public void addAttributedType(IdentityContext context, final AttributedType attributedType) { AttributedType clonedAttributedType = cloneAttributedType(context, attributedType); if (IdentityType.class.isInstance(clonedAttributedType)) { storeIdentityType(context, (IdentityType) clonedAttributedType); } else if (Relationship.class.isInstance(clonedAttributedType)) { storeRelationshipType((Relationship) clonedAttributedType); } else { this.fileDataSource.getAttributedTypes().put(attributedType.getId(), new FileAttributedType(attributedType)); } }
@Override public void addAttributedType(IdentityContext context, final AttributedType attributedType) { AttributedType clonedAttributedType = cloneAttributedType(context, attributedType); if (IdentityType.class.isInstance(clonedAttributedType)) { storeIdentityType(context, (IdentityType) clonedAttributedType); } else if (Relationship.class.isInstance(clonedAttributedType)) { storeRelationshipType((Relationship) clonedAttributedType); } else { this.fileDataSource.getAttributedTypes().put(attributedType.getId(), new FileAttributedType(attributedType)); } }
@Override public <T extends Serializable> Attribute<T> getAttribute(String name) { if (type == null) { throw IDMMessages.MESSAGES.nullArgument("type"); } AttributeStorageUtil attributeStorageUtil = new AttributeStorageUtil(); return attributeStorageUtil.getAttribute(dataSource, type.getId(), name); }
@Override public void setAttribute(IdentityContext context, AttributedType attributedType, Attribute<? extends Serializable> attribute) { AbstractJdbcType ajt = mapper.getInstance(attributedType.getClass()); ajt.setId(attributedType.getId()); ajt.setDataSource(dataSource); ajt.setType(attributedType); ajt.setAttribute(attribute); }
@Override public void removeAttribute(IdentityContext context, AttributedType attributedType, String attributeName) { AbstractJdbcType ajt = mapper.getInstance(attributedType.getClass()); ajt.setId(attributedType.getId()); ajt.setDataSource(dataSource); ajt.setType(attributedType); ajt.removeAttribute(attributeName); }
@Override public void setAttribute(IdentityContext context, AttributedType attributedType, Attribute<? extends Serializable> attribute) { AbstractJdbcType ajt = mapper.getInstance(attributedType.getClass()); ajt.setId(attributedType.getId()); ajt.setDataSource(dataSource); ajt.setType(attributedType); ajt.setAttribute(attribute); }
@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(); }
@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); }