cidBuilder.setName(proxyType);
cidBuilder.setExtendsTypes(Collections.singletonList(ENTITY_PROXY));
cidBuilder.setPhysicalTypeCategory(INTERFACE);
cidBuilder.setModifier(PUBLIC);
final List<AnnotationAttributeValue<?>> attributeValues = new ArrayList<AnnotationAttributeValue<?>>();
final StringAttributeValue stringAttributeValue = new StringAttributeValue(
VALUE, entity.getName().getFullyQualifiedTypeName());
attributeValues.add(stringAttributeValue);
final String locator = projectOperations
.getTopLevelPackage(focusedModule)
+ ".server.locator."
+ entity.getName().getSimpleTypeName() + "Locator";
final StringAttributeValue locatorAttributeValue = new StringAttributeValue(
new JavaSymbolName("locator"), locator);
attributeValues.add(locatorAttributeValue);
cidBuilder.updateTypeAnnotation(new AnnotationMetadataBuilder(
PROXY_FOR_NAME, attributeValues));
attributeValues.remove(locatorAttributeValue);
final List<StringAttributeValue> readOnlyValues = new ArrayList<StringAttributeValue>();
final FieldMetadata versionField = persistenceMemberLocator
.getVersionField(entity.getName());
if (versionField != null) {
readOnlyValues.add(new StringAttributeValue(VALUE, versionField
.getFieldName().getSymbolName()));
}
final List<FieldMetadata> idFields = persistenceMemberLocator
.getIdentifierFields(entity.getName());
if (!CollectionUtils.isEmpty(idFields)) {
readOnlyValues.add(new StringAttributeValue(VALUE, idFields.get(0)
.getFieldName().getSymbolName()));
}
final ArrayAttributeValue<StringAttributeValue> readOnlyAttribute = new ArrayAttributeValue<StringAttributeValue>(
new JavaSymbolName("readOnly"), readOnlyValues);
attributeValues.add(readOnlyAttribute);