use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testManyToManyFieldResolutionInBetween.
public void testManyToManyFieldResolutionInBetween() {
Filter filter = new Filter();
filter.is("mBranches__mSuppliers__mName", "ACME");
QuerySet<Product> products = Product.objects(getContext()).filter(filter);
assertEquals(1, products.count());
assertTrue(products.contains(mP1));
filter = new Filter();
filter.is("mBranches__mSuppliers__mName", "fail");
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 testForeignKeyResolutionInBetween.
public void testForeignKeyResolutionInBetween() {
Filter filter = new Filter();
filter.contains("mBranches__mBrand__mName", "cal");
QuerySet<Supplier> suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(1, suppliers.count());
assertTrue(suppliers.contains(mS1));
filter = new Filter();
filter.is("mBranches__mBrand__mName", "false");
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 testForeignKeyResolutionOnlyField.
public void testForeignKeyResolutionOnlyField() {
Filter filter = new Filter();
filter.is("mBrand", mB);
QuerySet<Branch> branches = Branch.objects(getContext()).filter(filter);
assertEquals(3, branches.count());
assertTrue(branches.contains(mB1));
assertTrue(branches.contains(mB3));
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class FieldResulutionTest method testForeignKeyResolutionLastField.
public void testForeignKeyResolutionLastField() {
Filter filter = new Filter();
filter.is("mBranches__mBrand", mB);
QuerySet<Supplier> suppliers = Supplier.objects(getContext()).filter(filter);
assertEquals(1, suppliers.count());
assertTrue(suppliers.contains(mS1));
}
use of com.orm.androrm.Filter in project androrm by androrm.
the class OneToManyField method get.
@Override
public QuerySet<R> get(Context context, L origin) {
String fieldName = Model.getBackLinkFieldName(mTargetClass, mOriginClass);
Filter filter = new Filter();
filter.is(fieldName, origin);
QuerySet<R> querySet = new QuerySet<R>(context, mTargetClass);
querySet.filter(filter);
return querySet;
}
Aggregations