Package org.springframework.roo.addon.plural

Examples of org.springframework.roo.addon.plural.PluralMetadata


              }
              final LogicalPath path = PhysicalTypeIdentifier
                      .getPath(domainTypeDetails.getDeclaredByMetadataId());
              final String pluralId = PluralMetadata.createIdentifier(domainType.getValue(),
                      path);
              final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                      .get(pluralId);
              if (pluralMetadata == null) {
                  continue;
              }
          domainTypesToPlurals.put(domainType.getValue(), pluralMetadata.getPlural());
            }
      }
      return domainTypesToPlurals;
    }
View Full Code Here


        // get the default annotation values
        final JsonAnnotationValues annotationValues = new JsonAnnotationValues(
                governorPhysicalTypeMetadata);

        String plural = javaType.getSimpleTypeName() + "s";
        final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                .get(PluralMetadata.createIdentifier(javaType, path));
        if (pluralMetadata != null) {
            plural = pluralMetadata.getPlural();
        }

        return new JsonMetadata(metadataIdentificationString, aspectName,
                governorPhysicalTypeMetadata, plural, annotationValues);
    }
View Full Code Here

        final ClassOrInterfaceTypeDetails entityTypeDetails = typeLocationService
                .getTypeDetails(entity);
        Validate.notNull(entityTypeDetails,
                "The type '%s' could not be resolved", entity);

        final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                .get(PluralMetadata.createIdentifier(entity,
                        PhysicalTypeIdentifier.getPath(entityTypeDetails
                                .getDeclaredByMetadataId())));
        Validate.notNull(pluralMetadata,
                "The plural for type '%s' could not be resolved", entity);

        // Create type annotation for new managed bean
        final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
                ROO_JSF_MANAGED_BEAN);
        annotationBuilder.addClassAttribute("entity", entity);

        if (StringUtils.isBlank(beanName)) {
            beanName = StringUtils
                    .uncapitalize(managedBean.getSimpleTypeName());
        }
        annotationBuilder.addStringAttribute("beanName", beanName);

        if (!includeOnMenu) {
            annotationBuilder.addBooleanAttribute("includeOnMenu",
                    includeOnMenu);
        }

        final LogicalPath managedBeanPath = pathResolver
                .getFocusedPath(Path.SRC_MAIN_JAVA);
        final String resourceIdentifier = typeLocationService
                .getPhysicalTypeCanonicalPath(managedBean, managedBeanPath);
        final String declaredByMetadataId = PhysicalTypeIdentifier
                .createIdentifier(managedBean,
                        pathResolver.getPath(resourceIdentifier));

        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                declaredByMetadataId, Modifier.PUBLIC, managedBean,
                PhysicalTypeCategory.CLASS);
        cidBuilder
                .addAnnotation(new AnnotationMetadataBuilder(ROO_SERIALIZABLE));
        cidBuilder.addAnnotation(annotationBuilder);

        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

        shell.flash(Level.FINE,
                "Created " + managedBean.getFullyQualifiedTypeName(),
                JsfOperationsImpl.class.getName());
        shell.flash(Level.FINE, "", JsfOperationsImpl.class.getName());

        copyEntityTypePage(entity, beanName, pluralMetadata.getPlural());

        // Create a javax.faces.convert.Converter class for the entity
        createConverter(new JavaPackage(managedBeanTypeName + ".converter"),
                entity);
    }
View Full Code Here

        }

        // Check the entity has a plural form
        final String pluralId = PluralMetadata.createIdentifier(targetEntity,
                typeLocationService.getTypePath(targetEntity));
        final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                .get(pluralId);
        if (pluralMetadata == null || pluralMetadata.getPlural() == null) {
            return null;
        }

        // Loop through the service interfaces that claim to support the given
        // target entity
        for (final ClassOrInterfaceTypeDetails serviceInterface : serviceInterfaceLocator
                .getServiceInterfaces(targetEntity)) {
            // Get the values of the @RooService annotation for this service
            // interface
            final ServiceAnnotationValues annotationValues = serviceAnnotationValuesFactory
                    .getInstance(serviceInterface);
            if (annotationValues != null) {

                // Check whether this method is implemented by the given service
                final String methodName = method.getName(annotationValues,
                        targetEntity, pluralMetadata.getPlural());
                if (StringUtils.isNotBlank(methodName)) {
                    // The service implements the method; get the additions to
                    // be made by the caller
                    final MemberTypeAdditions methodAdditions = getMethodAdditions(
                            callerMID, methodName, serviceInterface.getName(),
View Full Code Here

                return null;
            }
            final LogicalPath path = PhysicalTypeIdentifier
                    .getPath(domainTypeId);
            final String pluralId = PluralMetadata.createIdentifier(type, path);
            final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                    .get(pluralId);
            if (pluralMetadata == null) {
                return null;
            }
            // Maintain a list of entities that are being handled by this layer
            managedEntityTypes.put(type, metadataIdentificationString);
            metadataDependencyRegistry.registerDependency(pluralId,
                    metadataIdentificationString);
            domainTypePlurals.put(type, pluralMetadata.getPlural());
        }

        PermissionEvaluatorMetadata permissionEvaluatorMetadata = null;
        for (final ClassOrInterfaceTypeDetails permissionEvaluator : typeLocationService
                .findClassesOrInterfaceDetailsWithAnnotation(ROO_PERMISSION_EVALUATOR)) {
View Full Code Here

     * for our test entity type.
     *
     * @param plural can be <code>null</code>
     */
    private void setUpPluralMetadata(final String plural) {
        final PluralMetadata mockPluralMetadata = mock(PluralMetadata.class);
        when(mockPluralMetadata.getPlural()).thenReturn(plural);
        when(mockMetadataService.get(pluralId)).thenReturn(mockPluralMetadata);
    }
View Full Code Here

            }
            final LogicalPath path = PhysicalTypeIdentifier
                    .getPath(domainTypeDetails.getDeclaredByMetadataId());
            final String pluralId = PluralMetadata.createIdentifier(domainType,
                    path);
            final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                    .get(pluralId);
            if (pluralMetadata == null) {
                return null;
            }
            domainTypePlurals.put(domainType, pluralMetadata.getPlural());

            // Maintain a list of entities that are being handled by this layer
            managedEntityTypes.put(domainType, metadataIdentificationString);

            // Collect the additions the service class needs in order to invoke
View Full Code Here

        }

        if (StringUtils.isBlank(path)) {
            final LogicalPath targetPath = PhysicalTypeIdentifier.getPath(cid
                    .getDeclaredByMetadataId());
            final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                    .get(PluralMetadata.createIdentifier(backingType,
                            targetPath));
            Validate.notNull(pluralMetadata,
                    "Could not determine plural for '%s'",
                    backingType.getSimpleTypeName());
            path = pluralMetadata.getPlural().toLowerCase();
        }
        else if (path.equals("/") || path.equals("/*")) {
            LOGGER.warning("Your application already contains a mapping to '/' or '/*' by default. Please provide a different path.");
            return;
        }
View Full Code Here

        final String physicalTypeIdentifier = typeLocationService
                .getPhysicalTypeIdentifier(entity);
        final LogicalPath path = PhysicalTypeIdentifier
                .getPath(physicalTypeIdentifier);
        final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                .get(PluralMetadata.createIdentifier(entity, path));
        Validate.notNull(pluralMetadata, "Could not determine plural for '%s'",
                entity.getSimpleTypeName());
        final String plural = pluralMetadata.getPlural();

        final Map<MethodMetadataCustomDataKey, MemberTypeAdditions> crudAdditions = getCrudAdditions(
                entity, metadataIdentificationString);

        return new JsfManagedBeanMetadata(metadataIdentificationString,
View Full Code Here

                                                "beanName").getValue());

                                final LogicalPath logicalPath = PhysicalTypeIdentifier
                                        .getPath(parameterTypeCid
                                                .getDeclaredByMetadataId());
                                final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
                                        .get(PluralMetadata.createIdentifier(
                                                parameter, logicalPath));
                                if (pluralMetadata != null) {
                                    customDataBuilder.put(
                                            PARAMETER_TYPE_PLURAL_KEY,
                                            pluralMetadata.getPlural());
                                }
                                // Only support one generic type parameter
                                break parameterTypeLoop;
                            }
                            // Parameter type is not an entity - test for an
View Full Code Here

TOP

Related Classes of org.springframework.roo.addon.plural.PluralMetadata

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.