.getFocusedCanonicalPath(Path.SRC_MAIN_JAVA, interfaceType);
if (fileManager.exists(interfaceIdentifier)) {
return; // Type already exists - nothing to do
}
Validate.notNull(domainType, "Domain type required");
final AnnotationMetadataBuilder interfaceAnnotationMetadata = new AnnotationMetadataBuilder(
ROO_SERVICE);
interfaceAnnotationMetadata
.addAttribute(new ArrayAttributeValue<ClassAttributeValue>(
new JavaSymbolName("domainTypes"), Arrays
.asList(new ClassAttributeValue(
new JavaSymbolName("foo"), domainType))));
if (role == null) {
role = "";
}
if (requireAuthentication || usePermissionEvaluator || !role.equals("")) {
interfaceAnnotationMetadata.addBooleanAttribute(
"requireAuthentication", requireAuthentication);
}
if (!role.equals("")) {
interfaceAnnotationMetadata
.addAttribute(new ArrayAttributeValue<StringAttributeValue>(
new JavaSymbolName("authorizedCreateOrUpdateRoles"),
Arrays.asList(new StringAttributeValue(
new JavaSymbolName("bar"), role))));
interfaceAnnotationMetadata
.addAttribute(new ArrayAttributeValue<StringAttributeValue>(
new JavaSymbolName("authorizedReadRoles"), Arrays
.asList(new StringAttributeValue(
new JavaSymbolName("bar"), role))));
interfaceAnnotationMetadata
.addAttribute(new ArrayAttributeValue<StringAttributeValue>(
new JavaSymbolName("authorizedDeleteRoles"), Arrays
.asList(new StringAttributeValue(
new JavaSymbolName("bar"), role))));
}
if (usePermissionEvaluator) {
interfaceAnnotationMetadata.addBooleanAttribute(
"usePermissionEvaluator", true);
}
if (useXmlConfiguration) {
interfaceAnnotationMetadata.addBooleanAttribute(
"useXmlConfiguration", true);
}
final String interfaceMid = PhysicalTypeIdentifier.createIdentifier(
interfaceType, pathResolver.getPath(interfaceIdentifier));
final ClassOrInterfaceTypeDetailsBuilder interfaceTypeBuilder = new ClassOrInterfaceTypeDetailsBuilder(
interfaceMid, PUBLIC, interfaceType, INTERFACE);
interfaceTypeBuilder.addAnnotation(interfaceAnnotationMetadata.build());
typeManagementService.createOrUpdateTypeOnDisk(interfaceTypeBuilder
.build());
}