List of usage examples for org.apache.commons.lang StringUtils isBlank
public static boolean isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
From source file:com.chilmers.configbootstrapper.ConfigHelper.java
/** * Used for reading the application from it's location after initialization is done. * @param propertyKey the name of the property for the application config location or * null for the default key./* www . j a va 2 s.c om*/ * Can be null in most cases. If it is blank or null the default key will be used. * See {@link ConfigServletContextListener#DEFAULT_CONFIG_LOCATION_PROPERTY_KEY} * @return A property resource bundle holding the current configuration. */ public static PropertyResourceBundle readApplicationConfiguration(String propertyKey) { if (StringUtils.isBlank(propertyKey)) { propertyKey = ConfigServletContextListener.DEFAULT_CONFIG_LOCATION_PROPERTY_KEY; } String applicationConfigLocation = System.getProperty(propertyKey); return new ConfigHelper("config-bootstrapper").getApplicationConfiguration(applicationConfigLocation); }
From source file:com.prowidesoftware.swift.model.field.Field90FTest.java
@Test public void testField90FString() { Field90F f = null;/*from w w w. j a v a2 s .co m*/ f = new Field90F(""); assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":"); assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":/"); //assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F("://"); assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":///"); assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD"); assertEquals("DDDD", f.getComponent1()); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//"); assertEquals("DDDD", f.getComponent1()); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertTrue(StringUtils.isBlank(f.getComponent4())); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF123"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertEquals("123", f.getComponent4()); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF123/"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertEquals("123", f.getComponent4()); assertTrue(StringUtils.isBlank(f.getComponent5())); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF123/GGG"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertEquals("123", f.getComponent4()); assertEquals("GGG", f.getComponent5()); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF123/GGG/"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertEquals("123", f.getComponent4()); assertEquals("GGG", f.getComponent5()); assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":DDDD//EEEEEEEE/FFF123/GGG/456"); assertEquals("DDDD", f.getComponent1()); assertEquals("EEEEEEEE", f.getComponent2()); assertEquals("FFF", f.getComponent3()); assertEquals("123", f.getComponent4()); assertEquals("GGG", f.getComponent5()); assertEquals("456", f.getComponent6()); }
From source file:io.kamax.mxisd.config.StorageConfig.java
@PostConstruct private void postConstruct() { if (StringUtils.isBlank(getBackend())) { throw new ConfigurationException("storage.backend"); }// w w w. java 2 s . com }
From source file:net.nan21.dnet.module.md.presenter.ext.mm.service.ProductCategory_DsService.java
/** * Calculate real icon/image location//from w ww . j a va 2 s .c om */ @Override protected void postFind(IQueryBuilder<ProductCategory_Ds, ProductCategory_Ds, Object> builder, List<ProductCategory_Ds> result) throws Exception { String MM_PRODCATEG_ICON_BASEURL = this.getSettings().getParam(SysParams_Md.MM_PRODCATEG_ICON_BASEURL); String MM_PRODCATEG_ICON_EXT = this.getSettings().getParam(SysParams_Md.MM_PRODCATEG_ICON_EXT); for (ProductCategory_Ds ds : result) { if (StringUtils.isBlank(ds.getIconUrl())) { ds.setIconLocation(MM_PRODCATEG_ICON_BASEURL + "/" + ds.getCode() + "." + MM_PRODCATEG_ICON_EXT); } else { if (!ds.getIconUrl().startsWith("http")) { ds.setIconLocation(MM_PRODCATEG_ICON_BASEURL + "/" + ds.getIconUrl()); } else { ds.setIconLocation(ds.getIconUrl()); } } } }
From source file:com.cy.driver.action.UploadIdentityNumberAction.java
@RequestMapping(value = "/uploadIdentityNumber") @ResponseBody/*from www . ja v a 2 s. co m*/ @Log(type = 58) public JSonResponse exec(String driverId, String identityLicenseNum) throws Exception { try { authentication(driverId); if (!isOk) { return jSonResponse; } String id = driverId, identityNumber = identityLicenseNum; if (StringUtils.isBlank(identityNumber)) { //sendResponseToJson("-8", "???"); if (log.isWarnEnabled()) { log.warn("???"); } return JSonResponse.makeHasContentJSonRespone("-8", "???"); } if (!ValidateUtil.validateIdentityLicenseNum(identityNumber)) { //sendResponseToJson("-8", "?????"); if (log.isWarnEnabled()) { log.warn("?????"); } return JSonResponse.makeHasContentJSonRespone("-8", "?????"); } DriverUserInfoBo bo = new DriverUserInfoBo(); bo.setId(Integer.parseInt(id)); bo.setIdentityLicenseNum(identityNumber); int i = driverUserCargoInfoService.updateDriverUserInfo(bo); if (i == 1) { //sendResponseToJson("1", "??."); if (log.isInfoEnabled()) { log.info("??"); } return JSonResponse.makeHasContentJSonRespone("1", "??."); } else { //sendResponseToJson("0", "?."); if (log.isInfoEnabled()) { log.info("?."); } return JSonResponse.makeHasContentJSonRespone("0", "?."); } } catch (Exception e) { log.error("UploadIdentityNumberAction.class - " + e.getMessage()); return JSonResponse.makeHasContentJSonRespone("-8", ", ???"); } }
From source file:com.ishare.bean.IdentityBean.java
public boolean isIdentityInfoFull() { if (!StringUtils.isBlank(this.identification_num) && !StringUtils.isBlank(this.real_name) && !StringUtils.isBlank(this.driver_license_front) && !StringUtils.isBlank(this.driver_license_back)) { return true; }/*from w ww .j ava 2s .co m*/ return false; }
From source file:gov.nih.nci.protexpress.ui.actions.accountinfo.ForgotPasswordAction.java
/** * Method to submit the forgot password request. * @return the directive for the next action/page to be directed to. *///from w w w . j a v a2 s. c o m public String submitRequest() { try { if (StringUtils.isBlank(getLoginName())) { addActionError(getText("forgotpassword.userNameNotSpecified")); return Action.INPUT; } if (StringUtils.isBlank(getEmailId())) { addActionError(getText("forgotpassword.emailIdNotSpecified")); return Action.INPUT; } //Send email to user and admin EmailHelper.sendPasswordRequestConfirmationEmailToUser(getEmailId()); EmailHelper.sendPasswordRequestEmailToAdmin(getLoginName(), getEmailId()); setSuccessMessage(ConfigurationHelper .getConfigurationStringValue(ConfigParamEnum.FORGOT_PASSWORD_SUCCESS_MESSAGE)); return Action.SUCCESS; } catch (MessagingException me) { ActionHelper.saveMessage(getText("forgotpassword.emailFailure")); addActionError(getText(getText("forgotpassword.emailFailure"))); return Action.INPUT; } }
From source file:com.nagarro.core.validator.FieldNotEmptyValidator.java
@Override public void validate(final Object object, final Errors errors) { Assert.notNull(errors, "Errors object must not be null"); final Object fieldValue = errors.getFieldValue(fieldPath); if (fieldValue == null || (fieldValue instanceof String && StringUtils.isBlank((String) fieldValue))) { errors.rejectValue(fieldPath, FIELD_REQUIRED_MESSAGE_ID, new String[] { fieldPath }, null); }//w ww . j a v a 2 s.c o m }
From source file:net.ageto.gyrex.impex.common.steps.impl.writers.FileWriter.java
@Override protected StatusStep process() { try {/*ww w .ja v a 2 s .c o m*/ String filename = (String) getInputParam(FileWriterDefinition.InputParamNames.OUTPUT_FILENAME.name()); if (StringUtils.isBlank(filename)) { processError("{0} missing input.", ID); return StatusStep.ERROR; } StringBuffer content = (StringBuffer) getInputParam( FileWriterDefinition.InputParamNames.INPUT_CONTENT.name()); FileWriterWithEncoding fw = new FileWriterWithEncoding(new File(filename), CharEncoding.UTF_8); fw.write(content.toString()); fw.flush(); } catch (IOException e) { processError("File could not be created."); } processInfo("{0} has been completed successfully.", ID); return StatusStep.OK; }