* Build EDM Schema - STEPS
* ************************************************************
*/
@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
JPAEdmBuilder keyViewBuilder = null;
properties = new ArrayList<Property>();
List<Attribute<?, ?>> jpaAttributes = null;
String currentEntityName = null;
String targetEntityName = null;
String entityTypeName = null;
if (isBuildModeComplexType) {
jpaAttributes = sortInAscendingOrder(complexTypeView.getJPAEmbeddableType()
.getAttributes());
entityTypeName = complexTypeView.getJPAEmbeddableType().getJavaType()
.getSimpleName();
} else {
jpaAttributes = sortInAscendingOrder(entityTypeView.getJPAEntityType()
.getAttributes());
entityTypeName = entityTypeView.getJPAEntityType().getName();
}
for (Object jpaAttribute : jpaAttributes) {
currentAttribute = (Attribute<?, ?>) jpaAttribute;
// Check for need to Exclude
if (isExcluded((JPAEdmPropertyView) JPAEdmProperty.this, entityTypeName, currentAttribute.getName())) {
continue;
}
PersistentAttributeType attributeType = currentAttribute
.getPersistentAttributeType();
switch (attributeType) {
case BASIC:
currentSimpleProperty = new SimpleProperty();
properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty, false));
if (((SingularAttribute<?, ?>) currentAttribute).isId()) {
if (keyView == null) {
keyView = new JPAEdmKey(JPAEdmProperty.this);
keyViewBuilder = keyView.getBuilder();
}
keyViewBuilder.build();
}
break;
case EMBEDDED:
ComplexType complexType = complexTypeView
.searchEdmComplexType(currentAttribute.getJavaType().getName());