private void addCollectionItemClause(QueryTask.Query.Builder builder,String fieldName,ResourceConstraint constraint){
  List<String> values=constraint.getValues();
  boolean isNegative=false;
  if (constraint.isSetNegative() && constraint.isNegative()) {
    isNegative=true;
  }
  QueryTask.Query.Occurance occurance=isNegative ? QueryTask.Query.Occurance.MUST_NOT_OCCUR : QueryTask.Query.Occurance.MUST_OCCUR;
  if (values == null || values.size() == 0) {
    return;
  }
  if (values.size() == 1) {
    builder.addCollectionItemClause(fieldName,values.get(0),occurance);
    return;
  }
  builder.addInCollectionItemClause(fieldName,values,occurance);
}

private void addCollectionItemClause ( QueryTask . Query . Builder builder , String fieldName , ResourceConstraint constraint ) { List < String > values = constraint . getValues ( ) ; boolean isNegative = false ; if ( constraint . isSetNegative ( ) && constraint . isNegative ( ) ) { isNegative = true ; } QueryTask . Query . Occurance occurance = isNegative ? QueryTask . Query . Occurance . MUST_NOT_OCCUR : QueryTask . Query . Occurance . MUST_OCCUR ; if ( values == null || values . size ( ) == 0 ) { return ; } if ( values . size ( ) == 1 ) { builder . addCollectionItemClause ( fieldName , values . get ( 0 ) , occurance ) ; return ; } builder . addInCollectionItemClause ( fieldName , values , occurance ) ; }
a helper method for creating a clause for a single collection constraint .
