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.prowidesoftware.swift.model.field.Field92R.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(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("/"); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent2())) { result.append(StringUtils.trimToEmpty(getComponent2())); } result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent4())); return result.toString(); }
From source file:com.egt.ejb.core.reporter.ReporterBrokerBean.java
@Override public ObjectMessage executeReport(String informe, long funcion, String destino, EnumFormatoInforme tipo, String select, Object[] args, Map parametros) { Bitacora.trace(this.getClass(), "executeReport", informe, String.valueOf(funcion), destino, String.valueOf(tipo)); Bitacora.trace(select);//from w w w .jav a 2s . c o m Utils.traceObjectArray(args); Long rastro = null; ObjectMessage reply = null; try { informe = StringUtils.trimToEmpty(informe); if (STP.esIdentificadorArchivoValido(informe)) { if (TLC.getControlador().esFuncionAutorizada(funcion)) { TLC.getConnection(ds); rastro = TLC.getControlador().ponerInformePendiente(funcion); ReporterMessage message = new ReporterMessage(informe, funcion); TLC.getControlador().ponerUsuarioEnMensaje(message); message.setRastro(rastro); message.setMensaje(Bitacora.getTextoMensaje(CBM2.REPORT_EXECUTION_REQUEST, informe)); message.setDestino(destino); message.setTipo(tipo); message.setSelect(select); message.setArgs(args); message.setParameters(parametros); reply = messenger.send(message); TLC.getBitacora().info(message.getMensaje()); } else { throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM2.FUNCION_NO_AUTORIZADA, informe)); } } else { throw new ExcepcionAplicacion( Bitacora.getTextoMensaje(CBM2.IDENTIFICADOR_ARCHIVO_INVALIDO, informe)); } } catch (Exception ex) { EnumCondicionEjeFun condicion = EnumCondicionEjeFun.EJECUCION_CANCELADA; String mensaje = ThrowableUtils.getString(ex); Auditor.grabarRastroInforme(rastro, condicion, null, mensaje); TLC.getBitacora().error(mensaje); } return reply; }
From source file:com.prowidesoftware.swift.model.field.Field50H.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from ww w.ja va 2s. c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); result.append(StringUtils.trimToEmpty(getComponent2())); appendInLines(result, 3, 5); return result.toString(); }
From source file:com.hangum.tadpole.engine.sql.util.sqlscripts.DDLScriptManager.java
/** * // w w w . jav a 2 s . c o m * @param obj * @return */ public String getScript(Object obj) throws Exception { String retStr = ""; // find DDL Object if (PublicTadpoleDefine.OBJECT_TYPE.TABLES == actionType) { TableDAO tbl = (TableDAO) obj; setObjectName(tbl.getName()); retStr = rdbScript.getTableScript(tbl); } else if (PublicTadpoleDefine.OBJECT_TYPE.VIEWS == actionType) { TableDAO tbl = (TableDAO) obj; setObjectName(tbl.getName()); retStr = rdbScript.getViewScript(tbl.getName()); } else if (PublicTadpoleDefine.OBJECT_TYPE.INDEXES == actionType) { InformationSchemaDAO index = (InformationSchemaDAO) obj; setObjectName(index.getINDEX_NAME()); retStr = rdbScript.getIndexScript(index); } else if (PublicTadpoleDefine.OBJECT_TYPE.FUNCTIONS == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getFunctionScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.PROCEDURES == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getProcedureScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.PACKAGES == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getProcedureScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.TRIGGERS == actionType) { TriggerDAO trigger = (TriggerDAO) obj; setObjectName(trigger.getName()); retStr = rdbScript.getTriggerScript(trigger); } else { throw new Exception(Messages.get().ProcedureExecuterManager_0); } // ; ? ??? . if (StringUtils.endsWith(StringUtils.trimToEmpty(retStr), PublicTadpoleDefine.SQL_DELIMITER)) { return retStr; } else { return retStr + PublicTadpoleDefine.SQL_DELIMITER; } }
From source file:gemlite.core.util.Util.java
/** * BASE64 ? s ?/*from w w w .j a va 2 s. c o m*/ * * @param s * @param charSet * @return */ public final static String decodeFromBASE64(String s, String charSet) { String decodedStr; if (StringUtils.trimToEmpty(s).equals("")) return ""; BASE64Decoder decoder = new BASE64Decoder(); try { byte[] b = decoder.decodeBuffer(s); if (StringUtils.trimToEmpty(charSet).equals("")) decodedStr = new String(b); else decodedStr = new String(b, charSet); return decodedStr; } catch (Exception e) { LogUtil.getAppLog().error("decodeFromBASE64 Error for the string: " + s + "with CharSet " + charSet, e); return ""; } }
From source file:com.prowidesoftware.swift.model.field.Field68A.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from ww w .ja v a2 s .c om @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent4())); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent5())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent5())); } if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent6())) { result.append("//"); result.append(StringUtils.trimToEmpty(getComponent6())); } return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field23.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from w w w. j a v a2s.c om*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); if (StringUtils.isNotEmpty(getComponent2())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent2())); } if (StringUtils.isNotEmpty(getComponent3())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); } if (StringUtils.isNotEmpty(getComponent4())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent4())); } return result.toString(); }
From source file:ml.shifu.shifu.core.binning.EqualPopulationBinning.java
/** * Add the value (in format of text) into histogram with weight. * First of all the input string will be trimmed and check whether it is missing value or not * If it is missing value, the missing value count will +1 * After that, the input string will be parsed into double. If it is not a double, invalid value count will +1 * /*from www.j ava 2 s . c om*/ * @param val * , string type value * @param wVal * , frequency or weight of this value */ public void addData(String val, double wVal) { String fval = StringUtils.trimToEmpty(val); if (!isMissingVal(fval)) { double dval = 0; try { dval = Double.parseDouble(fval); } catch (NumberFormatException e) { // not a number? just ignore super.incInvalidValCnt(); return; } process(dval, wVal); } else { super.incMissingValCnt(); } }
From source file:com.prowidesoftware.swift.model.field.Field50K.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from ww w.jav a2s. com*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); if (StringUtils.isNotEmpty(getComponent1())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent1())); } appendInLines(result, getComponent2(), getComponent3(), getComponent4(), getComponent5()); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field70D.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(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); appendInLines(result, 3, 7); return result.toString(); }