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.haulmont.cuba.web.app.folders.AppFolderEditWindow.java
public AppFolderEditWindow(boolean adding, Folder folder, Presentations presentations, Runnable commitHandler) { super(adding, folder, presentations, commitHandler); if (!adding) { ThemeConstants theme = App.getInstance().getThemeConstants(); setWidth(theme.get("cuba.web.AppFolderEditWindow.width")); layout.setWidth("100%"); visibilityScriptField = new CubaSourceCodeEditor(); visibilityScriptField.setMode(AceMode.groovy); visibilityScriptField.setWidth(100, Unit.PERCENTAGE); visibilityScriptField.setCaption(getMessage("folders.visibilityScript")); String vScript = StringUtils.trimToEmpty(((AppFolder) folder).getVisibilityScript()); visibilityScriptField.setValue(vScript); layout.addComponent(visibilityScriptField, 3); quantityScriptField = new CubaSourceCodeEditor(); String qScript = StringUtils.trimToEmpty(((AppFolder) folder).getQuantityScript()); quantityScriptField.setValue(qScript); quantityScriptField.setMode(AceMode.groovy); quantityScriptField.setWidth(100, Unit.PERCENTAGE); quantityScriptField.setCaption(getMessage("folders.quantityScript")); layout.addComponent(quantityScriptField, 4); if (AppUI.getCurrent().isTestMode()) { setCubaId("appFolderEditWindow"); visibilityScriptField.setCubaId("visibilityScriptField"); quantityScriptField.setCubaId("quantityScriptField"); }/*from ww w . ja v a 2s.c o m*/ } }
From source file:ips1ap101.ejb.core.sqlagent.SqlAgentBrokerBean.java
@Override public ObjectMessage executeProcedure(String procedimiento, long funcion, Object[] args) { Bitacora.trace(this.getClass(), "executeProcedure", procedimiento, String.valueOf(funcion)); Utils.traceObjectArray(args);//ww w.j av a 2 s.c om Long rastro = null; ObjectMessage reply = null; try { procedimiento = StringUtils.trimToEmpty(procedimiento); if (STP.esIdentificadorArchivoValido(procedimiento)) { if (TLC.getControlador().esFuncionAutorizada(funcion)) { TLC.getConnection(ds); rastro = TLC.getControlador().ponerProcesoPendiente(funcion); SqlAgentMessage message = new SqlAgentMessage(procedimiento, funcion); message.setRastro(rastro); message.setMensaje(Bitacora.getTextoMensaje(CBM.PROCESS_EXECUTION_REQUEST, procedimiento)); message.setArgumentos(args); reply = messenger.send(message); TLC.getBitacora().info(message.getMensaje()); } else { throw new ExcepcionAplicacion( Bitacora.getTextoMensaje(CBM.FUNCION_NO_AUTORIZADA, procedimiento)); } } else { throw new ExcepcionAplicacion( Bitacora.getTextoMensaje(CBM.IDENTIFICADOR_ARCHIVO_INVALIDO, procedimiento)); } } catch (Exception ex) { CondicionEjeFunEnumeration condicion = CondicionEjeFunEnumeration.EJECUCION_CANCELADA; String mensaje = ThrowableUtils.getString(ex); Auditor.grabarRastroProceso(rastro, condicion, null, mensaje); TLC.getBitacora().error(mensaje); } return reply; }
From source file:ch.entwine.weblounge.kernel.security.SystemAdminDirectoryProvider.java
/** * {@inheritDoc}//ww w. j av a 2 s . c o m * * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary) */ @SuppressWarnings("rawtypes") public void updated(Dictionary properties) throws ConfigurationException { String login = null; String pass = ""; String digest = null; String name = null; String email = null; if (properties != null) { login = StringUtils.trimToNull((String) properties.get(OPT_ADMIN_LOGIN)); pass = StringUtils.trimToEmpty((String) properties.get(OPT_ADMIN_PASSWORD)); digest = StringUtils.trimToEmpty((String) properties.get(OPT_ADMIN_DIGEST)); name = StringUtils.trimToEmpty((String) properties.get(OPT_ADMIN_NAME)); email = StringUtils.trimToEmpty((String) properties.get(OPT_ADMIN_EMAIL)); } // If no user can be found if (login == null || "".equals(pass)) { logger.info("No system accounts have been defined"); if (administrator != null) logger.info("Deactivating system admin account"); administrator = null; return; } // Register the new one logger.info("Activating system admin user '{}'", login); administrator = new WebloungeUserImpl(login, Security.SYSTEM_CONTEXT); if (StringUtils.isNotBlank(name)) administrator.setName(name); if (StringUtils.isNotBlank(email)) administrator.setEmail(email); DigestType digestType = DigestType.plain; if (StringUtils.isNotBlank(digest)) { try { digestType = DigestType.valueOf(digest); } catch (IllegalArgumentException e) { logger.error("Digest type '{}' is unknown", digest); throw new ConfigurationException(OPT_ADMIN_DIGEST, digest); } } if (StringUtils.isNotBlank(pass)) { Password password = new PasswordImpl(StringUtils.trimToEmpty(pass), digestType); administrator.addPrivateCredentials(password); } // Add the roles for (Role role : SystemRole.SYSTEMADMIN.getClosure()) { administrator.addPublicCredentials(role); } }
From source file:nc.noumea.mairie.organigramme.dto.FichePosteDto.java
@JSON(include = false) public String getLibelleGradeCategorie() { String suffixe = StringUtils.isNotBlank(this.categorie) ? " (" + this.categorie + ")" : ""; return StringUtils.trimToNull(StringUtils.trimToEmpty(this.gradePoste) + suffixe); }
From source file:hudson.plugins.sonar.model.LightProjectConfig.java
public String getLanguage() { return StringUtils.trimToEmpty(language); }
From source file:meta.proyecto.base.ProyectoJava.java
public static String getEsquemaEntidadesComunes() { String string = getString("adalid.schema"); return StringUtils.trimToEmpty(string); }
From source file:hudson.plugins.simpleupdatesite.HPI.java
public List<Developer> getDevelopers(Attributes attributes) throws IOException { String devs = attributes.getValue("Plugin-Developers"); if (devs == null || devs.trim().length() == 0) { return Collections.emptyList(); }//ww w .j a v a 2 s . co m List<Developer> result = new ArrayList<Developer>(); Matcher matcher = this.developersPattern.matcher(devs); int totalMatched = 0; while (matcher.find()) { result.add(new Developer(StringUtils.trimToEmpty(matcher.group(1)), StringUtils.trimToEmpty(matcher.group(2)), StringUtils.trimToEmpty(matcher.group(3)))); totalMatched += matcher.end() - matcher.start(); } if (totalMatched < devs.length()) { // ignore and move on System.err.println("Unparsable developer info: '" + devs.substring(totalMatched) + "'"); } return result; }
From source file:com.hangum.tadpole.commons.sql.util.SQLUtil.java
/** * ?? ?? ? ?./*from w ww . j a va 2s . c o m*/ * * @param exeSQL * @return */ public static String executeQuery(String exeSQL) { try { // // https://github.com/hangum/TadpoleForDBTools/issues/140 . // TO DO ? ?? ??..DB? ? . // // ? -- ? ? ?? ? . // exeSQL = delComment(exeSQL, "--"); // ? // ? ? ?? ? . exeSQL = delComment(exeSQL, "--"); // // exeSQL = StringUtils.replace(exeSQL, "\r", " "); // exeSQL = StringUtils.replace(exeSQL, "\n", " "); // exeSQL = StringUtils.replace(exeSQL, Define.LINE_SEPARATOR, " "); // exeSQL = exeSQL.replaceAll("(\r\n|\n|\r)", " "); // ? ? exeSQL = StringUtils.trimToEmpty(exeSQL); } catch (Exception e) { logger.error("query execute", e); } return exeSQL; }
From source file:nc.noumea.mairie.appock.core.utility.AppockUtil.java
/** * Convertit la chaine en entre en majuscule sans accent, et sans blanc devant/derrire. * * @param str chane concerne//from w w w. j a v a2 s. c o m * @return "" si la chaine en entre est null */ public static String majusculeSansAccentTrim(String str) { if (str == null) { return ""; } String s = StringUtils.trimToEmpty(str).toUpperCase(); s = s.replaceAll("[]", "A"); s = s.replaceAll("[]", "E"); s = s.replaceAll("[?]", "I"); s = s.replaceAll("", "O"); s = s.replaceAll("[]", "U"); s = s.replaceAll("", "C"); return s; }
From source file:edu.common.dynamicextensions.xmi.XMIUtilities.java
/*** * Finds and returns the first model element having the given * <code>name</code> in the <code>umlPackage</code>, returns * <code>null</code> if not found. * * @param umlPackage The modelPackage to search * @param name the name to find./* w w w . jav a2s. c o m*/ * @return the found model element. */ public static Object find(org.omg.uml.modelmanagement.UmlPackage umlPackage, final String name) { return CollectionUtils.find(umlPackage.getOwnedElement(), new Predicate() { public boolean evaluate(Object object) { return StringUtils.trimToEmpty(((ModelElement) object).getName()).equals(name); //return true; } }); }