List of usage examples for org.apache.commons.lang3 StringUtils repeat
public static String repeat(final char ch, final int repeat)
From source file:org.openecomp.sdc.ci.tests.execute.service.UpdateServiceMetadataTest.java
protected String multipleString(String ch, int repeat) { return StringUtils.repeat(ch, repeat); }
From source file:org.openecomp.sdc.ci.tests.utils.Utils.java
public static String multipleChar(String ch, int repeat) { return StringUtils.repeat(ch, repeat); }
From source file:org.openestate.io.core.XmlUtils.java
private static void printNode(Element node, int indent) { String prefix = (indent > 0) ? StringUtils.repeat(">", indent) + " " : ""; LOGGER.debug(prefix + "<" + node.getTagName() + "> / " + node.getNamespaceURI() + " / " + node.getPrefix()); prefix = StringUtils.repeat(">", indent + 1) + " "; NamedNodeMap attribs = node.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attrib = (Attr) attribs.item(i); LOGGER.debug(prefix + "@" + attrib.getName() + " / " + attrib.getNamespaceURI() + " / " + attrib.getPrefix());//from w w w . j av a 2 s. com } NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Element) { XmlUtils.printNode((Element) child, indent + 1); } } }
From source file:org.openestate.io.examples.CasaItWritingExample.java
/** * Write a {@link CasaItDocument} into a {@link String} and print the * results to the console.// w w w . ja v a2 s.c o m * * @param doc * the document to write */ protected static void writeToConsole(CasaItDocument doc) { LOGGER.info("writing document"); try { String xml = doc.toXmlString(PRETTY_PRINT); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + xml); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } }
From source file:org.openestate.io.examples.DaftIeWritingExample.java
/** * Write a {@link DaftIeDocument} into a {@link String} and print the * results to the console./*from ww w. j ava 2 s . c o m*/ * * @param doc * the document to write */ protected static void writeToConsole(DaftIeDocument doc) { LOGGER.info("writing document with version " + doc.getDocumentVersion()); try { String xml = doc.toXmlString(PRETTY_PRINT); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + xml); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } }
From source file:org.openestate.io.examples.FilemakerResultMappingExample.java
/** * Start the example application./*from ww w . jav a 2s . c om*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(FilemakerWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a mapping from the example document, if no files were specified as command line arguments FilemakerResultMapping mapping = null; if (args.length < 1) { try { mapping = new FilemakerResultDocument(buildExampleDocument()).toMapping(); } catch (Exception ex) { LOGGER.error("Can't create mapping!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } } // read file, that was specified as command line argument else { try { mapping = new FilemakerResultDocument(XmlUtils.newDocument(new File(args[0]))).toMapping(); } catch (Exception ex) { LOGGER.error("Can't create mapping from file '" + args[0] + "'!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } } if (mapping == null) { LOGGER.error("No mapping was created!"); System.exit(1); } // loop through available rows and access their values through the field name for (int i = 0; i < mapping.getRowCount(); i++) { FilemakerResultMapping.Row row = mapping.getRow(i); LOGGER.info(StringUtils.repeat("-", 50)); LOGGER.info("record at row " + i); LOGGER.info("> recordId = " + row.getRecordId()); LOGGER.info("> modId = " + row.getModId()); // access record values through their field name for (String field : row.getFieldNames()) { LOGGER.info("> " + field + " = " + row.getValue(field)); } } }
From source file:org.openestate.io.examples.FilemakerWritingExample.java
/** * Write a {@link FilemakerResultDocument} into a {@link String} and print the * results to the console.//from ww w .j av a 2 s . c o m * * @param doc * the document to write */ protected static void writeToConsole(FilemakerResultDocument doc) { LOGGER.info("writing document"); try { String xml = doc.toXmlString(PRETTY_PRINT); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + xml); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } }
From source file:org.openestate.io.examples.IdxWritingExample.java
/** * Write some {@link IdxRecord} objects into a {@link String} and print the * results to the console./*from w w w.jav a 2s. c om*/ * * @param records * the CSV records to write */ protected static void writeToConsole(List<IdxRecord> records) { LOGGER.info("writing document"); IdxPrinter printer = null; try { StringBuilder csv = new StringBuilder(); printer = IdxPrinter.create(csv); printer.printRecords(records); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + csv.toString()); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } finally { IOUtils.closeQuietly(printer); } }
From source file:org.openestate.io.examples.ImmobiliareItWritingExample.java
/** * Write an {@link ImmobiliareItDocument} into a {@link String} and print the * results to the console./*www . j a v a 2 s . c om*/ * * @param doc * the document to write */ protected static void writeToConsole(ImmobiliareItDocument doc) { LOGGER.info("writing document with version " + doc.getDocumentVersion()); try { String xml = doc.toXmlString(PRETTY_PRINT); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + xml); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } }
From source file:org.openestate.io.examples.ImmoXmlWritingExample.java
/** * Write an {@link ImmoXmlDocument} into a {@link String} and print the * results to the console.//w w w .ja va 2 s. c o m * * @param doc * the document to write */ protected static void writeToConsole(ImmoXmlDocument doc) { LOGGER.info("writing document with version " + doc.getDocumentVersion()); try { String xml = doc.toXmlString(PRETTY_PRINT); LOGGER.info(StringUtils.repeat("-", 50) + SystemUtils.LINE_SEPARATOR + xml); } catch (Exception ex) { LOGGER.error("Can't write document into a string!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } }