/**
  * Adds the filter sort descriptor criterias and the subset policy
  *
  * @param query
  * @param options
  */
 public static void addCriterias(Query query, Options options) {
   addDescriptorPolicy(options, query);
   addSortCriteria(query, options);
   addFilterCriteria(query, options);
   SubsetPolicy subsetPolicy = new SubsetPolicy(options.pageSize, options.skip, true);
   query.setPolicy(HistoricalStatesPolicy.WITH_LAST_USER_PERFORMER);
   query.setPolicy(subsetPolicy);
 }
 /**
  * Add descriptor policy
  *
  * @param options
  * @param query
  */
 public static void addDescriptorPolicy(Options options, Query query) {
   if (options.allDescriptorsVisible) {
     query.setPolicy(DescriptorPolicy.WITH_DESCRIPTORS);
   } else if (CollectionUtils.isNotEmpty(options.visibleDescriptorColumns)) {
     query.setPolicy(
         DescriptorPolicy.withIds(new HashSet<String>(options.visibleDescriptorColumns)));
   } else {
     query.setPolicy(DescriptorPolicy.NO_DESCRIPTORS);
   }
 }