Examples of JpaEntityAnnotationValues


Examples of org.springframework.roo.addon.jpa.entity.JpaEntityAnnotationValues

        // Get the CRUD-related annotation values
        final JpaCrudAnnotationValues crudAnnotationValues = new JpaCrudAnnotationValues(
                governorPhysicalType);
        // Get the purely JPA-related annotation values, from @RooJpaEntity if
        // present, otherwise from @RooJpaActiveRecord
        JpaEntityAnnotationValues jpaEntityAnnotationValues = new JpaEntityAnnotationValues(
                governorPhysicalType, ROO_JPA_ENTITY);
        if (!jpaEntityAnnotationValues.isAnnotationFound()) {
            jpaEntityAnnotationValues = new JpaEntityAnnotationValues(
                    governorPhysicalType, ROO_JPA_ACTIVE_RECORD);
            Validate.validState(jpaEntityAnnotationValues.isAnnotationFound(),
                    "No @RooJpaEntity or @RooJpaActiveRecord on %s",
                    metadataIdentificationString);
        }

        // Look up the inheritance hierarchy for existing
        // JpaActiveRecordMetadata
        final JpaActiveRecordMetadata parent = getParentMetadata(governorPhysicalType
                .getMemberHoldingTypeDetails());

        // If the parent is null, but the type has a super class it is likely
        // that the we don't have information to proceed
        if (parent == null
                && governorPhysicalType.getMemberHoldingTypeDetails()
                        .getSuperclass() != null) {
            // If the superclass is not annotated with the Entity trigger
            // annotation then we can be pretty sure that we don't have enough
            // information to proceed
            if (MemberFindingUtils.getAnnotationOfType(governorPhysicalType
                    .getMemberHoldingTypeDetails().getAnnotations(),
                    ROO_JPA_ACTIVE_RECORD) != null) {
                return null;
            }
        }
        // We also need the plural
        final JavaType entity = JpaActiveRecordMetadata
                .getJavaType(metadataIdentificationString);
        final LogicalPath path = JpaActiveRecordMetadata
                .getPath(metadataIdentificationString);
        final String pluralId = PluralMetadata.createIdentifier(entity, path);
        final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                .get(pluralId);
        if (pluralMetadata == null) {
            // Can't acquire the plural
            return null;
        }
        metadataDependencyRegistry.registerDependency(pluralId,
                metadataIdentificationString);

        final List<FieldMetadata> idFields = persistenceMemberLocator
                .getIdentifierFields(entity);
        if (idFields.size() != 1) {
            // The ID field metadata is either unavailable or not stable yet
            return null;
        }
        final FieldMetadata idField = idFields.get(0);

        final String entityName = StringUtils.defaultIfEmpty(
                jpaEntityAnnotationValues.getEntityName(),
                entity.getSimpleTypeName());

        boolean isGaeEnabled = false;

        final String moduleName = path.getModule();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.