@Test public void testVisitDuring() throws GeomajasException { Filter f = filterService.parseFilter("myDate DURING 2006-11-30T00:30:00Z/2006-11-30T01:30:00Z"); Criterion c = (Criterion) (new CriteriaVisitor((HibernateFeatureModel) layer.getFeatureModel(), DateFormat.getDateTimeInstance()).visit((During) f, null)); Date from = ISODateTimeFormat.dateTimeNoMillis().parseDateTime("2006-11-30T00:30:00Z").toDate(); Date to = ISODateTimeFormat.dateTimeNoMillis().parseDateTime("2006-11-30T01:30:00Z").toDate(); Assert.assertEquals("myDate between " + from + " and " + to, c.toString()); }
public Object visit(And filter, Object userData) { Criterion c = null; for (Filter element : filter.getChildren()) { if (c == null) { c = (Criterion) element.accept(this, userData); } else { c = Restrictions.and(c, (Criterion) element.accept(this, userData)); } } return c; }
CriteriaVisitor implements FilterVisitor { public Object visit(And filter, Object userData) { Criterion c = null; for (Filter element : filter.getChildren()) { if (c == null) { c = (Criterion) element.accept(this, userData); } else { c = Restrictions.and(c, (Criterion) element.accept(this, userData)); } } return c; } }
CriteriaVisitor implements FilterVisitor { public Object visit(And filter, Object userData) { Criterion c = null; for (Filter element : filter.getChildren()) { if (c == null) { c = (Criterion) element.accept(this, userData); } else { c = Restrictions.and(c, (Criterion) element.accept(this, userData)); } } return c; } CriteriaVisitor(HibernateFeatureModel featureModel, DateFormat dateFormat); }
CriteriaVisitor implements FilterVisitor { public Object visit(And filter, Object userData) { Criterion c = null; for (Filter element : filter.getChildren()) { if (c == null) { c = (Criterion) element.accept(this, userData); } else { c = Restrictions.and(c, (Criterion) element.accept(this, userData)); } } return c; } CriteriaVisitor(HibernateFeatureModel featureModel, DateFormat dateFormat); Object visit(And filter, Object userData); @Override Object visit(Not filter, Object userData); @Override Object visit(Or filter, Object userData); @Override Object visit(PropertyIsBetween filter, Object userData); @Override Object visit(PropertyIsEqualTo filter, Object userData); @Override Object visit(PropertyIsNotEqualTo filter, Object userData); @Override Object visit(PropertyIsGreaterThan filter, Object userData); @Override Object visit(PropertyIsGreaterThanOrEqualTo filter, Object userData); @Override Object visit(PropertyIsLessThan filter, Object userData); @Override Object visit(PropertyIsLessThanOrEqualTo filter, Object userData); @Override Object visit(PropertyIsLike filter, Object userData); @Override Object visit(PropertyIsNull filter, Object userData); @Override Object visit(BBOX filter, Object userData); @Override Object visit(Beyond filter, Object userData); Object visit(Contains filter, Object userData); @Override Object visit(Crosses filter, Object userData); @Override Object visit(Disjoint filter, Object userData); @Override Object visit(DWithin filter, Object userData); @Override Object visit(Equals filter, Object userData); @Override Object visit(Intersects filter, Object userData); @Override Object visit(Overlaps filter, Object userData); @Override Object visit(Touches filter, Object userData); @Override Object visit(Within filter, Object userData); @Override Object visit(ExcludeFilter filter, Object userData); @Override Object visit(IncludeFilter filter, Object userData); @Override Object visit(Id filter, Object userData); @Override Object visitNullFilter(Object userData); @Override Object visit(PropertyIsNil filter, Object extraData); @Override Object visit(After after, Object extraData); @Override Object visit(AnyInteracts anyInteracts, Object extraData); @Override Object visit(Before before, Object extraData); @Override Object visit(Begins begins, Object extraData); @Override Object visit(BegunBy begunBy, Object extraData); @Override Object visit(During during, Object userData); @Override Object visit(EndedBy endedBy, Object extraData); @Override Object visit(Ends ends, Object extraData); @Override Object visit(Meets meets, Object extraData); @Override Object visit(MetBy metBy, Object extraData); @Override Object visit(OverlappedBy overlappedBy, Object extraData); @Override Object visit(TContains contains, Object extraData); @Override Object visit(TEquals equals, Object extraData); @Override Object visit(TOverlaps contains, Object extraData); }
CriteriaVisitor implements FilterVisitor { public Object visit(And filter, Object userData) { Criterion c = null; for (Filter element : filter.getChildren()) { if (c == null) { c = (Criterion) element.accept(this, userData); } else { c = Restrictions.and(c, (Criterion) element.accept(this, userData)); } } return c; } CriteriaVisitor(HibernateFeatureModel featureModel, DateFormat dateFormat); Object visit(And filter, Object userData); @Override Object visit(Not filter, Object userData); @Override Object visit(Or filter, Object userData); @Override Object visit(PropertyIsBetween filter, Object userData); @Override Object visit(PropertyIsEqualTo filter, Object userData); @Override Object visit(PropertyIsNotEqualTo filter, Object userData); @Override Object visit(PropertyIsGreaterThan filter, Object userData); @Override Object visit(PropertyIsGreaterThanOrEqualTo filter, Object userData); @Override Object visit(PropertyIsLessThan filter, Object userData); @Override Object visit(PropertyIsLessThanOrEqualTo filter, Object userData); @Override Object visit(PropertyIsLike filter, Object userData); @Override Object visit(PropertyIsNull filter, Object userData); @Override Object visit(BBOX filter, Object userData); @Override Object visit(Beyond filter, Object userData); Object visit(Contains filter, Object userData); @Override Object visit(Crosses filter, Object userData); @Override Object visit(Disjoint filter, Object userData); @Override Object visit(DWithin filter, Object userData); @Override Object visit(Equals filter, Object userData); @Override Object visit(Intersects filter, Object userData); @Override Object visit(Overlaps filter, Object userData); @Override Object visit(Touches filter, Object userData); @Override Object visit(Within filter, Object userData); @Override Object visit(ExcludeFilter filter, Object userData); @Override Object visit(IncludeFilter filter, Object userData); @Override Object visit(Id filter, Object userData); @Override Object visitNullFilter(Object userData); @Override Object visit(PropertyIsNil filter, Object extraData); @Override Object visit(After after, Object extraData); @Override Object visit(AnyInteracts anyInteracts, Object extraData); @Override Object visit(Before before, Object extraData); @Override Object visit(Begins begins, Object extraData); @Override Object visit(BegunBy begunBy, Object extraData); @Override Object visit(During during, Object userData); @Override Object visit(EndedBy endedBy, Object extraData); @Override Object visit(Ends ends, Object extraData); @Override Object visit(Meets meets, Object extraData); @Override Object visit(MetBy metBy, Object extraData); @Override Object visit(OverlappedBy overlappedBy, Object extraData); @Override Object visit(TContains contains, Object extraData); @Override Object visit(TEquals equals, Object extraData); @Override Object visit(TOverlaps contains, Object extraData);  }