Package org.springframework.data.mapping

Examples of org.springframework.data.mapping.PersistentEntity


        this.lightAdminConfiguration = lightAdminConfiguration;
        this.configuration = configuration;
    }

    public FileManipulationStrategy createForFileProperty(PersistentProperty persistentProperty) {
        PersistentEntity persistentEntity = persistentProperty.getOwner();

        if (isOfBinaryFileType(persistentProperty)) {
            return createBinaryFileManipulationStrategy();
        }
View Full Code Here


        return configurationUnit;
    }

    @SuppressWarnings("unchecked")
    private ConfigurationUnitVisitor<VisitableConfigurationUnit>[] configurationUnitVisitor(ConfigurationUnit configurationUnit) {
        final PersistentEntity persistentEntity = getPersistentEntity(configurationUnit);
        return new ConfigurationUnitVisitor[]{
                new EntityMetadataConfigurationUnitVisitor(persistentEntity),
                new FieldSetConfigurationUnitVisitor(persistentEntity),
                new FiltersConfigurationUnitVisitor(persistentEntity)
        };
View Full Code Here

    @SuppressWarnings("unchecked")
    public Collection<? extends DomainConfigurationProblem> validateFieldMetadata(PersistentFieldMetadata fieldMetadata, Class<?> domainType, DomainConfigurationValidationContext validationContext) {
        MappingContext mappingContext = validationContext.getMappingContext();
        final LightAdminConfiguration lightAdminConfiguration = validationContext.getLightAdminConfiguration();

        final PersistentEntity persistentEntity = mappingContext.getPersistentEntity(domainType);

        PersistentProperty persistentProperty = persistentEntity.getPersistentProperty(fieldMetadata.getField());

        if (persistentProperty == null) {
            return newArrayList(validationContext.notPersistableFieldProblem(fieldMetadata.getName()));
        }
View Full Code Here

    }

    public DomainTypeBasicConfiguration createNonManagedDomainTypeConfiguration(Class<?> domainType) {
        JpaRepository repository = new SimpleJpaRepository(domainType, entityManager);

        PersistentEntity persistentEntity = mappingContext.getPersistentEntity(domainType);

        DefaultEntityMetadataConfigurationUnitBuilder builder = new DefaultEntityMetadataConfigurationUnitBuilder(domainType);

        builder.nameExtractor(EntityNameExtractorFactory.forPersistentEntity(persistentEntity));
View Full Code Here

    public static String entityId(DomainTypeAdministrationConfiguration domainTypeAdministrationConfiguration, Object entity) {
        if (entity == null) {
            return null;
        }

        PersistentEntity persistentEntity = domainTypeAdministrationConfiguration.getPersistentEntity();
        PersistentProperty idProperty = persistentEntity.getIdProperty();

        BeanWrapper beanWrapper = new DirectFieldAccessFallbackBeanWrapper(entity);

        return String.valueOf(beanWrapper.getPropertyValue(idProperty.getName()));
    }
View Full Code Here

        return globalAdministrationConfiguration;
    }

    private void registerAssociationDomainTypeConfigurations(DomainTypeAdministrationConfiguration domainTypeAdministrationConfiguration, final GlobalAdministrationConfiguration globalAdministrationConfiguration) {
        PersistentEntity persistentEntity = domainTypeAdministrationConfiguration.getPersistentEntity();

        persistentEntity.doWithAssociations(new SimpleAssociationHandler() {
            @Override
            public void doWithAssociation(Association<? extends PersistentProperty<?>> association) {
                Class<?> associationDomainType = association.getInverse().getActualType();

                if (!isManagedEntity(associationDomainType) && repositories.hasRepositoryFor(associationDomainType)) {
View Full Code Here

    }

    private PersistentProperty attributeMetadata(Class<?> domainType, String field) {
        DomainTypeAdministrationConfiguration domainTypeAdministrationConfiguration = configuration.forManagedDomainType(domainType);

        PersistentEntity persistentEntity = domainTypeAdministrationConfiguration.getPersistentEntity();

        return persistentEntity.getPersistentProperty(field);
    }
View Full Code Here

    public static DynamicRepositoryEntityLinks wrap(EntityLinks delegate) {
        return new DynamicRepositoryEntityLinks(delegate);
    }

    public Link linkForFilePropertyLink(Object instance, PersistentProperty persistentProperty) {
        PersistentEntity persistentEntity = persistentProperty.getOwner();
        Serializable id = idValue(instance, persistentEntity);

        return delegate.linkForSingleResource(persistentEntity.getType(), id).slash(persistentProperty.getName()).slash("file").withSelfRel();
    }
View Full Code Here

    public boolean supports(Class<?> type) {
        return globalAdministrationConfiguration.isManagedDomainType(type);
    }

    public Link linkFor(PersistentEntityResource persistentEntityResource) {
        PersistentEntity persistentEntity = persistentEntityResource.getPersistentEntity();
        Object instance = persistentEntityResource.getContent();

        return linkToSingleResource(persistentEntity.getType(), idAttributeValue(instance, persistentEntity));
    }
View Full Code Here

    private Object findEntityOfDomain(String entityId, String domainTypeName) {
        DomainTypeAdministrationConfiguration domainTypeConfiguration = configuration.forEntityName(domainTypeName);
        DynamicJpaRepository repository = domainTypeConfiguration.getRepository();

        PersistentEntity persistentEntity = domainTypeConfiguration.getPersistentEntity();
        Serializable id = (Serializable) conversionService.convert(entityId, persistentEntity.getIdProperty().getActualType());

        return repository.findOne(id);
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.mapping.PersistentEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.