use of org.opennms.web.rest.v2.ScanReportRestService in project opennms by OpenNMS.
the class CriteriaBuilderSearchVisitorIT method testScanReportAndCondition.
@Test
public void testScanReportAndCondition() {
CriteriaBuilder builder = new ScanReportRestService().getCriteriaBuilder(null);
CriteriaBuilderSearchVisitor<ScanReport, ScanReport> visitor = new CriteriaBuilderSearchVisitor<>(builder, ScanReport.class);
// Simulates /opennms/api/v2/scanreports?_s=applications%3D%3DLocal+Access;timestamp%3Dle%3D2016-02-01T15:07:14.340-0500&limit=20&offset=0&order=desc&orderBy=timestamp
List<SearchCondition<ScanReport>> conditions = new ArrayList<SearchCondition<ScanReport>>();
conditions.add(new PrimitiveSearchCondition<ScanReport>("applications", "blah", String.class, ConditionType.EQUALS, new ScanReport()));
conditions.add(new PrimitiveSearchCondition<ScanReport>("timestamp", new Date(), Date.class, ConditionType.LESS_OR_EQUALS, new ScanReport()));
SearchCondition<ScanReport> andCondition = new AndSearchCondition<ScanReport>(conditions);
visitor.visit(andCondition);
Criteria criteria = visitor.getQuery().toCriteria();
System.out.println(criteria.toString());
m_dao.countMatching(criteria);
}
use of org.opennms.web.rest.v2.ScanReportRestService in project opennms by OpenNMS.
the class CriteriaBuilderSearchVisitorIT method testScanReportTwoConditions.
@Test
public void testScanReportTwoConditions() {
CriteriaBuilder builder = new ScanReportRestService().getCriteriaBuilder(null);
CriteriaBuilderSearchVisitor<ScanReport, ScanReport> visitor = new CriteriaBuilderSearchVisitor<>(builder, ScanReport.class);
visitor.visit(new PrimitiveSearchCondition<ScanReport>("applications", "blah", String.class, ConditionType.EQUALS, new ScanReport()));
visitor.visit(new PrimitiveSearchCondition<ScanReport>("timestamp", new Date(), Date.class, ConditionType.LESS_OR_EQUALS, new ScanReport()));
Criteria criteria = visitor.getQuery().toCriteria();
System.out.println(criteria.toString());
m_dao.countMatching(criteria);
}
use of org.opennms.web.rest.v2.ScanReportRestService in project opennms by OpenNMS.
the class CriteriaBuilderSearchVisitorIT method testScanReportTwoConditionsWithIsNotNull.
@Test
public void testScanReportTwoConditionsWithIsNotNull() {
CriteriaBuilder builder = new ScanReportRestService().getCriteriaBuilder(null);
CriteriaBuilderSearchVisitor<ScanReport, ScanReport> visitor = new CriteriaBuilderSearchVisitor<>(builder, ScanReport.class);
visitor.visit(new PrimitiveSearchCondition<ScanReport>("applications", CriteriaBuilderSearchVisitor.NULL_VALUE, String.class, ConditionType.NOT_EQUALS, new ScanReport()));
visitor.visit(new PrimitiveSearchCondition<ScanReport>("timestamp", new Date(), Date.class, ConditionType.LESS_OR_EQUALS, new ScanReport()));
Criteria criteria = visitor.getQuery().toCriteria();
System.out.println(criteria.toString());
m_dao.countMatching(criteria);
}
use of org.opennms.web.rest.v2.ScanReportRestService in project opennms by OpenNMS.
the class CriteriaBuilderSearchVisitorIT method testScanReportTwoConditionsWithIsNull.
@Test
public void testScanReportTwoConditionsWithIsNull() {
CriteriaBuilder builder = new ScanReportRestService().getCriteriaBuilder(null);
CriteriaBuilderSearchVisitor<ScanReport, ScanReport> visitor = new CriteriaBuilderSearchVisitor<>(builder, ScanReport.class);
visitor.visit(new PrimitiveSearchCondition<ScanReport>("applications", CriteriaBuilderSearchVisitor.NULL_VALUE, String.class, ConditionType.EQUALS, new ScanReport()));
visitor.visit(new PrimitiveSearchCondition<ScanReport>("timestamp", new Date(), Date.class, ConditionType.LESS_OR_EQUALS, new ScanReport()));
Criteria criteria = visitor.getQuery().toCriteria();
System.out.println(criteria.toString());
m_dao.countMatching(criteria);
}
Aggregations