Пример #1
0
 @Override
 protected List<EdmEntitySet> createEntitySets() throws ODataException {
   List<EdmEntitySet> edmEntitySets = new ArrayList<EdmEntitySet>();
   if (schemas == null) {
     schemas = edmProvider.getSchemas();
   }
   for (Schema schema : schemas) {
     for (EntityContainer entityContainer : schema.getEntityContainers()) {
       for (EntitySet entitySet : entityContainer.getEntitySets()) {
         EdmEntityContainer edmEntityContainer = createEntityContainer(entityContainer.getName());
         edmEntitySets.add(new EdmEntitySetImplProv(this, entitySet, edmEntityContainer));
       }
     }
   }
   return edmEntitySets;
 }
  @Override
  public List<EdmEntitySetInfo> getEntitySetInfos() throws ODataException {
    if (entitySetInfos == null) {
      entitySetInfos = new ArrayList<EdmEntitySetInfo>();

      if (schemas == null) {
        schemas = edmProvider.getSchemas();
      }

      for (Schema schema : schemas) {
        for (EntityContainer entityContainer : listOrEmptyList(schema.getEntityContainers())) {
          for (EntitySet entitySet : listOrEmptyList(entityContainer.getEntitySets())) {
            EdmEntitySetInfo entitySetInfo =
                new EdmEntitySetInfoImplProv(entitySet, entityContainer);
            entitySetInfos.add(entitySetInfo);
          }
        }
      }
    }

    return entitySetInfos;
  }
  @Override
  public String getDataServiceVersion() throws ODataException {
    if (schemas == null) {
      schemas = edmProvider.getSchemas();
    }

    if (dataServiceVersion == null) {
      dataServiceVersion = ODataServiceVersion.V10;

      for (Schema schema : listOrEmptyList(schemas)) {
        List<EntityType> entityTypes = listOrEmptyList(schema.getEntityTypes());
        for (EntityType entityType : entityTypes) {
          List<Property> properties = listOrEmptyList(entityType.getProperties());
          for (Property property : properties) {
            if (property.getCustomizableFeedMappings() != null) {
              if (property.getCustomizableFeedMappings().getFcKeepInContent() != null) {
                if (!property.getCustomizableFeedMappings().getFcKeepInContent()) {
                  dataServiceVersion = ODataServiceVersion.V20;
                  return dataServiceVersion;
                }
              }
              if (entityType.getCustomizableFeedMappings() != null) {
                if (entityType.getCustomizableFeedMappings().getFcKeepInContent() != null) {
                  if (entityType.getCustomizableFeedMappings().getFcKeepInContent()) {
                    dataServiceVersion = ODataServiceVersion.V20;
                    return dataServiceVersion;
                  }
                }
              }
            }
          }
        }
      }
    }
    return dataServiceVersion;
  }