List of usage examples for org.apache.commons.lang3 StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr)
Checks if CharSequence contains a search CharSequence irrespective of case, handling null .
From source file:org.cybercat.automation.components.VisibleTextField.java
@Override public void initWebElement(final Browser browser, final String text) throws PageObjectException { if (getState().equals(ElementState.CREATED)) { try {//from w ww. ja v a 2 s . c om processor.initWebElementByCriteria(browser, new AbstractCriteria<List<WebElement>>(path) { @Override public ExpectedCondition<List<WebElement>> getExpectedCondition(String path) { return ExpectedConditions.presenceOfAllElementsLocatedBy(processor.getByElement(path)); } @Override public boolean onSuccess(List<WebElement> elements, String path) { for (WebElement thisElement : elements) { String innerText = (String) browser.executeScript("return arguments[0].textContent", thisElement); System.out.println(thisElement.toString() + " +++ " + innerText + " +++ " + text); if (StringUtils.containsIgnoreCase(innerText, text)) { setActualPath(path); setElement(thisElement); setState(ElementState.INITIALIZED); if (getElement().isDisplayed()) { browser.highlightElement(getElement()); return true; } } } return false; } }); } catch (Exception e) { log.error("element \"" + name + "\" is not found "); throw new PageObjectException("element \"" + name + "\" is not found by text: \"" + text + "\"", e); } if (getElement() == null) throw new PageObjectException("element \"" + name + "\" is not found."); if (!waitPresent()) throw new PageObjectException( "\"" + getName() + "\" element is not visible by path " + getActualPath()); } //TODO: ???!!! super.initWebElement(browser, text); }
From source file:org.cybercat.automation.PersistenceManager.java
/** * Loads and returns all objects of defined type * /*from w w w. ja v a2 s .c o m*/ * @param clazz * - type of bins returned * @throws PageModelException */ @SuppressWarnings("unchecked") public <T extends Entity> List<T> load(Class<T> clazz) throws PageModelException { try { File[] files = createFileList(clazz); List<T> entries = new ArrayList<T>(); for (int i = 0; i < files.length; i++) { if (StringUtils.containsIgnoreCase(files[i].getAbsolutePath(), ".xml")) { entries.add((T) createUnmarshaller(clazz).unmarshal(files[i])); } } return entries; } catch (Exception e) { throw new PageModelException(e); } }
From source file:org.debux.webmotion.server.tools.HttpUtils.java
/** * @return true if webmotion in Tomcat container. *///from ww w. j a v a 2 s. c o m public static boolean isTomcatContainer(ServletContext context) { String serverInfo = context.getServerInfo(); return StringUtils.containsIgnoreCase(serverInfo, "tomcat"); }
From source file:org.debux.webmotion.server.tools.HttpUtils.java
/** * @return true if webmotion in Glassfish container. *//*from w ww . j a v a2 s . c o m*/ public static boolean isGlassfishContainer(ServletContext context) { String serverInfo = context.getServerInfo(); return StringUtils.containsIgnoreCase(serverInfo, "glassfish"); }
From source file:org.debux.webmotion.server.tools.HttpUtils.java
/** * @return true if webmotion in Jetty container. *//* w ww . j a v a 2 s . c o m*/ public static boolean isJettyContainer(ServletContext context) { String serverInfo = context.getServerInfo(); return StringUtils.containsIgnoreCase(serverInfo, "jetty"); }
From source file:org.efaps.ui.wicket.models.field.factories.HRefFactory.java
/** * Checks if is a check out.//from www . j a v a2 s .co m * * @param _uiField the _ui field * @return true, if is check out */ private boolean isCheckOut(final AbstractUIField _uiField) { return StringUtils.containsIgnoreCase(_uiField.getFieldConfiguration().getField().getReference(), HRef.CHECKOUT.toString()); }
From source file:org.egov.ptis.actions.create.CreatePropertyAction.java
private void showCalculateTaxButton() { if (StringUtils.containsIgnoreCase(userDesignationList, REVENUE_INSPECTOR_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT) || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT) || SOURCE_ONLINE.equalsIgnoreCase(applicationSource)) showTaxCalcBtn = Boolean.TRUE; }
From source file:org.egov.ptis.actions.create.CreatePropertyAction.java
@SkipValidation @Action(value = "/createProperty-forward") public String forward() { String loggedInUserDesignation = ""; if (property.getState() != null) { final List<Assignment> loggedInUserAssign = assignmentService.getAssignmentByPositionAndUserAsOnDate( property.getCurrentState().getOwnerPosition().getId(), securityUtils.getCurrentUser().getId(), new Date()); loggedInUserDesignation = !loggedInUserAssign.isEmpty() ? loggedInUserAssign.get(0).getDesignation().getName() : null;// www . j av a2 s . c om } final Assignment wfInitiator = getWorkflowInitiator(loggedInUserDesignation); if (WFLOW_ACTION_STEP_REJECT.equalsIgnoreCase(workFlowAction) && wfInitiator == null) { if (propertyTaxCommonUtils.isRoOrCommissioner(loggedInUserDesignation)) addActionError(getText(REJECT_ERROR_INITIATOR_INACTIVE, Arrays.asList(REVENUE_INSPECTOR_DESGN))); else addActionError(getText(REJECT_ERROR_INITIATOR_INACTIVE, Arrays.asList(JUNIOR_ASSISTANT + "/" + SENIOR_ASSISTANT))); return mode.equalsIgnoreCase(EDIT) ? RESULT_NEW : RESULT_VIEW; } else if (WFLOW_ACTION_STEP_REJECT.equalsIgnoreCase(workFlowAction) && propService.getWorkflowInitiator(property) == null) { addActionError(getText(REJECT_ERROR_INITIATOR_INACTIVE, Arrays.asList(JUNIOR_ASSISTANT + "/" + SENIOR_ASSISTANT))); return mode.equalsIgnoreCase(EDIT) ? RESULT_NEW : RESULT_VIEW; } if (multipleSubmitCondition(property, approverPositionId)) { return multipleSubmitRedirect(); } if (mode.equalsIgnoreCase(EDIT) && !WFLOW_ACTION_STEP_REJECT.equalsIgnoreCase(workFlowAction)) { validate(); if (hasErrors() && (StringUtils.containsIgnoreCase(userDesignationList, REVENUE_INSPECTOR_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT) || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT))) { showTaxCalcBtn = Boolean.TRUE; setAllowEditDocument(Boolean.TRUE); return RESULT_NEW; } else if (hasErrors()) return RESULT_NEW; updatePropertyDetails(); try { propService.createDemand(property, basicProp.getPropOccupationDate()); } catch (final TaxCalculatorExeption e) { addActionError(getText(UNIT_RATE_ERROR)); logger.error("forward : There are no Unit rates defined for chosen combinations", e); return RESULT_NEW; } } else { validateApproverDetails(); if (hasErrors()) return RESULT_VIEW; } if (!WFLOW_ACTION_STEP_REJECT.equalsIgnoreCase(workFlowAction)) transitionWorkFlow(property); if (WFLOW_ACTION_STEP_APPROVE.equalsIgnoreCase(workFlowAction)) return approve(); else if (WFLOW_ACTION_STEP_REJECT.equalsIgnoreCase(workFlowAction)) { transitionWorkFlow(property); return reject(); } basicProp.setUnderWorkflow(true); basicPropertyService.applyAuditing(property.getState()); if (SOURCE_SURVEY.equalsIgnoreCase(property.getSource())) { SurveyBean surveyBean = new SurveyBean(); surveyBean.setProperty(property); if (StringUtils.containsIgnoreCase(userDesignationList, REVENUE_INSPECTOR_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT) || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT)) { BigDecimal totalTax = propService.getSurveyTax(property, new Date()); surveyBean.setApplicationTax(totalTax); GisDetails gisDetails = property.getGisDetails(); if (gisDetails != null) { gisDetails.setPropertyZone(basicProp.getPropertyID().getZone()); gisDetails.setApplicationTax(totalTax); GisAuditDetails auditDetails = new GisAuditDetails(gisDetails); gisDetails.addAuditDetails(auditDetails); } } if (property.getCurrentState().getValue().toUpperCase() .endsWith(WF_STATE_REVENUE_OFFICER_APPROVED.toUpperCase())) { BigDecimal surveyVariance = propertyTaxUtil.getTaxDifferenceForGIS(property); property.setSurveyVariance(surveyVariance); if (surveyVariance.compareTo(BigDecimal.TEN) > 0 && !property.isThirdPartyVerified()) { noticeService.generateComparisonNotice(property); property.setSentToThirdParty(true); surveyBean.setProperty(property); } } propertySurveyService.updateSurveyIndex(APPLICATION_TYPE_NEW_ASSESSENT, surveyBean); } basicProp.addProperty(property); propService.updateIndexes(property, APPLICATION_TYPE_NEW_ASSESSENT); if (Source.CITIZENPORTAL.toString().equalsIgnoreCase(property.getSource())) propService.updatePortal(property, APPLICATION_TYPE_NEW_ASSESSENT); basicPropertyService.persist(basicProp); setDocNumber(getDocNumber()); setApplicationNoMessage(" with application number : "); return RESULT_ACK; }
From source file:org.egov.ptis.actions.modify.AmalgamationAction.java
private boolean checkDesignationsForView() { return StringUtils.containsIgnoreCase(userDesignationList, BILL_COLLECTOR_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, TAX_COLLECTOR_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, COMMISSIONER_DESGN) || StringUtils.containsIgnoreCase(userDesignationList, REVENUE_OFFICER_DESGN); }
From source file:org.egov.ptis.actions.modify.AmalgamationAction.java
private boolean checkDesignationsForEdit() { return StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT) || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT) || getModel().getState().getNextAction() != null && getModel().getState().getNextAction() .equalsIgnoreCase(WF_STATE_UD_REVENUE_INSPECTOR_APPROVAL_PENDING); }