List of usage examples for org.apache.commons.lang3 StringUtils remove
public static String remove(final String str, final char remove)
Removes all occurrences of a character from within the source string.
A null source string will return null .
From source file:org.jbpm.formModeler.core.processing.formRendering.FormRenderingFormatter.java
protected void beforeRenderField(Field field, String namespace, String renderMode) { String uid = namespaceManager.generateSquashedInputName(namespace, field); String fieldTypeCss = field.getFieldType().getCssStyle(); String fieldCss = field.getCssStyle(); Object overridenValue = getFormProcessor().getAttribute(field.getForm(), namespace, field.getFieldName() + ".cssStyle"); String css = fieldTypeCss;// w ww . ja v a2 s . co m if (!StringUtils.isEmpty(fieldCss)) { css = fieldCss; } if (overridenValue != null) { css = (String) overridenValue; } css = StringUtils.defaultString(css); css = StringUtils.remove(css, ' '); String styleToWrite = FIELD_CONTAINER_STYLE; StringTokenizer strtk = new StringTokenizer(css, ";"); while (strtk.hasMoreTokens()) { String tk = strtk.nextToken(); if ("display:none".equals(tk)) { styleToWrite = tk; break; } } writeToOut("<div style=\"" + styleToWrite + "\" id=\"" + uid + "_container\">"); }
From source file:org.jbpm.formModeler.core.processing.formRendering.FormRenderingFormatter.java
protected void beforeRenderLabel(Field field, String namespace, String renderMode) { String uid = namespaceManager.generateSquashedInputName(namespace, field); String fieldCss = field.getLabelCSSStyle(); Object overridenValue = getFormProcessor().getAttribute(field.getForm(), namespace, field.getFieldName() + ".labelCSSStyle"); String css = fieldCss;//from w ww.ja v a2s.c o m if (overridenValue != null) { css = (String) overridenValue; } css = StringUtils.defaultString(css); css = StringUtils.remove(css, ' '); String styleToWrite = FIELD_CONTAINER_STYLE; StringTokenizer strtk = new StringTokenizer(css, ";"); while (strtk.hasMoreTokens()) { String tk = strtk.nextToken(); if ("display:none".equals(tk)) { styleToWrite = tk; break; } } writeToOut("<div style=\"" + styleToWrite + "\" id=\"" + uid + "_label_container\">"); }
From source file:org.jpos.qi.system.RevisionsHelper.java
protected String getLink(String ref, String currentRevision) { String[] data = ref.split("\\."); if (data.length >= 2) { String backRoute = "revision_history" + (!currentRevision.isEmpty() ? "." + currentRevision : ""); String entity = data[0];// w ww . j a v a 2 s. c o m String id = StringUtils.remove(ref, entity + "."); String route = ((QINavigator) getApp().getNavigator()).getRouteForEntity(entity); if (route != null) return "<a href=\"#!/" + route + "/" + id + "?back=" + backRoute + "\">" + ref + "</a>"; } return ref; }
From source file:org.jspare.ui.jtwig.ToolkitJtwigTest.java
/** * Extends test.//from w ww . ja v a 2 s . c o m * * @throws Exception * the exception */ @Test public void extendsTest() throws Exception { String resource = "extends"; Map<String, Object> values = new HashMap<>(); values.put("template", "general"); values.put("page", "jspare-framework"); Template template = uiTookit.loadTemplate(resource); String output = template.apply(values); Assert.assertEquals("jspare-framework", StringUtils.remove(output, " ")); }
From source file:org.kalypso.wspwin.core.ProfileBean.java
public static String shortenName(final String name, final int maxLength) { final String noSpaces = StringUtils.remove(name, ' '); //$NON-NLS-1$ return StringUtils.abbreviateMiddle(noSpaces, "_", maxLength); //$NON-NLS-1$ }
From source file:org.kalypso.wspwin.core.RunOffEventBean.java
public static void write(final File outputFile, final RunOffEventBean[] fixation) throws IOException { try (final PrintWriter pw = new PrintWriter(outputFile)) { for (final RunOffEventBean runOff : fixation) { final String name = runOff.getName(); final String cleanName = StringUtils.remove(name, ' '); final String shortName = StringUtils.abbreviateMiddle(cleanName, ".", 20); //$NON-NLS-1$ final Map<BigDecimal, BigDecimal> entries = runOff.getEntries(); pw.format("%s %d%n", shortName, entries.size()); //$NON-NLS-1$ for (final Entry<BigDecimal, BigDecimal> entry : entries.entrySet()) { final BigDecimal station = entry.getKey(); final BigDecimal value = entry.getValue(); pw.format(Locale.US, "%.4f %.4f%n", station, value); //$NON-NLS-1$ }/*from w w w.j a va2s . c o m*/ } if (pw.checkError()) throw new IOException(); pw.close(); } }
From source file:org.kantega.respiro.documenter.ResourceParser.java
public static Option<ResourceDocumentation> parseResource(CompilationUnit root) { return fold(root.getChildrenNodes(), ClassOrInterfaceDeclaration.class, none(), (maybeDoc, decl) -> maybeDoc.orElse(() -> walk(decl, SingleMemberAnnotationExpr.class).exists(hasName("path")) ? some(walk(decl, MethodDeclaration.class).foldLeft((rDoc, mDelc) -> walk(mDelc, SingleMemberAnnotationExpr.class).exists(hasName("path")) || walk(mDelc, MarkerAnnotationExpr.class).exists(or(hasName("get"), hasName("post"))) ? rDoc.append(new MethodDocumentation( ofType(mDelc.getChildrenNodes(), SingleMemberAnnotationExpr.class) .filter(hasName("path")).headOption() .map(a -> rDoc.path + normalizeUrl(a.getMemberValue().toString())) .orSome(rDoc.path), ofType(mDelc.getChildrenNodes(), MarkerAnnotationExpr.class) .filter(or(hasName("get"), hasName("post"))).headOption() .map(a -> a.getName().getName()).orSome("GET"), ofType(mDelc.getChildrenNodes(), SingleMemberAnnotationExpr.class) .filter(hasName("rolesallowed")).headOption() .map(a -> arrayList( a.getMemberValue().toString().split(","))) .orSome(nil()).map(role -> StringUtils.remove(role, "\"")), mDelc.getComment() != null ? mDelc.getComment().getContent() : "", iterableList(mDelc.getParameters()).map(Node::toString), nil())) : rDoc, new ResourceDocumentation( ofType(decl.getChildrenNodes(), SingleMemberAnnotationExpr.class) .filter(hasName("path")).headOption() .map(a -> a.getMemberValue().toString()).map(Strings::normalizeUrl) .orSome("/"), ofType(decl.getChildrenNodes(), SingleMemberAnnotationExpr.class) .filter(hasName("rolesallowed")).headOption() .map(a -> arrayList(a.getMemberValue().toString().split(","))) .orSome(nil()), decl.getComment() == null ? "" : decl.getComment().getContent(), nil()))) : none()));//from w w w . ja v a2 s . com }
From source file:org.kuali.coeus.propdev.impl.person.ProposalPerson.java
/** * set the <code>simpleName</code> & the full name. */// w w w . j av a 2s . c o m @Override public void setFullName(String fullName) { this.fullName = fullName; setSimpleName(getFullName()); setSimpleName(StringUtils.lowerCase(getSimpleName())); setSimpleName(StringUtils.deleteWhitespace(getSimpleName())); setSimpleName(StringUtils.remove(getSimpleName(), '.')); }
From source file:org.kuali.kra.external.Cfda.service.impl.CfdaServiceImpl.java
/** * This method gets the url from the parameter and creates the fileName and * the actual URL used to FTP./*from w ww . j a v a 2 s . c om*/ */ protected void createGovURL() { // Example url ftp://ftp.cfda.gov/programs09187.csv String url = getParameterService().getParameterValueAsString(Constants.MODULE_NAMESPACE_AWARD, Constants.PARAMETER_COMPONENT_DOCUMENT, Constants.CFDA_GOV_URL_PARAMETER); String fileName = StringUtils.substringAfterLast(url, "/"); url = StringUtils.substringBeforeLast(url, "/"); if (StringUtils.contains(url, FTP_PREFIX)) { url = StringUtils.remove(url, FTP_PREFIX); } Calendar calendar = dateTimeService.getCurrentCalendar(); // need to pull off the '20' in 2009 String year = "" + calendar.get(Calendar.YEAR); year = year.substring(2, 4); fileName = fileName + year; // the last 3 numbers in the file name are the day of the year, but the files are from "yesterday" fileName = fileName + String.format("%03d", calendar.get(Calendar.DAY_OF_YEAR) - 1); fileName = fileName + ".csv"; setGovURL(url); setCfdaFileName(fileName); }
From source file:org.ligoj.app.plugin.prov.aws.in.ProvAwsPriceImportResource.java
/** * Install or update a EC2 price/*from w w w . j a v a 2s . c o m*/ */ private ProvInstancePrice newInstancePrice(final UpdateContext context, final AwsEc2Price csv, final ProvLocation region) { final VmOs os = VmOs.valueOf(csv.getOs().toUpperCase(Locale.ENGLISH)); final ProvInstanceType instance = installInstanceType(context, csv); final String license = StringUtils.trimToNull(StringUtils.remove( csv.getLicenseModel().replace("License Included", StringUtils.defaultString(csv.getSoftware(), "")) .replace("NA", "License Included"), "No License required")); final ProvTenancy tenancy = ProvTenancy.valueOf(StringUtils.upperCase(csv.getTenancy())); final ProvInstancePriceTerm term = context.getPriceTypes().computeIfAbsent(csv.getOfferTermCode(), k -> newInstancePriceTerm(context, csv)); final String code = toCode(csv); return context.getPrevious().computeIfAbsent(code, c -> { final ProvInstancePrice p = new ProvInstancePrice(); p.setLocation(region); p.setCode(code); p.setOs(os); p.setTenancy(tenancy); p.setLicense(license); p.setType(instance); p.setTerm(term); return p; }); }