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:blackboard.sonar.plugins.css.node.TextNode.java
public boolean isBlank() { return StringUtils.isBlank(getCode()); }
From source file:io.muic.ooc.webapp.servlet.LoginServlet.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // do login post logic // extract username and password from request String username = request.getParameter("username"); String password = request.getParameter("password"); if (!StringUtils.isBlank(username) && !StringUtils.isBlank(password)) { if (securityService.authenticate(username, password, request)) { response.sendRedirect("/"); } else {/* w w w. j a va 2s. c o m*/ String error = "Wrong username or password."; request.setAttribute("error", error); RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/login.jsp"); rd.include(request, response); } } else { String error = "Username or password is missing."; request.setAttribute("error", error); RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/login.jsp"); rd.include(request, response); } // check username and password against database // if valid then set username attribute to session via securityService // else put error message to render error on the login form }
From source file:edu.duke.cabig.c3pr.utils.web.validators.AssignedIdentifierDuplicateValidator.java
public void validate(Object object, Errors errors) { PersonUser personUser = null;/*from w w w. j a v a 2s.c o m*/ if (object instanceof PersonOrUserWrapper) { PersonOrUserWrapper wrapper = (PersonOrUserWrapper) object; personUser = wrapper.getPersonUser(); } //Since assigned identifier can be empty during user creation if (StringUtils.isBlank(personUser.getAssignedIdentifier())) { return; } PersonUser rStaffFromDB = personUserDao .getByAssignedIdentifierFromLocal(personUser.getAssignedIdentifier()); if (rStaffFromDB != null && !rStaffFromDB.getId().equals(personUser.getId())) { errors.reject("RSTAFF_EXISTS", "Research Staff with identifier " + personUser.getAssignedIdentifier() + " already exists"); return; } }
From source file:com.activecq.api.helpers.DesignHelper.java
/** * Returns an link tag for the css path supplied in the media indicator. * * @param path//from ww w .j ava2 s .c o m * @param page * @param attrs * @return */ public static String cssTag(String path, Page page, String media) { String src = cssSrc(path, page); if (StringUtils.isBlank(src)) { return "<!-- Missing CSS : " + path + ".css -->"; } if (StringUtils.isBlank(media)) { media = DEFAULT_CSS_MEDIA_TYPE; } media = StringEscapeUtils.escapeHtml(media); src = StringEscapeUtils.escapeHtml(src); // Begin writing link tag return "<link rel=\"stylesheet\" media=\"" + media + "\" href=\"" + src + "\" />"; }
From source file:com.playonlinux.ui.impl.cli.AbstractCLIStep.java
public final void display() { printMessage();/*from w w w . j a va 2 s.c om*/ System.out.println("\n"); String input; if (defineDefaultValue() == null) { input = System.console() .readLine(String.format("< %s [%s] > ", defineInputMessage(), defineDefaultValue())); if (StringUtils.isBlank(input)) { input = defineDefaultValue(); } } else { input = System.console().readLine(String.format("< %s >", defineInputMessage())); } }
From source file:com.acc.validator.FieldNotEmptyValidator.java
@Override public void validate(final Object object, final Errors errors) { Assert.notNull(errors, "Errors object must not be null"); final String fieldValue = (String) errors.getFieldValue(fieldPath); if (StringUtils.isBlank(fieldValue)) { errors.rejectValue(fieldPath, FIELD_REQUIRED_MESSAGE_ID, new String[] { fieldPath }, null); }/*from w w w . jav a 2 s . c om*/ }
From source file:de.thischwa.pmcms.model.domain.PoInfo.java
/** * Get the value of a field./*from www . java 2 s . c o m*/ * * @param fieldName * @return Value of the field or null, if not found. */ public static String getValue(final Page page, final String fieldName) { if (page == null || StringUtils.isBlank(fieldName) || CollectionUtils.isEmpty(page.getContent())) return null; for (Content content : page.getContent()) { if (content.getName().equalsIgnoreCase(fieldName)) return content.getValue(); } return null; }
From source file:com.greenline.guahao.biz.manager.helpcenter.impl.HelpCenterManagerImpl.java
@Override public List<HelpCenterArticleDO> getArticlesByCategoryId(String cateId) { if (StringUtils.isBlank(cateId)) { return null; }// w ww. jav a 2 s . co m return helpCenterDAO.getArticlesByCategoryId(Long.valueOf(cateId)); }
From source file:com.tesora.dve.sql.schema.LoadDataInfileLineOption.java
public LoadDataInfileLineOption(String starting, String terminated) { if (!StringUtils.isBlank(starting)) this.starting = StringEscapeUtils.unescapeJava(PEStringUtils.dequote(starting)); if (!StringUtils.isBlank(terminated)) this.terminated = StringEscapeUtils.unescapeJava(PEStringUtils.dequote(terminated)); }
From source file:com.googlecode.jtiger.modules.ecside.tag.ExportXlsTag.java
public void addExportAttributes(TableModel model, Export export) { if (StringUtils.isBlank(export.getView())) { export.setView(TableConstants.VIEW_XLS); }//from ww w . j a v a 2 s. c om if (StringUtils.isBlank(export.getViewResolver())) { export.setViewResolver(TableConstants.VIEW_XLS); } if (StringUtils.isBlank(export.getImageName())) { export.setImageName(TableConstants.VIEW_XLS); } if (StringUtils.isBlank(export.getText())) { export.setText(BuilderConstants.TOOLBAR_XLS_TEXT); } }