use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.
the class IdentifierMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.
@Override
protected String getGovernorPhysicalTypeIdentifier(final String metadataIdentificationString) {
final JavaType javaType = IdentifierMetadata.getJavaType(metadataIdentificationString);
final LogicalPath path = IdentifierMetadata.getPath(metadataIdentificationString);
return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.
the class IdentifierMetadataProviderImpl method getMetadata.
@Override
protected ItdTypeDetailsProvidingMetadataItem getMetadata(final String metadataIdentificationString, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final String itdFilename) {
if (projectOperations == null) {
projectOperations = getProjectOperations();
}
Validate.notNull(projectOperations, "ProjectOperations is required");
final IdentifierAnnotationValues annotationValues = new IdentifierAnnotationValues(governorPhysicalTypeMetadata);
if (!annotationValues.isAnnotationFound()) {
return null;
}
// We know governor type details are non-null and can be safely cast
final JavaType javaType = IdentifierMetadata.getJavaType(metadataIdentificationString);
final List<Identifier> identifierServiceResult = getIdentifiersForType(javaType);
final LogicalPath path = PhysicalTypeIdentifierNamingUtils.getPath(metadataIdentificationString);
if (projectOperations.isProjectAvailable(path.getModule())) {
// If the project itself changes, we want a chance to refresh this
// item
getMetadataDependencyRegistry().registerDependency(ProjectMetadata.getProjectIdentifier(path.getModule()), metadataIdentificationString);
}
return new IdentifierMetadata(metadataIdentificationString, aspectName, governorPhysicalTypeMetadata, annotationValues, identifierServiceResult);
}
use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.
the class JpaUnitTestMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.
@Override
protected String getGovernorPhysicalTypeIdentifier(final String metadataIdentificationString) {
final JavaType javaType = JpaUnitTestMetadata.getJavaType(metadataIdentificationString);
final LogicalPath path = JpaUnitTestMetadata.getPath(metadataIdentificationString);
return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.
the class SecurityFiltersMetadataProviderImpl method getGovernorPhysicalTypeIdentifier.
@Override
protected String getGovernorPhysicalTypeIdentifier(final String metadataIdentificationString) {
final JavaType javaType = SecurityFiltersMetadata.getJavaType(metadataIdentificationString);
final LogicalPath path = SecurityFiltersMetadata.getPath(metadataIdentificationString);
return PhysicalTypeIdentifier.createIdentifier(javaType, path);
}
use of org.springframework.roo.project.LogicalPath in project spring-roo by spring-projects.
the class ExceptionsOperationsImpl method addExceptionLabel.
/**
* Writes a label with a default exception message on messages.properties files
*
* @param exception
* @param moduleName
*/
private void addExceptionLabel(JavaType exception, String moduleName) {
if (getProjectOperations().isMultimoduleProject()) {
Validate.notBlank(moduleName, "Module name is required");
}
final LogicalPath resourcesPath = LogicalPath.getInstance(Path.SRC_MAIN_RESOURCES, moduleName);
final String targetDirectory = getPathResolver().getIdentifier(resourcesPath, "");
final String exceptionName = exception.getSimpleTypeName();
final String labelKey = LABEL_PREFIX.concat(exceptionName.toLowerCase());
Set<I18n> supportedLanguages = getI18nSupport().getSupportedLanguages();
for (I18n i18n : supportedLanguages) {
String messageBundle = String.format("messages_%s.properties", i18n.getLocale().getLanguage());
String bundlePath = String.format("%s%s%s", targetDirectory, AntPathMatcher.DEFAULT_PATH_SEPARATOR, messageBundle);
if (getFileManager().exists(bundlePath)) {
getPropFilesManager().addPropertyIfNotExists(resourcesPath, messageBundle, labelKey, String.format(LABEL_MESSAGE, exceptionName), true);
}
}
// Always update english message bundles
getPropFilesManager().addPropertyIfNotExists(resourcesPath, "messages.properties", labelKey, String.format(LABEL_MESSAGE, exceptionName), true);
}
Aggregations