Java Code Examples for org.apache.olingo.odata2.api.edm.EdmException#ASSOCIATIONNOTFOUND

The following examples show how to use org.apache.olingo.odata2.api.edm.EdmException#ASSOCIATIONNOTFOUND . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlMetadataDeserializer.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
private void setAssociationSetForNavigations() throws EdmException {
  for(EdmEntitySet edmEntitySet:edmEntitySetList){
    List<String> navigations =  edmEntitySet.getEntityType().getNavigationPropertyNames();
    if(navigations!=null && !navigations.isEmpty()){
      for (EdmNavigationProperty navigationProperty : navProperties) {
        if (navigations.contains(navigationProperty.getName())) { //NOSONAR
          FullQualifiedName associationName = ((EdmNavigationPropertyImpl) navigationProperty).getRelationshipName();
          String toRoleName = ((EdmNavigationPropertyImpl) navigationProperty).getToRole();
          EdmAssociationEnd end = associationsMap.get(associationName).getEnd(toRoleName);
          if (end == null) {
            throw new EdmException(EdmException.ASSOCIATIONNOTFOUND);
          }
          String relation = associationName.toString();
          StringBuilder key = new StringBuilder();
          key.append(edmEntitySet.getName());
          key.append(">>");
          key.append(relation);
          key.append(">>");
          key.append(navigationProperty.getFromRole());
          ((EdmNavigationPropertyImpl) navigationProperty).setMultiplicity(end.getMultiplicity());
          associationSetMap.put(key.toString(), tempAssociationSetMap.get(relation));
        }
      }
    }
  }
}
 
Example 2
Source File: EdmAssociationSetImpl.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Override
public EdmAssociation getAssociation() throws EdmException {
  EdmAssociation association =
      edm.getAssociation(this.associationSetFQName.getNamespace(), 
          this.associationSetFQName.getName());
  if (association == null) {
    throw new EdmException(EdmException.ASSOCIATIONNOTFOUND);
  }
  return association;
}