List of usage examples for org.apache.commons.lang StringUtils remove
public static String remove(String str, char remove)
Removes all occurrences of a character from within the source string.
From source file:com.hangum.tadpole.mongodb.erd.core.relation.RelationUtil.java
/** * ?? .// w ww .j a v a 2s .c om * * @param userDB * @param mapDBTables * @param db * @throws Exception */ public static void calRelation(UserDBDAO userDB, Map<String, Table> mapDBTables, DB db) throws Exception { List<ReferencedTableDAO> listRealRefTableDAO = new ArrayList<ReferencedTableDAO>(); Set<String> keySet = mapDBTables.keySet(); for (String keyTable : keySet) { Table table = mapDBTables.get(keyTable); EList<Column> listColumn = table.getColumns(); for (Column column : listColumn) { String strField = column.getField(); if (MongodbUtils.isReferenceKey(column.getType(), strField)) { ReferencedTableDAO refTableDao = new ReferencedTableDAO(); refTableDao.setTable_name(table.getName()); refTableDao.setColumn_name(strField); refTableDao.setReferenced_table_name(StringUtils.remove(strField, "_id")); refTableDao.setReferenced_column_name(strField); refTableDao.setConstraint_name(strField); listRealRefTableDAO.add(refTableDao); } } } calRelation(userDB, mapDBTables, db, listRealRefTableDAO); }
From source file:adalid.util.meta.CodeAnalyzerTreeVisitor.java
private void info(String string) { string = StringUtils.removeEnd(string, CM); // string = StringUtils.remove(string, NL); string = StringUtils.replace(string, EOL, SP); // "<n>" // string = StringUtils.remove(string, TB); string = StringUtils.replace(string, TAB, SP); // "<t>" string = StringUtils.remove(string, SP + SP); string = StringUtils.trimToEmpty(string); logger.info(tabs() + string);//from w w w .j av a 2 s.c o m }
From source file:com.cubeia.backoffice.users.phonelookup.strategies.SweEniro.java
/** * <p class="adr">//from w w w. j a va2s .co m * <span class="street-address">Stadsgarden 10 </span> * <span class="postal-code">116 45</span> * <span class="locality">STOCKHOLM</span> * </p> * * @param html */ private void parseAddress(String html) { String streetTag = "street-address\">"; String street = html.substring(streetTag.length() + html.indexOf(streetTag)); street = street.substring(0, street.indexOf("</span>")).trim(); String zipTag = "postal-code\">"; String zipcode = html.substring(zipTag.length() + html.indexOf(zipTag)); zipcode = zipcode.substring(0, zipcode.indexOf("</span>")).trim(); zipcode = StringUtils.remove(zipcode, " "); String cityTag = "locality\">"; String city = html.substring(cityTag.length() + html.indexOf(cityTag)); city = city.substring(0, city.indexOf("</span>")).trim(); user.setBillingAddress(street); user.setZipcode(zipcode); user.setCity(city); }
From source file:com.pedra.storefront.interceptors.beforeview.UiThemeResourceBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) { final CMSSiteModel currentSite = cmsSiteService.getCurrentSite(); final String siteName = currentSite.getUid(); final String themeName = getThemeNameForSite(currentSite); final String uiExperienceCode = uiExperienceService.getUiExperienceLevel().getCode(); final String uiExperienceCodeLower = uiExperienceCode.toLowerCase(); final Object urlEncodingAttributes = request.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String contextPath = StringUtils.remove(request.getContextPath(), (urlEncodingAttributes != null) ? urlEncodingAttributes.toString() : ""); final String siteRootUrl = contextPath + "/_ui/" + uiExperienceCodeLower; final String siteResourcePath = siteRootUrl + "/site-" + siteName; final String themeResourcePath = siteRootUrl + "/theme-" + themeName; final String commonResourcePath = siteRootUrl + "/" + COMMON; modelAndView.addObject("contextPath", contextPath); modelAndView.addObject("siteResourcePath", siteResourcePath); modelAndView.addObject("themeResourcePath", themeResourcePath); modelAndView.addObject("commonResourcePath", commonResourcePath); modelAndView.addObject("siteRootUrl", siteRootUrl); modelAndView.addObject("uiExperienceLevel", uiExperienceCode); final String detectedUiExperienceCode = uiExperienceService.getDetectedUiExperienceLevel().getCode(); modelAndView.addObject("detectedUiExperienceCode", detectedUiExperienceCode); final UiExperienceLevel overrideUiExperienceLevel = uiExperienceService.getOverrideUiExperienceLevel(); if (overrideUiExperienceLevel == null) { modelAndView.addObject("uiExperienceOverride", Boolean.FALSE); } else {/*from w w w.j av a 2 s. c o m*/ modelAndView.addObject("uiExperienceOverride", Boolean.TRUE); modelAndView.addObject("overrideUiExperienceCode", overrideUiExperienceLevel.getCode()); } final DeviceData currentDetectedDevice = deviceDetectionFacade.getCurrentDetectedDevice(); modelAndView.addObject("detectedDevice", currentDetectedDevice); final List<String> dependantAddOns = requiredAddOnsNameProvider .getAddOns(request.getSession().getServletContext().getServletContextName()); modelAndView.addObject("addOnCommonCssPaths", getAddOnCommonCSSPaths(contextPath, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnThemeCssPaths", getAddOnThemeCSSPaths(contextPath, themeName, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnJavaScriptPaths", getAddOnJSPaths(contextPath, siteName, uiExperienceCodeLower, dependantAddOns)); }
From source file:com.epam.cme.storefront.interceptors.beforeview.UiThemeResourceBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) { final CMSSiteModel currentSite = cmsSiteService.getCurrentSite(); final String siteName = currentSite.getUid(); final String themeName = getThemeNameForSite(currentSite); final String uiExperienceCode = uiExperienceService.getUiExperienceLevel().getCode(); final String uiExperienceCodeLower = uiExperienceCode.toLowerCase(); final Object urlEncodingAttributes = request.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String contextPath = StringUtils.remove(request.getContextPath(), (urlEncodingAttributes != null) ? urlEncodingAttributes.toString() : ""); final String siteRootUrl = contextPath + "/_ui/" + uiExperienceCodeLower; final String sharedResourcePath = contextPath + "/_ui/" + SHARED; final String siteResourcePath = siteRootUrl + "/site-" + siteName; final String themeResourcePath = siteRootUrl + "/theme-" + themeName; final String commonResourcePath = siteRootUrl + "/" + COMMON; modelAndView.addObject("contextPath", contextPath); modelAndView.addObject("sharedResourcePath", sharedResourcePath); modelAndView.addObject("siteResourcePath", siteResourcePath); modelAndView.addObject("themeResourcePath", themeResourcePath); modelAndView.addObject("commonResourcePath", commonResourcePath); modelAndView.addObject("siteRootUrl", siteRootUrl); modelAndView.addObject("CSRFToken", CSRFTokenManager.getTokenForSession(request.getSession())); modelAndView.addObject("uiExperienceLevel", uiExperienceCode); final String detectedUiExperienceCode = uiExperienceService.getDetectedUiExperienceLevel().getCode(); modelAndView.addObject("detectedUiExperienceCode", detectedUiExperienceCode); final UiExperienceLevel overrideUiExperienceLevel = uiExperienceService.getOverrideUiExperienceLevel(); if (overrideUiExperienceLevel == null) { modelAndView.addObject("uiExperienceOverride", Boolean.FALSE); } else {//from w ww .ja va2 s . co m modelAndView.addObject("uiExperienceOverride", Boolean.TRUE); modelAndView.addObject("overrideUiExperienceCode", overrideUiExperienceLevel.getCode()); } final DeviceData currentDetectedDevice = deviceDetectionFacade.getCurrentDetectedDevice(); modelAndView.addObject("detectedDevice", currentDetectedDevice); final List<String> dependantAddOns = requiredAddOnsNameProvider .getAddOns(request.getSession().getServletContext().getServletContextName()); modelAndView.addObject("addOnCommonCssPaths", getAddOnCommonCSSPaths(contextPath, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnThemeCssPaths", getAddOnThemeCSSPaths(contextPath, themeName, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnJavaScriptPaths", getAddOnJSPaths(contextPath, siteName, uiExperienceCodeLower, dependantAddOns)); }
From source file:it.test.CoverageTest.java
private String cleanupScmAndDuplication(String coverage) { coverage = StringUtils.remove(coverage, ",\"scmAuthor\":\"\""); coverage = StringUtils.remove(coverage, ",\"scmRevision\":\"\""); coverage = StringUtils.remove(coverage, ",\"duplicated\":false"); return coverage; }
From source file:com.exxonmobile.ace.hybris.storefront.interceptors.beforeview.UiThemeResourceBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) { final CMSSiteModel currentSite = cmsSiteService.getCurrentSite(); final String siteName = currentSite.getUid(); final String themeName = getThemeNameForSite(currentSite); final String uiExperienceCode = uiExperienceService.getUiExperienceLevel().getCode(); final String uiExperienceCodeLower = uiExperienceCode.toLowerCase(); final Object urlEncodingAttributes = request.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String contextPath = StringUtils.remove(request.getContextPath(), (urlEncodingAttributes != null) ? urlEncodingAttributes.toString() : ""); final String siteRootUrl = contextPath + "/_ui/" + uiExperienceCodeLower; final String sharedResourcePath = contextPath + "/_ui/" + SHARED; final String siteResourcePath = siteRootUrl + "/site-" + siteName; final String themeResourcePath = siteRootUrl + "/theme-" + themeName; final String commonResourcePath = siteRootUrl + "/" + COMMON; modelAndView.addObject("contextPath", contextPath); modelAndView.addObject("sharedResourcePath", sharedResourcePath); modelAndView.addObject("siteResourcePath", siteResourcePath); modelAndView.addObject("themeResourcePath", themeResourcePath); modelAndView.addObject("commonResourcePath", commonResourcePath); modelAndView.addObject("siteRootUrl", siteRootUrl); modelAndView.addObject("uiExperienceLevel", uiExperienceCode); final String detectedUiExperienceCode = uiExperienceService.getDetectedUiExperienceLevel().getCode(); modelAndView.addObject("detectedUiExperienceCode", detectedUiExperienceCode); final UiExperienceLevel overrideUiExperienceLevel = uiExperienceService.getOverrideUiExperienceLevel(); if (overrideUiExperienceLevel == null) { modelAndView.addObject("uiExperienceOverride", Boolean.FALSE); } else {//from ww w . j a v a 2s .com modelAndView.addObject("uiExperienceOverride", Boolean.TRUE); modelAndView.addObject("overrideUiExperienceCode", overrideUiExperienceLevel.getCode()); } final DeviceData currentDetectedDevice = deviceDetectionFacade.getCurrentDetectedDevice(); modelAndView.addObject("detectedDevice", currentDetectedDevice); final List<String> dependantAddOns = requiredAddOnsNameProvider .getAddOns(request.getSession().getServletContext().getServletContextName()); modelAndView.addObject("addOnCommonCssPaths", getAddOnCommonCSSPaths(contextPath, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnThemeCssPaths", getAddOnThemeCSSPaths(contextPath, themeName, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnJavaScriptPaths", getAddOnJSPaths(contextPath, siteName, uiExperienceCodeLower, dependantAddOns)); }
From source file:com.bjond.Main.java
/** * Simply splits a key=value pair and removes single quotes. * * @param element/* w w w .j ava 2 s. co m*/ * @return */ private static String[] keyValueSplitter(final String element) { // key=value split on equals final String[] s = element.split("="); // Remove quotes s[1] = StringUtils.remove(s[1], '\''); return s; }
From source file:com.inktomi.wxmetar.MetarParser.java
static boolean parseWinds(String token, final Metar metar) { boolean rval = Boolean.FALSE; // Winds will be the only element that ends in knots if (StringUtils.endsWith(token, "KT")) { // At this point, we know we should handle this token rval = Boolean.TRUE;//from ww w .j a va2 s. c om // Remove the KT token = StringUtils.remove(token, "KT"); // Is it variable? if (StringUtils.startsWith(token, "VRB")) { metar.winds.variable = Boolean.TRUE; // Trim of the VRB token = StringUtils.remove(token, "VRB"); metar.winds.windSpeed = Float.parseFloat(token); // Stop processing this token return rval; } // At this point, we know the first 3 chars are wind direction metar.winds.windDirection = Integer.parseInt(StringUtils.substring(token, 0, 3)); // Is it gusting? 17012G24 int postionOfG = StringUtils.indexOf(token, "G"); if (postionOfG > -1) { metar.winds.windGusts = Float .parseFloat(StringUtils.substring(token, postionOfG + 1, token.length())); metar.winds.windSpeed = Float.parseFloat(StringUtils.substring(token, 3, postionOfG)); } // Is it just a normal wind measurement? // 26006 if (postionOfG == -1 && !metar.winds.variable) { metar.winds.windSpeed = Float.parseFloat(StringUtils.substring(token, 2, token.length())); } } return rval; }
From source file:cec.easyshop.storefront.interceptors.beforeview.UiThemeResourceBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) { final CMSSiteModel currentSite = cmsSiteService.getCurrentSite(); final String siteName = currentSite.getUid(); final String themeName = getThemeNameForSite(currentSite); final String uiExperienceCode = uiExperienceService.getUiExperienceLevel().getCode(); final String uiExperienceCodeLower = uiExperienceViewResolver.getUiExperienceViewPrefix().isEmpty() ? uiExperienceCode.toLowerCase() : StringUtils.remove(uiExperienceViewResolver.getUiExperienceViewPrefix() .get(uiExperienceService.getUiExperienceLevel()), "/"); final Object urlEncodingAttributes = request.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String contextPath = StringUtils.remove(request.getContextPath(), (urlEncodingAttributes != null) ? urlEncodingAttributes.toString() : ""); final String siteRootUrl = contextPath + "/_ui/" + uiExperienceCodeLower; final String sharedResourcePath = contextPath + "/_ui/" + SHARED; final String siteResourcePath = siteRootUrl + "/site-" + siteName; final String themeResourcePath = siteRootUrl + "/theme-" + themeName; final String commonResourcePath = siteRootUrl + "/" + COMMON; final String encodedContextPath = request.getContextPath(); final LanguageModel currentLanguage = commerceCommonI18NService.getCurrentLanguage(); modelAndView.addObject("contextPath", contextPath); modelAndView.addObject("sharedResourcePath", sharedResourcePath); modelAndView.addObject("siteResourcePath", siteResourcePath); modelAndView.addObject("themeResourcePath", themeResourcePath); modelAndView.addObject("commonResourcePath", commonResourcePath); modelAndView.addObject("encodedContextPath", encodedContextPath); modelAndView.addObject("siteRootUrl", siteRootUrl); modelAndView.addObject("language", (currentLanguage != null ? currentLanguage.getIsocode() : "en")); modelAndView.addObject("CSRFToken", CSRFTokenManager.getTokenForSession(request.getSession())); modelAndView.addObject("uiExperienceLevel", uiExperienceCode); final String detectedUiExperienceCode = uiExperienceService.getDetectedUiExperienceLevel().getCode(); modelAndView.addObject("detectedUiExperienceCode", detectedUiExperienceCode); final UiExperienceLevel overrideUiExperienceLevel = uiExperienceService.getOverrideUiExperienceLevel(); if (overrideUiExperienceLevel == null) { modelAndView.addObject("uiExperienceOverride", Boolean.FALSE); } else {// w w w .j a v a 2s. co m modelAndView.addObject("uiExperienceOverride", Boolean.TRUE); modelAndView.addObject("overrideUiExperienceCode", overrideUiExperienceLevel.getCode()); } final DeviceData currentDetectedDevice = deviceDetectionFacade.getCurrentDetectedDevice(); modelAndView.addObject("detectedDevice", currentDetectedDevice); final List<String> dependantAddOns = requiredAddOnsNameProvider .getAddOns(request.getSession().getServletContext().getServletContextName()); modelAndView.addObject("addOnCommonCssPaths", getAddOnCommonCSSPaths(contextPath, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnThemeCssPaths", getAddOnThemeCSSPaths(contextPath, themeName, uiExperienceCodeLower, dependantAddOns)); modelAndView.addObject("addOnJavaScriptPaths", getAddOnJSPaths(contextPath, siteName, uiExperienceCodeLower, dependantAddOns)); }