Package com.vst.model

Examples of com.vst.model.ConstructionExample


        constructionExampleManager.saveConstructionExample(constructionExample);
        constructionExampleDao.verify();
    }

    public void testAddAndRemoveConstructionExample() throws Exception {
        ConstructionExample constructionExample = new ConstructionExample();

        // set required fields

        // set expected behavior on dao
        constructionExampleDao.expects(once()).method("saveConstructionExample")
            .with(same(constructionExample)).isVoid();
        constructionExampleManager.saveConstructionExample(constructionExample);
        constructionExampleDao.verify();

        // reset expectations
        constructionExampleDao.reset();

        constructionExampleDao.expects(once()).method("removeConstructionExample").with(eq(new Long(constructionExampleId)));
        constructionExampleManager.removeConstructionExample(constructionExampleId);
        constructionExampleDao.verify();

        // reset expectations
        constructionExampleDao.reset();
        // remove
        Exception ex = new ObjectRetrievalFailureException(ConstructionExample.class, constructionExample.getExampleId());
        constructionExampleDao.expects(once()).method("removeConstructionExample").isVoid();
        constructionExampleDao.expects(once()).method("getConstructionExample").will(throwException(ex));
        constructionExampleManager.removeConstructionExample(constructionExampleId);
        try {
            constructionExampleManager.getConstructionExample(constructionExampleId);
View Full Code Here


        }

        //process examples
        List<?> allExamples = getAllExamplesList();
        for (Object o : allExamples) {
          ConstructionExample ce =
            (ConstructionExample) o;

          ObjectConstruction oc = coMap.get(ce.getObjectConstructionId());
          if(oc != null){
            oc.getConstructionExamples().add(ce);
          }
        }
View Full Code Here

      List<ConstructionExample> ceList = new ArrayList<ConstructionExample>();
      Map<Integer, ConstructionExample> ceMap =
        new HashMap<Integer, ConstructionExample>();
      for (Object o : cerows) {
          Object[] cols = (Object[]) o;
          ConstructionExample ce = new ConstructionExample();
          ce.setExampleId((Integer) cols[0]);
          ce.setExampleRelativeNumber((Integer) cols[1]);
          ce.setExampleName((String) cols[2]);
          ce.setObjectId((Integer) cols[3]);
          ce.setObjectConstructionId((Integer) cols[4]);
          ceList.add(ce);
          ceMap.put(ce.getExampleId(), ce);
      }

        List<?> res = getSession().createQuery(
              "select "+
              " cd.constructionDefectId, "+
              " cd.comment, "+
              " dt.defectTypeId, "+
              " dt.defectTypeName,"+
              " dv.varityId, "+
              " dv.varityName,"+
              " dz.defectZoneId, "+
              " dz.defectZoneName,"+
              " cd.exampleId"+
              " from ConstructionDefect as cd, DefectType as dt, " +
              " DefectZone as dz, DefectVarity dv"+
              " where cd.defectType.defectTypeId = dt.defectTypeId " +
              "  and cd.defectZone.defectZoneId = dz.defectZoneId " +
              "  and cd.defectVarity.varityId = dv.varityId")
                  .list();

          for (Object r : res){
            Object[] rescolumns = (Object[]) r;
            ConstructionDefect cd = new ConstructionDefect(
              (Integer) rescolumns[0], (String) rescolumns[1]);
            DefectType dt = new DefectType(
               (Integer) rescolumns[2], (String) rescolumns[3]);
            DefectVarity dv = new DefectVarity(
              (Integer) rescolumns[4], (String) rescolumns[5]);
            DefectZone dz = new DefectZone(
               (Integer) rescolumns[6], (String) rescolumns[7]);

            cd.setDefectType(dt);
            cd.setDefectVarity(dv);
            cd.setDefectZone(dz);

            ConstructionExample ce =
              ceMap.get((Integer) rescolumns[8]);
            if (ce != null) {
              ce.getExampleDefects().add(cd);
            }
          }
       return ceList;
    }
View Full Code Here

public class StrengthDaoHibernate extends BaseDaoHibernate<Strength> implements StrengthDao {


    public List getStrengthsByExampleId(String exampleId) {
        ConstructionExample constructionExample = (ConstructionExample) super.getSession().get(ConstructionExample.class, new Integer(exampleId));
        return constructionExample.getStrengthPoints();
    }
View Full Code Here

        this.defectTypeDao = defectTypeDao;
    }

    public String getDefectConstructionNumber(String exampleId){
    try {
        ConstructionExample constructionExample = (ConstructionExample) super.getSession().get(ConstructionExample.class, new Integer(exampleId));
        super.getSession().evict(constructionExample);
        return constructionExample.getExampleRelativeNumber()+"."+(constructionExample.getExampleDefects().size()+1);
    } catch (Exception e) {
       return "0.0.0.1";
    }
}
View Full Code Here




public List getConstructionDefectsByExampleId(String exampleId){
     ConstructionExample constructionExample=(ConstructionExample)super.getSession().get(ConstructionExample.class,new Integer(exampleId));
     return constructionExample.getExampleDefects();
}
View Full Code Here



    public String getDefectConstructionNumberZone(String exampleId){
    try {
        ConstructionExample constructionExample = (ConstructionExample) super.getSession().get(ConstructionExample.class, new Integer(exampleId));
        super.getSession().evict(constructionExample);
        return constructionExample.getExampleRelativeNumber()+"."+(constructionExample.getExampleDefects().size()+1);
    } catch (Exception e) {
       return "0.0.0.1";
    }
}
View Full Code Here

    }



public List getConstructionDefectsZoneByExampleId(String exampleId){
     ConstructionExample constructionExample=(ConstructionExample)super.getSession().get(ConstructionExample.class,new Integer(exampleId));
     return constructionExample.getExampleDefectsZone();
}
View Full Code Here

TOP

Related Classes of com.vst.model.ConstructionExample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.