@Override public <T extends CredentialStorage> T retrieveCurrentCredential(Agent agent, Class<T> storageClass) { Object lastCredential = retrieveCurrentCredentialEntity(agent, storageClass); return (T) convertToCredentialStorage(lastCredential, storageClass); }
@Override protected void removeFromRelationships(IdentityContext context, IdentityType identityType) { // First we build a list of all the relationships that the specified identity // is participating in List<?> relationshipsToRemove = findIdentityTypeRelationships(context, Relationship.class, identityType); // Now that we have the list, we can iterate through and remove the records for (Object relationship : relationshipsToRemove) { remove(context, convertToRelationshipType(context, relationship)); } }
private IdentityStoreConfiguration getConfiguration() { JPAIdentityStoreConfiguration configuration = new JPAIdentityStoreConfiguration(); configuration.setIdentityClass(IdentityObject.class); configuration.setAttributeClass(IdentityObjectAttribute.class); configuration.setRelationshipClass(RelationshipObject.class); configuration.setRelationshipIdentityClass(RelationshipIdentityObject.class); configuration.setRelationshipAttributeClass(RelationshipObjectAttribute.class); configuration.setCredentialClass(CredentialObject.class); configuration.setCredentialAttributeClass(CredentialObjectAttribute.class); configuration.setPartitionClass(PartitionObject.class); return configuration; }
private IdentityStoreConfiguration getConfiguration() { JPAIdentityStoreConfiguration configuration = new JPAIdentityStoreConfiguration(); configuration.setIdentityClass(IdentityObject.class); configuration.setAttributeClass(IdentityObjectAttribute.class); configuration.setMembershipClass(MembershipObject.class); configuration.setCredentialClass(CredentialObject.class); configuration.setCredentialAttributeClass(CredentialObjectAttribute.class); return configuration; }
private void configureIdentityTypeHandlers() { this.identityTypeStores.put(getIdentityTypeDiscriminator(User.class), new UserHandler()); this.identityTypeStores.put(getIdentityTypeDiscriminator(Agent.class), new AgentHandler()); this.identityTypeStores.put(getIdentityTypeDiscriminator(Role.class), new RoleHandler()); this.identityTypeStores.put(getIdentityTypeDiscriminator(Group.class), new GroupHandler()); this.identityTypeStores.put(getIdentityTypeDiscriminator(Relationship.class), new RelationshipHandler()); }
private void removeAttributes(Object object) { EntityManager em = getEntityManager(); if (getConfig().getAttributeClass() != null) { List<?> results = findAttributes(object); for (Object result : results) { em.remove(result); } } }
private void configurePartition(Partition partition, Object identity, IdentityType identityType) { if (getConfig().isModelPropertySet(PROPERTY_IDENTITY_PARTITION)) { // TODO implement cache support for partitions Object partitionInstance = getModelProperty(Object.class, identity, PROPERTY_IDENTITY_PARTITION); identityType.setPartition(convertPartitionEntityToPartition(partitionInstance)); } else { identityType.setPartition(partition); } }
<P> P getModelProperty(Class<P> propertyType, Object instance, String propertyName) { @SuppressWarnings("unchecked") Property<P> property = (Property<P>) getConfig().getModelProperty(propertyName); return property == null ? null : property.getValue(instance); }
@Override public void update(IdentityContext identityContext, Partition partition) { update(identityContext, (AttributedType) partition); }
@Override public <P extends Partition> List<P> get(IdentityContext identityContext, Class<P> partitionClass) { return getPartitions(identityContext, partitionClass, null); }
@Override public List<Permission> listPermissions(IdentityContext ctx, Class<?> resourceClass, Serializable identifier) { return listPermissions(ctx, resourceClass, identifier, null); }
public Property<Object> getAttributeIdentityProperty() { return getModelProperty(PROPERTY_ATTRIBUTE_IDENTITY); }
@Override void remove(Object identity, Group identityType, JPAIdentityStore store) { disassociateChilds(identityType,store); }
void setModelProperty(Object instance, String propertyName, Object value) { setModelProperty(instance, propertyName, value, false); }
@Override protected void removeFromRelationships(IdentityContext context, IdentityType identityType) { // First we build a list of all the relationships that the specified identity // is participating in List<?> relationshipsToRemove = findIdentityTypeRelationships(context, Relationship.class, identityType); // Now that we have the list, we can iterate through and remove the records for (Object relationship : relationshipsToRemove) { remove(context, convertToRelationshipType(context, relationship)); } }
@Override public void update(IdentityContext identityContext, Partition partition) { update(identityContext, (AttributedType) partition); }
@Override public <P extends Partition> List<P> get(IdentityContext identityContext, Class<P> partitionClass) { return getPartitions(identityContext, partitionClass, null); }
@Override public List<Permission> listPermissions(IdentityContext ctx, Object resource) { return listPermissions(ctx, resource, null); }
public Property<Object> getAttributeValueProperty() { return getModelProperty(PROPERTY_ATTRIBUTE_VALUE); }
public Property<Object> getDiscriminatorProperty() { return getModelProperty(PROPERTY_IDENTITY_DISCRIMINATOR); } }