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:io.ehdev.json.validation.pojo.validation.JsonValidationEnum.java
@Override public boolean isEntryValid(String inputValue) { if (nullAcceptable && null == inputValue || StringUtils.equalsIgnoreCase("null", inputValue)) return true; return (caseSensitive) ? checkCaseSensitive(inputValue) : checkNonCaseSensitive(inputValue); }
From source file:com.yqboots.initializer.core.builder.excel.MenuItemSheetBuilder.java
@Override protected void formatChecking(final Sheet sheet) { // get the title row Row row = sheet.getRow(0);/*from ww w . j av a 2 s .co m*/ Cell nameCell = row.getCell(0); Cell urlCell = row.getCell(1); Cell menuGroupCell = row.getCell(2); Cell menuItemGroupCell = row.getCell(3); Assert.isTrue(StringUtils.equalsIgnoreCase(nameCell.getStringCellValue(), "name"), "Column 'name' is required"); Assert.isTrue(StringUtils.equalsIgnoreCase(urlCell.getStringCellValue(), "url"), "Column 'URL' is required"); Assert.isTrue(StringUtils.equalsIgnoreCase(menuGroupCell.getStringCellValue(), "Menu Group"), "Column 'Menu Group' is required"); Assert.isTrue(StringUtils.equalsIgnoreCase(menuItemGroupCell.getStringCellValue(), "Menu Item Group"), "Column 'Menu Item Group' is required"); }
From source file:$.ApplicationAction.java
@Action(name = "/{name}/edit", method = HttpMethod.GET) public ActionResult appForm(@ActionParam("name") String name) { ActionResult actionResult = new ActionResult("freemarker", "/view/application/application-form.ftl"); if (!StringUtils.equalsIgnoreCase(name, "-")) { Application app = appManager.getApplicationById(name); actionResult.addToModel("app", app); } else {//from w w w. ja va2s . co m actionResult.addToModel("app", new DefaultApplication()); } return actionResult; }
From source file:com.baifendian.swordfish.common.job.struct.node.impexp.writer.HdfsWriter.java
/** * fieldDelimiter??//from w w w .j a va 2s. co m * * @return */ private boolean checkFieldDelimiter(String fieldDelimiter) { return StringUtils.isNotEmpty(fieldDelimiter) && !StringUtils.equalsIgnoreCase(fieldDelimiter, "\n"); }
From source file:ch.cyberduck.core.shared.DefaultFindFeature.java
@Override public boolean find(final Path file) throws BackgroundException { if (file.isRoot()) { return true; }// ww w . j a va 2s .com try { final AttributedList<Path> list; if (!cache.containsKey(file.getParent())) { list = session.list(file.getParent(), new DisabledListProgressListener()); cache.put(file.getParent(), list); } else { list = cache.get(file.getParent()); } final boolean found = list.contains(file); if (!found) { switch (session.getCase()) { case insensitive: // Find for all matching filenames ignoring case for (Path f : list) { if (!f.getType().equals(file.getType())) { continue; } if (StringUtils.equalsIgnoreCase(f.getName(), file.getName())) { log.warn(String.format("Found matching file %s ignoring case", f)); return true; } } } if (null == file.attributes().getVersionId()) { final IdProvider id = session.getFeature(IdProvider.class); final String version = id.getFileid(file); if (version != null) { return true; } } } return found; } catch (NotfoundException e) { return false; } }
From source file:com.sketchy.server.action.TestHardwareSettings.java
@Override public JSONServletResult execute(HttpServletRequest request) throws Exception { JSONServletResult jsonServletResult = new JSONServletResult(Status.SUCCESS); HardwareControllerProperties oldHardwareControllerProperties = SketchyContext.hardwareControllerProperties; try {//www. ja v a 2 s . c o m String responseBody = getResponseBody(request); HardwareControllerProperties newHardwareControllerProperties = (HardwareControllerProperties) MetaDataObject .fromJson(responseBody); SketchyContext.hardwareControllerProperties = newHardwareControllerProperties; SketchyContext.initializeHardwareController(); String action = request.getParameter("action"); if (StringUtils.equalsIgnoreCase(action, "penUp")) { SketchyContext.hardwareController.penUp(); } else if (StringUtils.equalsIgnoreCase(action, "penDown")) { SketchyContext.hardwareController.penDown(); } else if (StringUtils.equalsIgnoreCase(action, "penCycle")) { for (int idx = 0; idx < 5; idx++) { SketchyContext.hardwareController.penUp(); SketchyContext.hardwareController.penDown(); } } else if (StringUtils.equalsIgnoreCase(action, "leftMotorForward")) { // Using delay of 0, it will be restricted by the Minimum Step Period for the motor SketchyContext.hardwareController.moveMotors(1000, 0, 0); } else if (StringUtils.equalsIgnoreCase(action, "leftMotorBackward")) { // Using delay of 0, it will be restricted by the Minimum Step Period for the motor SketchyContext.hardwareController.moveMotors(-1000, 0, 0); } else if (StringUtils.equalsIgnoreCase(action, "rightMotorForward")) { // Using delay of 0, it will be restricted by the Minimum Step Period for the motor SketchyContext.hardwareController.moveMotors(0, 1000, 0); } else if (StringUtils.equalsIgnoreCase(action, "rightMotorBackward")) { // Using delay of 0, it will be restricted by the Minimum Step Period for the motor SketchyContext.hardwareController.moveMotors(0, -1000, 0); } } catch (Throwable t) { jsonServletResult = new JSONServletResult(Status.ERROR, "Error Saving Hardware Settings! " + t.getMessage()); } finally { SketchyContext.hardwareControllerProperties = oldHardwareControllerProperties; } return jsonServletResult; }
From source file:edu.umn.se.trap.rule.businessrule.GrantAuthorizationRule.java
/** * @param grants, formUser/*from w ww . j av a 2 s . c o m*/ * @throws TrapException */ protected void checkGrantAuthorization(Set<FormGrant> grants, FormUser formUser) throws TrapException { Iterator<FormGrant> grantIter = grants.iterator(); String user = formUser.getUserName(); while (grantIter.hasNext()) { FormGrant grant = grantIter.next(); boolean authorizedFlag = false; String[] authorized = grant.getAuthorizedPayees(); for (int i = 0; i < authorized.length; i++) { if (StringUtils.equalsIgnoreCase(user, authorized[i])) { authorizedFlag = true; } } if (authorizedFlag != true) { throw new TrapException(TrapErrors.USER_NOT_AUTORIZED); } } }
From source file:net.gplatform.sudoor.server.captcha.model.CaptchaEngine.java
/** * //from w w w . j a v a 2 s . co m * @param request * @return */ public boolean validate(HttpServletRequest request) { String captchaFromPage = request.getParameter("_captcha"); HttpSession session = request.getSession(); String captchaFromSession = (String) session.getAttribute(Constants.KAPTCHA_SESSION_KEY); logger.debug("CaptchaValidator: Session ID:{} captchaFromPage:{} captchaFromSession:{}", session.getId(), captchaFromPage, captchaFromSession); if (masterKey.checkWithMasterKey(captchaFromPage)) { return true; } if (StringUtils.equalsIgnoreCase(captchaFromSession, captchaFromPage)) { return true; } return false; }
From source file:core.plugin.mybatis.PageInterceptor.java
@Override public Object intercept(Invocation inv) throws Throwable { // prepare?Connection Connection connection = (Connection) inv.getArgs()[0]; String dbType = connection.getMetaData().getDatabaseProductName(); L.debug(dbType);/* www. j a v a 2 s. co m*/ Dialect dialect = null; if (StringUtils.equalsIgnoreCase("ORACLE", dbType)) { dialect = new OracleDialect(); } else if (StringUtils.equalsIgnoreCase("H2", dbType)) { dialect = new H2Dialect(); } else { throw new AppRuntimeException("A404: Not Support ['" + dbType + "'] Pagination Yet!"); } StatementHandler target = (StatementHandler) inv.getTarget(); BoundSql boundSql = target.getBoundSql(); String sql = boundSql.getSql(); if (StringUtils.isBlank(sql)) { return inv.proceed(); } // ?select?? if (sql.matches(SQL_SELECT_REGEX) && !Pattern.matches(SQL_COUNT_REGEX, sql)) { Object obj = FieldUtils.readField(target, "delegate", true); // ??? RowBounds RowBounds rowBounds = (RowBounds) FieldUtils.readField(obj, "rowBounds", true); // ??SQL if (rowBounds != null && rowBounds != RowBounds.DEFAULT) { FieldUtils.writeField(boundSql, "sql", dialect.getSqlWithPagination(sql, rowBounds), true); // ???(?) FieldUtils.writeField(rowBounds, "offset", RowBounds.NO_ROW_OFFSET, true); FieldUtils.writeField(rowBounds, "limit", RowBounds.NO_ROW_LIMIT, true); } } return inv.proceed(); }
From source file:com.bekwam.resignator.PasswordController.java
@FXML public void ok(ActionEvent evt) { if (logger.isDebugEnabled()) { logger.debug("[OK]"); }// ww w .ja v a 2 s . c om String tmpHash = hashUtils.hash(pfPassword.getText()); if (StringUtils.equalsIgnoreCase(tmpHash, activeConfiguration.getHashedPassword())) { if (logger.isDebugEnabled()) { logger.debug("[OK] password matches"); } exitCode = ExitCodeType.OK; passwordMatches.setValue(true); synchronized (this) { this.notify(); } ((Button) evt.getSource()).getScene().getWindow().hide(); } else { if (logger.isDebugEnabled()) { logger.debug("[OK] password does not match; numretries={}", numRetries); } if (numRetries >= MAX_NUM_RETRIES) { numRetries = 1; // reset the counter exitCode = ExitCodeType.MAX_RETRIES; passwordMatches.setValue(false); synchronized (this) { this.notify(); } ((Button) evt.getSource()).getScene().getWindow().hide(); } else { // allow for another attempt numRetries++; passwordMatches.setValue(false); if (!vboxContents.getChildren().contains(vboxErr)) { vboxContents.getChildren().add(vboxErr); } ((Button) evt.getSource()).getScene().getWindow().sizeToScene(); } } }