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.Field36E.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from w w w . j av a 2 s .c om*/ @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())); result.append(StringUtils.trimToEmpty(getComponent4())); return result.toString(); }
From source file:net.bulletin.pdi.xero.step.XeroGetStep.java
/** * <p>The Xero cert to use is stored in a file which is pointed at from the meta-data for * the step. This method will pull in that file and turn it into a string so that it can * be used.</p>//from w ww .ja va2 s. c o m */ private String readXeroKey(XeroGetStepMeta meta) throws KettleException { String keyFilePath = environmentSubstitute(meta.getAuthenticationKeyFile()); logBasic("will load xero key from; " + keyFilePath); File file = new File(keyFilePath); if (!file.exists()) { throw new KettleException("the xero key file cannot be found; " + file.getAbsolutePath()); } InputStream inputStream = null; try { inputStream = new FileInputStream(file); String key = StringUtils.trimToEmpty(IOUtils.toString(inputStream, CharEncoding.UTF_8)); if (StringUtils.isBlank(key)) { throw new KettleException("the xero key file appears to be blank; " + file.getAbsolutePath()); } return key; } catch (IOException ioe) { throw new KettleException("unable to process the xero key file; " + file.getAbsolutePath()); } finally { if (null != inputStream) { try { inputStream.close(); } catch (IOException ignore) { } } } }
From source file:com.mirth.connect.connectors.ws.WebServiceSender.java
@Override public ConnectorProperties getProperties() { WebServiceDispatcherProperties properties = new WebServiceDispatcherProperties(); properties.setWsdlUrl(wsdlUrlField.getText()); properties.setService(StringUtils.trimToEmpty((String) serviceComboBox.getSelectedItem())); properties.setPort(StringUtils.trimToEmpty((String) portComboBox.getSelectedItem())); properties.setLocationURI(StringUtils.trimToEmpty((String) locationURIComboBox.getSelectedItem())); properties.setSocketTimeout(socketTimeoutField.getText()); properties.setSoapAction(soapActionField.getText()); properties.setOneWay(invocationOneWayRadio.isSelected()); if (operationComboBox.getSelectedIndex() != -1) { properties.setOperation((String) operationComboBox.getSelectedItem()); }//from w w w .j a v a2 s . com properties.setUseAuthentication(authenticationYesRadio.isSelected()); properties.setUsername(usernameField.getText()); properties.setPassword(new String(passwordField.getPassword())); properties.setEnvelope(soapEnvelope.getText()); ArrayList<String> operations = new ArrayList<String>(); for (int i = 0; i < operationComboBox.getModel().getSize(); i++) { operations.add((String) operationComboBox.getModel().getElementAt(i)); } properties.setWsdlDefinitionMap(currentServiceMap); properties.setHeaders(getHeaderProperties()); properties.setUseMtom(useMtomYesRadio.isSelected()); List<List<String>> attachments = getAttachments(); properties.setAttachmentNames(attachments.get(0)); properties.setAttachmentContents(attachments.get(1)); properties.setAttachmentTypes(attachments.get(2)); return properties; }
From source file:com.prowidesoftware.swift.model.field.Field14S.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from w ww .j av a2 s . 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()) || org.apache.commons.lang.StringUtils.isNotEmpty(getComponent4())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent4())); } return result.toString(); }
From source file:com.matricula.Actions.RegistrationAction.java
private boolean validate() { if (editStudent == null) { return false; }/*from w w w. j a v a2s . com*/ if (periodId == null) { return false; } if (editProgram == null) { return false; } if (schoolDayId == null) { return false; } if (StringUtils.trimToEmpty(editMatricula.getComment()).length() == 0) { return false; } return true; }
From source file:com.prowidesoftware.swift.model.field.Field13C.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from www.j av a 2s . 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(StringUtils.trimToEmpty(getComponent3())); result.append(StringUtils.trimToEmpty(getComponent4())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field95S.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//* w ww . j a v a 2s . c o m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("/"); if (StringUtils.isNotEmpty(getComponent2())) { result.append(StringUtils.trimToEmpty(getComponent2())); } result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent4())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent5())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field11R.java
/** * Serializes the fields' components into the single string value (SWIFT format) */// w w w. j av a2 s . c om @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); result.append(StringUtils.trimToEmpty(getComponent2())); if (StringUtils.isNotEmpty(getComponent3()) || StringUtils.isNotEmpty(getComponent4())) { result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); if (StringUtils.isNotEmpty(getComponent3())) { result.append(StringUtils.trimToEmpty(getComponent3())); } if (StringUtils.isNotEmpty(getComponent4())) { result.append(StringUtils.trimToEmpty(getComponent4())); } } return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field252.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///ww w .j a va2 s. c om @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(StringUtils.trimToEmpty(getComponent3())); } if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent4())) { result.append(StringUtils.trimToEmpty(getComponent4())); } return result.toString(); }
From source file:com.egt.core.jsf.JSF.java
public static String getExtensionNombreArchivo(String archivo, String carpeta) { String str = StringUtils.trimToEmpty(archivo); String dir = Utils.getAttachedFilesDir(carpeta); String ext = getExtensionArchivo(archivo); if (StringUtils.isNotBlank(ext)) { File file = new File(dir + str); if (file.isFile()) { return ext.toUpperCase(); }//from w ww .j a va 2 s.com } return null; }