/**
   * 生成查询参数Map
   *
   * @return Map<String, Object>
   */
  private Map<String, Object> genParamMap(String condition) {
    Map<String, Object> params = new HashMap<String, Object>();

    if ("default".equals(flag)) {
      Calendar cal = Calendar.getInstance();
      cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
      String eDate = dateFormat.format(cal.getTime());
      cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 6);
      String sDate = dateFormat.format(cal.getTime());
      params.put("beginDate", sDate);
      params.put("endDate", eDate);

      // 设置日期过滤框默认值
      statParams.put("beginDate", sDate);
      statParams.put("endDate", eDate);
    }

    if (StringUtils.isNotBlank(statParams.get("processType"))) {
      params.put("processType", statParams.get("processType"));
    }

    if (StringUtils.isNotBlank(statParams.get("beginDate"))) {
      params.put("beginDate", statParams.get("beginDate"));
    }

    if (StringUtils.isNotBlank(statParams.get("endDate"))) {
      params.put("endDate", statParams.get("endDate"));
    }

    return params;
  }
Beispiel #2
0
  /** 获取一周回看分类节目列表 */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public void getBTVPrograms() {
    try {
      Assert.notNull(typeId, "分类id不能为空!");
      Map params = new HashMap();
      params.put("typeId", typeId);
      params.put("pageSize", String.valueOf(getPager().getMax()));
      params.put("curPage", String.valueOf(getPager().getPage()));

      String response = HttpUtils.sendPost(BTV_PROGRAMS_URL, params, "utf-8");
      JSONObject jo = JSON.parseObject(response);
      if (null != jo) {
        String ret = jo.getString("ret");
        if (StringUtils.equals("0", ret)) {
          String programList = jo.getString("result");
          List<Map> rows = null;
          if (StringUtils.isNotBlank(programList)) {
            rows = JSON.parseArray(programList, Map.class);
          }
          if (null == rows) {
            rows = new ArrayList<Map>();
          }
          resultMap.put("total", jo.get("totalCount"));
          resultMap.put("rows", rows);
          jsonMap();
        }
      }
    } catch (Exception e) {
      logger.error("调用接口getBTVPrograms失败", e);
      jsonRet("1", e.getMessage());
    }
  }
  private void updateSubject(Node rootNode, String transactionNumber) throws Exception {
    IdentificationTransaction identificationTransaction =
        rapbackDAO.getIdentificationTransaction(transactionNumber);

    Subject subject = identificationTransaction.getSubject();

    String fbiId =
        XmlUtils.xPathStringSearch(
            rootNode,
            "jxdm50:Subject/nc30:RoleOfPerson/jxdm50:PersonAugmentation/jxdm50:PersonFBIIdentification/nc30:IdentificationID");
    if (StringUtils.isNotBlank(fbiId)) {
      subject.setUcn(fbiId);
    }

    String civilSid =
        XmlUtils.xPathStringSearch(
            rootNode,
            "jxdm50:Subject/nc30:RoleOfPerson/jxdm50:PersonAugmentation/jxdm50:PersonStateFingerprintIdentification[ident-ext:FingerprintIdentificationIssuedForCivilPurposeIndicator='true']/nc30:IdentificationID");
    if (StringUtils.isNotBlank(civilSid)) {
      subject.setCivilSid(civilSid);
    }

    String criminalSid =
        XmlUtils.xPathStringSearch(
            rootNode,
            "jxdm50:Subject/nc30:RoleOfPerson/jxdm50:PersonAugmentation/jxdm50:PersonStateFingerprintIdentification[ident-ext:FingerprintIdentificationIssuedForCriminalPurposeIndicator='true']/nc30:IdentificationID");
    if (StringUtils.isNotBlank(criminalSid)) {
      subject.setCriminalSid(criminalSid);
    }

    rapbackDAO.updateSubject(subject);
  }
Beispiel #4
0
  public static Map<String, String> loadMappings(InputStream input) {

    Map<String, String> res = new HashMap<String, String>();
    // load the mapping rule
    try {
      List<String> maps = IOUtils.readLines(input);
      for (String map : maps) {
        if (StringUtils.isBlank(map)) {
          continue;
        }

        if (map.trim().startsWith("#")) {
          continue;
        }

        String[] ss = StringUtils.split(map, "=");
        if (ss.length == 2) {
          res.put(ss[0], ss[1]);

        } else {
          debug("skipping map=" + map);
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }

    return res;
  }
Beispiel #5
0
  /**
   * Localizes files, archives and jars the user has instructed us to provide on the cluster as
   * resources for execution.
   *
   * @param conf
   * @return List<LocalResource> local resources to add to execution
   * @throws IOException when hdfs operation fails
   * @throws LoginException when getDefaultDestDir fails with the same exception
   */
  public List<LocalResource> localizeTempFilesFromConf(String hdfsDirPathStr, Configuration conf)
      throws IOException, LoginException {
    List<LocalResource> tmpResources = new ArrayList<LocalResource>();

    String addedFiles = Utilities.getResourceFiles(conf, SessionState.ResourceType.FILE);
    if (StringUtils.isNotBlank(addedFiles)) {
      HiveConf.setVar(conf, ConfVars.HIVEADDEDFILES, addedFiles);
    }
    String addedJars = Utilities.getResourceFiles(conf, SessionState.ResourceType.JAR);
    if (StringUtils.isNotBlank(addedJars)) {
      HiveConf.setVar(conf, ConfVars.HIVEADDEDJARS, addedJars);
    }
    String addedArchives = Utilities.getResourceFiles(conf, SessionState.ResourceType.ARCHIVE);
    if (StringUtils.isNotBlank(addedArchives)) {
      HiveConf.setVar(conf, ConfVars.HIVEADDEDARCHIVES, addedArchives);
    }

    String auxJars = HiveConf.getVar(conf, HiveConf.ConfVars.HIVEAUXJARS);

    // need to localize the additional jars and files
    // we need the directory on hdfs to which we shall put all these files
    String allFiles = auxJars + "," + addedJars + "," + addedFiles + "," + addedArchives;
    addTempFiles(conf, tmpResources, hdfsDirPathStr, allFiles.split(","));
    return tmpResources;
  }
 public String getServerLink() {
   String url =
       StringUtils.defaultIfEmpty(
           StringUtils.trimToEmpty(getServerPublicUrl()), StringUtils.trimToEmpty(getServerUrl()));
   url = StringUtils.defaultIfEmpty(url, MagicNames.DEFAULT_SONAR_URL);
   return StringUtils.chomp(url, "/");
 }
Beispiel #7
0
  @Override
  public List<FeedUpdater> getFeedUpdaters(Project project) {
    List<FeedUpdater> result = new ArrayList<FeedUpdater>();

    DevInfProjectExt ext = project.getExtension(DevInfProjectExt.class);
    if (ext != null) {
      String ciServer = ext.getCiUrl();
      if (StringUtils.isNotBlank(ciServer)) {
        String projectId = project.getUuid().toString();
        String url = null;
        try {
          url = StringUtils.removeEnd(ciServer, "/") + JENKINS_RSS_ALL; // $NON-NLS-1$
          SyndFeedUpdater feedUpdater =
              new SyndFeedUpdater(new URL(url), projectId, "jenkins", "Jenkins"); // $NON-NLS-1$
          result.add(feedUpdater);
        } catch (MalformedURLException e) {
          LOG.info(
              MessageFormat.format(
                  "{0} is not a valid URL. Fetching Jenkins feed for {1} not possible.",
                  url, project.getName()));
        }
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug(
              MessageFormat.format(
                  "No CI URL defined. Fetching Jenkins feed for {0} not possible.",
                  project.getName()));
        }
      }
    }
    return result;
  }
  @RequestMapping("/search")
  public ModelAndView search(
      @RequestParam String subscriberNumber,
      @RequestParam String programName,
      @RequestParam String status) {
    ModelAndView modelAndView = new ModelAndView("searchResults");
    List<Subscription> subscriptions = allSubscriptions.getAll();
    if (!StringUtils.isEmpty(subscriberNumber)) {
      subscriptions =
          filter(
              having(
                  on(Subscription.class).getSubscriber().getNumber(),
                  containsString(subscriberNumber)),
              subscriptions);
    }
    if (!StringUtils.isEmpty(programName)) {
      subscriptions =
          filter(
              having(
                  on(Subscription.class).getProgramType().getProgramKey(),
                  isIn(programName.split("/"))),
              subscriptions);
    }
    if (!StringUtils.isEmpty(status)) {
      subscriptions =
          filter(
              having(on(Subscription.class).getStatusName(), isIn(status.split("/"))),
              subscriptions);
    }

    modelAndView.addObject("subscriptions", subscriptions);
    return modelAndView;
  }
  @Test
  public void getContacts()
      throws HubSpotConnectorException, HubSpotConnectorNoAccessTokenException,
          HubSpotConnectorAccessTokenExpiredException {

    createNewContact();

    ContactList cl = connector.getAllContacts(USER_ID, null, null);

    Assert.assertNotNull(cl);
    Assert.assertTrue(cl.getContacts().size() > 0);
    Assert.assertFalse(
        StringUtils.isEmpty(cl.getContacts().get(0).getContactProperties().getFirstname()));

    cl = connector.getRecentContacts(USER_ID, null, null, null);

    Assert.assertNotNull(cl);
    Assert.assertTrue(cl.getContacts().size() > 0);
    Assert.assertFalse(
        StringUtils.isEmpty(cl.getContacts().get(0).getContactProperties().getFirstname()));

    final String q = "mule";
    final ContactQuery cq = connector.getContactsByQuery(USER_ID, q, null);

    Assert.assertNotNull(cq);
    Assert.assertEquals(cq.getQuery(), q);
    Assert.assertTrue(cq.getContacts().size() >= 0);
    // Assert.assertFalse(StringUtils.isEmpty(cq.getContacts().get(0).getContactProperties().getFirstname()));
  }
  @RequestMapping(value = "/UserList", produces = "application/json")
  @ResponseBody
  public Map<String, Object> getUserList(HttpServletRequest request) throws Exception {

    HashMap<String, String> param = new HashMap<String, String>();
    Map<String, Object> model = new HashMap<String, Object>();
    List<UserDto> list = null;

    String userType = request.getParameter("userType");
    String roleId = request.getParameter("roleId");
    String useYn = request.getParameter("useYn");
    String firstName = request.getParameter("firstName");

    if (StringUtils.isEmpty(firstName)) {
      firstName = "%";
    } else {
      firstName = "%" + firstName + "%";
    }

    try {
      param.put("firstName", firstName);
      param.put("userType", StringUtils.isEmpty(userType) ? null : userType);
      param.put("roleId", StringUtils.isEmpty(roleId) ? null : roleId);
      param.put("useYn", StringUtils.isEmpty(useYn) ? null : useYn);
      list = user.getUserList(param);
    } catch (Exception e) {
      e.printStackTrace();
    }

    model.put("list", list);

    return model;
  }
  @RequestMapping("/UserDetailInfo")
  public ModelAndView userDetailInfo(HttpServletRequest request) throws Exception {
    ModelAndView mav = new ModelAndView("business/common/userDetailInfo");

    UserDto userDto = new UserDto();

    String userId = request.getParameter("userId");
    userDto = user.getUserInfo(userId);

    String userTypeName = null;
    CodeDto cdoeDto = code.getCodeInfo("SYSTEM", "USER_TYPE", userDto.getUserType());
    if (cdoeDto != null) userTypeName = cdoeDto.getCodeName();

    String birthDt = userDto.getBirthDt();
    if (!StringUtils.isEmpty(birthDt) && StringUtils.length(birthDt) == 8) {
      birthDt =
          StringUtils.substring(birthDt, 0, 2)
              + "/"
              + StringUtils.substring(birthDt, 2, 4)
              + "/"
              + StringUtils.substring(birthDt, 4);
    }
    userDto.setBirthDt(birthDt);
    userDto.setUserTypeName(userTypeName);

    mav.addObject("userPhoto", user.getProfilePhoto(userId));
    mav.addObject("userDto", userDto);

    return mav;
  }
Beispiel #12
0
  public void startL(Attributes attrs) {
    // Refer to Gen 3:14 in ESV for example use of type=x-indent
    String type = attrs.getValue(OSISUtil.OSIS_ATTR_TYPE);
    int level = TagHandlerHelper.getAttribute(OSISUtil.OSIS_ATTR_LEVEL, attrs, 1);
    // make numIndents default to zero
    int numIndents = Math.max(0, level - 1);

    LType ltype = LType.IGNORE;
    if (StringUtils.isNotEmpty(type)) {
      if (type.contains("indent")) {
        // this tag is specifically for indenting so ensure there is an indent
        numIndents = numIndents + 1;
        writer.write(StringUtils.repeat(indent_html, numIndents));
        ltype = LType.INDENT;
      } else if (type.contains("br")) {
        writer.write(HTML.BR);
        ltype = LType.BR;
      } else {
        ltype = LType.IGNORE;
        log.debug("Unknown <l> tag type:" + type);
      }
    } else if (TagHandlerHelper.isAttr(OSISUtil.OSIS_ATTR_SID, attrs)) {
      writer.write(StringUtils.repeat(indent_html, numIndents));
      ltype = LType.IGNORE;
    } else if (TagHandlerHelper.isAttr(OSISUtil.OSIS_ATTR_EID, attrs)) {
      // e.g. Isaiah 40:12
      writer.write(HTML.BR);
      ltype = LType.BR;
    } else {
      // simple <l>
      writer.write(StringUtils.repeat(indent_html, numIndents));
      ltype = LType.END_BR;
    }
    stack.push(ltype);
  }
Beispiel #13
0
  public static String getDateAsDDMMYYYYWithTimestamp(Date inputDate) {
    if (GenericUtils.isNotNull(inputDate)) {
      Calendar cal = Calendar.getInstance();
      cal.setTime(inputDate);
      String day = new Integer(cal.get(Calendar.DATE)).toString();
      String mm = new Integer(cal.get(Calendar.MONTH) + 1).toString();
      String year = new Integer(cal.get(Calendar.YEAR)).toString();
      String hours = new Integer(cal.get(Calendar.HOUR_OF_DAY)).toString();
      String minutes = new Integer(cal.get(Calendar.MINUTE)).toString();
      String seconds = new Integer(cal.get(Calendar.SECOND)).toString();

      return StringUtils.leftPad(day, 2, "0")
          + DateUtils.DATE_SEPARATOR_CHAR
          + StringUtils.leftPad(mm, 2, "0")
          + DateUtils.DATE_SEPARATOR_CHAR
          + year
          + PortalConstant.SINGLE_SPACE
          + StringUtils.leftPad(hours, 2, "0")
          + PortalConstant.COLON
          + StringUtils.leftPad(minutes, 2, "0")
          + PortalConstant.COLON
          + StringUtils.leftPad(seconds, 2, "0");
    }

    return PortalConstant.BLANK_STRING;
  }
 @RequestMapping(value = "exportExcel")
 public String exportExcel(HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   String operator = request.getParameter("filter_LIKES_operator");
   String time = request.getParameter("filter_LIKES_time");
   StringBuilder builder = new StringBuilder("from OptLog where 1=1");
   if (StringUtils.isNotBlank(operator)) {
     builder.append(" and operator like '%").append(operator).append("%'");
     request.setAttribute("filter_LIKES_operator", operator);
   }
   if (StringUtils.isNotBlank(time)) {
     builder.append(" and time like '%").append(time).append("%'");
     request.setAttribute("filter_LIKES_time", time);
   }
   builder.append(" order by id desc");
   List<OptLog> data = optLogManager.findOptLogOrderby(builder.toString());
   // 生成Excel文件.
   Workbook wb = new ExcelExporter().export("操作日志", data);
   // 输出Excel文件.
   // HttpServletResponse response = Struts2Utils.getResponse();
   response.setContentType(ServletUtils.EXCEL_TYPE);
   ServletUtils.setFileDownloadHeader(response, "操作日志.xls");
   wb.write(response.getOutputStream());
   response.getOutputStream().flush();
   return null;
 }
  @Override
  public void doProcess(
      PublishedChangeSet changeSet, Map<String, String> parameters, PublishingTarget target)
      throws PublishingException {
    String root = target.getParameter(FileUploadServlet.CONFIG_ROOT);
    String contentFolder = target.getParameter(FileUploadServlet.CONFIG_CONTENT_FOLDER);
    String siteId =
        (!StringUtils.isEmpty(siteName)) ? siteName : parameters.get(FileUploadServlet.PARAM_SITE);

    root += "/" + contentFolder;

    if (StringUtils.isNotBlank(siteId)) {
      root = root.replaceAll(FileUploadServlet.CONFIG_MULTI_TENANCY_VARIABLE, siteId);
    }

    List<String> createdFiles = changeSet.getCreatedFiles();
    List<String> updatedFiles = changeSet.getUpdatedFiles();
    List<String> deletedFiles = changeSet.getDeletedFiles();

    if (CollectionUtils.isNotEmpty(createdFiles)) {
      update(siteId, root, createdFiles, false);
    }
    if (CollectionUtils.isNotEmpty(updatedFiles)) {
      update(siteId, root, updatedFiles, false);
    }
    if (CollectionUtils.isNotEmpty(deletedFiles)) {
      update(siteId, root, deletedFiles, true);
    }

    searchService.commit();
  }
 @Override
 protected boolean runTest(DatabaseRegistryEntry dbre) {
   boolean result = true;
   for (Map.Entry<String, String[]> method_tags : getMandatoryTags().entrySet()) {
     Vector<String> quoted_tags = new Vector<String>();
     for (String t : method_tags.getValue()) {
       quoted_tags.add(String.format("'%s'", t));
     }
     List<String> mlsss =
         getTemplate(dbre)
             .queryForDefaultObjectList(
                 String.format(
                     QUERY,
                     StringUtils.join(quoted_tags, ","),
                     method_tags.getKey(),
                     method_tags.getValue().length),
                 String.class);
     if (mlsss.size() > 0) {
       ReportManager.problem(
           this,
           dbre.getConnection(),
           "MLSSs for "
               + method_tags.getKey()
               + " found with no statistics: "
               + StringUtils.join(mlsss, ","));
       result = false;
     } else {
       ReportManager.correct(this, dbre.getConnection(), "PASSED ");
     }
   }
   return result;
 }
Beispiel #17
0
  @RequestMapping(value = "/searchActs")
  public String searchActs(HttpServletRequest request, Model model, SearchActForm form) {
    if (null != form
        && StringUtils.isNotEmpty(form.getStartDate())
        && StringUtils.isNotEmpty(form.getEndDate())) {
      try {
        Date startDate = DateUtils.parseDate(form.getStartDate(), new String[] {"yyyy-MM-dd"});
        Date endDate = DateUtils.parseDate(form.getEndDate(), new String[] {"yyyy-MM-dd"});

        PagerManager pager =
            new PagerManager(form.getPageId(), 10, actService.countNewActs(startDate, endDate));
        List<Act> actList =
            actService.searchNewActs(
                startDate, endDate, form.getOrder(), pager.getFirstResult(), pager.getMaxResult());
        List<CmsActView> viewList = new ArrayList<CmsActView>(actList.size());
        for (Act act : actList) {
          viewList.add(
              new CmsActView(
                  act,
                  actService.listSynonymActs(act.getId()),
                  actService.isShieldAct(act.getId())));
        }
        model.addAttribute("cmsActViewList", viewList);
        model.addAttribute("pager", pager);
      } catch (ParseException e) {
        log.error("parse search date error.", e);
      }
      model.addAttribute("searchActForm", form);
    }
    return "cms/act_list";
  }
  /*
   * (non-Javadoc)
   * @see uni.edu.pe.analisisSentimental.service.TweetManagerService#sintetizarOpinionMensaje(java.lang.String)
   */
  public void sintetizarOpinionMensaje(String codFinalidadData) {
    logger.debug("<==== Inicio Method sintetizarOpinionMensaje ====>");
    List<OpinionMensajeDto> lstOm = generalDAO.obtenerOpinionMensaje(codFinalidadData);
    for (OpinionMensajeDto om : lstOm) {
      if (Constantes.COD_OPINION_OBJETIVA.equals(om.getCodOpinionTwitter())) {
        om.setCodOpinionMensaje(om.getCodOpinionWeb());
      } else {
        om.setCodOpinionMensaje(om.getCodOpinionTwitter());
      }
      if (StringUtils.isNotBlank(om.getOpiIniTweet())) {
        if (StringUtils.isBlank(om.getOpiIniWeb())) {
          om.setCodOpinionMsjInicial(om.getOpiIniTweet());
        } else {
          if (Constantes.COD_OPINION_OBJETIVA.equals(om.getOpiIniTweet())) {
            om.setCodOpinionMsjInicial(om.getOpiIniWeb());
          } else if (om.getOpiIniTweet().equals(om.getOpiIniWeb())) {
            om.setCodOpinionMsjInicial(om.getOpiIniTweet());
          } else {
            om.setCodOpinionMsjInicial(COD_OPINION_NSC);
          }
        }
      } else {
        om.setCodOpinionMsjInicial(Constantes.COD_OPINION_NSC);
      }
    }

    tweetProcesadoDAO.sintetizarOpinionMensajeBatch(lstOm);
  }
Beispiel #19
0
  private File prepareTargetFileName(
      final File file, final SignaturePackaging signaturePackaging, final String signatureLevel) {

    final File parentDir = file.getParentFile();
    final String originalName = StringUtils.substringBeforeLast(file.getName(), ".");
    final String originalExtension = "." + StringUtils.substringAfterLast(file.getName(), ".");
    final String level = signatureLevel.toUpperCase();

    if (((SignaturePackaging.ENVELOPING == signaturePackaging)
            || (SignaturePackaging.DETACHED == signaturePackaging))
        && level.startsWith("XADES")) {

      final String form = "xades";
      final String levelOnly = DSSUtils.replaceStrStr(level, "XADES-", "").toLowerCase();
      final String packaging = signaturePackaging.name().toLowerCase();
      return new File(
          parentDir, originalName + "-" + form + "-" + packaging + "-" + levelOnly + ".xml");
    }

    if (level.startsWith("CADES") && !originalExtension.toLowerCase().equals(".p7m")) {
      return new File(parentDir, originalName + originalExtension + ".p7m");
    }

    if (level.startsWith("ASIC_S")) {
      return new File(parentDir, originalName + originalExtension + ".asics");
    }
    if (level.startsWith("ASIC_E")) {
      return new File(parentDir, originalName + originalExtension + ".asice");
    }

    return new File(parentDir, originalName + "-signed" + originalExtension);
  }
Beispiel #20
0
  private static void exportTables(
      Database database, String namesep, String genericOutputPath, String fieldsep, String rowsep) {
    try {
      for (Table table : database) {
        // Prepare the full csv file path, an integer is added if the file already exists
        String outputPath = constructOutputPath(genericOutputPath, namesep, table);
        FileWriter outputFileWriter = new FileWriter(outputPath);
        BufferedWriter outputBufferedWriter = new BufferedWriter(outputFileWriter);

        // Write the column names to the csv file
        ArrayList<String> columns = new ArrayList<String>();
        for (Column column : table.getColumns()) {
          columns.add(column.getName());
        }
        outputBufferedWriter.write(StringUtils.join(columns, fieldsep));
        outputBufferedWriter.write(rowsep);

        // Write the rows to the csv file
        for (Row row : table) {
          outputBufferedWriter.write(StringUtils.join(row.values(), fieldsep));
          outputBufferedWriter.write(rowsep);
        }
        outputBufferedWriter.close();
        outputFileWriter.close();
      }
    } catch (IOException ioe) {
      System.out.println("ERROR: unable to write the csv file to the file system");
      closeDatabase(database);
      System.exit(1);
    }
  }
  /**
   * Creates this from a JDOM element.
   *
   * @param jdom input
   */
  public UserQueryInput(Element jdom) {

    // Done in LuceneSearcher#computeQuery
    // protectRequest(jdom);

    for (Object e : jdom.getChildren()) {
      if (e instanceof Element) {
        Element node = (Element) e;
        String nodeName = node.getName();
        String nodeValue = StringUtils.trim(node.getText());
        if (SearchParameter.SIMILARITY.equals(nodeName)) {
          setSimilarity(jdom.getChildText(SearchParameter.SIMILARITY));
        } else {
          if (StringUtils.isNotBlank(nodeValue)) {

            if (SECURITY_FIELDS.contains(nodeName) || nodeName.contains("_op")) {
              addValues(searchPrivilegeCriteria, nodeName, nodeValue);
            } else if (RESERVED_FIELDS.contains(nodeName)) {
              searchOption.put(nodeName, nodeValue);
            } else {
              // addValues(searchCriteria, nodeName, nodeValue);
              // Rename search parameter to lucene index field
              // when needed
              addValues(
                  searchCriteria,
                  (searchParamToLuceneField.containsKey(nodeName)
                      ? searchParamToLuceneField.get(nodeName)
                      : nodeName),
                  nodeValue);
            }
          }
        }
      }
    }
  }
 protected boolean hasSalesTaxBeenEntered(
     AccountingLine accountingLine, boolean source, boolean newLine, int index) {
   boolean entered = true;
   String objCd = accountingLine.getFinancialObjectCode();
   String account = accountingLine.getAccountNumber();
   SalesTax salesTax = accountingLine.getSalesTax();
   if (ObjectUtils.isNull(salesTax)) {
     return false;
   }
   if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
     entered &= false;
   }
   if (StringUtils.isBlank(salesTax.getAccountNumber())) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentSaleDate() == null) {
     entered &= false;
   }
   return entered;
 }
 private static void validate(Uri uri) {
   if (StringUtils.isEmpty(uri.authority)
       && StringUtils.isEmpty(uri.path)
       && StringUtils.isEmpty(uri.query)) {
     throw new IllegalArgumentException("Invalid scheme-specific part");
   }
 }
 public List<Wqwqxkzxq1Form> findWqwqxkzxq1ListWithPage(
     int pagesize, int pageno, Wqwqxkzxq1Form wqwqxkzxq1Form) {
   String hqlWhere = "";
   Object[] params = null;
   List<String> paramsList = new ArrayList<String>();
   LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
   if (wqwqxkzxq1Form != null && StringUtils.isNotBlank(wqwqxkzxq1Form.getXh())) {
     hqlWhere += " and o.xh like ?";
     paramsList.add("%" + wqwqxkzxq1Form.getXh() + "%");
   }
   if (wqwqxkzxq1Form != null && StringUtils.isNotBlank(wqwqxkzxq1Form.getZymc())) {
     hqlWhere += " and o.zymc like ?";
     paramsList.add("%" + wqwqxkzxq1Form.getZymc() + "%");
   }
   orderby.put(" o.xh", "desc");
   params = paramsList.toArray();
   List<Wqwqxkzxq1> list =
       wqwqxkzxq1Dao.findCollectionByConditionWithPage(
           hqlWhere, params, orderby, pagesize, pageno);
   List<Wqwqxkzxq1Form> formlist = this.Wqwqxkzxq1POListToVOList(list);
   if (pageno == 1) {
     formListTemp =
         Wqwqxkzxq1POListToVOList(
             wqwqxkzxq1Dao.findCollectionByConditionNoPage(hqlWhere, params, orderby));
   }
   return formlist;
 }
    public void validateSmtp() {
      Validation.required("setup.smtpServer", smtpServer);

      if (HostNameOrIpAddressCheck.isValidHostName(smtpServer)) {
        if (PropertiesConfigurationValidator.validateIpList(nameservers)) {
          Set<String> ips = Sets.newHashSet(nameservers.split(","));
          if (!DnsUtils.validateHostname(ips, smtpServer)) {
            Validation.addError("setup.smtpServer", "setup.smtpServer.invalidSmtpServer");
          }
        } else if (StringUtils.isNotEmpty(nameservers)) {
          Validation.addError(
              "setup.nameservers", "setup.smtpServer.invalidNameserver", nameservers);
        }
      }

      if (!HostNameOrIpAddressCheck.isValidHostNameOrIp(smtpServer)) {
        Validation.addError("setup.smtpServer", "setup.smtpServer.invalid");
      }
      if (!StringUtils.isNumeric(smtpPort)) {
        Validation.addError("setup.smtpServer", "setup.smtpServer.invalidPort");
      }

      Validation.required("setup.smtpFrom", smtpFrom);
      Validation.email("setup.smtpFrom", smtpFrom);

      if (StringUtils.isNotBlank(smtpAuthType)
          && !StringUtils.equalsIgnoreCase(smtpAuthType, "None")) {
        Validation.required("setup.smtpUsername", smtpUsername);
        Validation.required("setup.smtpPassword", smtpPassword);

        if (PasswordUtil.isNotValid(smtpPassword)) {
          Validation.addError("setup.smtpPassword", "setup.password.notValid");
        }
      }
    }
 public boolean isValidStatus(String disclosureStatus, Integer dispositionStatus) {
   boolean isValid = true;
   if (StringUtils.isBlank(disclosureStatus)) {
     GlobalVariables.getMessageMap()
         .putError(ADMIN_ERRORS, KeyConstants.ERROR_COI_DISCLOSURE_STATUS_REQUIRED);
     isValid = false;
   }
   if (dispositionStatus == null) {
     GlobalVariables.getMessageMap()
         .putError(ADMIN_ERRORS, KeyConstants.ERROR_COI_DISPOSITON_STATUS_REQUIRED);
     isValid = false;
   }
   CoiDispositionStatus disposition =
       KraServiceLocator.getService(BusinessObjectService.class)
           .findBySinglePrimaryKey(CoiDispositionStatus.class, dispositionStatus);
   if (disposition == null) {
     GlobalVariables.getMessageMap()
         .putError(ADMIN_ERRORS, KeyConstants.ERROR_COI_DISPOSITON_STATUS_REQUIRED);
     isValid = false;
   }
   // if the disposition requires disapproval, then the disclosureStatus must be disapproved.
   if (StringUtils.equals(
           disposition.getCoiDisclosureStatusCode(), CoiDisclosureStatus.DISAPPROVED)
       && !StringUtils.equals(disclosureStatus, CoiDisclosureStatus.DISAPPROVED)) {
     GlobalVariables.getMessageMap()
         .putError(ADMIN_ERRORS, KeyConstants.ERROR_COI_DISCLOSURE_STATUS_INVALID);
     isValid = false;
   }
   return isValid;
 }
Beispiel #27
0
  @GET
  public Blob convert(
      @QueryParam("converter") String converter,
      @QueryParam("type") String type,
      @QueryParam("format") String format,
      @Context UriInfo uriInfo) {
    BlobHolder bh = getBlobHolderToConvert();

    boolean txWasActive = false;
    try {
      if (TransactionHelper.isTransactionActive()) {
        txWasActive = true;
        TransactionHelper.commitOrRollbackTransaction();
      }

      if (StringUtils.isNotBlank(converter)) {
        return convertWithConverter(bh, converter, uriInfo);
      } else if (StringUtils.isNotBlank(type)) {
        return convertWithMimeType(bh, type, uriInfo);
      } else if (StringUtils.isNotBlank(format)) {
        return convertWithFormat(bh, format, uriInfo);
      } else {
        throw new IllegalParameterException("No converter, type or format parameter specified");
      }
    } finally {
      if (txWasActive && !TransactionHelper.isTransactionActiveOrMarkedRollback()) {
        TransactionHelper.startTransaction();
      }
    }
  }
Beispiel #28
0
 @Override
 public void validate() {
   if (StringUtils.isEmpty(accountBean.getEmail())) {
     addFieldError("accountBean.email", "Email cannnot be blank");
   } else {
     String expression = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
     CharSequence inputStr = accountBean.getEmail();
     Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
     Matcher matcher = pattern.matcher(inputStr);
     if (!matcher.matches()) addFieldError("accountBean.email", "Invalid email address");
   }
   if (StringUtils.isEmpty(accountBean.getPassword())) {
     addFieldError("accountBean.password", "Password cannnot be blank");
   } else if (accountBean.getPassword().length() < 6) {
     addFieldError("accountBean.password", "Password must be minimum of 6 characters");
   }
   if (StringUtils.isEmpty(accountBean.getFirstname())) {
     addFieldError("accountBean.firstname", "First Name cannnot be blank");
   }
   if (StringUtils.isEmpty(accountBean.getLastname())) {
     addFieldError("accountBean.lastname", "Last Name cannnot be blank");
   }
   if (accountBean.getGender().equals("-1")) {
     addFieldError("accountBean.gender", "You have to specify gender");
   }
 }
Beispiel #29
0
  protected void drawHtmlPostSubsButtons(Writer out) throws IOException {
    Messages msgs = MessagesManager.getMessages();

    out.write(
        "<div class=\""
            + CssConstants.CSSCLASS_TABSETSAVEBAR
            + "\">\n"); //$NON-NLS-1$ //$NON-NLS-2$

    Button save = new Button();
    String saveOnclick = this.getConfigValue("saveOnclick", "mgnlDialogFormSubmit();");
    String saveLabel = this.getConfigValue("saveLabel", msgs.get("buttons.save"));
    if (StringUtils.isNotEmpty(saveOnclick) && StringUtils.isNotEmpty("saveLabel")) {
      save.setOnclick(saveOnclick); // $NON-NLS-1$ //$NON-NLS-2$
      save.setLabel(saveLabel); // $NON-NLS-1$ //$NON-NLS-2$
      out.write(save.getHtml());
    }
    Button cancel = new Button();
    cancel.setOnclick(
        this.getConfigValue("cancelOnclick", "window.close();")); // $NON-NLS-1$ //$NON-NLS-2$
    cancel.setLabel(
        this.getConfigValue(
            "cancelLabel", msgs.get("buttons.cancel"))); // $NON-NLS-1$ //$NON-NLS-2$
    out.write(cancel.getHtml());

    out.write("</div>\n"); // $NON-NLS-1$
  }
  /** @see org.displaytag.util.RequestHelper#getParameterMap() */
  public Map getParameterMap() {

    Map map = new HashMap();

    // get the parameters names
    Enumeration parametersName = this.request.getParameterNames();

    while (parametersName.hasMoreElements()) {
      // ... get the value
      String paramName = (String) parametersName.nextElement();

      request.getParameter(paramName);
      // put key/value in the map
      String[] originalValues =
          (String[])
              ObjectUtils.defaultIfNull(this.request.getParameterValues(paramName), new String[0]);
      String[] values = new String[originalValues.length];

      for (int i = 0; i < values.length; i++) {
        try {
          values[i] =
              URLEncoder.encode(
                  StringUtils.defaultString(originalValues[i]),
                  StringUtils.defaultString(
                      response.getCharacterEncoding(), "UTF8")); // $NON-NLS-1$
        } catch (UnsupportedEncodingException e) {
          throw new UnhandledException(e);
        }
      }
      map.put(paramName, values);
    }

    // return the Map
    return map;
  }