Examples of PhysicalTypeMetadata


Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

                && managedEntity.getDeclaredFields().isEmpty()
                && managedEntity.getDeclaredMethods().isEmpty();
    }

    private boolean isIdentifierDeletable(final JavaType identifierType) {
        final PhysicalTypeMetadata governorPhysicalTypeMetadata = getPhysicalTypeMetadata(identifierType);
        if (governorPhysicalTypeMetadata == null) {
            return false;
        }

        // Check for added constructors, fields and methods
        final ClassOrInterfaceTypeDetails managedIdentifier = governorPhysicalTypeMetadata
                .getMemberHoldingTypeDetails();
        return managedIdentifier.getDeclaredConstructors().isEmpty()
                && managedIdentifier.getDeclaredFields().isEmpty()
                && managedIdentifier.getDeclaredMethods().isEmpty();
    }
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

    private void manageIdentifier(final JavaType javaType,
            final AnnotationMetadataBuilder jpaAnnotationBuilder,
            final Set<JavaSymbolName> attributesToDeleteIfPresent,
            final Table table) {
        final JavaType identifierType = getIdentifierType(javaType);
        final PhysicalTypeMetadata identifierPhysicalTypeMetadata = getPhysicalTypeMetadata(identifierType);

        // Process primary keys and add 'identifierType' attribute
        final int pkCount = table.getPrimaryKeyCount();
        if (pkCount == 1) {
            // Table has one primary key
            // Check for redundant, managed identifier class and delete if found
            if (isIdentifierDeletable(identifierType)) {
                deleteJavaType(identifierType, "the " + table.getName()
                        + " table has only one primary key");
            }

            attributesToDeleteIfPresent
                    .add(new JavaSymbolName(IDENTIFIER_TYPE));

            // We don't need a PK class, so we just tell the
            // JpaActiveRecordProvider via IdentifierService the column name,
            // field type and field name to use
            final List<Identifier> identifiers = getIdentifiersFromPrimaryKeys(table);
            identifierResults.put(javaType, identifiers);
        }
        else if (pkCount == 0 || pkCount > 1) {
            // Table has either no primary keys or more than one primary key so
            // create a composite key

            // Check if identifier class already exists and if not, create it
            if (identifierPhysicalTypeMetadata == null
                    || !identifierPhysicalTypeMetadata.isValid()
                    || identifierPhysicalTypeMetadata
                            .getMemberHoldingTypeDetails() == null) {
                createIdentifierClass(identifierType);
            }

            jpaAnnotationBuilder.addClassAttribute(IDENTIFIER_TYPE,
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

            JavaType mvcType = null;
            for (final ClassOrInterfaceTypeDetails mvcCod : typeLocationService
                    .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_WEB_SCAFFOLD)) {
                // We know this physical type exists given type location service
                // just found it.
                final PhysicalTypeMetadata mvcMd = (PhysicalTypeMetadata) metadataService
                        .get(mvcCod.getDeclaredByMetadataId());
                final WebScaffoldAnnotationValues webScaffoldAnnotationValues = new WebScaffoldAnnotationValues(
                        mvcMd);
                if (webScaffoldAnnotationValues.isAnnotationFound()
                        && webScaffoldAnnotationValues.getFormBackingObject()
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

        }

        // Second, find controllers for those entities.
        for (final ClassOrInterfaceTypeDetails cod : typeLocationService
                .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_WEB_SCAFFOLD)) {
            final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService
                    .get(typeLocationService.getPhysicalTypeIdentifier(cod
                            .getName()));
            Validate.notNull(ptm, "Java source code unavailable for type %s",
                    cod.getName().getFullyQualifiedTypeName());
            final WebScaffoldAnnotationValues webScaffoldAnnotationValues = new WebScaffoldAnnotationValues(
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

            throw new IllegalArgumentException("Cannot locate source for '"
                    + controllerType.getFullyQualifiedTypeName() + "'");
        }

        // Obtain the physical type and itd mutable details
        final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService
                .get(id);
        Validate.notNull(ptm, "Java source code unavailable for type %s",
                PhysicalTypeIdentifier.getFriendlyName(id));
        final WebScaffoldAnnotationValues webScaffoldAnnotationValues = new WebScaffoldAnnotationValues(
                ptm);
        if (!webScaffoldAnnotationValues.isAnnotationFound()
                || !webScaffoldAnnotationValues.getFormBackingObject().equals(
                        entityType)) {
            throw new IllegalArgumentException(
                    "Aborting, this controller type does not manage the "
                            + entityType.getSimpleTypeName()
                            + " form backing type.");
        }

        final PhysicalTypeDetails ptd = ptm.getMemberHoldingTypeDetails();
        Validate.notNull(ptd,
                "Java source code details unavailable for type %s",
                PhysicalTypeIdentifier.getFriendlyName(id));
        final ClassOrInterfaceTypeDetails cid = (ClassOrInterfaceTypeDetails) ptd;
        if (null == MemberFindingUtils.getAnnotationOfType(
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

                .get(JsonMetadata.createIdentifier(jsonObject, jsonObjectPath));
        if (jsonMetadata == null) {
            return null;
        }

        final PhysicalTypeMetadata backingObjectPhysicalTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(PhysicalTypeIdentifier.createIdentifier(jsonObject,
                        typeLocationService.getTypePath(jsonObject)));
        Validate.notNull(backingObjectPhysicalTypeMetadata,
                "Unable to obtain physical type metadata for type %s",
                jsonObject.getFullyQualifiedTypeName());
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

        }

        final String controllerPhysicalTypeId = PhysicalTypeIdentifier
                .createIdentifier(JspMetadata.getJavaType(jspMetadataId),
                        JspMetadata.getPath(jspMetadataId));
        final PhysicalTypeMetadata controllerPhysicalTypeMd = (PhysicalTypeMetadata) metadataService
                .get(controllerPhysicalTypeId);
        if (controllerPhysicalTypeMd == null) {
            return null;
        }
        final MemberHoldingTypeDetails mhtd = controllerPhysicalTypeMd
                .getMemberHoldingTypeDetails();
        if (mhtd == null) {
            return null;
        }
        final List<String> allowedMenuItems = new ArrayList<String>();
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

                            + typeName.getFullyQualifiedTypeName()
                            + "' is not an 'active record' entity");
        }

        // Get the member details
        final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(PhysicalTypeIdentifier.createIdentifier(javaType, path));
        if (physicalTypeMetadata == null) {
            throw new IllegalStateException(
                    "Could not determine physical type metadata for type "
                            + javaType);
        }
        final ClassOrInterfaceTypeDetails cid = physicalTypeMetadata
                .getMemberHoldingTypeDetails();
        if (cid == null) {
            throw new IllegalStateException(
                    "Could not determine class or interface type details for type "
                            + javaType);
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.