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.cognifide.aet.job.common.collectors.screen.ScreenCollector.java
private boolean isPatternAndResultMD5Identical(byte[] screenshot) { if (properties.getPatternId() != null) { final String screenshotMD5 = DigestUtils.md5Hex(screenshot); final String patternMD5 = artifactsDAO.getArtifactMD5(properties, properties.getPatternId()); return StringUtils.equalsIgnoreCase(patternMD5, screenshotMD5); } else {/* w ww .ja v a 2s . com*/ return false; } }
From source file:net.noday.core.security.ShiroDbRealm.java
/** * ?,.//from w ww .ja va 2s. c o m */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { if (authcToken instanceof CaptchaUsernamePasswordToken) { setCredentialsMatcher(hashedCredentialsMatcher); CaptchaUsernamePasswordToken token = (CaptchaUsernamePasswordToken) authcToken; String captcha = null; // Object s_count = getSession().getAttribute(LOGINFAILEDCOUNTKEY); Object s_captcha = getSession().getAttribute(Captcha.CAPTCHAKEY); if (s_captcha != null && s_captcha instanceof String) { captcha = (String) s_captcha; } if (!StringUtils.equalsIgnoreCase(captcha, token.getCaptcha())) { throw new IncorrectCaptchaException("??"); } Loginable<Long> user = service.findUserByLoginName(token.getUsername()); if (user != null) { return new SimpleAuthenticationInfo( new ShiroUser(user.getId(), user.getLoginName(), user.getName()), // ?User? user.getPassword(), ByteSource.Util.bytes(Base64.decode(user.getSalt())), getName()); } } else { setCredentialsMatcher(allowAllCredentialsMatcher); UsernamePasswordToken token = (UsernamePasswordToken) authcToken; // TODO ? ?token Loginable<Long> user = service.findUserByLoginName(token.getUsername()); return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getLoginName(), user.getName()), user.getPassword(), getName()); } return null; }
From source file:com.antonjohansson.svncommit.core.domain.ModifiedItem.java
/** * Gets whether or not this item can be replicated. * * @return Returns {@code true} if this item can be replicated. *//* w w w .j a v a2 s . com*/ public boolean canReplicate() { String extension = FilenameUtils.getExtension(fileNameProperty.getValue()); return StringUtils.equalsIgnoreCase(extension, "SQL"); }
From source file:com.github.sdbg.core.DartCoreDebug.java
/** * @return <code>true</code> if option has "expected" value. *//*from w w w . j a v a 2 s.c o m*/ private static boolean isOptionValue(String optionSuffix, String expected) { //&&&String option = DartCore.PLUGIN_ID + "/" + optionSuffix; String option = SDBGDebugCorePlugin.PLUGIN_ID + "/" + optionSuffix; String value = Platform.getDebugOption(option); if (value == null) { value = DartCore.getUserDefinedProperty(option); } return StringUtils.equalsIgnoreCase(value, expected); }
From source file:com.glaf.dts.domain.TransformExcecution.java
public boolean isSuccessful() { if (StringUtils.equalsIgnoreCase(success, "1") || StringUtils.equalsIgnoreCase(success, "Y") || StringUtils.equalsIgnoreCase(success, "true")) { return true; }//from w w w . j ava 2 s.co m return false; }
From source file:com.liveneo.plat.web.action.DownloadAction.java
public InputStream getInputStream() throws UnsupportedEncodingException, FileNotFoundException { // attachment,?,??;inline,??,? String file = ""; if (StringUtils.equalsIgnoreCase(loadflag, "restore")) { file = CreateXml.backuptarget + fileName + ".zip"; }//from w ww . j av a2s .c om if (StringUtils.equalsIgnoreCase(loadflag, "excel")) { file = getServletContext().getRealPath("/WEB-INF/pages/template/" + fileName); } if (StringUtils.equalsIgnoreCase(loadflag, "recording")) { HttpURLConnection connection = null; try { URL url = new URL(fileName); connection = (HttpURLConnection) url.openConnection(); connection.connect(); // BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); this.getResponse().setHeader("application/x-msdownload", "attachment;file=" + java.net.URLEncoder.encode(file, "UTF-8")); return new BufferedInputStream(connection.getInputStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // System.out.println(getServletContext().getRealPath("/noneccrecord/ivrvoice/")+"/"+StringUtils.substringAfter(fileName, "/opt/AppServer/tomcat/webapps/noneccrecord/ivrvoice/")); // file="D:/apache-tomcat-6.0.35/webapps/npworkplat/noneccrecord/ivrvoice/file1680475804236541293_ivrvoice.wav"; } if (StringUtils.equalsIgnoreCase(loadflag, "license")) { file = fileName; } if (StringUtils.equalsIgnoreCase(loadflag, "wo")) { WorkOrderAction w = new WorkOrderAction(); List<Workorder> ws = new ArrayList<Workorder>(); ws = (List<Workorder>) this.getSession().getAttribute(sessionname); if (ws.size() > 0) { this.createWorkorderExcel(getServletContext().getRealPath("/excel/wo_info.xls"), ws, "??"); } file = getServletContext().getRealPath("/excel/") + "/" + fileName; System.out.println("file:" + file); } // if (StringUtils.equalsIgnoreCase(loadflag, "report")) { String title = this.getRequest().getParameter("title"); title = java.net.URLDecoder.decode(title, "UTF-8"); title = java.net.URLDecoder.decode(title, "UTF-8"); String tvalue = this.getRequest().getParameter("tvalue"); // String[] titles = title.split(","); //?trtd List<List<String>> tds = new ArrayList<List<String>>(); String[] tr = tvalue.split(";"); for (int j = 0; j < tr.length; j++) { List<String> td = new ArrayList<String>(); String[] fields = tr[j].split(","); for (String v : fields) { if (v == null) { v = ""; } td.add(v); } tds.add(td); } //?excel ExcelUtils.exportExcel(getServletContext().getRealPath("/excel/") + "/" + fileName, titles, tds); file = getServletContext().getRealPath("/excel/") + "/" + fileName; } //? if (StringUtils.equalsIgnoreCase(loadflag, "commonexcel")) { String title = this.getRequest().getParameter("title"); title = java.net.URLDecoder.decode(title, "UTF-8"); title = java.net.URLDecoder.decode(title, "UTF-8"); // String[] titles = title.split(","); //?trtd List<List<String>> tds = new ArrayList<List<String>>(); tds = (List<List<String>>) this.getSession().getAttribute(sessionname); //?excel ExcelUtils.exportExcel(getServletContext().getRealPath("/excel/") + "/" + fileName, titles, tds); file = getServletContext().getRealPath("/excel/") + "/" + fileName; } this.getResponse().setHeader("application/x-msdownload", "attachment;file=" + java.net.URLEncoder.encode(file, "UTF-8")); // fileName? return new BufferedInputStream(new FileInputStream(file)); }
From source file:com.glaf.core.db.mybatis2.SqlMapContainer.java
public void execute(String dataSourceName, String statementId, String operation, Map<String, Object> params) throws Exception { if (LogUtils.isDebug()) { logger.debug("execute sqlmap:" + statementId); logger.debug("params:" + params); }//from w w w . ja va2 s .c o m Connection connection = null; try { connection = DBConnectionFactory.getConnection(dataSourceName); getEntityDAO().setConnection(connection); if (StringUtils.equalsIgnoreCase("insert", operation)) { getEntityDAO().insert(statementId, params); } else if (StringUtils.equalsIgnoreCase("update", operation)) { getEntityDAO().update(statementId, params); } else if (StringUtils.equalsIgnoreCase("delete", operation)) { getEntityDAO().delete(statementId, params); } } catch (Exception ex) { throw new RuntimeException(ex); } finally { JdbcUtils.close(connection); } }
From source file:com.glaf.core.dao.MyBatisEntityDAO.java
public void executeBatch(List<SqlExecutor> sqlExecutors) { for (SqlExecutor sqlExecutor : sqlExecutors) { String statementId = sqlExecutor.getStatementId(); String operation = sqlExecutor.getOperation(); Object parameter = sqlExecutor.getParameter(); if (StringUtils.equalsIgnoreCase("insert", operation)) { getSqlSession().insert(statementId, parameter); } else if (StringUtils.equalsIgnoreCase("update", operation)) { getSqlSession().update(statementId, parameter); } else if (StringUtils.equalsIgnoreCase("delete", operation)) { getSqlSession().delete(statementId, parameter); }//from w w w . j a v a 2s.c om } }
From source file:gobblin.data.management.version.finder.DatePartitionHiveVersionFinder.java
public DatePartitionHiveVersionFinder(FileSystem fs, Config config) { this.pattern = ConfigUtils.getString(config, PARTITION_VALUE_DATE_TIME_PATTERN_KEY, DEFAULT_PARTITION_VALUE_DATE_TIME_PATTERN); if (config.hasPath(PARTITION_VALUE_DATE_TIME_TIMEZONE_KEY)) { this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(config.getString(PARTITION_VALUE_DATE_TIME_TIMEZONE_KEY))); } else {//from w w w.j av a2 s . c om this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(DEFAULT_PARTITION_VALUE_DATE_TIME_TIMEZONE)); } this.partitionKeyName = ConfigUtils.getString(config, PARTITION_KEY_NAME_KEY, DEFAULT_PARTITION_KEY_NAME); this.partitionKeyNamePredicate = new Predicate<FieldSchema>() { @Override public boolean apply(FieldSchema input) { return StringUtils.equalsIgnoreCase(input.getName(), DatePartitionHiveVersionFinder.this.partitionKeyName); } }; }
From source file:com.adobe.cq.wcm.core.components.internal.form.FormStructureHelperImpl.java
private boolean isButtonElement(Resource resource) { if (resource.isResourceType(FormConstants.RT_CORE_FORM_BUTTON_V1) || resource.isResourceType(FormConstants.RT_CORE_FORM_BUTTON_V2)) { ValueMap valueMap = resource.adaptTo(ValueMap.class); if (valueMap != null) { String type = valueMap.get("type", String.class); if (StringUtils.equalsIgnoreCase(Button.Type.SUBMIT.name(), type)) { return true; }/*from w w w . j a v a 2 s . c o m*/ } } return false; }