/**
   * Hook for quantity and setting asset numbers.
   *
   * @see
   *     org.kuali.rice.kns.maintenance.KualiMaintainableImpl#addNewLineToCollection(java.lang.String)
   */
  @Override
  public void addNewLineToCollection(String collectionName) {

    // create handle for the addline section of the doc
    IndirectCostRecoveryRateDetail addLine =
        (IndirectCostRecoveryRateDetail) newCollectionLines.get(collectionName);
    List<IndirectCostRecoveryRateDetail> maintCollection =
        (List<IndirectCostRecoveryRateDetail>)
            ObjectUtils.getPropertyValue(getBusinessObject(), collectionName);

    if (StringUtils.isBlank(addLine.getSubAccountNumber())
        || StringUtils.containsOnly(addLine.getSubAccountNumber(), "-")) {
      addLine.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
    }
    if (StringUtils.isBlank(addLine.getFinancialSubObjectCode())
        || StringUtils.containsOnly(addLine.getFinancialSubObjectCode(), "-")) {
      addLine.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    }

    Integer icrEntryNumberMax = 0;
    for (IndirectCostRecoveryRateDetail item : maintCollection) {
      if (icrEntryNumberMax < item.getAwardIndrCostRcvyEntryNbr()) {
        icrEntryNumberMax = item.getAwardIndrCostRcvyEntryNbr();
      }
    }

    // addLine.setActive(true); // TODO remove after active indicator fixes
    addLine.setNewCollectionRecord(true);
    addLine.setAwardIndrCostRcvyEntryNbr(icrEntryNumberMax + 1);
    maintCollection.add(addLine);
    initNewCollectionLine(collectionName);
  }
Ejemplo n.º 2
0
 /**
  * 分析帐户状态字符串,判断有无帐户,并在原Map中存储一个Key为“ACCOUNT_STATE”的值; 如果有,则为“has”,没有则为“hasNot”
  *
  * @param list 存储据的list列表
  * @param accKind 分析的种类标识:2. 存款业务账户明细 3.授信业务账户明细
  */
 @SuppressWarnings({"rawtypes", "unchecked"})
 public static void analyzeAccState(List list, int accKind) {
   if (list != null && !list.isEmpty()) {
     for (int i = 0; i < list.size(); i++) {
       Map row = (Map) list.get(i);
       String state = StringUtils.trimToEmpty((String) row.get("STATE"));
       String accountState = "has";
       // 判断是否全部都由0组成 ,或者 是否全部都由N组成,如果是,表示帐户状态是“无”
       if (StringUtils.containsOnly(state, "0") || StringUtils.containsOnly(state, "N")) {
         accountState = "hasNot";
       } else { // 如果不是,则表示帐户状态为“有”
         // Do nothing
       }
       row.put("ACCOUNT_STATE", accountState);
     }
   }
 }
  @Override
  public String getRequestURI() {
    final String originalRequestURI = super.getRequestURI();
    final String tempRequestURI = StringUtils.remove(originalRequestURI, super.getContextPath());

    if (StringUtils.isEmpty(tempRequestURI) || StringUtils.containsOnly(tempRequestURI, "/")) {
      return "/";
    }
    return originalRequestURI;
  }
 void call() {
   final boolean extracted = processPhoneNumber();
   if (extracted == true) {
     return;
   }
   if (StringUtils.containsOnly(form.getPhoneNumber(), "0123456789+-/() ") == false) {
     form.addError("address.phoneCall.number.invalid");
     return;
   }
   form.setPhoneNumber(extractPhonenumber(form.getPhoneNumber()));
   callNow();
 }
Ejemplo n.º 5
0
  @Test
  public void testEmailValidation() {
    assertTrue(ValidationUtil.isWellFormedEmail("*****@*****.**"));
    assertTrue(ValidationUtil.isWellFormedEmail("*****@*****.**"));
    assertTrue(ValidationUtil.isWellFormedEmail("[email protected]       "));
    assertTrue(ValidationUtil.isWellFormedEmail("       [email protected]       "));

    assertFalse(ValidationUtil.isWellFormedEmail("xx.jb_0m@atira"));
    assertFalse(ValidationUtil.isWellFormedEmail(null));
    assertFalse(ValidationUtil.isWellFormedEmail(""));
    assertFalse(ValidationUtil.isWellFormedEmail("xx"));
    assertFalse(ValidationUtil.isWellFormedEmail("[email protected]"));
    assertFalse(ValidationUtil.isWellFormedEmail("xx.jb_0m@atira."));
    assertTrue(StringUtils.containsOnly("abc", "abcdefghijklmnopqrstuvwxyz0123456789"));
  }
Ejemplo n.º 6
0
  public Set<Method> getAnnotatedMethods(Class customClass) {
    Set<Method> annotatedMethods = new HashSet<Method>();

    List<Method> methods = customClass.getMethods();
    for (Method method : methods) {
      List<String> comments = method.getComments();
      if (comments != null && comments.size() > 0) {
        for (String comment : comments) {
          String[] lines = comment.split("[\\r\\n]+");
          for (String line : lines) {
            String deleteWhitespace = StringUtils.deleteWhitespace(line);
            if (StringUtils.endsWith(deleteWhitespace, MODEL_ANNOTATION)) {
              String difference = StringUtils.removeEnd(deleteWhitespace, MODEL_ANNOTATION);
              if (StringUtils.containsOnly(difference, VALID_PREFIX_CHARACTERS)
                  || difference.isEmpty()) {
                annotatedMethods.add(method);
              }
            }
          }
        }
      }
    }
    return annotatedMethods;
  }