List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty
public static boolean isNotEmpty(final CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
StringUtils.isNotEmpty(null) = false StringUtils.isNotEmpty("") = false StringUtils.isNotEmpty(" ") = true StringUtils.isNotEmpty("bob") = true StringUtils.isNotEmpty(" bob ") = true
From source file:com.inkubator.hrm.web.organisation.DivisiFormController.java
@PostConstruct @Override/* w w w .ja v a 2s.com*/ public void initialization() { super.initialization(); try { String divisiId = FacesUtil.getRequestParameter("divisiId"); model = new DivisiModel(); isUpdate = Boolean.FALSE; if (StringUtils.isNotEmpty(divisiId)) { Divisi divisi = service.getEntiyByPK(Long.parseLong(divisiId)); if (divisiId != null) { model = getModelFromEntity(divisi); isUpdate = Boolean.TRUE; } } doSelectOneMenuDepartment(); } catch (Exception e) { LOGGER.error("error", e); } }
From source file:com.arvato.thoroughly.service.tmall.impl.APIServiceImpl.java
private String startSearch(final Class<?> classType, String prefix) { final Field[] objectFields = classType.getDeclaredFields(); final StringBuffer sb = new StringBuffer(); String fieldsSeparatedByCommas = null; prefix = prefix == null ? "" : prefix + "."; for (final Field item : objectFields) { if ("serialVersionUID".equals(item.getName())) { continue; }/*from ww w . j ava 2 s.c o m*/ final ApiListField apiListField = item.getAnnotation(ApiListField.class); if (apiListField != null) { continue; } final ApiField annotation = item.getAnnotation(ApiField.class); sb.append(prefix + annotation.value() + ","); } if (StringUtils.isNotEmpty(sb)) { fieldsSeparatedByCommas = sb.toString().substring(0, sb.toString().length() - 1); fields.put(classType.getTypeName(), fieldsSeparatedByCommas); } return fieldsSeparatedByCommas; }
From source file:fr.mycellar.interfaces.web.services.FilterCouple.java
/** * @return// w w w .j a va2s .c om */ public boolean isFilterSet() { return (filter != null) && (!(filter instanceof String) || StringUtils.isNotEmpty((String) filter)); }
From source file:models.CodeCommentThread.java
public boolean isOnChangesOfPullRequest() { return isOnPullRequest() && StringUtils.isNotEmpty(commitId); }
From source file:com.ijuru.kumva.sms.web.SearchServlet.java
/** * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//* ww w.ja v a 2s . c om*/ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String query = request.getParameter("q"); if (query == null || query.length() == 0) return; query = query.trim(); String keyword = Context.getOptions().getInputKeyword(); // Strip keyword if one is specified if (StringUtils.isNotEmpty(keyword) && query.toLowerCase().startsWith(keyword + " ")) { query = query.substring((keyword + " ").length()); } int timeout = Context.getOptions().getConnectionTimeout(); String searchRef = Context.getOptions().getSearchRef(); try { Search search = new RemoteSearch(Context.getDictionary(), timeout); SearchResult result = search.execute(query, 10, searchRef); String message = Messages.searchResult(result, query); out.write(message); } catch (Exception ex) { out.write(Messages.errorOccurred()); log.warn("Remote search failed"); } }
From source file:lumbermill.aws.kcl.internal.KinesisConsumerBootstrap.java
public KinesisConsumerBootstrap(KinesisClientLibConfiguration kinesisCfg, UnitOfWorkListener unitOfWorkListener, ExceptionStrategy exceptionStrategy, Metrics metricsCallback, boolean dry) { this.kinesisCfg = kinesisCfg; this.unitOfWorkListener = unitOfWorkListener; this.exceptionStrategy = exceptionStrategy; this.metricsCallback = metricsCallback; this.dry = dry; String httpsProxy = System.getenv("https_proxy"); if (StringUtils.isNotEmpty(httpsProxy)) { URI proxy = URI.create(httpsProxy); kinesisCfg.getKinesisClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getKinesisClientConfiguration().setProxyPort(proxy.getPort()); kinesisCfg.getDynamoDBClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getDynamoDBClientConfiguration().setProxyPort(proxy.getPort()); kinesisCfg.getCloudWatchClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getCloudWatchClientConfiguration().setProxyPort(proxy.getPort()); }/*ww w .j a va 2s . c om*/ }
From source file:com.streamsets.pipeline.stage.processor.listpivot.ListPivotProcessor.java
public ListPivotProcessor(String listPath, String newPath, boolean copyFields, boolean replaceListField, boolean saveOriginalFieldName, String originalFieldNamePath, OnStagePreConditionFailure onStagePreConditionFailure) { this.listPath = listPath; this.copyFields = copyFields; this.replaceListField = replaceListField; this.saveOriginalFieldName = saveOriginalFieldName; this.originalFieldNamePath = originalFieldNamePath; this.newPath = (StringUtils.isNotEmpty(newPath)) ? newPath : listPath; this.onStagePreConditionFailure = onStagePreConditionFailure; }
From source file:com.myapp.controller.act.rest.editor.model.ModelEditorJsonRestResource.java
@RequestMapping(value = "/act/service/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json") public ObjectNode getEditorJson(@PathVariable String modelId) { ObjectNode modelNode = null;//from w w w .ja v a 2s .c o m Model model = repositoryService.getModel(modelId); if (model != null) { try { if (StringUtils.isNotEmpty(model.getMetaInfo())) { modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); } else { modelNode = objectMapper.createObjectNode(); modelNode.put(MODEL_NAME, model.getName()); } modelNode.put(MODEL_ID, model.getId()); ObjectNode editorJsonNode = (ObjectNode) objectMapper .readTree(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")); modelNode.put("model", editorJsonNode); } catch (Exception e) { LOGGER.error("Error creating model JSON", e); throw new ActivitiException("Error creating model JSON", e); } } return modelNode; }
From source file:io.wcm.handler.url.impl.modes.UrlConfig.java
/** * @return true if at least Site URL is set */ public boolean isValid() { return StringUtils.isNotEmpty(this.siteUrl); }
From source file:io.wcm.samples.handler.controller.http.Redirect.java
@PostConstruct protected void activate() throws IOException { // resolve link of redirect page String redirectUrl = linkHandler.get(resource).buildUrl(); // in preview/publish mode redirect to target if ((wcmMode == WCMMode.DISABLED || wcmMode == WCMMode.PREVIEW) && StringUtils.isNotEmpty(redirectUrl)) { if (StringUtils.equals(redirectStatus, "301")) { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", redirectUrl); } else {//from www.j av a 2 s. c o m response.sendRedirect(redirectUrl); } renderPage = false; } else if (wcmMode == WCMMode.DISABLED) { response.sendError(HttpServletResponse.SC_NOT_FOUND); renderPage = false; } }