@Test public void testOpDefault() throws Exception { FileModificationDateFileFilterRule filterRule = new FileModificationDateFileFilterRule(new DateValue(NEW_DATE_TIME), -1); assertFalse(filterRule.match(testNode)); }
@Override public boolean match(File file) throws FilterRuleNotAppliableException { long lastModified = file.getLastModified(); if (-1 == lastModified) { throw new FilterRuleNotAppliableException("The file or directory doesn't have any modification date"); } switch (op) { case OP_IS: return date.isEqualTo(lastModified); case OP_ISNT: return !date.isEqualTo(lastModified); case OP_IS_BEFORE: return date.isBefore(lastModified); case OP_IS_AFTER: return date.isAfter(lastModified); } return false; }
FileModificationDateFileFilterRule implements FileFilterRule { @Override public boolean match(File file) throws FilterRuleNotAppliableException { long lastModified = file.getLastModified(); if (-1 == lastModified) { throw new FilterRuleNotAppliableException("The file or directory doesn't have any modification date"); } switch (op) { case OP_IS: return date.isEqualTo(lastModified); case OP_ISNT: return !date.isEqualTo(lastModified); case OP_IS_BEFORE: return date.isBefore(lastModified); case OP_IS_AFTER: return date.isAfter(lastModified); } return false; } }
FileModificationDateFileFilterRule implements FileFilterRule { @Override public boolean match(File file) throws FilterRuleNotAppliableException { long lastModified = file.getLastModified(); if (-1 == lastModified) { throw new FilterRuleNotAppliableException("The file or directory doesn't have any modification date"); } switch (op) { case OP_IS: return date.isEqualTo(lastModified); case OP_ISNT: return !date.isEqualTo(lastModified); case OP_IS_BEFORE: return date.isBefore(lastModified); case OP_IS_AFTER: return date.isAfter(lastModified); } return false; } FileModificationDateFileFilterRule(DateValue date, int operator); }
FileModificationDateFileFilterRule implements FileFilterRule { @Override public boolean match(File file) throws FilterRuleNotAppliableException { long lastModified = file.getLastModified(); if (-1 == lastModified) { throw new FilterRuleNotAppliableException("The file or directory doesn't have any modification date"); } switch (op) { case OP_IS: return date.isEqualTo(lastModified); case OP_ISNT: return !date.isEqualTo(lastModified); case OP_IS_BEFORE: return date.isBefore(lastModified); case OP_IS_AFTER: return date.isAfter(lastModified); } return false; } FileModificationDateFileFilterRule(DateValue date, int operator); @Override String getRuleType(); static String[] getAllOperators(); @Override int getOperator(); @Override String getOperatorName(); @Override OperandValue getValue(); @Override boolean match(File file); @Override String toString(); }
FileModificationDateFileFilterRule implements FileFilterRule { @Override public boolean match(File file) throws FilterRuleNotAppliableException { long lastModified = file.getLastModified(); if (-1 == lastModified) { throw new FilterRuleNotAppliableException("The file or directory doesn't have any modification date"); } switch (op) { case OP_IS: return date.isEqualTo(lastModified); case OP_ISNT: return !date.isEqualTo(lastModified); case OP_IS_BEFORE: return date.isBefore(lastModified); case OP_IS_AFTER: return date.isAfter(lastModified); } return false; } FileModificationDateFileFilterRule(DateValue date, int operator); @Override String getRuleType(); static String[] getAllOperators(); @Override int getOperator(); @Override String getOperatorName(); @Override OperandValue getValue(); @Override boolean match(File file); @Override String toString(); static final String TYPE_NAME; static final int OP_IS; static final int OP_ISNT; static final int OP_IS_BEFORE; static final int OP_IS_AFTER; }