コード例 #1
0
ファイル: Util.java プロジェクト: rjbaucells/olingo-odata4
  public static Entity findEntity(
      EdmEntityType edmEntityType, EntityCollection entitySet, List<UriParameter> keyParams) {

    List<Entity> entityList = entitySet.getEntities();

    // loop over all entities in order to find that one that matches
    // all keys in request e.g. contacts(ContactID=1, CompanyID=1)
    for (Entity entity : entityList) {
      boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
      if (foundEntity) {
        return entity;
      }
    }

    return null;
  }
コード例 #2
0
 public static void applySearchSystemQueryOption(
     final SearchOption searchOption, EntityCollection entitySet)
     throws ODataApplicationException {
   if (searchOption != null) {
     SearchExpression se = searchOption.getSearchExpression();
     Iterator<Entity> it = entitySet.getEntities().iterator();
     while (it.hasNext()) {
       boolean keep = false;
       Entity entity = it.next();
       ListIterator<Property> properties = entity.getProperties().listIterator();
       while (properties.hasNext() && !keep) {
         keep = isTrue(se, properties.next());
       }
       if (!keep) {
         it.remove();
       }
     }
   }
 }