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;
 
 

Author(s):
SAP AG
 
 public class EdmServiceMetadataImplProv implements EdmServiceMetadata {
 
   private EdmProvider edmProvider;
   private String dataServiceVersion;
   private List<Schemaschemas;
 
   public EdmServiceMetadataImplProv(final EdmProvider edmProvider) {
     this. = edmProvider;
   }
 
   @Override
   public InputStream getMetadata() throws ODataException {
     if ( == null) {
        = .getSchemas();
     }
 
     OutputStreamWriter writer = null;
     CircleStreamBuffer csb = new CircleStreamBuffer();
     EntityProviderException cachedException = null;
 
     try {
       writer = new OutputStreamWriter(csb.getOutputStream(), "UTF-8");
       XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
       XmlMetadataProducer.writeMetadata(metadataxmlStreamWriternull);
       return csb.getInputStream();
     } catch (XMLStreamException e) {
       cachedException = new EntityProviderException(.e);
       throw cachedException;
     } catch (UnsupportedEncodingException e) {
       cachedException = new EntityProviderException(.e);
       throw cachedException;
     } finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
       if (writer != null) {
         try {
           writer.close();
         } catch (IOException e) {
           if (cachedException != null) {
             throw cachedException;
           } else {
             throw new EntityProviderException(.e);
           }
         }
       }
     }
   }
 
   @Override
   public String getDataServiceVersion() throws ODataException {
     if ( == null) {
        = .getSchemas();
     }
    if ( == null) {
      if ( != null) {
        for (Schema schema : ) {
          List<EntityTypeentityTypes = schema.getEntityTypes();
          if (entityTypes != null) {
            for (EntityType entityType : entityTypes) {
              List<Propertyproperties = entityType.getProperties();
              if (properties != null) {
                for (Property property : properties) {
                  if (property.getCustomizableFeedMappings() != null) {
                    if (property.getCustomizableFeedMappings().getFcKeepInContent() != null) {
                      if (!property.getCustomizableFeedMappings().getFcKeepInContent()) {
                         = .;
                        return ;
                      }
                    }
                  }
                }
                if (entityType.getCustomizableFeedMappings() != null) {
                  if (entityType.getCustomizableFeedMappings().getFcKeepInContent() != null) {
                    if (entityType.getCustomizableFeedMappings().getFcKeepInContent()) {
                       = .;
                      return ;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return ;
  }
    if ( == null) {
      if ( == null) {
         = .getSchemas();
      }
      for (Schema schema : ) {
        for (EntityContainer entityContainer : schema.getEntityContainers()) {
          for (EntitySet entitySet : entityContainer.getEntitySets()) {
            EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySetentityContainer);
            .add(entitySetInfo);
          }
        }
      }
    }
    return ;
  }
New to GrepCode? Check out our FAQ X