List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:org.zalando.spring.data.businesskey.config.BusinessKeyHandlerBeanDefinitionParser.java
@Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { String keyGeneratorRef = element.getAttribute(BUSINESSKEY_GENERATOR_REF); if (StringUtils.hasText(keyGeneratorRef)) { builder.addPropertyValue("keyGenerator", createLazyInitTargetSourceBeanDefinition(keyGeneratorRef)); }// w ww .j av a2 s .c o m }
From source file:com.frank.search.solr.core.query.result.DelegatingCursor.java
protected DelegatingCursor(SolrQuery query, String initalCursorMark) { this.referenceQuery = query; this.cursorMark = StringUtils.hasText(initalCursorMark) ? initalCursorMark : CursorMarkParams.CURSOR_MARK_START; this.state = State.REDAY; this.delegate = Collections.<T>emptyList().iterator(); }
From source file:ch.ralscha.extdirectspring.bean.api.RemotingApi.java
public RemotingApi(String type, String url, String namespace) { this.type = type; this.descriptor = null; this.actions = new HashMap<String, List<Action>>(); this.pollingProviders = new ArrayList<PollingProvider>(); this.sseProviders = new HashMap<String, List<String>>(); this.url = url; if (StringUtils.hasText(namespace)) { this.namespace = namespace.trim(); } else {/*from www. ja va 2 s .c om*/ this.namespace = null; } }
From source file:br.com.suricattus.surispring.spring.security.controller.FormLoginController.java
public void login() throws IOException, ServletException { if (!StringUtils.hasText(getParameter("j_username")) || !StringUtils.hasText(getParameter("j_password"))) { addMsgErro("javax.faces.loginFailed"); return;/*from www .j a v a 2 s . c om*/ } RequestDispatcher dispatcher = getRequest().getRequestDispatcher("/j_spring_security_check"); dispatcher.forward(getRequest(), getResponse()); FacesContext.getCurrentInstance().responseComplete(); }
From source file:csns.web.validator.ResourceValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.field.required"); Resource resource = (Resource) target; if (resource.getType() != ResourceType.NONE) { switch (resource.getType()) { case TEXT: if (!StringUtils.hasText(resource.getText())) errors.rejectValue("text", "error.field.required"); else if (!antiSamy.validate(resource.getText())) errors.rejectValue("text", "error.html.invalid"); break; case URL: if (!StringUtils.hasText(resource.getUrl())) errors.rejectValue("url", "error.field.required"); break; default:/*w w w.ja va 2s . c o m*/ // file upload is not validated. } } }
From source file:org.apache.ftpserver.config.spring.FileSystemBeanDefinitionParser.java
/** * {@inheritDoc}/*from w ww. j ava2 s . c om*/ */ @Override protected void doParse(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder builder) { if (StringUtils.hasText(element.getAttribute("case-insensitive"))) { builder.addPropertyValue("caseInsensitive", Boolean.valueOf(element.getAttribute("case-insensitive"))); } if (StringUtils.hasText(element.getAttribute("create-home"))) { builder.addPropertyValue("createHome", Boolean.valueOf(element.getAttribute("create-home"))); } }
From source file:fr.xebia.management.config.ProfileAspectDefinitionParser.java
@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) { String id = element.getAttribute(ID_ATTRIBUTE); if (!StringUtils.hasText(id)) { id = PROFILE_ASPECT_BEAN_NAME;/*from w ww .ja v a 2s .c o m*/ } return id; }
From source file:nl.surfnet.mujina.saml.AuthnRequestGenerator.java
public AuthnRequest generateAuthnRequest(String destination, String responseLocation, String protocolBinding) { AuthnRequestBuilder authnRequestBuilder = (AuthnRequestBuilder) builderFactory .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME); AuthnRequest authnRequest = authnRequestBuilder.buildObject(); if (StringUtils.hasText(responseLocation)) { authnRequest.setAssertionConsumerServiceURL(responseLocation); }//ww w .jav a2 s . c o m authnRequest.setID(idService.generateID()); authnRequest.setIssueInstant(timeService.getCurrentDateTime()); authnRequest.setDestination(destination); if (StringUtils.hasText(protocolBinding)) { authnRequest.setProtocolBinding(protocolBinding); } authnRequest.setIssuer(issuerGenerator.generateIssuer()); return authnRequest; }
From source file:org.drools.container.spring.namespace.KnowledgeLoggerFileParser.java
@Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(KnowledgeLoggerBeanFactory.class); String localName = element.getLocalName(); String id = element.getAttribute("id"); emptyAttributeCheck(element.getLocalName(), "id", id); factory.addPropertyValue("name", id); String ksession = element.getAttribute("ksession"); emptyAttributeCheck(element.getLocalName(), "ksession", ksession); if (StringUtils.hasText(ksession)) { factory.addPropertyReference("ksession", ksession); }//from w w w .ja v a2 s.c om if ("fileKnowledgeLogger".equalsIgnoreCase(localName) || "threadedFileKnowledgeLogger".equalsIgnoreCase(localName)) { String file = element.getAttribute("file"); emptyAttributeCheck(element.getLocalName(), "file", file); if (StringUtils.hasText(file)) { factory.addPropertyValue("file", file); } } if ("fileKnowledgeLogger".equalsIgnoreCase(localName)) { factory.addPropertyValue("loggerType", KnowledgeLoggerBeanFactory.KNOWLEDGE_LOGGER_TYPE.LOGGER_TYPE_FILE); } else if ("threadedFileKnowledgeLogger".equalsIgnoreCase(localName)) { factory.addPropertyValue("loggerType", KnowledgeLoggerBeanFactory.KNOWLEDGE_LOGGER_TYPE.LOGGER_TYPE_THREADED_FILE); } else if ("consoleKnowledgeLogger".equalsIgnoreCase(localName)) { factory.addPropertyValue("loggerType", KnowledgeLoggerBeanFactory.KNOWLEDGE_LOGGER_TYPE.LOGGER_TYPES_CONSOLE); } return factory.getBeanDefinition(); }
From source file:com.uimirror.auth.form.OTPAuthenticationForm.java
private void validate() { if (!StringUtils.hasText(getOtp())) informIllegalArgument("OTP should be present"); }