Пример #1
0
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(true);

    String currentclassuuid = StringUtils.trimToEmpty(request.getParameter("currentclassroomuuid"));
    String currentclssteacher = StringUtils.trimToEmpty(request.getParameter("teacheruuid"));

    if (StringUtils.isBlank(currentclassuuid)) {
      session.setAttribute(SessionConstants.PROMOTE_CALSS_ERROR, CLASS_DELETE_ERROR);

    } else if (StringUtils.isBlank(currentclssteacher)) {
      session.setAttribute(SessionConstants.PROMOTE_CALSS_ERROR, CLASS_DELETE_ERROR);

    } else {
      ClassTeacher classTeacher = new ClassTeacher();
      classTeacher.setClassRoomUuid(currentclassuuid);
      classTeacher.setTeacherUuid(currentclssteacher);

      if (classTeacherDAO.deleteClassTeacher(classTeacher)) {
        session.setAttribute(SessionConstants.PROMOTE_CALSS_SUCCESS, CLASS_DELETED_SUCCESS);
      } else {
        session.setAttribute(SessionConstants.PROMOTE_CALSS_ERROR, CLASS_DELETE_ERROR);
      }
    }
    response.sendRedirect("classTeachers.jsp");
    return;
  }
Пример #2
0
 @PostLoad
 private void onPostLoad() {
   estado = StringUtils.trimToEmpty(estado);
   observaciones = StringUtils.trimToEmpty(observaciones);
   facturaInicial = StringUtils.trimToEmpty(facturaInicial);
   facturaFinal = StringUtils.trimToEmpty(facturaFinal);
 }
 @Override
 public String chkString() {
   StringBuilder sb =
       new StringBuilder(baseChkString())
           .append(StringUtils.trimToEmpty(getRetUrl()))
           .append(StringUtils.trimToEmpty(getMerPriv()));
   return sb.toString();
 }
Пример #4
0
  private Map<String, String> getTransferParam(
      String ordId,
      String outCustId,
      String outAcctId,
      String transAmt,
      String inCustId,
      String inAcctId,
      String merPriv) {
    String version = signUtils.getVersion1();
    String cmdId = "Transfer";
    String bgRetUrl = signUtils.getBgRetUrl() + "/handler/callbackBgRetUrl";

    Map<String, String> params = new HashMap<String, String>();
    params.put("Version", version);
    params.put("CmdId", cmdId);
    params.put("OrdId", ordId);
    params.put("OutCustId", outCustId);
    params.put("OutAcctId", outAcctId);

    params.put("TransAmt", transAmt);
    params.put("InCustId", inCustId);

    params.put("BgRetUrl", bgRetUrl);
    params.put("MerPriv", merPriv);
    //    	Version +CmdId + OrdId + OutCustId +
    //    	OutAcctId + TransAmt+ InCustId+ InAcctId+
    //    	RetUrl + BgRetUrl+ MerPriv

    // 组装加签字符串原文
    // 注意加签字符串的组装顺序参 请照接口文档
    StringBuffer buffer = new StringBuffer();
    buffer
        .append(StringUtils.trimToEmpty(version))
        .append(StringUtils.trimToEmpty(cmdId))
        .append(StringUtils.trimToEmpty(ordId))
        .append(StringUtils.trimToEmpty(outCustId))
        .append(StringUtils.trimToEmpty(outAcctId))
        .append(StringUtils.trimToEmpty(transAmt))
        .append(StringUtils.trimToEmpty(inCustId));
    if (StringUtils.isNotBlank(inAcctId)) {
      params.put("InAcctId", inAcctId);
      buffer.append(StringUtils.trimToEmpty(inAcctId));
    }
    buffer.append(StringUtils.trimToEmpty(bgRetUrl)).append(StringUtils.trimToEmpty(merPriv));
    String plainStr = buffer.toString();
    System.out.println(plainStr);

    try {
      params.put("ChkValue", signUtils.encryptByRSA(plainStr));
    } catch (Exception e) {
      // TODO Auto-generated catch block
      logger.error("getTransferParam->encryptByRSA error", e);
    }
    signUtils.addRequestChinapnrLogEventPublish(cmdId, "OrdId_" + ordId);
    return params;
  }
Пример #5
0
        @Override
        public void handleMessage(final Message msg) {
          try {
            if (waypoint == null) {
              Log.d("No waypoint loaded to edit. id= " + waypointId);
              waypointId = -1;
            } else {
              geocode = waypoint.getGeocode();
              prefix = waypoint.getPrefix();
              lookup = waypoint.getLookup();
              own = waypoint.isUserDefined();

              if (initViews) {
                visitedCheckBox.setChecked(waypoint.isVisited());
                if (waypoint.getCoords() != null) {
                  buttonLat.setText(
                      waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE));
                  buttonLon.setText(
                      waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
                }
                waypointName.setText(
                    Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString());
                Dialogs.moveCursorToEnd(waypointName);
                if (TextUtils.containsHtml(waypoint.getNote())) {
                  note.setText(
                      Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString());
                } else {
                  note.setText(StringUtils.trimToEmpty(waypoint.getNote()));
                }
                Dialogs.moveCursorToEnd(note);
              }
              new AsyncTask<Void, Void, Geocache>() {
                @Override
                protected Geocache doInBackground(final Void... params) {
                  return DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY);
                }

                @Override
                protected void onPostExecute(final Geocache cache) {
                  setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache);
                }
              }.execute();
            }

            if (own) {
              initializeWaypointTypeSelector();
            }
          } catch (final RuntimeException e) {
            Log.e("EditWaypointActivity.loadWaypointHandler", e);
          } finally {
            if (waitDialog != null) {
              waitDialog.dismiss();
              waitDialog = null;
            }
          }
        }
 public String getDescriptionName() {
   return (new StringBuilder())
       .append(StringUtils.trimToEmpty(this.moduleName))
       .append(":")
       .append(StringUtils.trimToEmpty(this.name))
       .append("(")
       .append(this.index)
       .append(")")
       .toString();
 }
Пример #7
0
  /**
   * { "InDetails": [ //还款账户串 { "DivDetails": [ //Fee 分账账户串 { "DivAcctId": "MDT000001", //分账账户号
   * "DivAmt": "1.00", // 分账金额 "DivCustId": "xxx" //分账商户号 } ], "Fee": "1.00", // 扣款手续费 此字段为空时
   * FeeObjFlag,DivDetails 可不填 "FeeObjFlag": "I", // 手续费收取对象标志 I/O , I--向入款客户号 InCustId 收取O--向出款客户号
   * OutCustId 收取 "InAcctId": "xxx", //入账子账号 "InCustId": "xxx", //入账客户号 "OrdId":
   * "201412102144",//还款订单号 "SubOrdId": "xxx", //原投标订单号 "TransAmt": "5.00" // 交易金额 }, {
   * "DivDetails": [ { "DivAcctId": "MDT000001", "DivAmt": "1.00", "DivCustId": "xxx" } ], "Fee":
   * "1.00", "FeeObjFlag": "O", "InAcctId": "xxx", "InCustId": "xxx", "OrdId": "xxx", "SubOrdId":
   * "xxx", "TransAmt": "5.00" } ] }
   */
  private Map<String, String> getBatchRepaymentParams(
      String outCustId,
      String outAcctId,
      String batchId,
      String merOrdDate,
      String inDetails,
      String proId)
      throws Exception {
    String version = signUtils.getVersion2();
    String cmdId = "BatchRepayment";
    String merCustId = signUtils.getMerCustId();
    String bgRetUrl = signUtils.getBgRetUrl() + "/handler/callbackBgRetUrl";

    // 若为中文,请用Base64转码

    Map<String, String> params = new HashMap<String, String>();
    params.put("Version", version);
    params.put("CmdId", cmdId);
    params.put("MerCustId", merCustId);
    params.put("OutCustId", outCustId);
    params.put("OutAcctId", outAcctId);
    params.put("BatchId", batchId);

    params.put("MerOrdDate", merOrdDate);
    params.put("InDetails", inDetails);
    params.put("ProId", proId);
    params.put("BgRetUrl", bgRetUrl);

    //    	Version
    //    	+CmdId + MerCustId + OutCustId +
    //    	OutAcctId+ BatchId+ MerOrdDate + InDetails
    //    	+ BgRetUrl+ MerPriv + ReqExt+ ProId

    // 组装加签字符串原文
    // 注意加签字符串的组装顺序参 请照接口文档
    StringBuffer buffer = new StringBuffer();
    buffer
        .append(StringUtils.trimToEmpty(version))
        .append(StringUtils.trimToEmpty(cmdId))
        .append(StringUtils.trimToEmpty(merCustId))
        .append(StringUtils.trimToEmpty(outCustId))
        .append(StringUtils.trimToEmpty(outAcctId))
        .append(StringUtils.trimToEmpty(batchId))
        .append(StringUtils.trimToEmpty(merOrdDate))
        .append(StringUtils.trimToEmpty(inDetails))
        .append(StringUtils.trimToEmpty(proId))
        .append(StringUtils.trimToEmpty(bgRetUrl));
    String plainStr = buffer.toString();
    System.out.println(plainStr);

    params.put("ChkValue", signUtils.encryptByRSA(plainStr));
    signUtils.addRequestChinapnrLogEventPublish(cmdId, "BatchId_" + batchId + " ProId_" + proId);
    return params;
  }
  @Override
  public void setValue(Term value) {
    this.value = value;

    // initialize form fields
    view.setFieldValue(CODE_MEANING, StringUtils.trimToEmpty(value.getCodeMeaning()));
    view.setFieldValue(CODE_VALUE, StringUtils.trimToEmpty(value.getCodeValue()));
    view.setFieldValue(DESCRIPTION, StringUtils.trimToEmpty(value.getDescription()));
    view.setFieldValue(CREATION_DATE, value.getCreationDate());
    view.setFieldValue(MODIFICATION_DATE, value.getModificationDate());

    view.setReadOnly(value.getLexicon().isReadOnly());
  }
 private void writeLine(String referrer, String url, String status, String cause, boolean append) {
   try (FileWriter out = new FileWriter(outputFile, append)) {
     out.write(StringUtils.trimToEmpty(referrer));
     out.write('\t');
     out.write(StringUtils.trimToEmpty(url));
     out.write('\t');
     out.write(StringUtils.trimToEmpty(status));
     out.write('\t');
     out.write(StringUtils.trimToEmpty(cause));
     out.write('\n');
   } catch (IOException e) {
     throw new CollectorException("Cannot write link report to file: " + outputFile, e);
   }
 }
Пример #10
0
  /**
   * Create by : 2015年9月14日 上午11:04:22
   *
   * @throws UnsupportedEncodingException
   */
  private void setParam(HttpPost httpPost, Map<String, String> paramMap)
      throws UnsupportedEncodingException {
    if ((null != paramMap) && !paramMap.isEmpty()) {
      List<NameValuePair> params = new LinkedList<NameValuePair>();

      for (Map.Entry<String, String> entry : paramMap.entrySet())
        params.add(
            new BasicNameValuePair(
                StringUtils.trimToEmpty(entry.getKey()),
                StringUtils.trimToEmpty(entry.getValue())));

      if ((null != params) && !params.isEmpty())
        httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
    }
  }
Пример #11
0
  public String getResourcePrefix() {
    if (resourcePrefix == null) {
      this.resourcePrefix = StringUtils.trimToEmpty(configuration.getString("web.resource-prefix"));
    }

    return resourcePrefix;
  }
 @Override
 public Negotiator<?> findNegotiator(
     HttpServletRequest req, NegotiatingView view, ViewNegotiatorRegistry viewNegotiatorRegistry) {
   String requestUri = req.getRequestURI();
   String extension = StringUtils.trimToEmpty(StringUtils.substringAfterLast(requestUri, "."));
   String mimeType = MimeTypes.lookupMimeType(extension);
   return viewNegotiatorRegistry.getNegotiator(mimeType);
 }
        @Override
        public void handleMessage(Message msg) {
          try {
            if (waypoint == null) {
              if (waitDialog != null) {
                waitDialog.dismiss();
                waitDialog = null;
              }

              id = -1;
            } else {
              geocode = waypoint.getGeocode();
              type = waypoint.getWaypointType();
              prefix = waypoint.getPrefix();
              lookup = waypoint.getLookup();

              app.setAction(geocode);

              if (waypoint.getCoords() != null) {
                ((Button) findViewById(R.id.buttonLatitude))
                    .setText(waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE));
                ((Button) findViewById(R.id.buttonLongitude))
                    .setText(waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
              }
              ((EditText) findViewById(R.id.name))
                  .setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString());
              ((EditText) findViewById(R.id.note))
                  .setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString());

              if (waitDialog != null) {
                waitDialog.dismiss();
                waitDialog = null;
              }
            }
          } catch (Exception e) {
            if (waitDialog != null) {
              waitDialog.dismiss();
              waitDialog = null;
            }
            Log.e(Settings.tag, "cgeowaypointadd.loadWaypointHandler: " + e.toString());
          }
        }
Пример #14
0
  /**
   * Gets the string content of a node via xpath
   *
   * @param nodeObj
   * @param xpath
   * @return
   */
  private static String getNodeContent(final Object nodeObj, final String xpath) {
    Node node = XPath.selectNode(xpath, nodeObj);
    if (node == null) {
      if (Logger.isDebugEnabled() == true) {
        Logger.debug("Could not find node by xpath: " + xpath + " in node: " + nodeObj.toString());
      }
      return StringUtils.EMPTY;
    }

    return StringUtils.trimToEmpty(node.getTextContent());
  }
Пример #15
0
 public String removeSymbolList(String cinemaName) {
   cinemaName = StringUtils.trimToEmpty(cinemaName);
   cinemaName = StringUtils.remove(cinemaName, " ");
   cinemaName = StringUtils.remove(cinemaName, "--");
   cinemaName = StringUtils.remove(cinemaName, "-");
   cinemaName = replaceSymbol(cinemaName, "\\(.*\\)", Lists.newArrayList("(", ")"));
   cinemaName = replaceSymbol(cinemaName, "(.*)", Lists.newArrayList("(", ")"));
   cinemaName = replaceSymbol(cinemaName, "\\(.*)", Lists.newArrayList("(", ")"));
   cinemaName = replaceSymbol(cinemaName, "(.*\\)", Lists.newArrayList("(", ")"));
   return cinemaName;
 }
  /**
   * 处理请求zk的路径
   *
   * @param path 路径
   * @return String
   */
  private String processZkPath(String path) {
    if (StringUtils.endsWith(path, "/")) {
      path = StringUtils.substring(path, 0, StringUtils.lastIndexOf(path, "/"));
    }
    path = StringUtils.trimToEmpty(path);
    if (StringUtils.isEmpty(path)) {
      path = "/";
    }

    return path;
  }
 @RequestMapping("/connect")
 public String connect(
     HttpServletRequest request,
     RedirectAttributes attrs,
     @RequestParam(required = true) String zkServer) {
   if (StringUtils.isBlank(zkServer)) {
     return "redirect:/";
   }
   zkServer = StringUtils.trimToEmpty(zkServer);
   request.getSession().setAttribute(Keys.KEY_ZKSERVER, zkServer);
   attrs.addFlashAttribute(Keys.KEY_ZKSERVER, zkServer);
   return "redirect:/zkRead/ls";
 }
Пример #18
0
 /**
  * @param key
  * @return
  * @throws ServerSideException
  */
 @SuppressWarnings("unchecked")
 private JSONArray doLineChartArchive(String key, String chartY) throws ServerSideException {
   JSONArray jsonArray = new JSONArray();
   BtaArchiveCtrl archiveMgr = new BtaArchiveCtrl();
   org.json.simple.parser.JSONParser jsonParser = new org.json.simple.parser.JSONParser();
   try {
     if (0 < StringUtils.trimToEmpty(key).length()) {
       jsonArray.add(jsonParser.parse(archiveMgr.getBtaArchiveByDeal(key).getJsonString(chartY)));
     }
   } catch (ParseException exception) {
     LOG.error(exception);
   }
   return jsonArray;
 }
 @Override
 public ActionForward display(
     ActionMapping pActionMapping,
     ActionForm pActionForm,
     HttpServletRequest pHttpServletRequest,
     HttpServletResponse pHttpServletResponse) {
   User lLoggedInUser = AhpActionHelper.getLoggedInUser(pHttpServletRequest);
   CreateQuestionForm lCreateQuestionForm = (CreateQuestionForm) pActionForm;
   String lNextPage = StringUtils.trimToEmpty(lCreateQuestionForm.getNextPage());
   ActionForward lActionForward =
       pActionMapping.findForward(NavigateActions.DisplayCreateQuestion.toString());
   if (NavigateActions.DisplayCreateQuestion.toString().equals(lNextPage)
       || NavigateActions.DisplayCreateQuestionStart.toString().equals(lNextPage)
       || NavigateActions.DisplayCreateQuestionNext.toString().equals(lNextPage)) {
     if (NavigateActions.DisplayCreateQuestionStart.toString().equals(lNextPage)) {
       this.setDefaultValues(lCreateQuestionForm);
       pHttpServletRequest.getSession().removeAttribute(QUIZ_UNDER_CREATION);
     }
     if (NavigateActions.DisplayCreateQuestionNext.toString().equals(lNextPage)) {
       this.setDefaultValues(lCreateQuestionForm);
     }
     if (lCreateQuestionForm.isSubmitAction(SubmitActions.ADD_OPTION)) {
       Option lOption = new Option();
       lOption.setOptionDescription("");
       lCreateQuestionForm.getOptions().add(lOption);
     }
     if (lCreateQuestionForm.isSubmitAction(SubmitActions.DELETE_OPTION)) {
       int lDeleteIndex = Integer.parseInt(lCreateQuestionForm.getHiddenDeleteOptionIndex());
       if (lCreateQuestionForm.getOptions().size() > lDeleteIndex)
         lCreateQuestionForm.getOptions().remove(lDeleteIndex);
       while (lCreateQuestionForm.getOptions().size() < 3) {
         Option lOption = new Option();
         lOption.setOptionDescription("");
         lCreateQuestionForm.getOptions().add(lOption);
       }
     }
     if (lCreateQuestionForm.isSubmitAction(SubmitActions.RESET)) {
       this.setDefaultValues(lCreateQuestionForm);
     }
   }
   if (NavigateActions.DisplayCreateQuizConfirmation.toString().equals(lNextPage)) {
     lActionForward =
         pActionMapping.findForward(NavigateActions.DisplayCreateQuestionConfirmation.toString());
   }
   if (NavigateActions.DisplayCreateQuizCancelled.toString().equals(lNextPage)) {
     lActionForward = pActionMapping.findForward(NavigateActions.DisplayQuizConsole.toString());
   }
   return lActionForward;
 }
Пример #20
0
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(true);
    String teacherUuid = StringUtils.trimToEmpty(request.getParameter("staffid"));
    String classId = StringUtils.trimToEmpty(request.getParameter("classId"));

    if (StringUtils.isBlank(teacherUuid)
        || teacherUuid == null
        || StringUtils.equals(teacherUuid, "null")) {
      session.setAttribute(SessionConstants.STAFF_FIND_ERROR, ERROR_EMPTY_STAFF);

    } else if (StringUtils.isBlank(classId)) {
      session.setAttribute(SessionConstants.STAFF_FIND_ERROR, ERROR_EMPTY_CLASS);

    } else if (classTeacherDAO.getClassTeacherByteacherId(teacherUuid) != null) {
      session.setAttribute(SessionConstants.STAFF_FIND_ERROR, ERROR_TECAHER_HAS_CLASS);

    } else if (classTeacherDAO.getClassTeacherByclassId(classId) != null) {
      session.setAttribute(SessionConstants.STAFF_FIND_ERROR, ERROR_CLASS_HAS_TEACHER);

    } else {

      ClassTeacher Teacher = new ClassTeacher();
      Teacher.setClassRoomUuid(classId);
      Teacher.setTeacherUuid(teacherUuid);
      if (classTeacherDAO.putClassTeacher(Teacher)) {
        session.setAttribute(SessionConstants.STAFF_FIND_SUCCESS, SUCCESS_ADD_OK);
      } else {
        session.setAttribute(SessionConstants.STAFF_FIND_ERROR, ERROR_ADD_FAILED);
      }
    }

    response.sendRedirect("addclassTecaher.jsp");
    return;
  }
 /*
  * (non-Javadoc)
  * @see
  * org.springframework.core.convert.converter.Converter#convert(java.lang.
  * Object)
  */
 @Override
 public WarehouseInventory convert(LoadInventoryFlatFileContainer source) {
   WarehouseInventory inventory = new WarehouseInventory();
   inventory.setActive(true);
   inventory.setQuantity(Long.valueOf(source.getWareHouseQuantity()));
   IceCream iceCream = new IceCream();
   iceCream.setActive(true);
   iceCream.setIceCreamName(source.getItemNumber());
   if (StringUtils.trimToEmpty(source.getDescription()).isEmpty()) {
     iceCream.setDescription(source.getDescription());
   }
   inventory.setSalesPrice(NumberHelper.convertPenniesStringToDecimal(source.getPrice()));
   inventory.setIceCream(iceCream);
   return inventory;
 }
  /**
   * Validate event creation.
   *
   * @param event the event
   * @throws ValidationException the validation exception
   */
  public static void validateEventCreation(final Event event) throws ValidationException {

    if (event == null) {
      return;
    }

    final ValidationException validationException = new ValidationException();

    if (StringUtils.isEmpty(StringUtils.trimToEmpty(event.getName()))) {
      validationException.addMessage("Event must have a name.");
    }

    if (event.getEventType() == null) {
      validationException.addMessage("EventType can not be empty.");
    }

    if (event.getStartTime() == null) {
      validationException.addMessage("Start date must be supplied.");
    }

    if (event.getEndTime() == null) {
      validationException.addMessage("End date must be supplied.");
    }

    if (event.getStartTime() != null
        && event.getEndTime() != null
        && (!event.getStartTime().isBefore(event.getEndTime()))) {
      validationException.addMessage("Start date must be before end date.");
    }

    if (event.getVoteCategories() == null || event.getVoteCategories().isEmpty()) {
      validationException.addMessage("At least one voting category must be supplied.");
    } else {

      for (final VoteCategory category : event.getVoteCategories()) {
        try {
          validateVoteCategory(category);
        } catch (final ValidationException e) {
          validationException.addAllMessages(e.getErrorMessages());
        }
      }
    }

    if (validationException.hasErrorMessages()) {
      throw validationException;
    }
  }
  /**
   * Validate vote category.
   *
   * @param category the category
   * @throws ValidationException the validation exception
   */
  public static void validateVoteCategory(final VoteCategory category) throws ValidationException {

    final ValidationException validationException = new ValidationException();

    if (category == null) {
      return;
    }

    if (StringUtils.isEmpty(StringUtils.trimToEmpty(category.getCategoryName()))) {
      validationException.addMessage("Vote Category must have a name.");
    }

    if (category.getVoteOptions() == null || category.getVoteOptions().size() < 2) {
      validationException.addMessage("Vote Category must have at least two options.");
    }

    if (validationException.hasErrorMessages()) {
      throw validationException;
    }
  }
Пример #24
0
  /**
   * 将IP地址转换为整数类型
   *
   * @param addr 字符串类型的IP地址
   * @return 整数
   */
  public static int ipToInt(final String ipStr) {
    int ip = 0;
    if (!IPAddressUtil.isIPv4LiteralAddress(ipStr)) {
      String[] string = ipStr.split(",");
      int iLen = string.length;
      String ipStr_ = null;
      if (iLen > 0) ipStr_ = StringUtils.trimToEmpty(string[iLen - 1]);
      if (!IPAddressUtil.isIPv4LiteralAddress(ipStr)) {
        return ip;
      }
    }

    if (StringUtils.isNotBlank(ipStr)) {
      final String[] addressBytes = ipStr.split("\\.");
      ip = 0;
      for (int i = 0; i < 4; i++) {
        ip <<= 8;
        ip |= Integer.parseInt(addressBytes[i]);
      }
    }
    return ip;
  }
Пример #25
0
 @Override
 public ActionForward process(
     ActionMapping pActionMapping,
     ActionForm pActionForm,
     HttpServletRequest pHttpServletRequest,
     HttpServletResponse pHttpServletResponse) {
   User lLoggedInUser = AhpActionHelper.getLoggedInUser(pHttpServletRequest);
   ManageQuizForm lDeleteQuizForm = (ManageQuizForm) pActionForm;
   String lSubmitAction = StringUtils.trimToEmpty(lDeleteQuizForm.getSubmitAction());
   if (lDeleteQuizForm.isSubmitAction(SubmitActions.RETURN_TO_MANAGE_QUIZ)) {
     lDeleteQuizForm.getPaginationData().setOperation(PaginationOperations.ComboSubmit.toString());
     lDeleteQuizForm
         .getPaginationData()
         .setHiddenSelectedComboValue(lDeleteQuizForm.getPaginationData().getSelectedPage());
     lDeleteQuizForm.setNextPage(NavigateActions.DisplayManageQuiz.toString());
   } else if (lDeleteQuizForm.isSubmitAction(SubmitActions.CONFIRM_DELETE)) {
     this.deleteQuiz(lDeleteQuizForm, lLoggedInUser);
     lDeleteQuizForm.setNextPage(NavigateActions.DisplayManageQuiz.toString());
   } else {
     lDeleteQuizForm.setNextPage(NavigateActions.DisplayDeleteQuiz.toString());
   }
   return pActionMapping.findForward(NavigateActions.DisplayDeleteQuiz.toString());
 }
Пример #26
0
 @PostLoad
 private void trim() {
   nombre = StringUtils.trimToEmpty(nombre);
   direccion = StringUtils.trimToEmpty(direccion);
   colonia = StringUtils.trimToEmpty(colonia);
   idLocalidad = StringUtils.trimToEmpty(idLocalidad);
   idEstado = StringUtils.trimToEmpty(idEstado);
   cp = StringUtils.trimToEmpty(cp);
   telefonos = StringUtils.trimToEmpty(telefonos);
   idGerente = StringUtils.trimToEmpty(idGerente);
   idSync = StringUtils.trimToEmpty(idSync);
   idModificado = StringUtils.trimToEmpty(idModificado);
   centroCostos = StringUtils.trimToEmpty(centroCostos);
   marca = StringUtils.trimToEmpty(marca);
   ciudad = StringUtils.trimToEmpty(ciudad);
 }
Пример #27
0
 public String getName() {
   return StringUtils.trimToNull(
       StringUtils.trimToEmpty(firstname) + " " + StringUtils.trimToEmpty(lastname));
 }
Пример #28
0
 /** Create by : 2015年9月14日 上午11:03:15 */
 private void setHeader(HttpPost httpPost, Map<String, String> headerMap) {
   if ((null != headerMap) && (headerMap.size() > 0))
     for (Map.Entry<String, String> entry : headerMap.entrySet())
       httpPost.setHeader(
           StringUtils.trimToEmpty(entry.getKey()), StringUtils.trimToEmpty(entry.getValue()));
 }
Пример #29
0
 @PostLoad
 private void onPostLoad() {
   idFactura = StringUtils.trimToEmpty(idFactura);
   idBanco = StringUtils.trimToEmpty(idBanco);
   idFormaPago = StringUtils.trimToEmpty(idFormaPago);
   referenciaPago = StringUtils.trimToEmpty(referenciaPago);
   idEmpleado = StringUtils.trimToEmpty(idEmpleado);
   idMod = StringUtils.trimToEmpty(idMod);
   idRecibo = StringUtils.trimToEmpty(idRecibo);
   parcialidad = StringUtils.trimToEmpty(parcialidad);
   idFPago = StringUtils.trimToEmpty(idFPago);
   clave = StringUtils.trimToEmpty(clave);
   referenciaClave = StringUtils.trimToEmpty(referenciaClave);
   idBancoEmisor = StringUtils.trimToEmpty(idBancoEmisor);
   idTerminal = StringUtils.trimToEmpty(idTerminal);
   idPlan = StringUtils.trimToEmpty(idPlan);
 }
Пример #30
0
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(true);

    String bookisbn = StringUtils.trimToEmpty(request.getParameter("bookisbn"));
    String bookuuid = StringUtils.trimToEmpty(request.getParameter("bookuuid"));
    String studentAdmNo = StringUtils.trimToEmpty(request.getParameter("admissionNo"));
    String schooluuid = StringUtils.trimToEmpty(request.getParameter("schooluuid"));
    // System.out.println("bookuuid="+bookuuid);

    if (StringUtils.isBlank(bookisbn)) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_BOOK_NOT_FOUND);
    }
    if (StringUtils.isBlank(bookuuid)) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_SOMETHING_WENT_WRONG);

    } else if (StringUtils.isBlank(studentAdmNo)) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_STUDENT_ADMNO_NOT_FOUND);

    } else if (StringUtils.isBlank(schooluuid)) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_SOMETHING_WENT_WRONG);

    } else if (bookDAO.getBookByBorrowStatus(bookisbn, BORROW_STATUS_BORROWED) != null) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, BOOK_NOT_AVALILABLE);

    } else if (bookDAO.getBookByBookStatus(bookisbn, BOOK_STATUS_REFERENCE) != null) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, BOOK__REFERENCE);

    } else if (studentBookDAO.getStudentBook(bookuuid, BORROW_STATUS_BORROWED) != null) {
      session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, BOOK_NOT_AVALILABLE);

    } else {
      Book book;
      Student student;
      StudentBook studentBook;
      student = studentDAO.getStudentObjByadmNo(schooluuid, studentAdmNo);
      if (student != null) {
        if (StringUtils.equals(student.getStatusUuid(), statusUuid)) {
          studentBook = new StudentBook();
          studentBook.setStudentUuid(student.getUuid());
          studentBook.setBookUuid(bookuuid);
          studentBook.setBorrowStatus(BORROW_STATUS_BORROWED);

          book = bookDAO.getBookByUUID(schooluuid, bookuuid);
          book.setBorrowStatus(BORROW_STATUS_BORROWED);
          bookDAO.updateBook(book);

          if (studentBookDAO.BorrowBook(studentBook)) {
            session.setAttribute(SessionConstants.BOOK_BORROW_SUCCESS, SUCCESS_BOOK_BORROWED);
          } else {
            session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_SOMETHING_WENT_WRONG);
          }
        } else {
          session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_STUDENT_INACTIVE);
        }
      } else {
        session.setAttribute(SessionConstants.BOOK_BORROW_ERROR, ERROR_STUDENT_ADMNO_NOT_FOUND);
      }
    }

    response.sendRedirect("lib.jsp");
    return;
  }