Coverage Report - jp.co.y_net.amm.dao.GrpDao
 
Classes in this File Line Coverage Branch Coverage Complexity
GrpDao
0%
0/28
0%
0/4
1.5
 
 1  0
 package jp.co.y_net.amm.dao;
 2  
 import java.util.List;
 3  
 
 4  
 import org.hibernate.criterion.DetachedCriteria;
 5  
 import org.hibernate.criterion.Example;
 6  
 import org.springframework.orm.hibernate3.HibernateTemplate;
 7  
 import org.springframework.stereotype.Component;
 8  
 
 9  
 
 10  
 @Component("grpDao")
 11  0
 public class GrpDao extends AbstractDao {
 12  
     
 13  
     /* 参照形処理 ------------------------------------------------------------------------------------------------ */
 14  
     /** ユニークキーを使用した取得 */
 15  
     public Grp getByGrpid(Integer grpid) {
 16  0
         Grp cnd = new Grp();
 17  0
         cnd.setGrpid(grpid);
 18  0
         List<Grp> list = get(cnd);
 19  0
         if(list.size() == 1) {
 20  0
             return list.get(0);
 21  
         }
 22  0
         return null;
 23  
     }
 24  
     /** 全件取得(論理削除除外) */
 25  
     public List<Grp> get() {
 26  0
         Grp cnd = new Grp();
 27  0
         cnd.setDeleted(AppDef.FLASE); // 論理削除考慮
 28  0
         return get(cnd);
 29  
     }
 30  
     /** 条件付き取得(論理削除除外) */
 31  
     public List<Grp> get(Grp cnd) {
 32  0
         if(cnd != null) {
 33  0
             cnd.setDeleted(AppDef.FLASE); // 論理削除考慮
 34  
         }
 35  0
         HibernateTemplate hibernateTemplate = getHibernateTemplate();
 36  0
         DetachedCriteria dc = DetachedCriteria.forClass(Grp.class);
 37  0
         dc.add(Example.create(cnd));
 38  
         @SuppressWarnings("unchecked")
 39  0
         List<Grp> list = (List<Grp>) hibernateTemplate.findByCriteria(dc);
 40  0
         hibernateTemplate.clear();
 41  0
         return list;
 42  
     }
 43  
     
 44  
     /* 更新系処理 ------------------------------------------------------------------------------------------------ */
 45  
     private static final String ENTITYNAME = "Grp";
 46  
     private static final String PKEYNAME = "grpid";
 47  
     /**
 48  
      * 登録処理
 49  
      * ・必要なカラムを自動採番する
 50  
      * ・共通処理を実施する。
 51  
      * @see AbstractDao#add(AppDto, Integer)
 52  
      * @param item 追加対象オブジェクト
 53  
      * @param updateusrid 更新者ID
 54  
      */
 55  
     public void add(Grp item, Integer updateusrid) {
 56  
         /* 自動採番 */
 57  0
         item.setGrpid(getNextId(ENTITYNAME, PKEYNAME, 1000000001)); // グループIDとユーザIDの重複を避けるため、開始する値を変更する。
 58  
         /* Insert実施 */
 59  0
         super.add(item, updateusrid);
 60  0
     }
 61  
 
 62  0
     public void update(Grp item, Integer updateusrid) {
 63  0
         super.update(item, updateusrid);
 64  0
     }
 65  0
     public void removeLogical(Grp item, Integer updateusrid) {
 66  0
         super.removeLogical(item, updateusrid);
 67  0
     }
 68  
 }