List of usage examples for org.springframework.util StringUtils isEmpty
public static boolean isEmpty(@Nullable Object str)
From source file:cat.albirar.framework.database.exceptions.EntityNotFoundException.java
/** * Compound the message for the search information. * The message are:/* ww w .j a v a2s.c o m*/ * <pre> * [{@link #getOperation() operation} + ": "] + "entity " + ["with " + {@link #getKeyName()} + "='" + {@link #getKeyValue()} + "' " ] + "not found!" * </pre> * @return The compound message */ private String compoundMessage() { StringBuilder stb; stb = new StringBuilder(); if (!StringUtils.isEmpty(getOperation())) { stb.append(getOperation()).append(": "); } stb.append("entity "); if (!StringUtils.isEmpty(getEntityName())) { stb.append("'").append(getEntityName()).append("' "); } if (!StringUtils.isEmpty(getKeyValue()) && !StringUtils.isEmpty(getKeyName())) { stb.append("with ").append(getKeyName()).append("='").append(getKeyValue()).append("' "); } stb.append("not found!"); return stb.toString(); }
From source file:com.graphaware.importer.data.access.BaseTabularDataReader.java
/** * Read a String that is intended to be converted to another type. * * @param columnName column name./* www .j a v a 2 s. c om*/ * @return the String, or <code>null</code> if the value was <code>null</code>, or an empty String. */ protected final String readStringForConversion(String columnName) { String value = doReadObject(columnName); if (value == null) { return null; } if (StringUtils.isEmpty(value.trim())) { return null; } return value.trim(); }
From source file:cn.guoyukun.spring.jpa.plugin.web.controller.BaseTreeableController.java
@RequestMapping(value = "tree", method = RequestMethod.GET) @PageableDefaults(sort = { "parentIds=asc", "weight=asc" }) public String tree(HttpServletRequest request, @RequestParam(value = "searchName", required = false) String searchName, @RequestParam(value = "async", required = false, defaultValue = "false") boolean async, Searchable searchable, Model model) { if (permissionList != null) { permissionList.assertHasViewPermission(); }/*from www . j a va2 s. c om*/ List<M> models = null; if (!StringUtils.isEmpty(searchName)) { searchable.addSearchParam("name_like", searchName); models = baseService.findAllByName(searchable, null); if (!async) { //? ?? searchable.removeSearchFilter("name_like"); List<M> children = baseService.findChildren(models, searchable); models.removeAll(children); models.addAll(children); } else { //?? } } else { if (!async) { //? ?? models = baseService.findAllWithSort(searchable); } else { //?? models = baseService.findRootAndChild(searchable); } } model.addAttribute("trees", convertToZtreeList(request.getContextPath(), models, async, true)); return viewName("tree"); }
From source file:burstcoin.jminer.core.network.Network.java
@PostConstruct protected void postConstruct() { timer = new Timer(); poolMining = CoreProperties.isPoolMining(); if (poolMining) { String poolServer = CoreProperties.getPoolServer(); String numericAccountId = CoreProperties.getNumericAccountId(); if (!StringUtils.isEmpty(poolServer) && !StringUtils.isEmpty(numericAccountId)) { this.poolServer = CoreProperties.getPoolServer(); this.numericAccountId = CoreProperties.getNumericAccountId(); this.walletServer = CoreProperties.getWalletServer(); this.winnerRetriesOnAsync = CoreProperties.getWinnerRetriesOnAsync(); this.winnerRetryIntervalInMs = CoreProperties.getWinnerRetryIntervalInMs(); this.devPool = CoreProperties.isDevPool(); } else {/*from www . j a va 2 s . co m*/ LOG.error("init pool network failed!"); LOG.error("jminer.properties: 'poolServer' or 'numericAccountId' is missing?!"); } } else { String soloServer = CoreProperties.getSoloServer(); String passPhrase = CoreProperties.getPassPhrase(); if (!StringUtils.isEmpty(soloServer) && !StringUtils.isEmpty(passPhrase)) { this.soloServer = soloServer; this.passPhrase = passPhrase; } else { LOG.error("init solo network failed!"); LOG.error("jminer.properties: 'soloServer' or 'passPhrase' is missing?!"); } } this.defaultTargetDeadline = CoreProperties.getTargetDeadline(); this.connectionTimeout = CoreProperties.getConnectionTimeout(); }
From source file:com.phoenixnap.oss.ramlapisync.generation.rules.basic.ClassFieldDeclarationRule.java
@Override public JFieldVar apply(ApiResourceMetadata controllerMetadata, JDefinedClass generatableType) { JFieldVar field = generatableType.field(JMod.PRIVATE, this.fieldClazz, this.fieldName); //add @Autowired field annoation if (autowire) { field.annotate(Autowired.class); }/*from ww w .jav a2 s . c o m*/ //add @Qualifier("qualifierBeanName") if (qualifierAnnotation && !StringUtils.isEmpty(qualifier)) { field.annotate(Qualifier.class).param("value", qualifier); } //add @Value(value="") annotation to the field if (valueAnnotation) { field.annotate(Value.class).param("value", valueAnnotationValue); } return field; }
From source file:org.sakuli.actions.screenbased.TypingUtil.java
/** * Enters the given text one character/key after another using keyDown/keyUp. * <p>/*ww w . j a v a 2 s .c o m*/ * About the usable Key constants see documentation of {@link org.sikuli.script.Key}. * The function could also type UTF-8 unicode characters, if the OS supports it. * The text is entered at the current position of the focus. * </p> * * @param text containing characters and/or {@link org.sikuli.script.Key} constants * @param optModifiers (optional) an String with only {@link org.sikuli.script.Key} constants. * @return this {@link A} or NULL on errors. */ public A type(String text, String optModifiers) { if (StringUtils.isEmpty(optModifiers)) { return typeImpl(text, true); } return typeModifiedImpl(text, optModifiers, true); }
From source file:com.biz.report.service.impl.ItemDashBoardServiceImpl.java
public List<Report3DataSet> readDataForBarChart(String items, String year, String months) { if (!StringUtils.isEmpty(items) && items.contains("[")) { items = items.substring(1, items.length() - 1); }/*from w w w .j a v a 2 s .c o m*/ if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } List list = itemDashBoardDao.readByMonth(items, months, year); List<Report2> reportList = new MappingEngine().getPieChartReport(list); List<Report3DataSet> dataSets = new ArrayList<Report3DataSet>(); for (Report2 r : reportList) { dataSets.add(new Report3DataSet(r.getTypeName(), r.getAmount())); } return dataSets; }
From source file:com.ryantenney.metrics.spring.Util.java
static String resolveName(String explicitName, Method method, Object... arguments) { //single arg methods where the arg is null need to be initialized with one null element, since the array comes in as null sometimes Object[] args;/*from w w w. j a v a2 s . c o m*/ if (arguments == null) { args = new Object[] { null }; } else { args = arguments; } String resolvedName = explicitName; MetricParam mp; int i = 0; Annotation[][] parametersAnnotations = method.getParameterAnnotations(); for (Annotation[] parameterAnnotations : parametersAnnotations) { for (Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation != null && parameterAnnotation instanceof MetricParam && i < args.length) { mp = (MetricParam) parameterAnnotation; String token = mp.value(); if (StringUtils.isEmpty(token)) { token = Integer.toString(i); } token = "{" + token + "}"; String value = ""; if (mp.collection()) { int size = 0; if (args[i] != null) { size = ((Collection<?>) args[i]).size(); } value = "size." + Integer.toString(size); } else { if (args[i] != null) { value = args[i].toString(); } else { value = "null"; } } resolvedName = explicitName.replace(token, value); } } i++; } return resolvedName; }
From source file:be.roots.taconic.pricingguide.service.MailServiceImpl.java
@Override public void sendReport(DateTime lastMonth, String filename, byte[] report) throws MessagingException { final MimeMessageHelper helper = new MimeMessageHelper(javaMailSender.createMimeMessage(), true); helper.setFrom(fromEmail);// w w w . j a v a2s.c o m if (StringUtils.isEmpty(testEmail)) { helper.setTo(reportRecipientEmail.split(",")); } else { helper.setTo(testEmail.split(",")); } if (!StringUtils.isEmpty(bccEmail)) { helper.setBcc(bccEmail.split(",")); } helper.setSubject(documentTitle + " requests for " + lastMonth.toString(DefaultUtil.FORMAT_MONTH)); final String body = "Dear<br>" + "<br>" + "Attached you find the overview of " + documentTitle + " requests for " + lastMonth.toString(DefaultUtil.FORMAT_MONTH) + ".<br>" + "<br>" + "Taconic Biosciences, Inc.<br>" + "One Hudson City Centre<br>" + "Hudson, New York 12534<br>" + "North America +1 888 822-6642<br>" + "Europe +45 70 23 04 05<br>" + "info@taconic.com<br>" + "www.taconic.com"; helper.setText(body, true); helper.addAttachment(filename, new ByteArrayResource(report)); javaMailSender.send(helper.getMimeMessage()); }
From source file:org.wallride.web.controller.admin.page.PageSearchController.java
@RequestMapping(method = RequestMethod.GET) public String search(@PathVariable String language, @Validated @ModelAttribute("form") PageSearchForm form, BindingResult result, @PageableDefault(50) Pageable pageable, Model model, HttpServletRequest servletRequest) throws UnsupportedEncodingException { org.springframework.data.domain.Page<Page> pages = pageService.getPages(form.toPageSearchRequest(), pageable);/* w w w .ja va 2 s .c om*/ model.addAttribute("pages", pages); model.addAttribute("pageable", pageable); model.addAttribute("pagination", new Pagination<>(pages, servletRequest)); UriComponents uriComponents = ServletUriComponentsBuilder.fromRequest(servletRequest) .queryParams(ControllerUtils.convertBeanForQueryParams(form, conversionService)).build(); if (!StringUtils.isEmpty(uriComponents.getQuery())) { model.addAttribute("query", URLDecoder.decode(uriComponents.getQuery(), "UTF-8")); } return "page/index"; }