public boolean dateMatch(List<String> dateFilters, Date instanceDate, InstanceFilter filter) {
   boolean match = true;
   for (String ddf : dateFilters) {
     String isoDate = ISO8601DateParser.format(instanceDate);
     String critDate = Filter.getDateWithoutOp(ddf);
     if (ddf.startsWith("=")) {
       if (!isoDate.startsWith(critDate)) match = false;
     } else if (ddf.startsWith("<=")) {
       if (!isoDate.startsWith(critDate) && isoDate.compareTo(critDate) > 0) match = false;
     } else if (ddf.startsWith(">=")) {
       if (!isoDate.startsWith(critDate) && isoDate.compareTo(critDate) < 0) match = false;
     } else if (ddf.startsWith("<")) {
       if (isoDate.compareTo(critDate) > 0) match = false;
     } else if (ddf.startsWith(">")) {
       if (isoDate.compareTo(critDate) < 0) match = false;
     }
   }
   return match;
 }
Exemple #2
0
 private static String getDateWithoutOp(String ddf) {
   return Filter.getDateWithoutOp(ddf);
 }