Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 SAP AG Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 package com.sap.core.odata.core.edm.provider;
 
 import java.util.List;
 import java.util.Map;
 
 
 public class EdmEntityTypeImplProv extends EdmStructuralTypeImplProv implements EdmEntityType {
 
   private EntityType entityType;
 
 
 
   public EdmEntityTypeImplProv(final EdmImplProv edmfinal EntityType entityTypefinal String namespacethrows EdmException {
     super(edmentityType.namespace);
     this. = entityType;
 
   }
 
   private void buildNavigationPropertiesInternal() throws EdmException {
 
     if (.getNavigationProperties() != null) {
       for (final NavigationProperty navigationProperty : .getNavigationProperties()) {
         .put(navigationProperty.getName(), navigationProperty);
       }
     }
   }
 
   @Override
   public List<StringgetKeyPropertyNames() throws EdmException {
     if ( == null) {
       if ( != null) {
         return ((EdmEntityType).getKeyPropertyNames();
       }
 
        = new ArrayList<String>();
 
       if (.getKey() != null) {
         for (final PropertyRef keyProperty : .getKey().getKeys()) {
           .add(keyProperty.getName());
         }
       } else {
         //Entity Type does not define a key
         throw new EdmException(.);
       }
     }
 
     return ;
   }
 
   @Override
   public List<EdmPropertygetKeyProperties() throws EdmException {
     if ( == null) {
       if ( != null) {
         return ((EdmEntityType).getKeyProperties();
       }
 
       if ( == null) {
          = new HashMap<StringEdmProperty>();
          = new ArrayList<EdmProperty>();
 
         for (String keyPropertyName : getKeyPropertyNames()) {
           final EdmTyped edmProperty = getProperty(keyPropertyName);
           if (edmProperty != null && edmProperty instanceof EdmProperty) {
             .put(keyPropertyName, (EdmPropertyedmProperty);
             .add((EdmPropertyedmProperty);
          } else {
            throw new EdmException(.);
          }
        }
      }
    }
    return ;
  }
  public boolean hasStream() throws EdmException {
    return .isHasStream();
  }
  }
    if ( == null) {
      if ( != null) {
      }
      if (.getNavigationProperties() != null) {
        for (final NavigationProperty navigationProperty : .getNavigationProperties()) {
          .add(navigationProperty.getName());
        }
      }
    }
  }
  public EdmEntityType getBaseType() throws EdmException {
    return (EdmEntityType;
  }
  protected EdmTyped getPropertyInternal(final String namethrows EdmException {
    EdmTyped edmProperty = super.getPropertyInternal(name);
    if (edmProperty != null) {
      return edmProperty;
    }
    if (.containsKey(name)) {
      edmProperty = createNavigationProperty(.get(name));
      .put(nameedmProperty);
    } else if ( != null) {
      edmProperty = .getProperty(name);
      if (edmProperty != null) {
        .put(nameedmProperty);
      }
    }
    return edmProperty;
  }
  protected EdmTyped createNavigationProperty(final NavigationProperty propertythrows EdmException {
    return new EdmNavigationPropertyImplProv(property);
  }
  public EdmAnnotations getAnnotations() throws EdmException {
  }
New to GrepCode? Check out our FAQ X