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