Java Code Examples for org.apache.commons.lang3.StringUtils.equalsIgnoreCase()

The following are Jave code examples for showing how to use equalsIgnoreCase() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: oscm   File: IdPResponseFilter.java   View Source Code Vote up 7 votes
protected void buildSAMLLogoutRequestAndStoreInSession(
        HttpServletRequest request, String samlResponse)
        throws SaaSApplicationException {
    String samlSessionId = getSamlResponseExtractor()
            .getSessionIndex(samlResponse);
    String nameID = getSamlResponseExtractor().getUserId(samlResponse);
    String tenantID = getSamlResponseExtractor().getTenantID(samlResponse);
    String issuer = getSamlResponseExtractor().getIssuer(samlResponse);
    authSettings.init(tenantID);
    if(!StringUtils.equalsIgnoreCase(issuer, authSettings.getIdpIssuer())) {
        //TODO: move issuer verification to AssertionContentVerifier if possible.
        throw new IssuerNotMatchException();
    }
    final SigningAlgorithmType signingAlgorithm = getSigningAlgorithmType();
    String logoutRequest = logoutRequestGenerator.generateLogoutRequest(
                samlSessionId, nameID, getLogoutURL(),
                getKeystorePath(), getIssuer(),
                getKeyAlias(), getKeystorePass(), signingAlgorithm);
    request.getSession().setAttribute(SESSION_PARAM_SAML_LOGOUT_REQUEST, logoutRequest);
}
 
Example 2
Project: timesheet-upload   File: UpdatePasswordValidator.java   View Source Code Vote up 6 votes
@Override
public void validate(Object target, Errors errors) {
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "employeeFirstName", "NotEmpty.registration.fname");
    Employee employeeRegistration = (Employee) target;

    if (StringUtils.isNotBlank(employeeRegistration.getEmpPassword())) {
        if (passwordValidator.validate(employeeRegistration.getEmpPassword())) {
            //Check if the confirmation password is same as the new password.
            if (!StringUtils.equalsIgnoreCase(employeeRegistration.getEmpPassword(), employeeRegistration.getEmpPassword2())) {
                errors.rejectValue("empPassword2", "NotValid.registration.confirm.password");
            }
        } else {
            errors.rejectValue("empPassword", "NotValid.registration.password");
        }
    }

}
 
Example 3
Project: outcomes   File: DesUtils.java   View Source Code Vote up 6 votes
public static String desEncrypt(String origin, String encoding) {
    if ((origin == null) || (encoding == null)) {
        return null;
    }

    // TODO String.valueOf(null) == "null";
    if (StringUtils.equalsIgnoreCase("null", origin)) {
        return null;
    }

    try {
        return encrypt(origin.getBytes(encoding), "DES");
    } catch (UnsupportedEncodingException e) {
        System.out.println("The encoding is not supported.");
    }

    return null;
}
 
Example 4
Project: simm-lib   File: RiskWeight.java   View Source Code Vote up 6 votes
public static BigDecimal getHVR(RiskClass r, Sensitivity s) {
  if (r.equals(RiskClass.COMMODITY)) {
    return cm.getHVR();
  } else if (r.equals(RiskClass.CREDIT_NON_QUALIFYING)) {
    return cnq.getHVR();
  } else if (r.equals(RiskClass.CREDIT_QUALIFYING) && StringUtils.equalsIgnoreCase(s.getRiskType(), RiskType.RISK_TYPE_BASE_CORR)) {
    throw new RuntimeException("called HVR for base corr sensitvity: " + s);
  } else if (r.equals(RiskClass.CREDIT_QUALIFYING)) {
    return cq.getHVR();
  } else if (r.equals(RiskClass.EQUITY)) {
    return eq.getHVR();
  } else if (r.equals(RiskClass.FX)) {
    return fx.getHVR();
  } else if (r.equals(RiskClass.INTEREST_RATE)) {
    return ir.getHVR();
  } else {
    throw new RuntimeException("found bad com.acadiasoft.simm.model.risk class: " + r);
  }
}
 
Example 5
Project: weixin_api   File: HttpUtil.java   View Source Code Vote up 6 votes
/**
 * 从响应消息的Content-Disposition头中获得文件名。
 * 
 * @param headers
 * @return 如果不是文件则返回null
 */
private static String getResponseFileName(Header[] headers) {
	String filename = null;
	if (headers == null) {
		return null;
	}
	for (Header header : headers) {
		if (StringUtils.equalsIgnoreCase(header.getName(), "Content-Disposition")) {
			String value = header.getValue();
			String key = "filename=";
			int keyLength = key.length();
			int position = StringUtils.indexOfIgnoreCase(header.getValue(), key);
			if (position > -1) {
				filename = StringUtils.substring(value, position + keyLength);
			}
			break;
		}
	}
	return filename;
}
 
Example 6
Project: simm-lib   File: RiskCorrelation.java   View Source Code Vote up 6 votes
public static BigDecimal getSensitivityCorrelation(RiskClass r, Sensitivity si, Sensitivity sk) {
  if (r.equals(RiskClass.COMMODITY)) {
    return cm.getSensitivityCorrelation(si, sk);
  } else if (r.equals(RiskClass.CREDIT_NON_QUALIFYING)) {
    return cnq.getSensitivityCorrelation(si, sk);
  } else if (r.equals(RiskClass.CREDIT_QUALIFYING)
    && StringUtils.equalsIgnoreCase(si.getRiskType(), RiskType.RISK_TYPE_BASE_CORR)
    && StringUtils.equalsIgnoreCase(sk.getRiskType(), RiskType.RISK_TYPE_BASE_CORR)) {
    throw new RuntimeException("called com.acadiasoft.simm.model.risk correlation for base corr sensitvity: " + si + ", " + sk);
  } else if (r.equals(RiskClass.CREDIT_QUALIFYING)) {
    return cq.getSensitivityCorrelation(si, sk);
  } else if (r.equals(RiskClass.EQUITY)) {
    return eq.getSensitivityCorrelation(si, sk);
  } else if (r.equals(RiskClass.FX)) {
    return fx.getSensitivityCorrelation(si, sk);
  } else if (r.equals(RiskClass.INTEREST_RATE)) {
    return ir.getSensitivityCorrelation(si, sk);
  } else {
    throw new RuntimeException("found bad com.acadiasoft.simm.model.risk class: " + r);
  }
}
 
Example 7
Project: vscrawler   File: CovertUtil.java   View Source Code Vote up 6 votes
public static Seed covertRequest(Request request) {
    if (StringUtils.isNotEmpty(request.getMethod()) && !StringUtils.equalsIgnoreCase(request.getMethod(), "get")) {
        log.warn("vscrawler can not support webmagic get method,this request {} will be ignore", request.getUrl());
        return null;
    }
    Seed seed = new Seed(request.getUrl());
    seed.setExt(Maps.transformEntries(request.getExtras(), new Maps.EntryTransformer<String, Object, String>() {
        @Override
        public String transformEntry(String key, Object value) {
            if (value instanceof String) {
                return (String) value;
            }
            return JSONObject.toJSONString(value);
        }
    }));

    return seed;
}
 
Example 8
Project: take   File: SinkFileNode.java   View Source Code Vote up 5 votes
@Override
public void process(PageContext pageContext) {

    MediaType mediaType = pageContext.getMediaType();
    String subtype = mediaType.subtype();
    if (!supportMedia.contains(subtype)) {
        return;
    }
    byte[] body = pageContext.getBody();
    String url = pageContext.getRequest().url().toString();
    String name = DigestUtils.md5Hex(url);
    String path = Take.path;
    File file = new File(path);
    file.mkdirs();
    try {
        if (StringUtils.equalsIgnoreCase(subtype, "html")) {
            LOGGER.info("保存html文件 {} {}", url, name);
            Files.write(pageContext.getHtml(), new File(path, name + ".html"), Charset.forName(pageContext.getCharset()));
        } else if (StringUtils.equalsIgnoreCase(subtype, "jpeg")
                || StringUtils.equalsIgnoreCase(subtype, "png")
                || StringUtils.equalsIgnoreCase(subtype, "gif")
                ) {
            LOGGER.info("保存图片 {} {}", url, name);
            Files.write(body, new File(path, name + "." + subtype));
        }

    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 9
Project: simm-lib   File: EquityCorrelationV2_0.java   View Source Code Vote up 5 votes
@Override
public BigDecimal getSensitivityCorrelation(Sensitivity si, Sensitivity sk) {
  if (StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, si.getBucket()) || StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, sk.getBucket())) {
    return RESIDUAL;
  } else {
    // NOTE: both sensitivities should be in the same bucket, so bi and bk should
    //    be equal
    int i = Integer.valueOf(si.getBucket());
    int k = Integer.valueOf(sk.getBucket());
    return CORRELATIONS[i - 1][k - 1];
  }
}
 
Example 10
Project: patternlab-for-sling   File: PatternPatternCategoryFactoryImpl.java   View Source Code Vote up 5 votes
private List<String> getTemplateDedicatedFiles(String templateName, List<String> jsonDataFiles, List<String> templateNames) {
    final List<String> templateDedicatedDataFiles = Lists.newArrayList();
    for (String jsonDataFile : jsonDataFiles) {
        final String[] jsonDataIds = StringUtils.substringsBetween(jsonDataFile, PatternLabConstants.SELECTOR, PatternLabConstants.SELECTOR);
        if (jsonDataIds == null || jsonDataIds.length == 0) {
            templateDedicatedDataFiles.add(jsonDataFile);
        } else {
            final String jsonDataId = jsonDataIds[0];
            if (StringUtils.equalsIgnoreCase(templateName, jsonDataId) || !templateNames.contains(jsonDataId)) {
                templateDedicatedDataFiles.add(jsonDataFile);
            }
        }
    }
    return templateDedicatedDataFiles;
}
 
Example 11
Project: simm-lib   File: CreditNonQualifyingCorrelationV2_0.java   View Source Code Vote up 5 votes
@Override
public BigDecimal getBucketCorrelation(String bi, String bk) {
  if (StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, bi) || StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, bk)) {
    throw new RuntimeException("called bucket correlation for a residual bucket: " + bi + ", " + bk);
  } else {
    return NON_RESIDUAL_TO_NON_RESIDUAL;
  }
}
 
Example 12
Project: cas-5.1.0   File: DefaultRegisteredServiceMapper.java   View Source Code Vote up 5 votes
/**
 * Parse raw logout type string to {@link LogoutType}.
 *
 * @param logoutType the reg svc
 */
private static LogoutType parseLogoutType(final String logoutType) {
    if (StringUtils.equalsIgnoreCase(logoutType, RegisteredServiceLogoutTypeEditBean.BACK.toString())) {
        return LogoutType.BACK_CHANNEL;
    }
    if (StringUtils.equalsIgnoreCase(logoutType, RegisteredServiceLogoutTypeEditBean.FRONT.toString())) {
        return LogoutType.FRONT_CHANNEL;
    }
    return LogoutType.NONE;
}
 
Example 13
Project: mensa-api   File: TodayResultSupplier.java   View Source Code Vote up 5 votes
@Override
public Optional<DateSearchResult> forTextAndMensa(String text, Mensa mensa) {
    Optional<DateSearchResult> result = Optional.empty();
    if (StringUtils.equalsIgnoreCase(text, messagesService.getMessage(Messages.COMMAND_DATE_TODAY))) {
        LocalDate today = supplier.get();
        if (timeUtils.isOpeningDay(today, mensa)) {
            result = Optional.of(DateSearchResult.of(today, Optional.empty()));
        } else {
            result = Optional.of(DateSearchResult.of(today, Optional.of(timeUtils.nextOpeningDay(today, mensa))));
        }
    }
    return result;
}
 
Example 14
Project: simm-lib   File: RiskCorrelation.java   View Source Code Vote up 5 votes
public static BigDecimal getBaseCorrSensitvityCorrelation(RiskClass r, Sensitivity si, Sensitivity sk) {
  if (r.equals(RiskClass.CREDIT_QUALIFYING)
    && StringUtils.equalsIgnoreCase(si.getRiskType(), RiskType.RISK_TYPE_BASE_CORR)
    && StringUtils.equalsIgnoreCase(sk.getRiskType(), RiskType.RISK_TYPE_BASE_CORR)) {
    return bc.getRiskCorrelation(si, sk);
  } else {
    throw new RuntimeException("called base corr correlation with other com.acadiasoft.simm.model.sensitivity type: " + si + ", " + sk);
  }
}
 
Example 15
Project: simm-lib   File: CreditNonQualifyingCorrelationV2_0.java   View Source Code Vote up 5 votes
@Override
public BigDecimal getSensitivityCorrelation(Sensitivity si, Sensitivity sk) {
  if (StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, si.getBucket()) || StringUtils.equalsIgnoreCase(Sensitivity.RESIDUAL, sk.getBucket())) {
    return RESIDUAL;
  } else if (StringUtils.equals(si.getQualifier(), sk.getQualifier())) {
    return AGGREGATE_SAME;
  } else {
    return AGGREGATE_DIFF;
  }
}
 
Example 16
Project: vscrawler   File: JedisSegmentQueueStore.java   View Source Code Vote up 4 votes
private boolean isNil(String input) {
    return StringUtils.equalsIgnoreCase(input, "nil") || StringUtils.isBlank(input);
}
 
Example 17
Project: scoold   File: LanguageUtils.java   View Source Code Vote up 4 votes
private Map<String, String> readLanguageFromFile(String langCode) {
	if (langCode != null && langCode.length() == 2) {
		Properties lang = new Properties();
		String file = "lang_" + langCode + ".properties";
		InputStream ins = null;
		try {
			ins = LanguageUtils.class.getClassLoader().getResourceAsStream(file);
			if (ins != null) {
				lang.load(ins);
				if (!lang.isEmpty()) {
					int progress = 0;
					Map<String, String> langmap = new TreeMap<String, String>();
					for (String propKey : lang.stringPropertyNames()) {
						String propVal = lang.getProperty(propKey);
						if (!langCode.equals(getDefaultLanguageCode())) {
							String defaultVal = getDefaultLanguage().get(propKey);
							if (!StringUtils.isBlank(propVal) && !StringUtils.equalsIgnoreCase(propVal, defaultVal)) {
								progress++;
							}
						}
						langmap.put(propKey, propVal);
					}
					if (langCode.equals(getDefaultLanguageCode())) {
						progress = langmap.size(); // 100%
					}
					if (progress > 0) {
						updateTranslationProgressMap(langCode, progress);
					}
					return langmap;
				}
			}
		} catch (Exception e) {
			logger.info("Could not read language file " + file + ": ", e);
		} finally {
			try {
				if (ins != null) {
					ins.close();
				}
			} catch (IOException ex) {
				logger.error(null, ex);
			}
		}
	}
	return null;
}
 
Example 18
Project: timesheet-upload   File: RegistrationValidator.java   View Source Code Vote up 4 votes
@Override
public void validate(Object target, Errors errors) {

    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "employeeFirstName", "NotEmpty.registration.fname");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "employeeLastName", "NotEmpty.registration.lname");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "employeeEmailId", "NotEmpty.registration.email");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "empPassword", "NotEmpty.registration.password");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "empPassword2", "NotEmpty.registration.confirm.password");

    Employee employeeRegistration = (Employee) target;

    //Email Validation
    if (!emailValidator.validate(employeeRegistration.getEmployeeEmailId())) {
        errors.rejectValue("employeeEmailId", "NotValid.registration.email");
    } else {
        //Check if the Email Id has a linked account.
        try {
            if (employeeService.checkIfEmployeeIdExists(employeeRegistration.getEmployeeEmailId())) {
                errors.rejectValue("employeeEmailId", "Duplicate.registration.email");
            }
        } catch (Exception ex) {
            log.error("Exception while checking if the email id already exist:: ");
            errors.rejectValue("employeeEmailId", "Error.checking.registration.email");
        }
    }

    if (StringUtils.isNotBlank(employeeRegistration.getEmpPassword())) {
        if (!passwordValidator.validate(employeeRegistration.getEmpPassword())) {
            errors.rejectValue("empPassword", "NotValid.registration.password");
        } else {
            if (!StringUtils.equalsIgnoreCase(employeeRegistration.getEmpPassword(), employeeRegistration.getEmpPassword2())) {
                errors.rejectValue("empPassword2", "NotValid.registration.confirm.password");
            }
        }
    }

    if (!StringUtils.isBlank(employeeRegistration.getEmployeePhone())) {
        String phoneNumber = employeeRegistration.getEmployeePhone().replaceAll("[()-]", "");
        pattern = Pattern.compile(PHONE_PATTERN);
        matcher = pattern.matcher(phoneNumber);
        if (!matcher.matches()) {
            errors.rejectValue("phoneNumber", "NotValid.registration.phoneNum");
        }
    }

}
 
Example 19
Project: elasticsearch-aem   File: ElasticSearchTransportHandler.java   View Source Code Vote up 2 votes
/**
 *
 * @param config
 * @return only accept if the serializationType is "elastic"
 */
@Override
public boolean canHandle(AgentConfig config) {
  return StringUtils.equalsIgnoreCase(config.getSerializationType(), ElasticSearchIndexContentBuilder.NAME);
}
 
Example 20
Project: QiuQiu   File: TableList.java   View Source Code Vote up 2 votes
/**
 * 表名对比方法
 * @param table
 * @param ruleNode
 * @return true:对比通过,需要替换表名
 */
private boolean checkTableName(Table table, RuleNode ruleNode) {
    String queryTable = pattern.matcher(table.getName()).replaceAll("");
    return StringUtils.equalsIgnoreCase(queryTable, ruleNode.sourceTable());
}