use of org.motechproject.mds.domain.EntityType in project motech by motech.
the class EntityMetadataBuilderImpl method fixEnhancerIssuesInMetadata.
@Override
public void fixEnhancerIssuesInMetadata(JDOMetadata jdoMetadata, SchemaHolder schemaHolder) {
for (PackageMetadata pmd : jdoMetadata.getPackages()) {
for (ClassMetadata cmd : pmd.getClasses()) {
String className = String.format("%s.%s", pmd.getName(), cmd.getName());
EntityType entityType = EntityType.forClassName(className);
if (entityType == EntityType.STANDARD) {
EntityDto entity = schemaHolder.getEntityByClassName(className);
if (null != entity) {
for (MemberMetadata mmd : cmd.getMembers()) {
CollectionMetadata collMd = mmd.getCollectionMetadata();
FieldDto field = schemaHolder.getFieldByName(entity, mmd.getName());
if (null != collMd) {
fixCollectionMetadata(collMd, field);
}
if (null != field && field.getType().isRelationship()) {
fixRelationMetadata(pmd, entity, field);
}
// Defining column name for join and element results in setting it both as XML attribute and child element
fixDuplicateColumnDefinitions(mmd);
}
}
}
}
}
}
Aggregations