コード例 #1
0
 protected Map referenceData(HttpServletRequest request) throws Exception {
   System.out.println("\n\n\n\n\nInside the reference data     \n");
   Map referenceData = new HashMap();
   referenceData.put("workItemDescriptionList", rfiService.getWorkItemDescriptionList());
   referenceData.put("layerList", rfiService.getLayerList());
   referenceData.put("sideList", rfiService.getSideList());
   referenceData.put("activityList", rfiService.getActivityList());
   return referenceData;
 }
コード例 #2
0
 protected Map referenceData(HttpServletRequest request) throws Exception {
   System.out.println("\n\n\n\n\nInside the reference data     \n");
   Map referenceData = new HashMap();
   referenceData.put("itemsList", rfiService.getItemsList());
   List<String> sideList = rfiService.getSideList();
   if (sideList != null) {
     sideList.remove("BS");
   }
   referenceData.put("sideList", sideList);
   referenceData.put("layerList", rfiService.getLayerList());
   referenceData.put("activityList", rfiService.getActivityList());
   return referenceData;
 }
コード例 #3
0
 @Override
 protected ModelAndView onSubmit(
     HttpServletRequest request,
     HttpServletResponse response,
     Object command,
     BindException errors)
     throws Exception {
   try {
     System.out.println("\n\n\n\n\nInside the submit method     \n");
     AddRFIForm addRfiForm = (AddRFIForm) command;
     RFI rfi = new RFI();
     rfi.setRfiNumber(addRfiForm.getRfiNumber());
     rfi.setRfiCode(addRfiForm.getRfiCode());
     rfi.setFromChainage(addRfiForm.getFromChainage());
     rfi.setToChainage(addRfiForm.getToChainage());
     rfi.setSide(addRfiForm.getSide());
     rfi.setLayer(addRfiForm.getLayer());
     rfi.setActivity(addRfiForm.getActivity());
     rfi.setItemDescription(addRfiForm.getItemDescription());
     rfi.setWiRemarks(addRfiForm.getWiRemarks());
     rfi.setRemarks(addRfiForm.getRemarks());
     rfi.setBreakRfiString("");
     rfi.setStatus("In Process");
     rfi.setIssueDate(addRfiForm.getIssueDate());
     rfi.setInspectionDate(addRfiForm.getInspectionDate());
     List<ExpandedRFI> overlappedRfiList = null;
     if (!(request.getParameter("force") != null
         && "true".equals(request.getParameter("force")))) {
       overlappedRfiList = rfiService.isOverlap(rfi);
     }
     PrintWriter out = response.getWriter();
     if (overlappedRfiList != null) {
       String message = "";
       Iterator<ExpandedRFI> rfiIt = overlappedRfiList.iterator();
       while (rfiIt.hasNext()) {
         ExpandedRFI overlappedRfi = rfiIt.next();
         if (overlappedRfi.getStatus().equals("Approved")) {
           message +=
               "Overlap: "
                   + overlappedRfi.getIssueDateAsText()
                   + " Approved RFI Number = "
                   + overlappedRfi.getRfiNumber()
                   + ", Appr From = "
                   + overlappedRfi.getApprovedFrom()
                   + ", Appr To = "
                   + overlappedRfi.getApprovedTo()
                   + "\n";
         } else {
           message +=
               "Overlap: "
                   + overlappedRfi.getIssueDateAsText()
                   + " In Process RFI Number = "
                   + overlappedRfi.getRfiNumber()
                   + ", From = "
                   + overlappedRfi.getFromChainage()
                   + ", To = "
                   + overlappedRfi.getToChainage()
                   + "\n";
         }
       }
       response.setContentType("text/xml");
       System.out.println(
           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<rfi><status>error</status><message>"
               + message
               + "</message></rfi>");
       out.println(
           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<rfi><status>error</status><message>"
               + message
               + "</message></rfi>");
       out.close();
     } else {
       rfi = rfiService.add(rfi);
       int generatedRfiNumber = Integer.parseInt(rfi.getRfiNumber());
       int nextRfiNumber = generatedRfiNumber + 1;
       System.out.println("Next rfi number is " + nextRfiNumber);
       response.setContentType("text/xml");
       System.out.println(
           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<nextRfiNumber>"
               + nextRfiNumber
               + "</nextRfiNumber><status>true</status>");
       out.println(
           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<rfi><generatedRfiNumber>"
               + generatedRfiNumber
               + "</generatedRfiNumber><nextRfiNumber>"
               + nextRfiNumber
               + "</nextRfiNumber><status>true</status></rfi>");
       out.close();
     }
     return null;
     // return new ModelAndView("rfiSuccess","rfi",rfi);
     // return new ModelAndView("redirect:addRFI.htm");
   } catch (Exception e) {
     System.out.println("skdjaldj     \n");
     e.printStackTrace();
     throw e;
   }
 }
コード例 #4
0
  @Override
  protected ModelAndView onSubmit(
      HttpServletRequest request,
      HttpServletResponse response,
      Object command,
      BindException errors)
      throws Exception {
    try {

      String deleteException = request.getParameter("deleteException");
      if (deleteException != null && !StringUtils.isEmptyOrWhitespaceOnly(deleteException)) {
        String[] exceptionId = request.getParameterValues("exceptionId");
        if (exceptionId != null && exceptionId.length > 0) {
          for (int i = 0; i < exceptionId.length; ++i) {
            rfiService.deleteLayerExceptions(Long.valueOf(exceptionId[i]));
          }
        }

        return null;
      }

      LayerException layerException = (LayerException) command;
      String actionType = request.getParameter("actionType");
      if ("add".equals(actionType)) {
        List<LayerException> layerExceptionList =
            rfiService.getLayerExceptionsList(
                0,
                0,
                "",
                " where activity = '"
                    + layerException.getActivity()
                    + "' AND item_description = '"
                    + layerException.getItemDescription()
                    + "' and side = '"
                    + layerException.getSide()
                    + "' ");
        if (layerExceptionList.contains(layerException)) {
          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>error</resultCode><resultText>Layer Exception cannot be added because it overlap with database entry!</resultText></result>");
          out.close();

          return null;
        } else {
          rfiService.addLayerException(layerException);

          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>success</resultCode><resultText>Layer Exception added successfully!</resultText></result>");
        }
      } else if ("edit".equals(actionType)) {
        List<LayerException> layerExceptionList =
            rfiService.getLayerExceptionsList(
                0,
                0,
                "",
                " where exception_id <> '"
                    + layerException.getExceptionId()
                    + "' and item_description = '"
                    + layerException.getItemDescription()
                    + "' and side = '"
                    + layerException.getSide()
                    + "' ");
        if (layerExceptionList.contains(layerException)) {
          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>error</resultCode><resultText>Layer Exception cannot be added because it overlap with database entry!</resultText></result>");
          out.close();

          return null;
        } else {
          rfiService.editLayerExceptions(layerException);

          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>success</resultCode><resultText>Layer Exception edited successfully!</resultText></result>");
          out.close();
        }
      }

      return null;
      // return new ModelAndView("rfiSuccess","rfi",rfi);
      // return new ModelAndView("redirect:addRFI.htm");
    } catch (Exception e) {
      System.out.println("skdjaldj     \n");
      e.printStackTrace();
      throw e;
    }
  }
コード例 #5
0
  @Override
  protected ModelAndView onSubmit(
      HttpServletRequest request,
      HttpServletResponse response,
      Object command,
      BindException errors)
      throws Exception {
    try {

      System.out.println("\n\n\n\n\nInside the submit method     \n");
      Quantity quantity = (Quantity) command;
      String actionType = request.getParameter("actionType");
      if ("add".equals(actionType)) {
        List<Quantity> quantityList =
            rfiService.getQuantityList(
                0,
                0,
                "",
                " where activity = '"
                    + quantity.getActivity()
                    + "' AND item_description = '"
                    + quantity.getItemDescription()
                    + "' and side = '"
                    + quantity.getSide()
                    + "' and layer = '"
                    + quantity.getLayer()
                    + "' ");
        if (quantityList.contains(quantity)) {
          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>error</resultCode><resultText>Area cannot be added because it overlap with database entry!</resultText></result>");
          out.close();

          return null;
        } else {
          rfiService.addQuantity(quantity);

          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>success</resultCode><resultText>Area added successfully!</resultText></result>");
        }
      } else if ("edit".equals(actionType)) {
        List<Quantity> quantityList =
            rfiService.getQuantityList(
                0,
                0,
                "",
                " where quantity_id <> '"
                    + quantity.getQuantityId()
                    + "' and item_description = '"
                    + quantity.getItemDescription()
                    + "' and side = '"
                    + quantity.getSide()
                    + "' and layer = '"
                    + quantity.getLayer()
                    + "' ");
        if (quantityList.contains(quantity)) {
          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>error</resultCode><resultText>Area cannot be added because it overlap with database entry!</resultText></result>");
          out.close();

          return null;
        } else {
          rfiService.editQuantity(quantity);

          response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          out.println(
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result><resultCode>success</resultCode><resultText>Area edited successfully!</resultText></result>");
          out.close();
        }
      }

      return null;
    } catch (Exception e) {
      System.out.println("skdjaldj     \n");
      e.printStackTrace();
      throw e;
    }
  }