List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:hydrograph.ui.engine.ui.util.ImportedSchemaPropagation.java
private void validateAllComponents(Container container) { if (container != null) { for (Component component : container.getUIComponentList()) { if (component instanceof SubjobComponent) { String previousValidityStatus = component.getValidityStatus(); component.validateComponentProperties(true); if (StringUtils.equalsIgnoreCase(UIComponentsConstants.ERROR.value(), previousValidityStatus) && StringUtils.equalsIgnoreCase(UIComponentsConstants.VALID.value(), component.getProperties().get(UIComponentsConstants.VALIDITY_STATUS.value()) .toString())) { component.setValidityStatus(UIComponentsConstants.WARN.value()); component.getProperties().put(UIComponentsConstants.VALIDITY_STATUS.value(), UIComponentsConstants.WARN.value()); }/*from w ww . j a va 2 s . c o m*/ } else { component.validateComponentProperties(true); if (StringUtils.equalsIgnoreCase(Constants.TRANSFORM, component.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.AGGREGATE, component.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.NORMALIZE, component.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE, component.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.CUMULATE, component.getComponentName())) { if ((TransformMapping) component.getProperties().get(Constants.OPERATION) != null) { TransformMapping transformMapping = (TransformMapping) component.getProperties() .get(Constants.OPERATION); List<FilterProperties> sortedList = SchemaSyncUtility.INSTANCE .sortOutputFieldToMatchSchemaSequence(convertSchemaToFilterProperty(component), transformMapping); transformMapping.getOutputFieldList().clear(); transformMapping.getOutputFieldList().addAll(sortedList); if (transformMapping.isAllInputFieldsArePassthrough()) { addPassThroughFields(transformMapping, component); updatePassThroughField(transformMapping, component); List<String> passthroughFields = getPassThroughFields( transformMapping.getMapAndPassthroughField()); addPassthroughFieldsToSchema(passthroughFields, component); } } } } } } }
From source file:info.magnolia.cms.security.MgnlUser.java
/** * adds a new node under specified node collection *///from ww w .j a va 2 s .c om private void add(String name, String nodeName) { try { HierarchyManager hm; if (StringUtils.equalsIgnoreCase(nodeName, NODE_ROLES)) hm = MgnlContext.getHierarchyManager(ContentRepository.USER_ROLES); else hm = MgnlContext.getHierarchyManager(ContentRepository.USER_GROUPS); if (!this.hasAny(name, nodeName)) { Content node = userNode.getContent(nodeName); // add corresponding ID try { String value = hm.getContent("/" + name).getUUID(); // assuming that there is a flat hierarchy // used only to get the unique label HierarchyManager usersHM = ContentRepository.getHierarchyManager(ContentRepository.USERS); String newName = Path.getUniqueLabel(usersHM, node.getHandle(), "0"); node.createNodeData(newName).setValue(value); userNode.save(); } catch (PathNotFoundException e) { if (log.isDebugEnabled()) log.debug("Role [ " + name + " ] does not exist in the ROLES repository"); } } } catch (RepositoryException e) { log.error("failed to add " + name + " to user [" + this.getName() + "]", e); } }
From source file:com.thistech.spotlink.engine.AbstractPlacementDecisionEngine.java
/** * Fill a single PlacementOpportunity, removing Ads from the list of ads as they are used. <br/> * @param placementRequest The original PlacementRequest. * @param placementOpportunity The PlacementOpportunity to fill. * @param ads The list of Ads.// w w w. j ava2 s.co m * @return The PlacementsDecision */ protected PlacementDecisionType fillPlacementOpportunity(PlacementRequestType placementRequest, PlacementOpportunityType placementOpportunity, List<Ad> ads) { PlacementDecisionBuilder placementDecisionBuilder = new PlacementDecisionBuilder(placementOpportunity); for (PlacementControlType placementControl : placementOpportunity.getPlacementControl()) { Ad ad = null; if (!StringUtils.equalsIgnoreCase(placementControl.getAction(), "delete")) { ad = (Ad) ListUtil.pop(ads); } if (ad != null) { saveTrackingEvents(ad.getTrackingEvents()); } placementDecisionBuilder.withPlacement(buildPlacement(placementRequest, placementControl, ad)); } return placementDecisionBuilder.build(); }
From source file:hydrograph.ui.graph.editor.JobDeleteParticipant.java
private boolean deleteCorrospondingXmlAndJobFileifUserDeletePropertyFile(IProject iProject) { if (StringUtils.equalsIgnoreCase(modifiedResource.getParent().getName(), Messages.PARAM)) { IFolder jobsFolder = iProject.getFolder(CustomMessages.ProjectSupport_JOBS); if (jobsFolder != null) { setJobFileAndXmlFile(jobsFolder); }//w w w . j a v a2 s. c o m String message = getErrorMessageIfUserDeletePropertyRelatedFiles(jobIFile, xmlIFile); showErrorMessage(jobIFile, xmlIFile, Messages.bind(message, modifiedResource.getName())); } return flag; }
From source file:gov.nih.nci.ncicb.tcga.dcc.dam.webservice.WSFilterAdapter.java
/** * process one center to be added to the filter * * @param center/*from www . ja v a 2 s.co m*/ * @param platFormTypeC * @return valid center id string */ protected String processCenter(final String center, final String platFormTypeC) { //added this check to disallow values for clinical type if (StringUtils.equalsIgnoreCase(platFormTypeC, NonplatformType.NONPLATFORMTYPE_CLINICAL.getAssociatedPseudoPlatformType())) { throw new WebApplicationException(WebServiceUtil.getStatusResponse(HttpStatusCode.PRECONDITION_FAILED, "Center cannot be specified with clinical data type")); } try { return "" + Integer.parseInt(center); } catch (NumberFormatException e) { //The platform must be set to be able to select the correct center if (StringUtils.isBlank(platform)) { throw new WebApplicationException(WebServiceUtil .getStatusResponse(HttpStatusCode.PRECONDITION_FAILED, "The platform must be set.")); } final List<Map<String, Object>> centers = (List<Map<String, Object>>) DAMUtils.getInstance() .getAllCenters(); boolean centerMatchFound = false; boolean platformMatchFound = false; for (final String platformAlias : parseValue(platform)) { final Platform platform = DAMUtils.getInstance().getPlatformWithAlias(platformAlias); final String platformCenterType = platform.getCenterType(); final Iterator<Map<String, Object>> centerMapIterator = centers.iterator(); while (centerMapIterator.hasNext()) { final Map<String, Object> centerMap = centerMapIterator.next(); if (damWSUtil.hasValueIgnoreCase(centerMap, center)) { centerMatchFound = true; if (damWSUtil.hasValueIgnoreCase(centerMap, platformCenterType)) { return centerMap.get(CENTER_ID).toString(); } } } } if (!centerMatchFound) { throw new WebApplicationException(WebServiceUtil.getStatusResponse( HttpStatusCode.PRECONDITION_FAILED, "Center '" + center + "' is unknown.")); } if (!platformMatchFound) { throw new WebApplicationException( WebServiceUtil.getStatusResponse(HttpStatusCode.PRECONDITION_FAILED, "Center '" + center + "' does not support the platform '" + trimFirstAndLastComma(platform) + "'.")); } } return ""; }
From source file:fr.paris.lutece.portal.web.search.SearchApp.java
/** * Returns search results// w w w . j av a 2s .co m * * @param request The HTTP request. * @param nMode The current mode. * @param plugin The plugin * @return The HTML code of the page. * @throws SiteMessageException If an error occurs */ @Override public XPage getPage(HttpServletRequest request, int nMode, Plugin plugin) throws SiteMessageException { XPage page = new XPage(); String strQuery = request.getParameter(PARAMETER_QUERY); String strTagFilter = request.getParameter(PARAMETER_TAG_FILTER); String strEncoding = AppPropertiesService.getProperty(PROPERTY_ENCODE_URI_ENCODING, DEFAULT_URI_ENCODING); if (StringUtils.equalsIgnoreCase(CONSTANT_HTTP_METHOD_GET, request.getMethod()) && !StringUtils.equalsIgnoreCase(strEncoding, CONSTANT_ENCODING_UTF8)) { try { if (StringUtils.isNotBlank(strQuery)) { strQuery = new String(strQuery.getBytes(strEncoding), CONSTANT_ENCODING_UTF8); } if (StringUtils.isNotBlank(strTagFilter)) { strTagFilter = new String(strTagFilter.getBytes(strEncoding), CONSTANT_ENCODING_UTF8); } } catch (UnsupportedEncodingException e) { AppLogService.error(e.getMessage(), e); } } if (StringUtils.isNotEmpty(strTagFilter)) { strQuery = strTagFilter; } boolean bEncodeUri = Boolean.parseBoolean( AppPropertiesService.getProperty(PROPERTY_ENCODE_URI, Boolean.toString(DEFAULT_ENCODE_URI))); String strSearchPageUrl = AppPropertiesService.getProperty(PROPERTY_SEARCH_PAGE_URL); String strError = ""; Locale locale = request.getLocale(); // Check XSS characters if ((strQuery != null) && (SecurityUtil.containsXssCharacters(request, strQuery))) { strError = I18nService.getLocalizedString(MESSAGE_INVALID_SEARCH_TERMS, locale); strQuery = ""; } String strNbItemPerPage = request.getParameter(PARAMETER_NB_ITEMS_PER_PAGE); String strDefaultNbItemPerPage = AppPropertiesService.getProperty(PROPERTY_RESULTS_PER_PAGE, DEFAULT_RESULTS_PER_PAGE); strNbItemPerPage = (strNbItemPerPage != null) ? strNbItemPerPage : strDefaultNbItemPerPage; int nNbItemsPerPage = Integer.parseInt(strNbItemPerPage); String strCurrentPageIndex = request.getParameter(PARAMETER_PAGE_INDEX); strCurrentPageIndex = (strCurrentPageIndex != null) ? strCurrentPageIndex : DEFAULT_PAGE_INDEX; SearchEngine engine = (SearchEngine) SpringContextService.getBean(BEAN_SEARCH_ENGINE); List<SearchResult> listResults = engine.getSearchResults(strQuery, request); // The page should not be added to the cache // Notify results infos to QueryEventListeners notifyQueryListeners(strQuery, listResults.size(), request); UrlItem url = new UrlItem(strSearchPageUrl); String strQueryForPaginator = strQuery; if (bEncodeUri) { strQueryForPaginator = encodeUrl(request, strQuery); } if (StringUtils.isNotBlank(strTagFilter)) { strQuery = ""; } url.addParameter(PARAMETER_QUERY, strQueryForPaginator); url.addParameter(PARAMETER_NB_ITEMS_PER_PAGE, nNbItemsPerPage); Paginator<SearchResult> paginator = new Paginator<SearchResult>(listResults, nNbItemsPerPage, url.getUrl(), PARAMETER_PAGE_INDEX, strCurrentPageIndex); Map<String, Object> model = new HashMap<String, Object>(); model.put(MARK_RESULTS_LIST, paginator.getPageItems()); model.put(MARK_QUERY, strQuery); model.put(MARK_PAGINATOR, paginator); model.put(MARK_NB_ITEMS_PER_PAGE, strNbItemPerPage); model.put(MARK_ERROR, strError); ISponsoredLinksSearchService sponsoredLinksService = new SponsoredLinksSearchService(); if (sponsoredLinksService.isAvailable()) { model.put(MARK_SPONSOREDLINKS_SET, sponsoredLinksService.getHtmlCode(strQuery, locale)); } model.put(MARK_LIST_TYPE_AND_LINK, SearchService.getSearchTypesAndLinks()); model.putAll(SearchParameterHome.findAll()); HtmlTemplate template = AppTemplateService.getTemplate(TEMPLATE_RESULTS, locale, model); page.setPathLabel(I18nService.getLocalizedString(PROPERTY_PATH_LABEL, locale)); page.setTitle(I18nService.getLocalizedString(PROPERTY_PAGE_TITLE, locale)); page.setContent(template.getHtml()); return page; }
From source file:hydrograph.ui.propertywindow.widgets.utility.SchemaRowValidation.java
private void validationCheckForBigDecimalAndDateDatatype(GridRow gridRow, String componentType, TableItem tableItem) {//from w w w . ja va2 s. c o m if (StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(), JAVA_MATH_BIG_DECIMAL)) { validationCheckForBigDecimalDatatype(gridRow, componentType, tableItem); } else if (StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(), JAVA_UTIL_DATE)) { validationCheckForDateDatatype(gridRow, tableItem); } else { setBlackColor(tableItem); } }
From source file:hydrograph.ui.validators.impl.AdditionalParamDBValidationRule.java
private boolean validateAdditionalParam(Map<String, String> additionalParam, String errorMessage, String propertyName) {/* w w w . j a va2 s .c o m*/ boolean isValid = false; for (String key : additionalParam.keySet()) { if (StringUtils.equalsIgnoreCase(key, Constants.ADDITIONAL_PARAMETERS_FOR_DB) && StringUtils.isNotBlank(additionalParam.get(Constants.ADDITIONAL_PARAMETERS_FOR_DB))) { Matcher matchs = Pattern.compile(Constants.DB_REGEX).matcher(additionalParam.get(key)); isValid = validateNumericField(additionalParam.get(key), propertyName, errorMessage, matchs); if (!isValid) { break; } } else { isValid = true; } } return isValid; }
From source file:edu.txstate.dmlab.clusteringwiki.cluster.ClusterEditor.java
/** * Get child cluster JSON structure from parent JSON cluster structure * given label of child cluster//from w ww . ja v a 2 s .co m * @param cluster * @param label * @return */ protected JSONObject getChildCluster(JSONObject cluster, String label) { try { JSONArray children = cluster.getJSONArray("children"); for (int i = 0; i < children.length(); i++) { String l = children.getJSONObject(i).getString("label"); if (StringUtils.equalsIgnoreCase(l.trim(), label)) return children.getJSONObject(i); } return null; } catch (JSONException e) { return null; } }
From source file:hydrograph.ui.engine.converter.impl.FTPConverterHelper.java
/** * file operation details/*from ww w.j av a 2 s .c o m*/ * @param ftp */ private void addFtpOperationDetails(FTP ftp) { if (properties.get("operation") != null) { if (!properties.get("operation").equals("")) { Map<String, FTPAuthOperationDetails> fileOperationDetaildetails = (Map<String, FTPAuthOperationDetails>) properties .get(PropertyNameConstants.FTP_OPERATION.value()); FileOperationChoice fileOperationChoice = new FileOperationChoice(); FTPAuthOperationDetails authOperationDetails = null; if (fileOperationDetaildetails != null && !fileOperationDetaildetails.isEmpty()) { for (Map.Entry<String, FTPAuthOperationDetails> map : fileOperationDetaildetails.entrySet()) { authOperationDetails = map.getValue(); if (StringUtils.equalsIgnoreCase(map.getKey(), Constants.GET_FILE)) { fileOperationChoice.setDownload(map.getKey()); ftp.setInputFilePath(authOperationDetails.getField2()); ftp.setOutputFilePath(authOperationDetails.getField1()); ftp.setOverwritemode(authOperationDetails.getField5()); } else { fileOperationChoice.setUpload(map.getKey()); ftp.setInputFilePath(authOperationDetails.getField1()); ftp.setOutputFilePath(authOperationDetails.getField2()); } } ftp.setFileOperation(fileOperationChoice); } } } }