List of usage examples for org.apache.commons.lang3 StringUtils isNoneEmpty
public static boolean isNoneEmpty(final CharSequence... css)
Checks if none of the CharSequences are empty ("") or null.
StringUtils.isNoneEmpty(null) = false StringUtils.isNoneEmpty(null, "foo") = false StringUtils.isNoneEmpty("", "bar") = false StringUtils.isNoneEmpty("bob", "") = false StringUtils.isNoneEmpty(" bob ", null) = false StringUtils.isNoneEmpty(" ", "bar") = true StringUtils.isNoneEmpty("foo", "bar") = true
From source file:com.smapley.vehicle.activity.SetActivity.java
private void updatePic(File file) { if (file != null) { ProgressDialog dialog = new ProgressDialog(this); dialog.setMessage(""); RequestParams params = new RequestParams(Constant.URL_ADDPHOTO); params.addBodyParameter("ukey", (String) SP.getUser("ukey")); params.addBodyParameter("name", file); dialog.show();//from w w w.j a va 2s . c o m x.http().post(params, new BaseCallback<Map>(dialog) { @Override public void success(Map result) { if (StringUtils.isNoneEmpty(result.get("filename").toString())) x.image().bind(image, Constant.URL_IMG + result.get("filename"), circleImage); } }); } }
From source file:com.epam.dlab.backendapi.resources.base.InfrastructureService.java
private void removeResourcesWithRunningContainers(String username, UserEnvironmentResources dto) throws Exception { final ProcessInfo processInfo = commandExecutor.executeSync(username, DockerCommands.generateUUID(), String.format(DockerCommands.GET_RUNNING_CONTAINERS_FOR_USER, dto.getEdgeUserName())); final String processInfoStdOut = processInfo.getStdOut(); if (StringUtils.isNoneEmpty(processInfoStdOut)) { final List<String> runningContainerNames = Arrays.asList(processInfoStdOut.split("\n")); log.info("Running containers for users: {}", runningContainerNames); final List<EnvResource> hostList = filter(dto.getEdgeUserName(), runningContainerNames, dto.getResourceList().getHostList()); final List<EnvResource> clusterList = filter(dto.getEdgeUserName(), runningContainerNames, dto.getResourceList().getClusterList()); dto.getResourceList().setHostList(hostList); dto.getResourceList().setClusterList(clusterList); }// ww w . j ava 2 s.c om }
From source file:h2backup.BackupTimerService.java
@PostConstruct public void init() { if (!enabled) { log.info("H2 database backup is disabled"); return;// www. j av a 2 s. c om } if (StringUtils.isEmpty(methodName)) { log.warn("No H2 database backup methods were specified"); return; } method = BackupMethod.valueOf(methodName); if (StringUtils.isEmpty(directory)) { directory = System.getProperty("user.dir"); } toList = asList(to.split(LIST_DELIMITER)); if (text == null) { text = StringUtils.EMPTY; } String timerInfoName = getTimerInfoName(); for (Timer timer : timerService.getAllTimers()) { if (timer.getInfo() instanceof BackupTimerInfo) { BackupTimerInfo timerInfo = (BackupTimerInfo) timer.getInfo(); if (StringUtils.equals(timerInfoName, timerInfo.getName())) { log.info("H2 database backup is already scheduled: {}", timerInfo); return; } } } ScheduleExpression scheduleExpression = new ScheduleExpression(); if (StringUtils.isNoneEmpty(year)) { scheduleExpression.year(year); } if (StringUtils.isNoneEmpty(month)) { scheduleExpression.month(month); } if (StringUtils.isNoneEmpty(dayOfMonth)) { scheduleExpression.dayOfMonth(dayOfMonth); } if (StringUtils.isNoneEmpty(dayOfWeek)) { scheduleExpression.dayOfWeek(dayOfWeek); } if (StringUtils.isNoneEmpty(hour)) { scheduleExpression.hour(hour); } if (StringUtils.isNoneEmpty(minute)) { scheduleExpression.minute(minute); } if (StringUtils.isNoneEmpty(second)) { scheduleExpression.second(second); } if (StringUtils.isNoneEmpty(timezone)) { scheduleExpression.timezone(timezone); } BackupTimerInfo timerInfo = new BackupTimerInfo(timerInfoName, scheduleExpression, Instant.now()); TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo(timerInfo); timerConfig.setPersistent(true); timerService.createCalendarTimer(scheduleExpression, timerConfig); log.info("Scheduled H2 database backup: {}", timerInfo); }
From source file:com.github.fengtan.sophie.beans.SolrUtils.java
/** * Get unique key field from the remote Solr server. * /*from ww w.j a v a 2 s . co m*/ * @param cached * If false, the value will be retrieved from Solr. If true, the * value may be retrieved from a local cache. * @return Unique key field name. * @throws SophieException * If the unique key field cannot be fetched. */ public static String getRemoteUniqueField(boolean cached) throws SophieException { // If cache is empty, or if client method explicitely wants uncached // value, then warm the cache. if (!cached || !StringUtils.isNoneEmpty(cachedUniqueField)) { SchemaRequest.UniqueKey request = new SchemaRequest.UniqueKey(); try { cachedUniqueField = request.process(Sophie.client).getUniqueKey(); } catch (SolrServerException | IOException | SolrException e) { throw new SophieException("Unable to fetch name of unique field", e); } } // Return cache. return cachedUniqueField; }
From source file:com.vip.saturn.job.console.controller.HomeController.java
@RequestMapping(value = "overview", method = RequestMethod.GET) public String overview(String name, final ModelMap model, HttpServletRequest request, final HttpSession session) { model.put("containerType", SaturnEnvProperties.CONTAINER_TYPE); if (StringUtils.isNoneEmpty(name)) { setSession(registryCenterService.connect(name), session); renderShellExecutorInfos(model); return "overview"; }/* w w w . ja v a 2s .co m*/ RegistryCenterConfiguration config = (RegistryCenterConfiguration) request.getSession() .getAttribute(AbstractController.ACTIVATED_CONFIG_SESSION_KEY); if (config == null) { return "redirect:registry_center_page"; } else { setSession(registryCenterService.connect(config.getNameAndNamespace()), session); renderShellExecutorInfos(model); return "overview"; } }
From source file:com.aestheticsw.jobkeywords.web.html.JobController.java
/** * The search page relies on an AJAX call to submit the form-parameters and redraw only a * portion of the HTML page./* ww w. j a v a 2 s .c o m*/ * * If a validation error occurs for an initial search then the Javascript must correctly handle * the case where a subsequent search corrects the validation error and draws the response. * Correcting a validation error requires the Javascript to redraw both the <form> and the * results <div> HTML. * * If the search page is in a clean state then the search results only require redrawing the * <div> that contains the results. When an initial validation error occurs, only the <div> that * contains the form must be redrawn. When an initial valication is subsequencly corrected then * both <div>s must be redrawn. */ @RequestMapping(value = "/search", method = RequestMethod.POST) public ModelAndView getTermListForSearchParameters(@Valid SearchFormBean searchFormBean, BindingResult result, RedirectAttributes redirect, @RequestParam(required = false) boolean isAjaxRequest) { Map<String, Object> modelMap = new HashMap<>(); modelMap.put("searchFormBean", searchFormBean); if (result.hasErrors()) { searchFormBean.setHadFormErrors(true); modelMap.put("formErrors", result.getAllErrors()); // Return the whole HTML page and let the Javascript select which <div> tags it wants to render. return new ModelAndView("keywords", modelMap); } Locale locale = Locale.US; if (StringUtils.isNoneEmpty(searchFormBean.getCountry())) { locale = SearchUtils.lookupLocaleByCountry(searchFormBean.getCountry()); } SearchParameters params = new SearchParameters( new QueryKey(searchFormBean.getQuery(), locale, searchFormBean.getCity()), searchFormBean.getJobCount(), searchFormBean.getStart(), searchFormBean.getRadius(), searchFormBean.getSort()); TermFrequencyList termFrequencyList; try { termFrequencyList = termExtractorService.extractTerms(params); } catch (IndeedQueryException e) { searchFormBean.setHadFormErrors(true); result.addError(new FieldError("searchFormBean", "query", "No results found, check query expression: " + params)); modelMap.put("formErrors", result.getAllErrors()); // Return the whole HTML page and let the Javascript select which <div> tags it wants to render. return new ModelAndView("keywords", modelMap); } searchFormBean.setHadFormErrors(false); modelMap.put("results", termFrequencyList); if (isAjaxRequest) { // Return only the results fragment. return new ModelAndView("keywords :: query-results", modelMap); } return new ModelAndView("keywords", modelMap); }
From source file:com.axibase.tsd.driver.jdbc.content.ContentDescription.java
public String getStrategyName() { final String strategy = paramsMap.get(STRATEGY_PARAM_NAME); return StringUtils.isNoneEmpty(strategy) ? strategy : null; }
From source file:net.eledge.android.europeana.gui.activity.HomeActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { if (StringUtils.isNoneEmpty(mEditTextQuery.getText())) { mEditTextQuery.setText(null); return false; }/*from ww w . j a v a 2s . c o m*/ } return super.onKeyDown(keyCode, event); }
From source file:io.cloudslang.content.utils.NumberUtilities.java
/** * If the integer string is null or empty, it returns the defaultInteger otherwise it returns the integer value (see toInteger) * * @param integerStr the integer to convert * @param defaultInteger the default value if the integerStr is null or the empty string * @return the integer value of the string or the defaultInteger is the integer string is empty * @throws IllegalArgumentException if the passed integer string is not a valid integer *///from w w w .ja v a 2 s . com public static int toInteger(@Nullable final String integerStr, final int defaultInteger) { return StringUtils.isNoneEmpty(integerStr) ? toInteger(integerStr) : defaultInteger; }
From source file:com.hybris.integration.service.tmall.impl.TmcMessagesServiceImpl.java
@Override public TmcMessage getTmcMessage(final String integrationId) throws TmallAppException { String tmcJson = CommonUtils.readFile(persistenceUrl + "TMCMESSAGESINFORMATION" + integrationId + ".json"); TmcMessage tmc = null;/*w ww.ja v a 2 s.c o m*/ if (StringUtils.isNoneEmpty(tmcJson)) { try { tmcJson = encryptionTools.decrypt(tmcJson); } catch (final Exception e) { throw new TmallAppException(ResponseCode.AES_DECRYPTION_ERROR.getCode(), "AES decryption failure:" + e.getMessage()); } tmc = CommonUtils.getGsonByBuilder().fromJson(tmcJson, TmcMessage.class); } else { throw new TmallAppException(ResponseCode.OBJECT_NOT_FOUND.getCode(), "The [" + integrationId + "] does not exist"); } return tmc; }