Search in sources :

Example 1 with LogicalPath

use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.

the class DomainModelModuleMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.

@Override
protected String getGovernorPhysicalTypeIdentifier(final String metadataIdentificationString) {
    final JavaType javaType = DomainModelModuleMetadata.getJavaType(metadataIdentificationString);
    final LogicalPath path = DomainModelModuleMetadata.getPath(metadataIdentificationString);
    return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
Also used : RooJavaType(org.springframework.roo.model.RooJavaType) JavaType(org.springframework.roo.model.JavaType) LogicalPath(org.springframework.roo.project.LogicalPath)

Example 2 with LogicalPath

use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.

the class EntityDeserializerMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.

@Override
protected String getGovernorPhysicalTypeIdentifier(final String metadataIdentificationString) {
    final JavaType javaType = EntityDeserializerMetadata.getJavaType(metadataIdentificationString);
    final LogicalPath path = EntityDeserializerMetadata.getPath(metadataIdentificationString);
    return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
Also used : RooJavaType(org.springframework.roo.model.RooJavaType) JavaType(org.springframework.roo.model.JavaType) LogicalPath(org.springframework.roo.project.LogicalPath)

Example 3 with LogicalPath

use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.

the class ExceptionsMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.

@Override
protected String getGovernorPhysicalTypeIdentifier(String metadataIdentificationString) {
    final JavaType javaType = ExceptionsMetadata.getJavaType(metadataIdentificationString);
    final LogicalPath path = ExceptionsMetadata.getPath(metadataIdentificationString);
    return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
Also used : RooJavaType(org.springframework.roo.model.RooJavaType) JavaType(org.springframework.roo.model.JavaType) LogicalPath(org.springframework.roo.project.LogicalPath)

Example 4 with LogicalPath

use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.

the class JpaDataOnDemandCreator method createDataOnDemandConfiguration.

@Override
public JavaType createDataOnDemandConfiguration(String moduleName) {
    // Check if alreafy exists
    JavaType dodConfig = getDataOnDemandConfiguration();
    if (dodConfig != null) {
        return dodConfig;
    }
    // Add spring-boot-test dependency with test scope
    projectOperations.addDependency(moduleName, SPRING_BOOT_TEST_DEPENDENCY);
    // Get Pom
    final Pom module = projectOperations.getPomFromModuleName(moduleName);
    // Get test Path for module
    final LogicalPath path = LogicalPath.getInstance(Path.SRC_TEST_JAVA, moduleName);
    // Create the JavaType for the configuration class
    JavaType dodConfigurationClass = new JavaType(String.format("%s.dod.DataOnDemandConfiguration", typeLocationService.getTopLevelPackageForModule(module), moduleName));
    final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(dodConfigurationClass, path);
    if (metadataService.get(declaredByMetadataId) != null) {
        // The file already exists
        return new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId).getName();
    }
    // Create the CID builder
    ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, dodConfigurationClass, PhysicalTypeCategory.CLASS);
    cidBuilder.addAnnotation(new AnnotationMetadataBuilder(RooJavaType.ROO_JPA_DATA_ON_DEMAND_CONFIGURATION));
    // Write changes to disk
    final ClassOrInterfaceTypeDetails configDodCid = cidBuilder.build();
    typeManagementService.createOrUpdateTypeOnDisk(configDodCid);
    return configDodCid.getName();
}
Also used : RooJavaType(org.springframework.roo.model.RooJavaType) JavaType(org.springframework.roo.model.JavaType) LogicalPath(org.springframework.roo.project.LogicalPath) ClassOrInterfaceTypeDetailsBuilder(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder) ClassOrInterfaceTypeDetails(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails) AnnotationMetadataBuilder(org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder) Pom(org.springframework.roo.project.maven.Pom)

Example 5 with LogicalPath

use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.

the class JpaDataOnDemandCreator method createDataOnDemand.

@Override
public JavaType createDataOnDemand(JavaType entity) {
    Validate.notNull(entity, "Entity to produce a data on demand provider for is required");
    JavaType dodClass = getDataOnDemand(entity);
    if (dodClass != null) {
        return dodClass;
    }
    // Add plugin to generate test jar
    addMavenJarPlugin(entity.getModule());
    // Create the JavaType for DoD class
    JavaType name = new JavaType(entity.getPackage().getFullyQualifiedPackageName().concat(".dod.").concat(entity.getSimpleTypeName()).concat("DataOnDemand"), entity.getModule());
    // Obatain test path for the module of the new class
    final LogicalPath path = LogicalPath.getInstance(Path.SRC_TEST_JAVA, name.getModule());
    Validate.notNull(path, "Location of the new data on demand provider is required");
    // Create DoD configuration class
    createDataOnDemandConfiguration(entity.getModule());
    // Create entity factories for the given entity and its related entities
    createEntityFactory(entity);
    // Create data on demand class
    return newDataOnDemandClass(entity, name);
}
Also used : RooJavaType(org.springframework.roo.model.RooJavaType) JavaType(org.springframework.roo.model.JavaType) LogicalPath(org.springframework.roo.project.LogicalPath)

Aggregations

LogicalPath (org.springframework.roo.project.LogicalPath)85 JavaType (org.springframework.roo.model.JavaType)62 RooJavaType (org.springframework.roo.model.RooJavaType)55 ClassOrInterfaceTypeDetails (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails)13 JpaJavaType (org.springframework.roo.model.JpaJavaType)12 ClassOrInterfaceTypeDetailsBuilder (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder)10 AnnotatedJavaType (org.springframework.roo.classpath.details.annotations.AnnotatedJavaType)9 AnnotationMetadataBuilder (org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)9 SpringJavaType (org.springframework.roo.model.SpringJavaType)9 ArrayList (java.util.ArrayList)8 InputStream (java.io.InputStream)7 AnnotationMetadata (org.springframework.roo.classpath.details.annotations.AnnotationMetadata)6 MemberDetails (org.springframework.roo.classpath.scanner.MemberDetails)5 BufferedInputStream (java.io.BufferedInputStream)4 IOException (java.io.IOException)4 OutputStream (java.io.OutputStream)4 ZipInputStream (java.util.zip.ZipInputStream)4 I18n (org.springframework.roo.addon.web.mvc.i18n.components.I18n)4 FieldMetadata (org.springframework.roo.classpath.details.FieldMetadata)3 JavaSymbolName (org.springframework.roo.model.JavaSymbolName)3