List of usage examples for org.apache.commons.lang StringUtils trimToEmpty
public static String trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null
.
From source file:com.egt.core.jsf.JSF.java
public static void upload(Upload upload, String carpeta) throws Exception { Bitacora.trace(JSF.class, "upload", upload, carpeta); if (upload == null) { return;//from w w w.j a va2 s . c om } CampoArchivo campoArchivo = upload instanceof CampoArchivo ? (CampoArchivo) upload : null; if (campoArchivo != null) { campoArchivo.setClientFileName(null); campoArchivo.setServerFileName(null); } UploadedFile uploadedFile = upload.getUploadedFile(); if (uploadedFile == null) { return; } /**/ Bitacora.trace(JSF.class, "upload", "name=" + uploadedFile.getOriginalName()); Bitacora.trace(JSF.class, "upload", "path=" + uploadedFile.getClientFilePath()); Bitacora.trace(JSF.class, "upload", "type=" + uploadedFile.getContentType()); Bitacora.trace(JSF.class, "upload", "size=" + uploadedFile.getSize()); /**/ String validChars = "abcdefghijklmnopqrstuvwxyz_1234567890"; String filepath = null; if (StringUtils.isNotBlank(carpeta)) { String str = carpeta.toLowerCase(); if (StringUtils.containsOnly(str, validChars)) { filepath = str + "/"; } } String filename = STP.getRandomString(); String pathname = Utils.getAttachedFilesDir(filepath) + filename; String ofn = getNombreArchivo(uploadedFile.getOriginalName().replace('\\', '/')); String ext = getExtensionArchivo(ofn); if (StringUtils.isNotBlank(ext)) { String str = ext.toLowerCase(); if (StringUtils.containsOnly(str, validChars)) { filename += "." + str; pathname += "." + str; } } File file = new File(pathname); uploadedFile.write(file); /**/ String clientFilePath = uploadedFile.getClientFilePath(); String originalName = uploadedFile.getOriginalName(); String clientFileName = clientFilePath == null ? originalName : clientFilePath + originalName; String serverFileName = StringUtils.trimToEmpty(filepath) + filename; if (campoArchivo != null) { campoArchivo.setClientFileName(clientFileName); campoArchivo.setServerFileName(serverFileName); } }
From source file:com.prowidesoftware.swift.model.field.Field32R.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w w w . jav a 2 s .c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); if (StringUtils.isNotEmpty(getComponent1())) { result.append(StringUtils.trimToEmpty(getComponent1())); } result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field94G.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///w w w .ja v a2 s . co m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); if (StringUtils.isNotEmpty(getComponent3())) { result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); result.append(StringUtils.trimToEmpty(getComponent3())); } return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field13K.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w ww.j a v a 2 s . c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:com.bluexml.xforms.generator.forms.renderable.classes.RenderableLayout.java
/** * Gets the layout./*from w w w. ja v a 2s .c o m*/ * * @param classe * the classe * * @return the layout */ private String getLayout(AbstractClass classe) { String result = null; EList<Comment> comments = classe.getComments(); for (Comment comment : comments) { EList<Stereotype> stereotypes = comment.getStereotypes(); for (Stereotype stereotype : stereotypes) { if (StringUtils.trimToEmpty(stereotype.getName()).equals("layout")) { result = comment.getValue(); } } } return result; }
From source file:com.prowidesoftware.swift.model.field.Field34H.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w w w.j av a2 s. c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent1())) { result.append(StringUtils.trimToEmpty(getComponent1())); result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); } result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field41D.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///w w w .j av a 2 s . c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); for (final String s : components) { result.append(StringUtils.trimToEmpty(s)) .append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); } return result.toString(); }
From source file:com.hangum.tadpole.rdb.core.dialog.export.sqltoapplication.composites.realgrid.RealGridComposite.java
/** * sql to str/* w w w . ja v a 2 s. c om*/ */ private void sqlToStr() { StringBuffer sbStr = new StringBuffer(); String[] sqls = parseSQL(); if (StringUtils.isEmpty(textVariable.getText())) { textVariable.setText(slt.getDefaultVariable()); } HashMap<String, String> options = new HashMap<String, String>(); options.put("name", textVariable.getText()); for (int i = 0; i < sqls.length; i++) { if ("".equals(StringUtils.trimToEmpty(sqls[i]))) //$NON-NLS-1$ continue; if (i == 0) { sbStr.append(slt.sqlToString(sqls[i], options, null)); } else { options.put("name", textVariable.getText() + "_" + i); sbStr.append(slt.sqlToString(sqls[i], options, null)); } // ? . sbStr.append("\r\n"); //$NON-NLS-1$ } textConvert.setText(sbStr.toString()); }
From source file:com.prowidesoftware.swift.model.field.Field37H.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//* w w w . ja v a2 s . c o m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field71E.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from w w w . ja v a 2s . com*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(StringUtils.trimToEmpty(getComponent2())); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent3())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); } appendInLines(result, getComponent4(), getComponent5(), getComponent6(), getComponent7()); return result.toString(); }