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);
}
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);
}
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);
}
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();
}
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);
}
Aggregations