use of com.orm.androrm.Filter in project androrm by androrm.
the class AndrormMigration method getFilter.
private Filter getFilter(Class<T> model) {
Filter filter = new Filter();
filter.is("mModel", DatabaseBuilder.getTableName(model)).is("mAction", mAction).is("mValue", getValue(model));
return filter;
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testOneToManyResolutionOnlyField.
public void testOneToManyResolutionOnlyField() {
List<Branch> branches = new ArrayList<Branch>();
branches.add(mB1);
branches.add(mB2);
Filter filter = new Filter();
filter.in("mBranches", branches);
QuerySet<Product> products = Product.objects(getContext()).filter(filter);
assertEquals(1, products.count());
assertTrue(products.contains(mP1));
branches.remove(0);
filter = new Filter();
filter.in("mBranches", branches);
products = Product.objects(getContext()).filter(filter);
assertEquals(0, products.count());
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testManyToManyFieldResolutionLastField.
public void testManyToManyFieldResolutionLastField() {
List<Supplier> suppliers = new ArrayList<Supplier>();
suppliers.add(mS1);
Filter filter = new Filter();
filter.in("mBranches__mSuppliers", suppliers);
QuerySet<Product> products = Product.objects(getContext()).filter(filter);
assertEquals(1, products.count());
assertTrue(products.contains(mP1));
suppliers.clear();
filter = new Filter();
filter.in("mBranches__mSuppliers", suppliers);
products = Product.objects(getContext()).filter(filter);
assertEquals(0, products.count());
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testOneToManyResolutionLastField.
public void testOneToManyResolutionLastField() {
List<Branch> branches = new ArrayList<Branch>();
branches.add(mB1);
branches.add(mB2);
Filter filter = new Filter();
filter.in("mProducts__mBranches", branches);
QuerySet<Supplier> suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(1, suppliers.count());
assertTrue(suppliers.contains(mS1));
branches.remove(0);
filter = new Filter();
filter.in("mProducts__mBranches", branches);
suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(0, suppliers.count());
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testManyToManyFieldResolutionOnlyField.
public void testManyToManyFieldResolutionOnlyField() {
List<Branch> branches = new ArrayList<Branch>();
branches.add(mB1);
branches.add(mB2);
Filter filter = new Filter();
filter.in("mBranches", branches);
QuerySet<Supplier> suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(1, suppliers.count());
assertTrue(suppliers.contains(mS1));
branches.remove(0);
filter = new Filter();
filter.in("mBranches", branches);
suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(0, suppliers.count());
}
Aggregations