Package com.vst.model

Examples of com.vst.model.ConstructionDefect


        presetParams(q, objectId, typeId);
        List res =  q.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);
            cd.setDangerCategory((DangerCategory)rescolumns[8]);

            ConstructionExample ce =
              ceMap.get((Integer) rescolumns[9]);
            if (ce != null) {
              if (compareDangerCategory(cd.getDangerCategory(), ce.getRecommendedDangerCategory()) > 0){
                ce.setRecommendedDangerCategory(cd.getDangerCategory());
              }
              ce.getExampleDefects().add(cd);
              System.out.println("EXample defects size:"+ce.getExampleDefects().size());
              ce.setDefectCount(new Integer(ce.getExampleDefects().size()));
            }
View Full Code Here


    public void setConstructionDefectDao(ConstructionDefectDao dao) {
        this.dao = dao;
    }

    public void testAddConstructionDefect() throws Exception {
        ConstructionDefect constructionDefect = new ConstructionDefect();

        // set required fields

        dao.saveConstructionDefect(constructionDefect);

        // verify a primary key was assigned
        assertNotNull(constructionDefect.getConstructionDefectId());

        // verify set fields are same after save
    }
View Full Code Here

        // verify set fields are same after save
    }

    public void testGetConstructionDefect() throws Exception {
        ConstructionDefect constructionDefect = dao.getConstructionDefect(constructionDefectId);
        assertNotNull(constructionDefect);
    }
View Full Code Here

        ConstructionDefect constructionDefect = dao.getConstructionDefect(constructionDefectId);
        assertNotNull(constructionDefect);
    }

    public void testGetConstructionDefects() throws Exception {
        ConstructionDefect constructionDefect = new ConstructionDefect();

        List results = dao.getConstructionDefects(constructionDefect);
        assertTrue(results.size() > 0);
    }
View Full Code Here

        List results = dao.getConstructionDefects(constructionDefect);
        assertTrue(results.size() > 0);
    }

    public void testSaveConstructionDefect() throws Exception {
        ConstructionDefect constructionDefect = dao.getConstructionDefect(constructionDefectId);

        // update required fields

        dao.saveConstructionDefect(constructionDefect);
View Full Code Here

              "  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);
View Full Code Here

    public List getCategoriesByVarityId(String varityId) {
        return super.getSession().createQuery("from DefectCategory defectCategory where defectCategory.defectVarity.varityId=?").setString(0, varityId).list();
    }

    public DefectCategory getDefectCategoryByConstructionDefect(String constructionDefectId,String constructionTypeId) {
        ConstructionDefect constructionDefect = (ConstructionDefect) super.getSession().createQuery("from ConstructionDefect constructionDefect where constructionDefect.constructionDefectId=?").setString(0, constructionDefectId).uniqueResult();
        String defectZoneId=constructionDefect.getDefectZone().getDefectZoneId().toString();
        String defectTypeId=constructionDefect.getDefectType().getDefectTypeId().toString();
        String defectVarityId=constructionDefect.getDefectVarity().getVarityId().toString();
        String hqlQuery = "from DefectCategory defectCategory ";
        List parameterList = constructionDefect.getDefectParameters();
        boolean hasParameters = parameterList.size() > 0;



        String queryParameter="";
View Full Code Here

    /**
     * @see com.vst.dao.ConstructionDefectDao#getConstructionDefect(Integer constructionDefectId)
     */
    public ConstructionDefect getConstructionDefect(final Integer constructionDefectId) {
        ConstructionDefect constructionDefect = (ConstructionDefect) getObject(constructionDefectId);
        return constructionDefect;
    }
View Full Code Here

    /**
     * @see com.vst.dao.ConstructionDefectDao#removeConstructionDefect(Integer constructionDefectId)
     */
    public void removeConstructionDefect(final Integer constructionDefectId) {
        //TODO find out the real solution for updating index positions
        ConstructionDefect constructionDefect=(ConstructionDefect)getConstructionDefect(constructionDefectId);
        removeEntity(constructionDefect);
        super.getSession().createQuery("update ConstructionDefect set constructionDefectPosition=constructionDefectPosition-1 where exampleId=? AND constructionDefectPosition>?").setString(0,String.valueOf(constructionDefect.getExampleId())).setString(1,String.valueOf(constructionDefect.getConstructionDefectPosition()));
    }
View Full Code Here

TOP

Related Classes of com.vst.model.ConstructionDefect

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.