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.amazonaws.codedeploy.AWSCodeDeployPublisher.java
private FilePath getSourceDirectory(FilePath basePath) throws IOException, InterruptedException { String subdirectory = StringUtils.trimToEmpty(getSubdirectoryFromEnv()); if (!subdirectory.isEmpty() && !subdirectory.startsWith("/")) { subdirectory = "/" + subdirectory; }/*from www . j a v a 2 s . c o m*/ FilePath sourcePath = basePath.withSuffix(subdirectory).absolutize(); if (!sourcePath.isDirectory() || !isSubDirectory(basePath, sourcePath)) { throw new IllegalArgumentException("Provided path (resolved as '" + sourcePath + "') is not a subdirectory of the workspace (resolved as '" + basePath + "')"); } return sourcePath; }
From source file:net.duckling.ddl.web.controller.task.TaskBaseController.java
protected ModelAndView getForward(String teamCode, String params) { return new ModelAndView("forward:" + StringUtils.trimToEmpty(params)); }
From source file:com.egt.core.db.util.Exporter.java
private static ExporterMessage export(String informe, Long rastro, Long usuario, String destino, EnumFormatoArchivo tipo, String select, Object[] args, boolean logging) { Bitacora.trace(Exporter.class, "export", informe, rastro, destino, tipo); Bitacora.trace(trimToDefaultSelect(select)); Utils.traceObjectArray(args);//from w w w . j a va 2 s . co m String report = StringUtils.trimToEmpty(informe); String target = trimToNullTarget(destino); String format = getExportFormat(tipo); ResultSet resultSet = null; // String archivo = logging ? getLogFileName(rastro) : null; String archivo = null; EnumCondicionEjeFun condicion = EnumCondicionEjeFun.EJECUCION_EN_PROGRESO; String mensaje = TLC.getBitacora().info(CBM2.EXPORT_EXECUTION_BEGIN, report); boolean ok = Auditor.grabarRastroInforme(rastro, condicion, archivo, mensaje); if (ok) { try { JasperReport jasperReport = Reporter.getJasperReport(report); select = jasperReport == null ? select : Utils.replaceWhereClause(jasperReport.getQuery().getText(), select); if (StringUtils.isBlank(select)) { condicion = EnumCondicionEjeFun.EJECUTADO_CON_ERRORES; mensaje = TLC.getBitacora().error(CBM2.ERROR_COMANDO_SELECT); } else { int limite = Reporter.getLimiteFilasFuncionSelect(report); resultSet = TLC.getAgenteSql().executeQuery(select, limite, args); if (resultSet.isBeforeFirst()) { archivo = export(resultSet, report, target, format, usuario); condicion = EnumCondicionEjeFun.EJECUTADO_SIN_ERRORES; mensaje = TLC.getBitacora().warn(CBM2.EXPORT_EXECUTION_END, report); } else { condicion = EnumCondicionEjeFun.EJECUTADO_SIN_ERRORES; mensaje = TLC.getBitacora().error(CBM2.SELECT_ROW_EMPTY_SET, report); } } } catch (Exception ex) { condicion = EnumCondicionEjeFun.EJECUTADO_CON_ERRORES; mensaje = ThrowableUtils.getString(ex); TLC.getBitacora().fatal(ex); TLC.getBitacora().fatal(CBM2.EXPORT_EXECUTION_ABEND, report); } finally { Auditor.grabarRastroInforme(rastro, condicion, archivo, mensaje); DB.close(resultSet); } } else { condicion = EnumCondicionEjeFun.EJECUCION_CANCELADA; mensaje = TLC.getBitacora().error(CBM2.PROCESS_EXECUTION_ABEND, report); } ExporterMessage message = new ExporterMessage(report); message.setDestino(target); message.setTipo(tipo); message.setSelect(select); message.setArgs(args); message.setRastro(rastro); message.setCondicion(condicion); message.setArchivo(archivo); message.setMensaje(mensaje); return message; }
From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.composite.IRISLoginComposite.java
@Override public boolean makeUserDBDao(boolean isTest) { if (!isValidateInput(isTest)) return false; String dbUrl = String.format(getSelectDB().getDB_URL_INFO(), StringUtils.trimToEmpty(textHost.getText()), StringUtils.trimToEmpty(textPort.getText()) //StringUtils.trimToEmpty(textDatabase.getText()) );/* w w w . j a va 2 s . c o m*/ if (!"".equals(textJDBCOptions.getText())) { dbUrl += "?" + textJDBCOptions.getText(); } userDB = new UserDBDAO(); userDB.setDbms_type(getSelectDB().getDBToString()); userDB.setUrl(dbUrl); userDB.setUrl_user_parameter(textJDBCOptions.getText()); //userDB.setDb(StringUtils.trimToEmpty(textDatabase.getText())); userDB.setGroup_name(StringUtils.trimToEmpty(preDBInfo.getComboGroup().getText())); userDB.setDisplay_name(StringUtils.trimToEmpty(preDBInfo.getTextDisplayName().getText())); userDB.setOperation_type(PublicTadpoleDefine.DBOperationType .getNameToType(preDBInfo.getComboOperationType().getText()).toString()); userDB.setHost(StringUtils.trimToEmpty(textHost.getText())); userDB.setPort(StringUtils.trimToEmpty(textPort.getText())); userDB.setUsers(StringUtils.trimToEmpty(textUser.getText())); userDB.setPasswd(StringUtils.trimToEmpty(textPassword.getText())); // others connection . OthersConnectionInfoDAO otherConnectionDAO = othersConnectionInfo.getOthersConnectionInfo(); userDB.setIs_readOnlyConnect( otherConnectionDAO.isReadOnlyConnection() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_autocommit(otherConnectionDAO.isAutoCommit() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_showtables(otherConnectionDAO.isShowTables() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); // userDB.setIs_table_filter(otherConnectionDAO.isTableFilter()?PublicTadpoleDefine.YES_NO.YES.name():PublicTadpoleDefine.YES_NO.NO.name()); // userDB.setTable_filter_include(otherConnectionDAO.getStrTableFilterInclude()); // userDB.setTable_filter_exclude(otherConnectionDAO.getStrTableFilterExclude()); userDB.setIs_profile(otherConnectionDAO.isProfiling() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setQuestion_dml(otherConnectionDAO.isDMLStatement() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_external_browser(otherConnectionDAO.isExterBrowser() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setListExternalBrowserdao(otherConnectionDAO.getListExterBroswer()); userDB.setIs_visible(otherConnectionDAO.isVisible() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_summary_report(otherConnectionDAO.isSummaryReport() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); // ? ?? ? . userDB.setRole_id(PublicTadpoleDefine.USER_ROLE_TYPE.ADMIN.toString()); return true; }
From source file:adalid.commons.util.StrUtils.java
public static String getStringSqlParametrizado(String patron, Object... argumentos) { if (StringUtils.isBlank(patron)) { return null; }/*from w w w.ja va 2s . c o m*/ ArrayList<Object> objetos = new ArrayList<>(); for (Object arg : argumentos) { objetos.add(StringUtils.trimToEmpty(getStringSql(arg))); } return MessageFormat.format(patron, objetos.toArray()); }
From source file:com.prowidesoftware.swift.model.field.Field68B.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w ww .j ava2 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())); result.append(StringUtils.trimToEmpty(getComponent5())); result.append(StringUtils.trimToEmpty(getComponent6())); result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); result.append(StringUtils.trimToEmpty(getComponent7())); result.append(StringUtils.trimToEmpty(getComponent8())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent9())); result.append(StringUtils.trimToEmpty(getComponent10())); result.append(StringUtils.trimToEmpty(getComponent11())); return result.toString(); }
From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.composite.MySQLLoginComposite.java
@Override public boolean makeUserDBDao(boolean isTest) { if (!isValidateInput(isTest)) return false; String dbUrl = ""; String selectLocale = StringUtils.trimToEmpty(comboLocale.getText()); if (selectLocale.equals("") || DBLocaleUtils.NONE_TXT.equals(selectLocale)) { dbUrl = String.format(getSelectDB().getDB_URL_INFO(), StringUtils.trimToEmpty(textHost.getText()), StringUtils.trimToEmpty(textPort.getText()), StringUtils.trimToEmpty(textDatabase.getText())); if (!"".equals(textJDBCOptions.getText())) { dbUrl += "?" + textJDBCOptions.getText(); }/*from www.j a va 2 s. c o m*/ } else { dbUrl = String.format(getSelectDB().getDB_URL_INFO(), StringUtils.trimToEmpty(textHost.getText()), StringUtils.trimToEmpty(textPort.getText()), StringUtils.trimToEmpty(textDatabase.getText()) + "?useUnicode=false&characterEncoding=" + selectLocale); if (!"".equals(textJDBCOptions.getText())) { dbUrl += "&" + textJDBCOptions.getText(); } } userDB = new UserDBDAO(); userDB.setDbms_type(getSelectDB().getDBToString()); userDB.setUrl(dbUrl); userDB.setUrl_user_parameter(textJDBCOptions.getText()); userDB.setDb(StringUtils.trimToEmpty(textDatabase.getText())); userDB.setGroup_name(StringUtils.trimToEmpty(preDBInfo.getComboGroup().getText())); userDB.setDisplay_name(StringUtils.trimToEmpty(preDBInfo.getTextDisplayName().getText())); String dbOpType = PublicTadpoleDefine.DBOperationType .getNameToType(preDBInfo.getComboOperationType().getText()).name(); userDB.setOperation_type(dbOpType); if (dbOpType.equals(PublicTadpoleDefine.DBOperationType.PRODUCTION.name()) || dbOpType.equals(PublicTadpoleDefine.DBOperationType.BACKUP.name())) { userDB.setIs_lock(PublicTadpoleDefine.YES_NO.YES.name()); } userDB.setHost(StringUtils.trimToEmpty(textHost.getText())); userDB.setPort(StringUtils.trimToEmpty(textPort.getText())); userDB.setUsers(StringUtils.trimToEmpty(textUser.getText())); userDB.setPasswd(StringUtils.trimToEmpty(textPassword.getText())); userDB.setLocale(selectLocale); // ? ?? ? . userDB.setRole_id(PublicTadpoleDefine.USER_ROLE_TYPE.ADMIN.toString()); // other connection info setOtherConnectionInfo(); return true; }
From source file:com.prowidesoftware.swift.model.field.Field35B.java
/** * Get the Description as a concatenation of component3 to component6. * @return the Description from components *//* www.j a v a2 s . co m*/ public String getDescription() { StringBuilder result = new StringBuilder(); for (int i = 3; i < 7; i++) { if (StringUtils.isNotBlank(getComponent(i))) { if (result.length() > 0) { result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); } result.append(StringUtils.trimToEmpty(getComponent(i))); } } return result.toString(); }
From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.composite.HiveLoginComposite.java
@Override public boolean makeUserDBDao(boolean isTest) { if (!isValidateInput(isTest)) return false; DBDefine selectDB = (DBDefine) comboDriverType.getData(comboDriverType.getText()); String dbUrl = String.format(selectDB.getDB_URL_INFO(), StringUtils.trimToEmpty(textHost.getText()), StringUtils.trimToEmpty(textPort.getText()), StringUtils.trimToEmpty(textDatabase.getText())); if (!"".equals(textJDBCOptions.getText())) { dbUrl += "?" + textJDBCOptions.getText(); }// w w w . jav a2 s .c o m userDB = new UserDBDAO(); userDB.setDbms_type(selectDB.getDBToString()); userDB.setUrl(dbUrl); userDB.setUrl_user_parameter(textJDBCOptions.getText()); userDB.setDb(StringUtils.trimToEmpty(textDatabase.getText())); userDB.setGroup_name(StringUtils.trimToEmpty(preDBInfo.getComboGroup().getText())); userDB.setDisplay_name(StringUtils.trimToEmpty(preDBInfo.getTextDisplayName().getText())); String dbOpType = PublicTadpoleDefine.DBOperationType .getNameToType(preDBInfo.getComboOperationType().getText()).name(); userDB.setOperation_type(dbOpType); if (dbOpType.equals(PublicTadpoleDefine.DBOperationType.PRODUCTION.name()) || dbOpType.equals(PublicTadpoleDefine.DBOperationType.BACKUP.name())) { userDB.setIs_lock(PublicTadpoleDefine.YES_NO.YES.name()); } userDB.setHost(StringUtils.trimToEmpty(textHost.getText())); userDB.setPort(StringUtils.trimToEmpty(textPort.getText())); userDB.setUsers(StringUtils.trimToEmpty(textUser.getText())); userDB.setPasswd(StringUtils.trimToEmpty(textPassword.getText())); // others connection . // setOtherConnectionInfo(); OthersConnectionInfoDAO otherConnectionDAO = othersConnectionInfo.getOthersConnectionInfo(); userDB.setIs_readOnlyConnect( otherConnectionDAO.isReadOnlyConnection() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_autocommit(otherConnectionDAO.isAutoCommit() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_showtables(otherConnectionDAO.isShowTables() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); // userDB.setIs_table_filter(otherConnectionDAO.isTableFilter()?PublicTadpoleDefine.YES_NO.YES.name():PublicTadpoleDefine.YES_NO.NO.name()); // userDB.setTable_filter_include(otherConnectionDAO.getStrTableFilterInclude()); // userDB.setTable_filter_exclude(otherConnectionDAO.getStrTableFilterExclude()); userDB.setIs_profile(otherConnectionDAO.isProfiling() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setQuestion_dml(otherConnectionDAO.isDMLStatement() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); userDB.setIs_external_browser(otherConnectionDAO.isExterBrowser() ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); // ? ?? ? . userDB.setRole_id(PublicTadpoleDefine.USER_ROLE_TYPE.ADMIN.toString()); return true; }
From source file:ips1ap101.lib.core.db.util.Exporter.java
static ExporterMessage export(String report, String number, String userid, String target, String format, String select, Object[] args, boolean logging) { Bitacora.trace(Exporter.class, "export", report, number, target, format); String informe = StringUtils.trimToEmpty(report); Long rastro = trimToNullNumber(number); Long usuario = StringUtils.isNotBlank(userid) && StringUtils.isNumeric(userid) ? Long.valueOf(userid) : null;//from ww w .j a va 2s . c om String destino = trimToNullTarget(target); EnumFormatoArchivo tipo = getExportType(format); String decode = Utils.decodeSelect(trimToNullSelect(select)); return export(informe, rastro, usuario, destino, tipo, decode, false, args, logging); }