List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2)
Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.
null s are handled without exceptions.
From source file:com.nridge.core.ds.io.xml.SmartGWTXML.java
private Field.Type dsSGWTStringToType(String aTypeString) { Field.Type fieldType = Field.Type.Text; if (StringUtils.equalsIgnoreCase(aTypeString, "sequence")) fieldType = Field.Type.Integer; else if (StringUtils.equalsIgnoreCase(aTypeString, "integer")) fieldType = Field.Type.Integer; else if (StringUtils.equalsIgnoreCase(aTypeString, "float")) fieldType = Field.Type.Double; else if (StringUtils.equalsIgnoreCase(aTypeString, "boolean")) fieldType = Field.Type.Boolean; else if (StringUtils.equalsIgnoreCase(aTypeString, "date")) fieldType = Field.Type.DateTime; return fieldType; }
From source file:com.erudika.para.core.Tag.java
@Override public boolean equals(Object obj) { if (obj == null) { return false; }/*from ww w . j a va 2 s . c o m*/ if (getClass() != obj.getClass()) { return false; } final Tag other = (Tag) obj; if (!StringUtils.equalsIgnoreCase(tag, other.tag)) { return false; } return true; }
From source file:com.bekwam.resignator.model.ConfigurationJSONAdapter.java
private List<Profile> deserializeProfiles(JsonArray profiles) { List<Profile> ps = new ArrayList<>(); for (JsonElement e : profiles) { JsonObject profileObj = (JsonObject) e; String profileName = profileObj.get("profileName").getAsString(); Boolean rs = Boolean.FALSE; if (profileObj.get("replaceSignatures") != null) { rs = profileObj.get("replaceSignatures").getAsBoolean(); }//ww w . j av a 2s . c o m SigningArgumentsType argsType = SigningArgumentsType.JAR; if (profileObj.get("argsType") != null) { String at = profileObj.get("argsType").getAsString(); if (StringUtils.equalsIgnoreCase(at, String.valueOf(SigningArgumentsType.FOLDER))) { argsType = SigningArgumentsType.FOLDER; } } Profile p = new Profile(profileName, rs, argsType); // // SourceFile part // JsonObject sourceObj = profileObj.getAsJsonObject("sourceFile"); if (sourceObj != null) { JsonElement sfe = sourceObj.get("fileName"); if (sfe != null) { SourceFile sf = new SourceFile(sfe.getAsString()); p.setSourceFile(Optional.of(sf)); } } // // TargetFile part // JsonObject targetObj = profileObj.getAsJsonObject("targetFile"); if (sourceObj != null) { JsonElement tfe = targetObj.get("fileName"); if (tfe != null) { TargetFile tf = new TargetFile(tfe.getAsString()); p.setTargetFile(Optional.of(tf)); } } // // JarsignerConfig part // JsonObject jcObj = profileObj.getAsJsonObject("jarsignerConfig"); if (jcObj != null) { String alias = ""; String storepass = ""; String keypass = ""; String keystore = ""; Boolean verbose = false; JsonElement ae = jcObj.get("alias"); if (ae != null) { alias = ae.getAsString(); } JsonElement spe = jcObj.get("storepass"); if (spe != null) { storepass = spe.getAsString(); } JsonElement kpe = jcObj.get("keypass"); if (kpe != null) { keypass = kpe.getAsString(); } JsonElement kse = jcObj.get("keystore"); if (kse != null) { keystore = kse.getAsString(); } JsonElement ve = jcObj.get("verbose"); if (ve != null) { verbose = ve.getAsBoolean(); } JarsignerConfig jc = new JarsignerConfig(alias, "", "", keystore, verbose); jc.setEncryptedKeypass(keypass); jc.setEncryptedStorepass(storepass); p.setJarsignerConfig(Optional.of(jc)); } ps.add(p); } return ps; }
From source file:com.ottogroup.bi.spqr.pipeline.queue.chronicle.DefaultStreamingMessageQueue.java
/** * @see com.ottogroup.bi.spqr.pipeline.queue.StreamingMessageQueue#initialize(java.util.Properties) */// w w w. ja va2 s .c o m public void initialize(Properties properties) throws RequiredInputMissingException { //////////////////////////////////////////////////////////////////////////////// // extract and validate input if (properties == null) throw new RequiredInputMissingException("Missing required properties"); if (StringUtils.isBlank(this.id)) throw new RequiredInputMissingException("Missing required queue identifier"); if (StringUtils.equalsIgnoreCase( StringUtils.trim(properties.getProperty(CFG_CHRONICLE_QUEUE_DELETE_ON_EXIT)), "false")) this.deleteOnExit = false; this.basePath = StringUtils.lowerCase(StringUtils.trim(properties.getProperty(CFG_CHRONICLE_QUEUE_PATH))); if (StringUtils.isBlank(this.basePath)) this.basePath = System.getProperty("java.io.tmpdir"); String tmpCycleFormat = StringUtils .trim(properties.getProperty(CFG_CHRONICLE_QUEUE_CYCLE_FORMAT, "yyyy-MM-dd-HH-mm")); if (StringUtils.isNotBlank(tmpCycleFormat)) this.cycleFormat = tmpCycleFormat; String pathToChronicle = this.basePath; if (!StringUtils.endsWith(pathToChronicle, File.separator)) pathToChronicle = pathToChronicle + File.separator; pathToChronicle = pathToChronicle + id; try { this.queueRollingInterval = TimeUnit.MINUTES.toMillis( Long.parseLong(StringUtils.trim(properties.getProperty(CFG_CHRONICLE_QUEUE_ROLLING_INTERVAL)))); if (this.queueRollingInterval < VanillaChronicle.MIN_CYCLE_LENGTH) { this.queueRollingInterval = VanillaChronicle.MIN_CYCLE_LENGTH; } } catch (Exception e) { logger.info("Invalid queue rolling interval found: " + e.getMessage() + ". Using default: " + TimeUnit.MINUTES.toMillis(60)); } this.queueWaitStrategy = getWaitStrategy( StringUtils.trim(properties.getProperty(CFG_QUEUE_MESSAGE_WAIT_STRATEGY))); // //////////////////////////////////////////////////////////////////////////////// // clears the queue if requested if (this.deleteOnExit) { ChronicleTools.deleteDirOnExit(pathToChronicle); ChronicleTools.deleteOnExit(pathToChronicle); } try { this.chronicle = ChronicleQueueBuilder.vanilla(pathToChronicle) .cycleLength((int) this.queueRollingInterval).cycleFormat(this.cycleFormat).build(); this.queueConsumer = new DefaultStreamingMessageQueueConsumer(this.getId(), this.chronicle.createTailer(), this.queueWaitStrategy); this.queueProducer = new DefaultStreamingMessageQueueProducer(this.getId(), this.chronicle.createAppender(), this.queueWaitStrategy); } catch (IOException e) { throw new RuntimeException( "Failed to initialize chronicle at '" + pathToChronicle + "'. Error: " + e.getMessage()); } logger.info("queue[type=chronicle, id=" + this.id + ", deleteOnExist=" + this.deleteOnExit + ", path=" + pathToChronicle + "']"); }
From source file:io.github.lxgaming.teleportbow.util.Toolbox.java
public static boolean containsIgnoreCase(Collection<String> list, String targetString) { if (list == null || list.isEmpty()) { return false; }/* w w w . j a v a 2s. c om*/ for (String string : list) { if (StringUtils.equalsIgnoreCase(string, targetString)) { return true; } } return false; }
From source file:edu.umn.se.trap.rule.businessrule.TravelTypeMatchesGrantRule.java
/** * @param string/*from w w w . j ava2 s. co m*/ * @param b * @param grants * @throws TrapException */ private void checkForGrantType(String type, boolean b, Set<FormGrant> grants) throws TrapException { if (b) { boolean noGrantTypeInForm = true; for (FormGrant grant : grants) { if (StringUtils.equalsIgnoreCase(grant.getAccountType(), type)) { noGrantTypeInForm = false; } } if (noGrantTypeInForm) { throw new TrapException(TrapErrors.NO_GRANTS_FOR_TRAVEL_TYPE); } } }
From source file:com.glaf.chart.web.springmvc.KendouiChartController.java
@RequestMapping("/showChart") public ModelAndView chart(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); Map<String, Object> params = RequestUtils.getParameterMap(request); String chartId = ParamUtils.getString(params, "chartId"); String mapping = ParamUtils.getString(params, "mapping"); String mapping_enc = ParamUtils.getString(params, "mapping_enc"); String name = ParamUtils.getString(params, "name"); String name_enc = ParamUtils.getString(params, "name_enc"); Chart chart = null;//w w w . j a va 2 s. co m if (StringUtils.isNotEmpty(chartId)) { chart = chartService.getChart(chartId); } else if (StringUtils.isNotEmpty(name)) { chart = chartService.getChartByName(name); } else if (StringUtils.isNotEmpty(name_enc)) { String str = RequestUtils.decodeString(name_enc); chart = chartService.getChartByName(str); } else if (StringUtils.isNotEmpty(mapping)) { chart = chartService.getChartByMapping(mapping); } else if (StringUtils.isNotEmpty(mapping_enc)) { String str = RequestUtils.decodeString(mapping_enc); chart = chartService.getChartByMapping(str); } if (chart != null) { ChartDataManager manager = new ChartDataManager(); chart = manager.getChartAndFetchDataById(chart.getId(), params, RequestUtils.getActorId(request)); logger.debug("chart rows size:" + chart.getColumns().size()); request.setAttribute("chart", chart); request.setAttribute("chartId", chart.getId()); request.setAttribute("name", chart.getChartName()); JSONArray result = new JSONArray(); List<ColumnModel> columns = chart.getColumns(); if (columns != null && !columns.isEmpty()) { double total = 0D; List<String> categories = new ArrayList<String>(); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { for (ColumnModel cm : columns) { total += cm.getDoubleValue(); } } for (ColumnModel cm : columns) { if (cm.getCategory() != null && !categories.contains("'" + cm.getCategory() + "'")) { categories.add("'" + cm.getCategory() + "'"); } } request.setAttribute("categories", categories); request.setAttribute("categories_scripts", categories.toString()); logger.debug("categories=" + categories); Map<String, List<Double>> seriesMap = new HashMap<String, List<Double>>(); for (ColumnModel cm : columns) { String series = cm.getSeries(); if (series != null) { List<Double> valueList = seriesMap.get(series); if (valueList == null) { valueList = new ArrayList<Double>(); } if (cm.getDoubleValue() != null) { valueList.add(cm.getDoubleValue()); } else { valueList.add(0D); } seriesMap.put(series, valueList); } } request.setAttribute("seriesMap", seriesMap); if (!seriesMap.isEmpty()) { JSONArray array = new JSONArray(); Set<Entry<String, List<Double>>> entrySet = seriesMap.entrySet(); for (Entry<String, List<Double>> entry : entrySet) { String key = entry.getKey(); List<Double> valueList = entry.getValue(); JSONObject json = new JSONObject(); json.put("name", key); json.put("data", valueList); array.add(json); } logger.debug("seriesDataJson:" + array.toJSONString()); request.setAttribute("seriesDataJson", array.toJSONString()); } for (ColumnModel cm : columns) { JSONObject json = new JSONObject(); json.put("category", cm.getCategory()); json.put("series", cm.getSeries()); json.put("doublevalue", cm.getDoubleValue()); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { json.put("category", cm.getSeries()); json.put("value", Math.round(cm.getDoubleValue() / total * 10000) / 100.0D); } else { json.put("value", cm.getDoubleValue()); } result.add(json); } } request.setAttribute("jsonArray", result.toJSONString()); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { return new ModelAndView("/bi/chart/kendo/pie", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "line")) { return new ModelAndView("/bi/chart/kendo/line", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "radarLine")) { return new ModelAndView("/bi/chart/kendo/radarLine", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "bar")) { return new ModelAndView("/bi/chart/kendo/bar", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "stacked_area")) { return new ModelAndView("/bi/chart/kendo/stacked_area", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "stackedbar")) { return new ModelAndView("/bi/chart/kendo/stackedbar", modelMap); } } String x_view = ViewProperties.getString("kendo.chart"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/bi/chart/kendo/chart", modelMap); }
From source file:com.hybris.mobile.activity.ProfileDetailActivity.java
@Override public void onSubmit(ArrayList<String> array) { String titleCode = ""; String currencyCode = ""; String languageCode = ""; for (GenericNameCode obj : mTitles) { if (StringUtils.equalsIgnoreCase(obj.getName(), array.get(0).toString())) { titleCode = obj.getCode();//from ww w.ja v a 2 s . com break; } } for (GenericNameCode obj : mCurrencies) { if (StringUtils.equalsIgnoreCase(obj.getName(), array.get(3).toString())) { currencyCode = obj.getIsocode(); break; } } for (GenericNameCode obj : mLanguages) { if (StringUtils.equalsIgnoreCase(obj.getName(), array.get(4).toString())) { languageCode = obj.getIsocode(); break; } } QueryCustomer query = new QueryCustomer(); query.setFirstName(array.get(1)); query.setLastName(array.get(2)); query.setTitleCode(titleCode); query.setLanguage(languageCode); query.setCurrency(currencyCode); RESTLoader.execute(this, WebserviceMethodEnums.METHOD_UPDATE_PROFILE, query, this, true, true); }
From source file:mergedoc.encoding.StrictUniversalDetector.java
/** * @return The detected encoding is returned. If the detector couldn't * determine what encoding was used, null is returned. *///from www . j a v a2 s. c o m public String getDetectedCharset() { // [Kashihara] Change to extended charset for Japanese if (StringUtils.equalsIgnoreCase(detectedCharset, "shift_jis")) { return "MS932"; } return detectedCharset; }
From source file:com.inkubator.hrm.service.impl.NotificationApproverSmsMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { String approverNumber = StringUtils.EMPTY; String notifMessage = StringUtils.EMPTY; try {//from w ww. j a v a2 s .c om TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); approverNumber = jsonConverter.getValueByKey(json, "senderNumber"); HrmUser approver = hrmUserDao.getEntityByPhoneNumber("+" + approverNumber); String content = jsonConverter.getValueByKey(json, "smsContent"); String[] arrContent = StringUtils.split(content, "#"); notifMessage = StringUtils.EMPTY; ApprovalActivity approvalActivity = StringUtils.isNumeric(arrContent[0]) ? approvalActivityDao.getEntiyByPK(Long.parseLong(arrContent[0])) : null; /** validation */ if (approver == null) { notifMessage = "Maaf, No Telepon tidak terdaftar "; } else if (arrContent.length != 3) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!(StringUtils.equalsIgnoreCase(arrContent[1], "YES") || StringUtils.equalsIgnoreCase(arrContent[1], "NO") || StringUtils.equalsIgnoreCase(arrContent[1], "REVISI"))) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!StringUtils.isNumeric(arrContent[0])) { notifMessage = "Maaf, Approval Activity ID tidak terdaftar"; } else if (approvalActivity == null) { notifMessage = "Maaf, approval activity ID tidak terdaftar"; } else if (!StringUtils.equals(approvalActivity.getApprovedBy(), approver.getUserId())) { notifMessage = "Maaf, No Telpon ini tidak berhak untuk melakukan approval"; } else if (approvalActivity.getApprovalStatus() != HRMConstant.APPROVAL_STATUS_WAITING_APPROVAL) { notifMessage = "Maaf, permintaan tidak dapat di proses karena status Approval sudah berubah"; } /** proses approval, jika memenuhi validasi */ if (StringUtils.isEmpty(notifMessage)) { if (StringUtils.equalsIgnoreCase(arrContent[1], "YES")) { /** do Approved */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.approved(approvalActivity.getId(), null, arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk disetujui telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "NO")) { /** do Rejected */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.rejected(approvalActivity.getId(), arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk ditolak telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "REVISI")) { /** do Asking Revised */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.LOAN: loanNewApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.askingRevised(approvalActivity.getId(), arrContent[2]); break; default: /** Tidak semua module implement asking revised, jika belum/tidak implement maka kirim sms balik ke sender untuk notifikasi */ notifMessage = "Maaf, permintaan untuk \"REVISI\" tidak dapat diproses. Hanya bisa melakukan proses \"YES\" atau \"NO\""; break; } if (StringUtils.isEmpty(notifMessage)) { notifMessage = "Terima kasih, permintaan untuk direvisi telah di proses"; } } } } catch (Exception ex) { notifMessage = "Maaf, permintaan tidak dapat di proses, ada kegagalan di sistem. Mohon ulangi proses via aplikasi web atau hubungi Administrator"; LOGGER.error("Error", ex); } /** kirim sms balik ke sender untuk notifikasi messagenya */ final SMSSend mSSend = new SMSSend(); LOGGER.error("Info SMS " + notifMessage); mSSend.setFrom(HRMConstant.SYSTEM_ADMIN); mSSend.setDestination("+" + approverNumber); mSSend.setContent(notifMessage); //Send notificatin SMS this.jmsTemplateSMS.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(jsonConverter.getJson(mSSend)); } }); }