List of usage examples for org.springframework.util Assert hasText
@Deprecated public static void hasText(@Nullable String text)
From source file:org.italiangrid.storm.webdav.fs.attrs.DefaultExtendedFileAttributesHelper.java
@Override public String getExtendedFileAttributeValue(File f, String attributeName) throws IOException { Assert.notNull(f);//w ww . java 2 s . c o m Assert.hasText(attributeName); UserDefinedFileAttributeView faView = Files.getFileAttributeView(f.toPath(), UserDefinedFileAttributeView.class); if (faView == null) { throw new IOException("UserDefinedFileAttributeView not supported on file " + f.getAbsolutePath()); } return getAttributeValue(faView, attributeName); }
From source file:com.miko.demo.mongo.model.EntityC.java
public void setAttribute(String name, String value) { Assert.hasText(name); if (value == null) { this.attributes.remove(value); } else {//from www. j av a 2s .c o m this.attributes.put(name, value); } }
From source file:org.cloudfoundry.identity.uaa.api.client.impl.UaaClientOperationsImpl.java
public BaseClientDetails update(BaseClientDetails client) { Assert.notNull(client); Assert.hasText(client.getClientId()); return helper.put("/oauth/clients/{id}", client, CLIENT_REF, client.getClientId()); }
From source file:com.frank.search.solr.core.query.HighlightOptions.java
/** * Add name of field to highlight on/*from w ww . j a v a 2 s .c o m*/ * * @param fieldname * @return */ public HighlightOptions addField(String fieldname) { Assert.hasText(fieldname); return addField(new SimpleField(fieldname)); }
From source file:team.curise.dao.BaseDao.java
/** * hqlselect ??union,pagedQuery./* ww w. j a v a 2s.co m*/ * @see #pagedQuery(String,int,int,Object[]) * @param hql * @return */ public static String removeSelect(String hql) { Assert.hasText(hql); int beginPos = hql.toLowerCase().indexOf("from"); Assert.isTrue(beginPos != -1, " hql : " + hql + " must has a keyword 'from'"); return hql.substring(beginPos); }
From source file:net.groupbuy.service.impl.MailServiceImpl.java
public void send(String smtpFromMail, String smtpHost, Integer smtpPort, String smtpUsername, String smtpPassword, String toMail, String subject, String templatePath, Map<String, Object> model, boolean async) { Assert.hasText(smtpFromMail); Assert.hasText(smtpHost);// w w w . jav a 2s . c o m Assert.notNull(smtpPort); Assert.hasText(smtpUsername); Assert.hasText(smtpPassword); Assert.hasText(toMail); Assert.hasText(subject); Assert.hasText(templatePath); try { Setting setting = SettingUtils.get(); Configuration configuration = freeMarkerConfigurer.getConfiguration(); Template template = configuration.getTemplate(templatePath); String text = FreeMarkerTemplateUtils.processTemplateIntoString(template, model); javaMailSender.setHost(smtpHost); javaMailSender.setPort(smtpPort); javaMailSender.setUsername(smtpUsername); javaMailSender.setPassword(smtpPassword); MimeMessage mimeMessage = javaMailSender.createMimeMessage(); MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, false, "utf-8"); mimeMessageHelper.setFrom(MimeUtility.encodeWord(setting.getSiteName()) + " <" + smtpFromMail + ">"); mimeMessageHelper.setSubject(subject); mimeMessageHelper.setTo(toMail); mimeMessageHelper.setText(text, true); if (async) { addSendTask(mimeMessage); } else { javaMailSender.send(mimeMessage); } } catch (TemplateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (MessagingException e) { e.printStackTrace(); } }
From source file:com.miko.demo.mongo.service.EntityCReadAttributesTest.java
@Test public void findEntityCAndReadSpecificAttribute() { EntityC entityC = entityCService.findByName("mirage"); String attribute = entityC.getAttribute("mirage1"); logger.debug("FindEntityC = " + entityC.getName() + " attribute= " + attribute); Assert.hasText(attribute); }
From source file:nl.surfnet.coin.api.playground.ApiSettings.java
/** * @param url//w w w . ja v a 2 s.com * the request.getRequestUrl() */ public ApiSettings(String url) { Assert.hasText(url); String base = url.substring(0, url.lastIndexOf("test")); String env = "dev"; try { Matcher matcher = Pattern.compile("https(\\.\\w*\\.)surfconext").matcher(url); env = (matcher.find() ? matcher.group(1) : "."); } catch (Exception e) { // unexpected, but we won't risk runtime errors for defaults } if (url.contains("localhost")) { base = "http://localhost:8095/api/"; this.requestURL = base + "mock10/social/rest/groups/@me"; } else { this.requestURL = base + "social/rest/groups/@me"; } this.oauthKey = String.format("https://testsp%ssurfconext.nl/shibboleth", env); this.oauthSecret = "mysecret"; this.requestTokenEndPoint = base + "oauth1/requestToken"; this.accessTokenEndPoint = base + "oauth1/accessToken"; this.authorizationURL = base + "oauth1/confirm_access"; this.accessTokenEndPoint2 = base + "oauth2/token"; this.authorizationURL2 = base + "oauth2/authorize"; }
From source file:com.oreilly.springdata.gemfire.core.Product.java
/** * Sets the attribute with the given name to the given value. * /*from w w w .j a v a 2 s .com*/ * @param name must not be {@literal null} or empty. * @param value */ public void setAttribute(String name, String value) { Assert.hasText(name); if (value == null) { this.attributes.remove(value); } else { this.attributes.put(name, value); } }
From source file:com.miko.demo.mongo.service.RedisInitTest.java
@Test public void initRedisTest() { String hostname = connectionFactory.getHostName(); logger.debug("Init Redis Test = " + hostname); Assert.hasText(hostname); }