/** * This fetches the last Base Type entity from a hierarchy of base type derived types * @param baseTypeFQName * @return CsdlNavigationProperty */ private CsdlNavigationProperty fetchLastBaseEntityHavingNavigationProperty( FullQualifiedName baseTypeFQName, String navBindingProperty) { CsdlEntityType baseEntityType = null; while (baseTypeFQName != null) { if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) { baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName); } baseEntityType = csdlEntityTypesMap.get(baseTypeFQName); if (baseEntityType != null) { if (baseEntityType.getNavigationProperty(navBindingProperty) != null) { break; } else if (baseEntityType.getBaseType() != null) { baseTypeFQName = baseEntityType.getBaseTypeFQN(); } else if (baseEntityType.getBaseType() == null) { break; } } } if (baseEntityType == null) { throw new RuntimeException("Entity Type is null with fully qualified name:" + baseTypeFQName); } return baseEntityType.getNavigationProperty(navBindingProperty); }
/** * This fetches the last Base Type entity from a hierarchy of base type derived types * @param baseTypeFQName * @return CsdlNavigationProperty */ private CsdlNavigationProperty fetchLastBaseEntityHavingNavigationProperty( FullQualifiedName baseTypeFQName, String navBindingProperty) { CsdlEntityType baseEntityType = null; while (baseTypeFQName != null) { if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) { baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName); } baseEntityType = csdlEntityTypesMap.get(baseTypeFQName); if (baseEntityType != null) { if (baseEntityType.getNavigationProperty(navBindingProperty) != null) { break; } else if (baseEntityType.getBaseType() != null) { baseTypeFQName = baseEntityType.getBaseTypeFQN(); } else if (baseEntityType.getBaseType() == null) { break; } } } if (baseEntityType == null) { throw new RuntimeException("Entity Type is null with fully qualified name:" + baseTypeFQName); } return baseEntityType.getNavigationProperty(navBindingProperty); }
/** Adds annotations to Entity type Navigation Properties derived from entity set * @param annotationGrp * @param entityType * @param navPropertyName */ private void addAnnotationsToEntityTypeNavProperties(CsdlAnnotations annotationGrp, CsdlEntityType entityType, CsdlNavigationProperty navPropertyName) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(entityType.getNavigationProperty( navPropertyName.getName()).getAnnotations(), annotation)) { entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().add(annotation); } } }
} else { navProperty = remainingPath.length() > 0 ? fetchNavigationProperty(remainingPath, strNavProperty, sourceEntityTypeHavingNavProp) : sourceEntityTypeHavingNavProp.getNavigationProperty(strNavProperty);
} else { navProperty = remainingPath.length() > 0 ? fetchNavigationProperty(remainingPath, strNavProperty, sourceEntityTypeHavingNavProp) : sourceEntityTypeHavingNavProp.getNavigationProperty(strNavProperty);
} else { navProperty = (CsdlNavigationProperty) sourceEntityType. getNavigationProperty(navBindingPath); if (navProperty == null) { navProperty = fetchLastBaseEntityHavingNavigationProperty(
} else { navProperty = (CsdlNavigationProperty) sourceEntityType. getNavigationProperty(navBindingPath); if (navProperty == null) { navProperty = fetchLastBaseEntityHavingNavigationProperty(
entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().clear();