List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:net.projectmonkey.spring.acl.enhancement.identity.mapping.SecureObjectMappingWithInternalMethod.java
@Override public Object getDomainObject() { Object domainObject = this.domainObject; if (domainObject != null) { // Evaluate if we are required to use an inner domain object if (StringUtils.hasText(this.internalMethod)) { domainObject = MethodUtil.invoke(domainObject, this.internalMethod); }/*from ww w. j av a 2s. c o m*/ } return domainObject; }
From source file:org.opencredo.cloud.storage.si.adapter.config.InboundChannelAdapterParser.java
/** * @param element/* www . j a v a 2 s . co m*/ * @param parserContext */ @Override protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(ReadingMessageSource.class.getName()); String templateRef = element.getAttribute(AdapterParserUtils.TEMPLATE_REF_ATTRIBUTE); String containerName = element.getAttribute(AdapterParserUtils.CONTAINER_NAME_ATTRIBUTE); String filterRef = element.getAttribute(AdapterParserUtils.FILTER_ATTRIBUTE); String comparatorRef = element.getAttribute(AdapterParserUtils.COMPARATOR_ATTRIBUTE); builder.addConstructorArgReference(templateRef); builder.addConstructorArgValue(containerName); if (StringUtils.hasText(filterRef)) { builder.addConstructorArgReference(filterRef); } if (StringUtils.hasText(comparatorRef)) { builder.addConstructorArgReference(comparatorRef); } return builder.getBeanDefinition(); }
From source file:org.openspaces.maven.plugin.RunHSQLDBViewMojo.java
/** Executes the Mojo **/ public void executeMojo() throws MojoExecutionException, MojoFailureException { if (help != null) { printUsage();/* w w w . j ava 2 s.c o m*/ } else { ArrayList argList = new ArrayList(); // handles the case when the user specifies an empty string for driver // in that case driver gets the value 'true' if (StringUtils.hasText(driver) && !driver.equals("true")) { argList.add("-driver"); argList.add(driver); } // handles the case when the user specifies an empty string for driver // in that case url gets the value 'true' if (StringUtils.hasText(url) && !url.equals("true")) { argList.add("-url"); argList.add(url); } if (StringUtils.hasText(user)) { argList.add("-user"); argList.add(user); } if (StringUtils.hasText(password)) { argList.add("-password"); argList.add(password); } // create the arguments array String[] args = new String[argList.size()]; argList.toArray(args); PluginLog.getLog().info("Starting HSQLDB viewer with arguments: " + argList); // start the viewer and sleep forever DatabaseManagerSwing.main(args); try { Thread.currentThread().sleep(Long.MAX_VALUE); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:com.github.javarch.persistence.orm.test.DataBaseTestBuilder.java
private String readNextSqlScript(Resource rs) throws IOException { EncodedResource encoded = new EncodedResource(rs); LineNumberReader lnr = new LineNumberReader(encoded.getReader()); String currentStatement = lnr.readLine(); StringBuilder scriptBuilder = new StringBuilder(); while (currentStatement != null) { if (StringUtils.hasText(currentStatement) && (SQL_COMMENT_PREFIX != null && !currentStatement.startsWith(SQL_COMMENT_PREFIX))) { if (scriptBuilder.length() > 0) { scriptBuilder.append('\n'); }//from w w w .ja v a2 s.c o m scriptBuilder.append(currentStatement); } currentStatement = lnr.readLine(); } return scriptBuilder.toString(); }
From source file:org.web4thejob.web.panel.DefaultFramePanel.java
protected boolean isBound() { return hasTargetType() && StringUtils.hasText(getSettingValue(SettingEnum.URL_PROPERTY, "")); }
From source file:biz.c24.io.spring.batch.config.ItemWriterParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder bean) { // Optional//from w w w .j a va2 s . c o m String scope = element.getAttribute("scope"); if (StringUtils.hasText(scope)) { bean.setScope(scope); } else { // Default to step scope bean.setScope("step"); } // Mandatory String sinkRef = element.getAttribute("sink-ref"); bean.addPropertyReference("sink", sinkRef); int numSourceDefns = 0; // Optional String writerSourceRef = element.getAttribute("writer-source-ref"); if (StringUtils.hasText(writerSourceRef)) { bean.addPropertyReference("writerSource", writerSourceRef); numSourceDefns++; } Element fileSourceElement = DomUtils.getChildElementByTagName(element, "file-writer"); if (fileSourceElement != null) { BeanDefinition beanDefinition = parserContext.getDelegate().parseCustomElement(fileSourceElement, bean.getBeanDefinition()); beanDefinition.setBeanClassName(FileWriterSource.class.getName()); bean.addPropertyValue("writerSource", beanDefinition); numSourceDefns++; } Element zipFileSourceElement = DomUtils.getChildElementByTagName(element, "zip-file-writer"); if (zipFileSourceElement != null) { BeanDefinition beanDefinition = parserContext.getDelegate().parseCustomElement(zipFileSourceElement, bean.getBeanDefinition()); beanDefinition.setBeanClassName(ZipFileWriterSource.class.getName()); bean.addPropertyValue("writerSource", beanDefinition); numSourceDefns++; } if (numSourceDefns > 1) { parserContext.getReaderContext() .error("Only one of writer-source-ref, file-writer and zip-file-writer can be used", element); } else if (numSourceDefns == 0) { parserContext.getReaderContext() .error("One of writer-source-ref, file-writer and zip-file-writer must be specified", element); } }
From source file:oauth2.entities.User.java
public boolean isEnabled() { return StringUtils.hasText(password); }
From source file:org.focusns.common.web.widget.mvc.method.WidgetModelAttributeMethodProcessor.java
@Override protected void validateIfApplicable(WebDataBinder binder, MethodParameter parameter) { ////from ww w. ja va2 s .co m WebRequest webRequest = webRequestLocal.get(); String groupsStr = webRequest.getParameter("groups"); if (StringUtils.hasText(groupsStr)) { List<Object> hintList = new ArrayList<Object>(); String[] groups = StringUtils.commaDelimitedListToStringArray(groupsStr); for (String group : groups) { try { hintList.add(ClassUtils.forName(group, getClass().getClassLoader())); } catch (ClassNotFoundException e) { e.printStackTrace(); } } // hintList.add(Default.class); // Annotation[] annotations = parameter.getParameterAnnotations(); for (Annotation annot : annotations) { if (annot.annotationType().getSimpleName().startsWith("Valid")) { Object hints = hintList.toArray(new Object[hintList.size()]); binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] { hints }); } } } }
From source file:org.jasig.cas.adaptors.trusted.web.flow.PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction.java
protected Credentials constructCredentialsFromRequest(final RequestContext context) { final HttpServletRequest request = WebUtils.getHttpServletRequest(context); final String remoteUser = request.getRemoteUser(); if (StringUtils.hasText(remoteUser)) { if (logger.isDebugEnabled()) { logger.debug("Remote User [" + remoteUser + "] found in HttpServletRequest"); }/*from ww w . j a v a 2 s . c o m*/ return new PrincipalBearingCredentials(new SimplePrincipal(remoteUser)); } if (logger.isDebugEnabled()) { logger.debug("Remote User not found in HttpServletRequest."); } return null; }
From source file:com.artivisi.biller.simulator.service.impl.BillerSimulatorServiceImpl.java
@Override public Bank findBankByKode(String kode) { if (!StringUtils.hasText(kode)) return null; return (Bank) sessionFactory.getCurrentSession().createQuery("from Bank where kode = :kode") .setString("kode", kode.trim()).uniqueResult(); }