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.glaf.jbpm.db.mybatis2.SqlMapContainer.java
public void execute(Connection connection, 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 . j a v a 2s. co m*/ if (connection != null) { 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); } } }
From source file:de.micromata.mgc.application.jetty.JettyServerRunner.java
public void runServer(MgcApplicationWithJettyApplication<?> jettyServer) { try {/*from w ww . ja va 2 s. c o m*/ // TODO RK // System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); // System.out.println(">>> genomehome: " + genomeHome); // System.out.println(">>> url: " + publicUrl); // System.out.println(">>> wardir: " + warDir); // System.out.println("type 'stop' on command line for stopping"); MgcEventRegistries.getEventInstanceRegistry() .registerListener(new AbstractMgcApplicationStartStopListener() { @Override public void onEvent(MgcApplicationStartStopEvent event) { System.out.println(event.getValMessage().getI18nkey()); } }); jettyServer.startImpl(new String[] {}); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); do { String rl = in.readLine(); if (StringUtils.equalsIgnoreCase(rl, "stop") == true) { break; } } while (true); System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); jettyServer.stopAndWait(); } catch (Exception e) { e.printStackTrace(); System.exit(100); } }
From source file:de.adorsys.oauth.authdispatcher.matcher.BasicAuthAuthenticatorMatcher.java
@Override public ValveBase match(HttpServletRequest request, AuthorizationRequest authorizationRequest) { // Real basic auth header if (isBasicAuthentication(request)) { return valve; }// w w w. j a v a2 s . co m // Deals only with POST Requests. So no need to match others. // @See com.nimbusds.oauth2.sdk.TokenRequest.parse(HTTPRequest) if (!StringUtils.equalsIgnoreCase("POST", request.getMethod())) { return null; } try { TokenRequest tokenRequest = TokenRequest.parse(FixedServletUtils.createHTTPRequest(request)); if (tokenRequest.getAuthorizationGrant().getType() == GrantType.PASSWORD) { return valve; } } catch (Exception e) { // ignore silent } return null; }
From source file:edu.umn.se.trap.rule.businessrule.PersonalAndRentalCarRule.java
/** * @param expenses/*from w w w . ja v a2 s . co m*/ * @throws TrapException */ protected void checkCarRentals(List<Expense> expenses) throws TrapException { ArrayList<TransportationExpense> personal = new ArrayList<TransportationExpense>(expenses.size()); ArrayList<TransportationExpense> rental = new ArrayList<TransportationExpense>(expenses.size()); for (Expense expense : expenses) { if (expense.getType().equals(ExpenseType.TRANSPORTATION)) { if (StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(), "Car")) { if (((TransportationExpense) expense).isRental()) { rental.add(((TransportationExpense) expense)); } else { personal.add(((TransportationExpense) expense)); } } } } personal.trimToSize(); rental.trimToSize(); if (rental.size() != 0 && personal.size() != 0) { for (TransportationExpense pcar : personal) { for (TransportationExpense rcar : rental) { if (TrapDateUtil.sameDay(pcar.getDate(), rcar.getDate())) { throw new TrapException(TrapErrors.PERSONAL_RENTAL_CAR); } } } } }
From source file:com.sketchy.server.action.SetDrawingStatus.java
@Override public JSONServletResult execute(HttpServletRequest request) throws Exception { JSONServletResult jsonServletResult = new JSONServletResult(Status.SUCCESS); try {//w w w . ja va2 s. c om DrawingProcessorThread drawingProcessorThread = HttpServer.drawingProccessorThread; if (drawingProcessorThread == null) { throw new Exception("No Drawing Thread Found!"); } String action = request.getParameter("action"); if (StringUtils.equalsIgnoreCase(action, "cancel")) { HttpServer.drawingProccessorThread.cancelDrawing(); } else if (StringUtils.equalsIgnoreCase(action, "pause")) { HttpServer.drawingProccessorThread.pauseDrawing(); } else if (StringUtils.equalsIgnoreCase(action, "resume")) { HttpServer.drawingProccessorThread.resumeDrawing(); } } catch (Throwable t) { jsonServletResult = new JSONServletResult(Status.ERROR, "Error Setting Drawing Status! " + t.getMessage()); } return jsonServletResult; }
From source file:com.navercorp.lucy.security.xss.servletfilter.defender.XssFilterDefender.java
/** * @param value String/*from w w w .java2 s. c o m*/ * @return boolean */ private boolean convertBoolean(String value) { return StringUtils.equalsIgnoreCase(value, "true") ? true : false; }
From source file:com.mgmtp.jfunk.core.mail.MessagePredicates.java
/** * Creates a {@link Predicate} for matching a mail recipient. This Predicate returns true if at least * one recipient matches the given value. * //from w w w. j a v a 2s.c om * @param recipient * the recipient to match * @return the predicate */ public static Predicate<Message> forRecipient(final String recipient) { return new Predicate<Message>() { @Override public boolean apply(final Message input) { Address[] addresses; try { addresses = input.getAllRecipients(); if (addresses == null) { return false; } for (Address address : addresses) { if (StringUtils.equalsIgnoreCase(address.toString(), recipient)) { return true; } } } catch (MessagingException e) { throw new MailException("Error while reading recipients", e); } return false; } @Override public String toString() { return String.format("recipient to include %s", recipient); } }; }
From source file:edu.umn.se.trap.rule.grantrule.NonDodGrantNationalRule.java
/** * @param expense/*from w ww .j a v a 2s .com*/ * @throws TrapException */ private void checkCarRental(Expense expense) throws TrapException { /* * Expense Type: TRANSPORTATION * isRental: true * Transportation Type: CAR * Carrier: National */ if (expense.getType().equals(ExpenseType.TRANSPORTATION) && ((TransportationExpense) expense).isRental() && StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(), "CAR")) { GrantSet grantSet = expense.getEligibleGrants(); if (grantSet == null) { throw new TrapException("Invalid TrapForm object: grantSet was null."); } Set<FormGrant> grants = grantSet.getGrants(); if (grants == null) { throw new TrapException("Invalid TrapForm object: grants was null."); } Iterator<FormGrant> grantIter = grants.iterator(); while (grantIter.hasNext()) { FormGrant grant = grantIter.next(); if (!StringUtils.equalsIgnoreCase(grant.getFundingOrganization(), "DOD") && !StringUtils .equalsIgnoreCase(((TransportationExpense) expense).getCarrier(), "National")) { // Remove the grant if it is NOT a DOD grant and does not // have National as the rental agency. grantSet.removeGrant(grant.getAccountName()); } } } }
From source file:com.willwinder.ugs.nbp.core.services.SettingsChangedNotificationService.java
private void checkForLanguageChangeAndAskForRestart(UGSEvent ugsEvent) { if (ugsEvent.isSettingChangeEvent() && !StringUtils.equalsIgnoreCase(lastSelectedLanguage, backend.getSettings().getLanguage())) { lastSelectedLanguage = backend.getSettings().getLanguage(); Localization.initialize(backend.getSettings().getLanguage()); notifyRestartRequired();/* ww w . j a va2s . c o m*/ } }
From source file:edu.umn.se.trap.rule.businessrule.USCarrierRule.java
/** * @param expenses// www . j a v a 2 s. c o m * @throws TrapException */ protected void checkCarrier(List<Expense> expenses) throws TrapException { for (Expense expense : expenses) { if (expense.getType().equals(ExpenseType.TRANSPORTATION)) { // Check to see that the expense is an AIR type. if (StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(), "AIR")) { // Check to see that the air carrier is a US Carrier. if (checkCarrierString(((TransportationExpense) expense).getCarrier())) { } else { throw new TrapException(TrapErrors.US_CARRIER_ONLY); } } } } }