Examples of ClassOrInterfaceTypeDetailsBuilder


Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        }

        final String declaredByMetadataId = PhysicalTypeIdentifier
                .createIdentifier(type,
                        pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                declaredByMetadataId, Modifier.PUBLIC, type,
                PhysicalTypeCategory.CLASS);
        cidBuilder.addAnnotation(getAnnotation(jsonEntity));
        cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
                SpringJavaType.CONTROLLER));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                SpringJavaType.REQUEST_MAPPING);
        requestMapping.addAttribute(new StringAttributeValue(
                new JavaSymbolName("value"), "/"
                        + pluralMetadata.getPlural().toLowerCase()));
        cidBuilder.addAnnotation(requestMapping);
        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        // Create entity class
        final String declaredByMetadataId = PhysicalTypeIdentifier
                .createIdentifier(javaType, projectOperations.getPathResolver()
                        .getFocusedPath(Path.SRC_MAIN_JAVA));
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                declaredByMetadataId, Modifier.PUBLIC, javaType,
                PhysicalTypeCategory.CLASS);
        cidBuilder.setExtendsTypes(extendsTypes);
        cidBuilder.setAnnotations(annotations);

        final ClassOrInterfaceTypeDetails entity = cidBuilder.build();
        typeManagementService.createOrUpdateTypeOnDisk(entity);

        shell.flash(Level.FINE,
                "Created " + javaType.getFullyQualifiedTypeName(),
                DbreDatabaseListenerImpl.class.getName());
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

                        SEQUENCE_NAME_FIELD));
            }
        }

        // Update the annotation on disk
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                managedEntity);
        cidBuilder.updateTypeAnnotation(jpaAnnotationBuilder.build(),
                attributesToDeleteIfPresent);
        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
        return table;
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        dodConfig.add(new ClassAttributeValue(new JavaSymbolName("entity"),
                entity));
        annotations.add(new AnnotationMetadataBuilder(
                RooJavaType.ROO_DATA_ON_DEMAND, dodConfig));

        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                declaredByMetadataId, Modifier.PUBLIC, name,
                PhysicalTypeCategory.CLASS);
        cidBuilder.setAnnotations(annotations);

        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

                "Java source code details unavailable for type %s",
                PhysicalTypeIdentifier.getFriendlyName(id));
        final ClassOrInterfaceTypeDetails cid = (ClassOrInterfaceTypeDetails) ptd;
        if (null == MemberFindingUtils.getAnnotationOfType(
                cid.getAnnotations(), RooJavaType.ROO_WEB_FINDER)) {
            final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    cid);
            cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
                    RooJavaType.ROO_WEB_FINDER));
            typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
        }
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        attributes.add(new ArrayAttributeValue<StringAttributeValue>(
                new JavaSymbolName("excludeFields"), ignoreFields));
        final AnnotationMetadataBuilder toStringAnnotationBuilder = new AnnotationMetadataBuilder(
                ROO_TO_STRING, attributes);
        updatedGovernorBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                governorTypeDetails);
        toStringAnnotation = toStringAnnotationBuilder.build();
        updatedGovernorBuilder.updateTypeAnnotation(toStringAnnotation,
                new HashSet<JavaSymbolName>());
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        methods.add(new MethodMetadataBuilder(declaredByMetadataId, PUBLIC,
                new JavaSymbolName("onMessage"), JavaType.VOID_PRIMITIVE,
                AnnotatedJavaType.convertFromJavaTypes(parameterTypes),
                parameterNames, bodyBuilder));

        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                declaredByMetadataId, PUBLIC, targetType,
                PhysicalTypeCategory.CLASS);
        cidBuilder.setDeclaredMethods(methods);

        // Determine the canonical filename
        final String physicalLocationCanonicalPath = getPhysicalLocationCanonicalPath(declaredByMetadataId);

        // Check the file doesn't already exist
        Validate.isTrue(!fileManager.exists(physicalLocationCanonicalPath),
                "%s already exists", projectOperations.getPathResolver()
                        .getFriendlyName(physicalLocationCanonicalPath));

        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

        final String jmsContextPath = projectOperations.getPathResolver()
                .getFocusedIdentifier(Path.SPRING_CONFIG_ROOT,
                        "applicationContext-jms.xml");
        final Document document = XmlUtils.readXml(fileManager
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

                "Cannot locate source for '%s'",
                targetType.getFullyQualifiedTypeName());

        final String declaredByMetadataId = targetTypeDetails
                .getDeclaredByMetadataId();
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                targetTypeDetails);

        // Create the field
        cidBuilder.addField(new FieldMetadataBuilder(declaredByMetadataId,
                PRIVATE | TRANSIENT, Arrays
                        .asList(new AnnotationMetadataBuilder(AUTOWIRED)),
                fieldName, JMS_OPERATIONS));

        // Create the method
        cidBuilder.addMethod(createSendMessageMethod(fieldName,
                declaredByMetadataId, asynchronous));

        if (asynchronous) {
            ensureSpringAsynchronousSupportEnabled();
        }

        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

        webMvcOperations.installConversionService(controller.getPackage());

        List<AnnotationMetadataBuilder> annotations = null;

        ClassOrInterfaceTypeDetailsBuilder cidBuilder = null;
        if (existingController == null) {
            final LogicalPath controllerPath = pathResolver
                    .getFocusedPath(Path.SRC_MAIN_JAVA);
            final String resourceIdentifier = typeLocationService
                    .getPhysicalTypeCanonicalPath(controller, controllerPath);
            final String declaredByMetadataId = PhysicalTypeIdentifier
                    .createIdentifier(controller,
                            pathResolver.getPath(resourceIdentifier));

            // Create annotation @RequestMapping("/myobject/**")
            final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
            requestMappingAttributes.add(new StringAttributeValue(VALUE, "/"
                    + path));
            annotations = new ArrayList<AnnotationMetadataBuilder>();
            annotations.add(new AnnotationMetadataBuilder(REQUEST_MAPPING,
                    requestMappingAttributes));

            // Create annotation @Controller
            final List<AnnotationAttributeValue<?>> controllerAttributes = new ArrayList<AnnotationAttributeValue<?>>();
            annotations.add(new AnnotationMetadataBuilder(CONTROLLER,
                    controllerAttributes));

            // Create annotation @RooWebScaffold(path = "/test",
            // formBackingObject = MyObject.class)
            annotations.add(getRooWebScaffoldAnnotation(entity,
                    disallowedOperations, path, PATH));
            cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    declaredByMetadataId, Modifier.PUBLIC, controller,
                    PhysicalTypeCategory.CLASS);
        }
        else {
            cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    existingController);
            annotations = cidBuilder.getAnnotations();
            if (MemberFindingUtils.getAnnotationOfType(
                    existingController.getAnnotations(), ROO_WEB_SCAFFOLD) == null) {
                annotations.add(getRooWebScaffoldAnnotation(entity,
                        disallowedOperations, path, PATH));
            }
        }
        cidBuilder.setAnnotations(annotations);
        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
    }
View Full Code Here

Examples of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder

    }

    private void addSolrSearchableAnnotation(
            final ClassOrInterfaceTypeDetails cid) {
        if (cid.getTypeAnnotation(ROO_SOLR_SEARCHABLE) == null) {
            final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    cid);
            cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
                    ROO_SOLR_SEARCHABLE));
            typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
        }
    }
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.