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;
 
 import java.util.Map;
 

Author(s):
SAP AG
 
 public abstract class EdmImpl implements Edm {
 
 
 
   public EdmImpl(final EdmServiceMetadata edmServiceMetadata) {
     this. = edmServiceMetadata;
   }
 
   @Override
   public EdmEntityContainer getEntityContainer(final String namethrows EdmException {
     if (.containsKey(name)) {
       return .get(name);
     }
 
     EdmEntityContainer edmEntityContainer = null;
 
     try {
       edmEntityContainer = createEntityContainer(name);
       if (edmEntityContainer != null) {
         if (name == null && .containsKey(edmEntityContainer.getName())) {
           //ensure that the same default entity container is stored in the HashMap under null and its name 
           edmEntityContainer = .get(edmEntityContainer.getName());
           .put(nameedmEntityContainer);
         } else if (.containsKey(null) && name.equals(.get(null).getName())) {
           //ensure that the same default entity container is stored in the HashMap under null and its name        
           edmEntityContainer = .get(null);
           .put(nameedmEntityContainer);
         } else {
           .put(nameedmEntityContainer);
         }
       }
     } catch (ODataException e) {
       throw new EdmException(.e);
     }
 
     return edmEntityContainer;
   }
 
   @Override
   public EdmEntityType getEntityType(final String namespacefinal String namethrows EdmException {
     FullQualifiedName fqName = new FullQualifiedName(namespacename);
     if (.containsKey(fqName)) {
       return .get(fqName);
     }
 
     EdmEntityType edmEntityType = null;
 
     try {
       edmEntityType = createEntityType(fqName);
       if (edmEntityType != null) {
         .put(fqNameedmEntityType);
       }
     } catch (ODataException e) {
       throw new EdmException(.e);
     }
 
     return edmEntityType;
  }
  public EdmComplexType getComplexType(final String namespacefinal String namethrows EdmException {
    FullQualifiedName fqName = new FullQualifiedName(namespacename);
    if (.containsKey(fqName)) {
      return .get(fqName);
    }
    EdmComplexType edmComplexType = null;
    try {
      edmComplexType = createComplexType(fqName);
      if (edmComplexType != null) {
        .put(fqNameedmComplexType);
      }
    } catch (ODataException e) {
      throw new EdmException(.e);
    }
    return edmComplexType;
  }
  public EdmAssociation getAssociation(final String namespacefinal String namethrows EdmException {
    FullQualifiedName fqName = new FullQualifiedName(namespacename);
    if (.containsKey(fqName)) {
      return .get(fqName);
    }
    EdmAssociation edmAssociation = null;
    try {
      edmAssociation = createAssociation(fqName);
      if (edmAssociation != null) {
        .put(fqNameedmAssociation);
      }
    } catch (ODataException e) {
      throw new EdmException(.e);
    }
    return edmAssociation;
  }
    return ;
  }
    return getEntityContainer(null);
  }
  protected abstract EdmEntityContainer createEntityContainer(String namethrows ODataException;
  protected abstract EdmEntityType createEntityType(FullQualifiedName fqNamethrows ODataException;
  protected abstract EdmComplexType createComplexType(FullQualifiedName fqNamethrows ODataException;
  protected abstract EdmAssociation createAssociation(FullQualifiedName fqNamethrows ODataException;
New to GrepCode? Check out our FAQ X