Coverage Report - jp.co.y_net.amm.dao.InfDao
 
Classes in this File Line Coverage Branch Coverage Complexity
InfDao
0%
0/26
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("infDao")
 11  0
 public class InfDao extends AbstractDao {
 12  
     
 13  
     /* 参照形処理 ------------------------------------------------------------------------------------------------ */
 14  
     /** ユニークキーを使用した取得 */
 15  
     public Inf getByInfid(Integer infid) {
 16  0
         Inf cnd = new Inf();
 17  0
         cnd.setInfid(infid);
 18  0
         List<Inf> 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<Inf> get() {
 26  0
         Inf cnd = new Inf();
 27  0
         cnd.setDeleted(AppDef.FLASE); // 論理削除考慮
 28  0
         return get(cnd);
 29  
     }
 30  
     /** 条件付き取得(論理削除除外) */
 31  
     public List<Inf> get(Inf cnd) {
 32  0
         if(cnd != null) {
 33  0
             cnd.setDeleted(AppDef.FLASE); // 論理削除考慮
 34  
         }
 35  0
         HibernateTemplate hibernateTemplate = getHibernateTemplate();
 36  0
         DetachedCriteria dc = DetachedCriteria.forClass(Inf.class);
 37  0
         dc.add(Example.create(cnd));
 38  
         @SuppressWarnings("unchecked")
 39  0
         List<Inf> list = (List<Inf>) hibernateTemplate.findByCriteria(dc);
 40  0
         hibernateTemplate.clear();
 41  0
         return list;
 42  
     }
 43  
     
 44  
     /* 更新系処理 ------------------------------------------------------------------------------------------------ */
 45  
     private static final String ENTITYNAME = "Inf";
 46  
     private static final String PKEYNAME = "infid";
 47  
     /**
 48  
      * 登録処理
 49  
      * ・必要なカラムを自動採番する
 50  
      * ・共通処理を実施する。
 51  
      * @param item
 52  
      */
 53  
     public void add(Inf item, Integer updateusrid) {
 54  
         /* 自動採番 */
 55  0
         item.setInfid(getNextId(ENTITYNAME, PKEYNAME));
 56  
         /* Insert実施 */
 57  0
         super.add(item, updateusrid);
 58  0
     }
 59  
     public void update(Inf item, Integer updateusrid) {
 60  0
         super.update(item, updateusrid);
 61  0
     }
 62  
     public void removeLogical(Inf item, Integer updateusrid) {
 63  0
         super.removeLogical(item, updateusrid);
 64  0
     }
 65  
 
 66  
 
 67  
 }