use of com.axelor.rpc.Criteria in project axelor-open-suite by axelor.
the class ProductController method getDisplayedProductIdList.
@SuppressWarnings("unchecked")
private List<Long> getDisplayedProductIdList(ActionRequest request) {
JpaSecurity security = Beans.get(JpaSecurity.class);
List<Long> displayedProductIdList = new ArrayList<>();
Criteria criteria = Criteria.parse(request);
List<?> products = criteria.createQuery(Product.class, security.getFilter(JpaSecurity.CAN_READ, Product.class)).select("id").fetch(-1, -1);
for (Object product : products) {
if (product instanceof Map) {
Long id = (Long) ((Map<String, Object>) product).get("id");
displayedProductIdList.add(id);
}
}
return displayedProductIdList;
}
use of com.axelor.rpc.Criteria in project axelor-open-suite by axelor.
the class TestBamlParser method testJsonQuery.
@Test
public void testJsonQuery() {
Map<String, Object> rawCriteria = new HashMap<String, Object>();
Map<String, Object> _domainContext = new HashMap<String, Object>();
_domainContext.put("jsonModel", "File");
rawCriteria.put("fieldName", "attrs.integer1");
rawCriteria.put("operator", "=");
rawCriteria.put("value", 2);
rawCriteria.put("_domain", "jsonModel = :jsonModel");
rawCriteria.put("_domainContext", _domainContext);
Criteria criteria = Criteria.parse(rawCriteria, MetaJsonRecord.class, false);
criteria.createQuery(MetaJsonRecord.class).toString();
System.err.println(criteria.toString());
System.err.println(criteria.createQuery(MetaJsonRecord.class).toString());
}
Aggregations