List of usage examples for org.apache.commons.lang StringUtils repeat
public static String repeat(String str, int repeat)
Repeat a String repeat
times to form a new String.
From source file:ddf.catalog.source.solr.provider.SolrProviderTestBase.java
private static void messageBreak(String string) { String stars = StringUtils.repeat("*", string.length() + 2); LOGGER.info(stars);/*from w w w . j a v a2 s . c o m*/ LOGGER.info("* {}", string); LOGGER.info(stars); }
From source file:com.opengamma.component.ComponentConfigIniLoader.java
/** * Handle the inclusion of another file. * /* w w w. j a v a2 s .c om*/ * @param baseResource the base resource, not null * @param includeFile the resource to include, not null * @param depth the depth of the properties file, used for logging * @param config the config being loaded, not null */ private void handleInclude(final Resource baseResource, String includeFile, final int depth, final ComponentConfig config) { // find resource Resource include; try { include = ResourceUtils.createResource(includeFile); } catch (Exception ex) { try { include = baseResource.createRelative(includeFile); } catch (Exception ex2) { throw new OpenGammaRuntimeException(ex2.getMessage(), ex2); } } // load and merge getLogger().logInfo( StringUtils.repeat(" ", depth) + " Including item: " + ResourceUtils.getLocation(include)); try { doLoad(include, depth + 1, config); } catch (RuntimeException ex) { throw new OpenGammaRuntimeException("Unable to load INI file: " + include, ex); } }
From source file:com.axelor.studio.service.data.exporter.AsciidocExporter.java
private void processMenu(String menu, String view) throws IOException { if (menu.contains("-form(")) { String[] menus = menu.split("-form\\("); String parent = menus[0] + "-form"; if (countMap.containsKey(parent)) { menu = menus[menus.length - 1]; Integer count = countMap.get(parent); header += "\n\n==" + StringUtils.repeat("=", count) + " " + menu.substring(0, menu.length() - 1); countMap.put(view, count + 1); }//from w w w . j a v a2 s . c o m } else { String[] menus = menu.split("/", 4); int count = -1; header = ""; String checkMenu = ""; for (String mn : menus) { count++; checkMenu += mn + "/"; if (!processedMenus.contains(checkMenu)) { processedMenus.add(checkMenu); header += "\n\n==" + StringUtils.repeat("=", count) + " " + mn; countMap.put(view, count + 1); } } } if (imgDir != null && new File(imgDir, view + ".png").exists()) { header += "\nimage::" + view + ".png[" + menu + ", align=\"center\"]"; } }
From source file:com.netscape.cmstools.cli.CLI.java
public void printHelp() { int leftPadding = 1; int rightPadding = 25; System.out.println("Commands:"); for (CLI module : modules.values()) { if (module.isDeprecated()) continue; String label = module.getFullName(); int padding = rightPadding - leftPadding - label.length(); if (padding < 1) padding = 1;/*from www . j ava 2s .c o m*/ System.out.print(StringUtils.repeat(" ", leftPadding)); System.out.print(label); System.out.print(StringUtils.repeat(" ", padding)); System.out.println(module.getDescription()); } Collection<CLI> deprecatedModules = getDeprecatedModules(); if (!deprecatedModules.isEmpty()) { System.out.println(); System.out.println("Deprecated:"); for (CLI module : deprecatedModules) { String label = module.getFullName(); int padding = rightPadding - leftPadding - label.length(); if (padding < 1) padding = 1; System.out.print(StringUtils.repeat(" ", leftPadding)); System.out.print(label); System.out.print(StringUtils.repeat(" ", padding)); System.out.println(module.getDescription()); } } }
From source file:adalid.core.primitives.NumericPrimitive.java
@Override protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) { String tab = verbose ? StringUtils.repeat(" ", 4) : ""; String fee = verbose ? StringUtils.repeat(tab, n) : ""; String faa = " = "; String foo = verbose ? EOL : ", "; String string = super.fieldsToString(n, key, verbose, fields, maps); if (fields || verbose) { if (verbose) { if (_minValue != null) { string += fee + tab + "minValue" + faa + getValueString(_minValue) + foo; }/*from ww w.j a v a2 s . c o m*/ if (_maxValue != null) { string += fee + tab + "maxValue" + faa + getValueString(_maxValue) + foo; } } } return string; }
From source file:ch.systemsx.cisd.openbis.generic.shared.util.WebClientFilesUpdater.java
/** * Updates the <code>OpenBIS.gwt.xml</code> up to the technologies found. *//*from www.j ava 2 s. c o m*/ public final void updateOpenBISGwtXmlFile() { final File openBISGwtXmlFile = new File(workingDirectory, OPENBIS_PACKAGE_NAME + "/" + OPENBIS_GWT_XML_FILE_NAME); final String response = FileUtilities.checkFileFullyAccessible(openBISGwtXmlFile, "xml"); if (response != null) { throw new RuntimeException(response); } final StringBuilder builder = new StringBuilder(XML_MARKER_START); final String sep = "\n"; builder.append(sep); final String indent = StringUtils.repeat(" ", 4); boolean first = true; for (final String technology : technologies) { if (first == false) { builder.append(sep); } first = false; builder.append(indent); builder.append(String.format("<!-- %s plugin -->", StringUtils.capitalize(technology))); builder.append(sep); // <script>-tag builder.append(createTag(SCRIPT_TAG_TEMPLATE, indent, technology)); // <public>-tag builder.append(createTag(PUBLIC_TAG_TEMPLATE, indent, technology)); // <source>-tag builder.append(createTag(SOURCE_TAG_TEMPLATE, indent, technology)); } builder.append(indent); String content = FileUtilities.loadToString(openBISGwtXmlFile); content = content.substring(0, content.indexOf(XML_MARKER_START)) + builder.toString() + content.substring(content.indexOf(XML_MARKER_END), content.length()); FileUtilities.writeToFile(openBISGwtXmlFile, content); }
From source file:adalid.core.Key.java
@Override protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) { String tab = verbose ? StringUtils.repeat(" ", 4) : ""; String fee = verbose ? StringUtils.repeat(tab, n) : ""; String faa = " = "; String foo = verbose ? EOL : ", "; String string = super.fieldsToString(n, key, verbose, fields, maps); if (fields || verbose) { string += fee + tab + "fields" + faa + _keyFields.size() + foo; if (verbose) { string += fee + tab + "unique" + faa + _unique + foo; }/* ww w . j a v a 2s .c om*/ } return string; }
From source file:adalid.core.Tab.java
@Override protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) { String tab = verbose ? StringUtils.repeat(" ", 4) : ""; String fee = verbose ? StringUtils.repeat(tab, n) : ""; String faa = " = "; String foo = verbose ? EOL : ", "; String string = super.fieldsToString(n, key, verbose, fields, maps); if (fields || verbose) { string += fee + tab + "fields" + faa + _tabFields.size() + foo; if (verbose) { if (_renderingFilter != null) { string += _renderingFilter.toString(n + 1, "renderingFilter", verbose, fields, maps) + foo; }/*w w w.ja va 2 s. c o m*/ } } return string; }
From source file:com.qcadoo.model.integration.FieldModuleIntegrationTest.java
License:asdf
@Test public void shouldCallAndPassMaxStringLenFieldValidators() throws Exception { // given//from w w w . ja va 2 s . c om final String stringWith300Characters = StringUtils.repeat("a", 300); DataDefinition productDao = dataDefinitionService.get(PLUGIN_PRODUCTS_NAME, ENTITY_NAME_PRODUCT); PluginStateResolver pluginStateResolver = mock(PluginStateResolver.class); PluginUtilsService pluginUtil = new PluginUtilsService(); ReflectionTestUtils.setField(pluginUtil, "pluginStateResolver", pluginStateResolver); pluginUtil.init(); given(pluginStateResolver.isEnabled(PLUGIN_PRODUCTS_NAME)).willReturn(true); Entity product = createProduct(stringWith300Characters, "asd"); // when Entity savedProduct = productDao.save(product); // then Assert.assertTrue(savedProduct.isValid()); Assert.assertEquals(stringWith300Characters, savedProduct.getStringField("name")); }
From source file:com.rapleaf.hank.ZkTestCase.java
private void dumpZk(String parentPath, String nodeName, int depth) throws Exception { System.err.print(StringUtils.repeat(" ", depth)); System.err.print("/" + nodeName); String nodePath = parentPath + "/" + nodeName; nodePath = nodePath.replace("//", "/"); byte[] data = zk.getData(nodePath, false, null); if (data == null) { System.err.print(" -> null"); } else {//from www . j a v a 2s.c o m System.err.print(" -> [bytes]"); } System.err.println(); List<String> children = zk.getChildren(nodePath, false); for (String child : children) { dumpZk(nodePath, child, depth + 1); } }