Package com.vst.model

Examples of com.vst.model.ConstructionDefectZone


            constructionExampleManager.saveConstructionExample(constructionExample);

        } else if (request.getParameter("type").equals("zone")) {


            ConstructionDefectZone constructionDefect = constructionDefectManager.getConstructionDefectZone(constructionDefectId);
            ConstructionDefectZone newConstructionDefect = (ConstructionDefectZone) elementCopyManager.getNewObject(constructionDefect);

            constructionExample.getExampleDefectsZone().add(newConstructionDefect);
            constructionDefectManager.saveConstructionDefectZone(newConstructionDefect);
            constructionExampleManager.saveConstructionExample(constructionExample);
        }
View Full Code Here


                request.setAttribute("errormessage", bundle.getString("commonMistake"));
            }

        } else if (extractDefectTypeParam(request).equals("zone")) {

            ConstructionDefectZone constructionDefect = constructionDefectManager.getConstructionDefectZone(constructionDefectId);
            ConstructionExample constructionExample = constructionExampleManager.getConstructionExample(constructionDefect.getExampleId().toString());
            constructionExample.getExampleDefectsZone().remove(constructionDefect);
            constructionExampleManager.saveConstructionExample(constructionExample);
            constructionDefectManager.deleteConstructionDefectZone(constructionDefect);
            request.getSession().setAttribute("madeChanges", new Boolean(true));
            request.setAttribute("message", bundle.getString("constructionDefect.deleted"));
View Full Code Here

        int size = constructionDefects.size();

        if (constructionDefects.isEmpty()) {
            constructionDefects = constructionDefectManager.getConstructionDefectsZoneByExampleId(exampleId);
            for (int i = 0; i < constructionDefects.size(); i++) {
                ConstructionDefectZone constructionDefect = (ConstructionDefectZone) constructionDefects.get(i);
                constructionDefect.setObjectConstructionId(objectConstructionId);
            }
        } else {
            constructionDefects.addAll(constructionDefectManager.getConstructionDefectsZoneByExampleId(exampleId));
            for (int i = size; i < constructionDefects.size(); i++) {
                ConstructionDefectZone constructionDefect = (ConstructionDefectZone) constructionDefects.get(i);
                constructionDefect.setObjectConstructionId(objectConstructionId);
            }
        }
        return constructionDefects;
  }
View Full Code Here

  public void validate(Object obj, Errors errors) {

    System.out.println("validate");

    ConstructionDefectZone constructionDefect = (ConstructionDefectZone) obj;
    if (constructionDefect.getDangerCategory().getDangerCategoryId()
        .equals(-1)) {
      errors.rejectValue("dangerCategory.dangerCategoryId",
          "constructionDefect.noDangerCategory");
    }

    if (constructionDefect.getDefectType().getDefectTypeId().equals(-1)) {
      errors.rejectValue("defectType.defectTypeId",
          "constructionDefect.noDefectType");
    } else {
      // checking if all defect parameters were filled
      List defectParameterList = constructionDefect.getDefectParameters();
      for (int i = 0; i < defectParameterList.size(); i++) {
        DefectParameterZone defectParameter = (DefectParameterZone) defectParameterList
            .get(i);
        if (defectParameter.getParameterValue() == 0.0 // ||
                                // defectParameter.getParameterValueSecond()
                                // == 0.0
        ) {
          errors.rejectValue("defectParameters[" + i + "]",
              "constructionDefect.noDefectParameterValue");
        }
      }
    }
    if (constructionDefect.getDefectVarity().getVarityId().equals(-1)) {
      errors.rejectValue("defectVarity.varityId",
          "constructionDefect.noDefectVarity");
    }
    if (constructionDefect.getDefectZone().getDefectZoneId().equals(-1)) {
      errors.rejectValue("defectZone.defectZoneId",
          "constructionDefect.noDefectZone");
    }

    // if ((constructionDefect.getFile()==null ||
View Full Code Here

    /**
     * @see com.vst.dao.ConstructionDefectDao#getConstructionDefect(Integer constructionDefectId)
     */
    public ConstructionDefectZone getConstructionDefectZone(final Integer constructionDefectId) {
        ConstructionDefectZone constructionDefect = (ConstructionDefectZone) getHibernateTemplate().get(ConstructionDefectZone.class, constructionDefectId);
        if (constructionDefect == null) {
            log.warn("uh oh, constructionDefect with constructionDefectId '" + constructionDefectId + "' not found...");
            throw new ObjectRetrievalFailureException(ConstructionDefectZone.class, constructionDefectId);
        }

View Full Code Here

    /**
     * @see com.vst.dao.ConstructionDefectDao#removeConstructionDefect(Integer constructionDefectId)
     */
    public void removeConstructionDefectZone(final Integer constructionDefectId) {
        //TODO find out the real solution for updating index positions
        ConstructionDefectZone constructionDefect=getConstructionDefectZone(constructionDefectId);



        getHibernateTemplate().delete(constructionDefect);

        System.out.println("getExampleId =   "+constructionDefect.getExampleId()+"; getConstructionDefectPosition =   "+constructionDefect.getConstructionDefectPosition());

        super.getSession().createQuery("update ConstructionDefectsZone set constructionDefectPosition=constructionDefectPosition-1 where exampleId=? AND constructionDefectPosition>?").setString(0,String.valueOf(constructionDefect.getExampleId())).setString(1,String.valueOf(constructionDefect.getConstructionDefectPosition()));
    }
View Full Code Here

     private List setValues(ResultSet rs) throws SQLException {
        List list = new ArrayList();

        while (rs.next()) {
            ConstructionDefectZone constructionDefectZone = new ConstructionDefectZone();
            constructionDefectZone.setConstructionDefectId(new Integer(rs.getInt(1)));
            constructionDefectZone=getConstructionDefectZone(constructionDefectZone.getConstructionDefectId());
            list.add(constructionDefectZone);
        }

        return list;
    }
View Full Code Here

TOP

Related Classes of com.vst.model.ConstructionDefectZone

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.