@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 <V extends Serializable> Attribute<V> getAttribute(IdentityContext context, AttributedType attributedType, String attributeName) { loadAttributes(context, attributedType); return attributedType.getAttribute(attributeName); }
@Override public void setup(FileIdentityStoreConfiguration configuration) { super.setup(configuration); this.fileDataSource = new FileDataSource(configuration); }
@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()); } }
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()); } } } } }
@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()); } }
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()); } } } } }
@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 setup(FileIdentityStoreConfiguration configuration) { super.setup(configuration); this.fileDataSource = new FileDataSource(configuration); }
@Override public <V extends Serializable> Attribute<V> getAttribute(IdentityContext context, AttributedType attributedType, String attributeName) { loadAttributes(context, attributedType); return attributedType.getAttribute(attributeName); }
@Override public void setup(JPAIdentityStoreConfiguration config) { super.setup(config); if (config.getContextInitializers().isEmpty()) { JPA_STORE_LOGGER.jpaContextInitializerNotProvided(); } for (Class<?> entityType : config.getEntityTypes()) { configureEntityMapper(entityType); } logEntityMappers(); validateConfiguration(); }
@Override public void setup(JPAIdentityStoreConfiguration config) { super.setup(config); if (config.getContextInitializers().isEmpty()) { JPA_STORE_LOGGER.jpaContextInitializerNotProvided(); } for (Class<?> entityType : config.getEntityTypes()) { configureEntityMapper(entityType); } logEntityMappers(); validateConfiguration(); }