• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java QuerySet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.orm.androrm.QuerySet的典型用法代码示例。如果您正苦于以下问题:Java QuerySet类的具体用法?Java QuerySet怎么用?Java QuerySet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QuerySet类属于com.orm.androrm包,在下文中一共展示了QuerySet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAddAllAndGet

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testAddAllAndGet() {
	Brand b = new Brand();
	b.setName("Copcal");
	b.save(getContext());
	
	Branch b1 = new Branch();
	b1.setName("test1");
	b1.setBrand(b);
	b1.save(getContext());
	
	Branch b2 = new Branch();
	b2.setName("test2");
	b2.setBrand(b);
	b2.save(getContext());
	
	b = Brand.objects(getContext()).get(b.getId());
	
	QuerySet<Branch> branches = b.getBranches(getContext());
	
	assertEquals(2, branches.count());
	assertTrue(branches.contains(b1));
	assertTrue(branches.contains(b2));
	
	assertEquals(b, b1.getBrand(getContext()));
	assertEquals(b, b2.getBrand(getContext()));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:27,代码来源:OneToManyFieldTest.java


示例2: testInFilterModel

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testInFilterModel() {
	Person p = new Person();
	p.setName("tom");
	p.save(getContext());
	
	Car c = new Car();
	c.addDriver(p);
	c.setName("Toyota");
	c.save(getContext());
	
	List<Person> drivers = new ArrayList<Person>();
	drivers.add(p);
	
	Filter filter = new Filter();
	filter.in("mDrivers", drivers);
	
	QuerySet<Car> cars = Car.objects(getContext()).filter(filter);
	
	assertEquals(1, cars.count());
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:21,代码来源:FilterTest.java


示例3: testInFilterString

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testInFilterString() {
	Person tom = new Person();
	tom.setName("tom");
	tom.save(getContext());
	
	Person peter = new Person();
	peter.setName("peter");
	peter.save(getContext());
	
	Person susan = new Person();
	susan.setName("susan");
	susan.save(getContext());
	
	List<String> names = new ArrayList<String>();
	names.add("tom");
	names.add("peter");
	
	Filter filter = new Filter();
	filter.in("mName", names);
	
	QuerySet<Person> people = Person.objects(getContext()).filter(filter);
	
	assertEquals(2, people.count());
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:25,代码来源:FilterTest.java


示例4: get

import com.orm.androrm.QuerySet; //导入依赖的package包/类
@Override
public QuerySet<R> get(Context context, L origin) {
	QuerySet<R> querySet = new QuerySet<R>(context, mTargetClass);
	querySet.injectQuery(getQuery(origin.getId()));
	
	return querySet;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:8,代码来源:ManyToManyField.java


示例5: get

import com.orm.androrm.QuerySet; //导入依赖的package包/类
@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;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:OneToManyField.java


示例6: testAddAndGet

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testAddAndGet() {
	Brand b = new Brand();
	b.setName("Copcal");
	b.save(getContext());
	
	Branch b1 = new Branch();
	b1.setName("test1");
	b1.setBrand(b);
	b1.save(getContext());
	
	Branch b2 = new Branch();
	b2.setName("test2");
	b2.setBrand(b);
	b2.save(getContext());
	
	QuerySet<Branch> branches = b.getBranches(getContext());
	
	b = Brand.objects(getContext()).get(b.getId());
	
	branches = b.getBranches(getContext());
	
	assertEquals(2, branches.count());
	assertTrue(branches.contains(b1));
	assertTrue(branches.contains(b2));
	
	assertEquals(b, b1.getBrand(getContext()));
	assertEquals(b, b2.getBrand(getContext()));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:29,代码来源:OneToManyFieldTest.java


示例7: testAddAndGet

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testAddAndGet() {
	Product p1 = new Product();
	p1.setName("test1");
	p1.save(getContext());

	Product p2 = new Product();
	p2.setName("test2");
	p2.save(getContext());
	
	Brand b = new Brand();
	b.setName("Copcal");
	b.save(getContext());

	Supplier s = new Supplier();
	s.setName("ACME");
	s.setBrand(b);
	s.addProduct(p1);
	s.addProduct(p2);
	s.save(getContext());

	s = Supplier.objects(getContext()).get(s.getId());

	QuerySet<Product> products = s.getProducts(getContext());

	assertEquals(2, products.count());
	assertTrue(products.contains(p1));
	assertTrue(products.contains(p2));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:29,代码来源:ManyToManyFieldTest.java


示例8: testAddAllAndGet

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testAddAllAndGet() {
	Product p1 = new Product();
	p1.setName("test1");
	p1.save(getContext());

	Product p2 = new Product();
	p2.setName("test2");
	p2.save(getContext());
	
	Brand b = new Brand();
	b.setName("Copcal");
	b.save(getContext());

	Supplier s = new Supplier();
	s.setName("ACME");
	s.setBrand(b);
	s.addProducts(Arrays.asList(new Product[] { p1, p2 }));
	s.save(getContext());

	s = Supplier.objects(getContext()).get(s.getId());

	QuerySet<Product> products = s.getProducts(getContext());

	assertEquals(2, products.count());
	assertTrue(products.contains(p1));
	assertTrue(products.contains(p2));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:28,代码来源:ManyToManyFieldTest.java


示例9: testContains

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public void testContains() {
	Filter filter = new Filter();
	filter.contains("mName", "Pretoria");
	
	Branch contained = Branch.objects(getContext()).get(1);
	Branch notContained = Branch.objects(getContext()).get(3);
	
	QuerySet<Branch> result = Branch.objects(getContext()).filter(filter);
	
	assertTrue(result.contains(contained));
	assertFalse(result.contains(notContained));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:QuerySetTest.java


示例10: testForeignKeyResolutionOnlyField

import com.orm.androrm.QuerySet; //导入依赖的package包/类
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));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:11,代码来源:FieldResulutionTest.java


示例11: testForeignKeyResolutionLastField

import com.orm.androrm.QuerySet; //导入依赖的package包/类
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));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:10,代码来源:FieldResulutionTest.java


示例12: getCount

import com.orm.androrm.QuerySet; //导入依赖的package包/类
/**
 * used to retrieve the count for the specified date.
 */
public int getCount(Date date) {
    int count = 0;
    Filter filter = new Filter();
    DateFormat format = DateFormat.getDateInstance();
    filter.is("date", format.format(date));
    QuerySet<Cache> caches = Cache.objects(context).filter(filter);
    if (caches.isEmpty()) {
        return 0;
    }
    for (Cache cache : caches) {
        count = cache.getCount();
    }
    return count;
}
 
开发者ID:shunix,项目名称:Daily-Pushups,代码行数:18,代码来源:CacheManager.java


示例13: buildList

import com.orm.androrm.QuerySet; //导入依赖的package包/类
private void buildList() {
    final String NAME = "NAME";
    final String STATUS = "STATUS";
    List<Map<String, String>> data =
            new ArrayList<Map<String, String>>();
    Map<String, String> map;
    QuerySet<Scripture> results;
    
    try {
        results = Scripture.objects(getApplication())
                .filter(new Filter().is("book__mId", bookId))
                .orderBy("position");
    } catch (RuntimeException e) {
        // Tried to catch NoSuchFieldException, but eclipse gave an
        // error about the code not throwing that exception. The code does
        // throw that exception, however (see com.orm.androrm.Model).
        L.w("NoSuchFieldException in ScriptureListActivity" +
                ".buildList. Syncing DB and trying again...");
        SyncDB.syncDB(getApplication());
        results = Scripture.objects(getApplication())
                .filter(new Filter().is("book__mId", bookId))
                .orderBy("position");
    }
    for (Scripture scrip : results) {
        map = new HashMap<String, String>();
        map.put(NAME, scrip.getReference());
        map.put(STATUS, getStatusString(scrip.getStatus()));
        data.add(map);
    }
    setListAdapter(new SimpleAdapter(
            this,
            data,
            R.layout.scripture_list_item,
            new String[] {NAME, STATUS},
            new int[] {R.id.txtReference, R.id.txtStatus}));
}
 
开发者ID:tooke7,项目名称:sm-helper,代码行数:37,代码来源:ScriptureListActivity.java


示例14: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
/**< reference to the WordTile the builder is attached to */

    public static final QuerySet<GameTileTimer> objects(Context context) {
        return objects(context, GameTileTimer.class);
    }
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:6,代码来源:GameTileTimer.java


示例15: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public static final QuerySet<LetterTile> objects(Context context) {
    return objects(context, LetterTile.class);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:LetterTile.java


示例16: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public static final QuerySet<WordTile> objects(Context context) {
    return objects(context, WordTile.class);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:WordTile.java


示例17: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
/**< current quantity of this item in the Inventory */

    public static final QuerySet<RequestItem> objects(Context context) {
        return objects(context, RequestItem.class);
    }
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:6,代码来源:RequestItem.java


示例18: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public static final QuerySet<Gift> objects(Context context) {
    return objects(context, Gift.class);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:Gift.java


示例19: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
public static final QuerySet<DecorationTile> objects(Context context) {
    return objects(context, DecorationTile.class);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:4,代码来源:DecorationTile.java


示例20: objects

import com.orm.androrm.QuerySet; //导入依赖的package包/类
/**< reference to the WordTile the builder is attached to */

    public static final QuerySet<WordBuilder> objects(Context context) {
        return objects(context, WordBuilder.class);
    }
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:6,代码来源:WordBuilder.java



注:本文中的com.orm.androrm.QuerySet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IServerType类代码示例发布时间:2022-05-22
下一篇:
Java DefaultScheduleEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap