Changeset 1640
- Timestamp:
- May 9, 2012, 2:59:48 PM (10 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java
r1639 r1640 18 18 import net.sf.basedb.core.ItemQuery; 19 19 import net.sf.basedb.core.Type; 20 import net.sf.basedb.core.query.Expression; 20 21 import net.sf.basedb.core.query.Expressions; 21 22 import net.sf.basedb.core.query.Hql; … … 424 425 425 426 /** 426 List all annotation types registered in BASE with a name matching this annotation 427 type definition. Normally, only a single annotation type should be returned. 427 List all annotation types registered in BASE with a name and main item type 428 matching this annotation type definition. Normally, only a single annotation 429 type should be returned. 428 430 */ 429 431 public List<AnnotationType> list(DbControl dc) … … 431 433 ItemQuery<AnnotationType> query = AnnotationType.getQuery(null); 432 434 query.restrict(Restrictions.eq(Hql.property("name"), Expressions.parameter("name", name, Type.STRING))); 435 query.joinPermanent(Hql.innerJoin("itemTypes", "it")); 436 437 Item[] mt = getMainType(); 438 Expression[] mainTypes = new Expression[mt.length]; 439 for (int i = 0; i < mainTypes.length; ++i) 440 { 441 mainTypes[i] = Expressions.integer(mt[i].getValue()); 442 } 443 query.restrictPermanent(Restrictions.in(Hql.alias("it"), mainTypes)); 444 433 445 query.include(Include.ALL); 446 query.setDistinct(true); 434 447 return query.list(dc); 435 448 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Subtype.java
r1639 r1640 259 259 260 260 /** 261 List all subtypes registered in BASE with a name matching this subtype 262 definition. Normally, only a single subtype should be returned. 261 List all subtypes registered in BASE with a name and main item type 262 matching this subtype definition. Normally, only a single subtype 263 should be returned. 263 264 */ 264 265 public List<ItemSubtype> list(DbControl dc) 265 266 { 266 ItemQuery<ItemSubtype> query = ItemSubtype.getQuery( null);267 ItemQuery<ItemSubtype> query = ItemSubtype.getQuery(getMainType()); 267 268 query.restrict( 268 269 Restrictions.eq(
Note: See TracChangeset
for help on using the changeset viewer.