List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:org.openmrs.module.appointmentscheduling.web.ProviderEditor.java
/** * @should set using id//ww w. ja va 2s . c om * @should set using uuid */ @Override public void setAsText(String text) throws IllegalArgumentException { ProviderService ps = Context.getProviderService(); if (StringUtils.hasText(text)) { try { setValue(ps.getProvider(Integer.valueOf(text))); } catch (Exception ex) { Provider p = ps.getProviderByUuid(text); setValue(p); if (p == null) { log.error("Error setting provider with id or uuid: " + text, ex); throw new IllegalArgumentException("Provider not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:csns.security.AuthenticationFailureHandler.java
@Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String username = request.getParameter("j_username"); if (StringUtils.hasText(username)) logger.info("Failed login attempt of " + username + " from " + request.getRemoteAddr()); super.onAuthenticationFailure(request, response, exception); }
From source file:org.easit.core.controllers.twitter.TwitterAfterConnectInterceptor.java
@Override public void preConnect(ConnectionFactory<Twitter> provider, MultiValueMap<String, String> parameters, WebRequest request) {//from w ww . j a v a2s . c o m if (StringUtils.hasText(request.getParameter(POST_TWEET_PARAMETER))) { request.setAttribute(POST_TWEET_ATTRIBUTE, Boolean.TRUE, WebRequest.SCOPE_SESSION); } }
From source file:com.frank.search.solr.core.TermsQueryParser.java
@Override public SolrQuery doConstructSolrQuery(TermsQuery query) { Assert.notNull(query, "Cannot construct solrQuery from null value."); SolrQuery solrQuery = new SolrQuery(); String queryString = getQueryString(query); if (StringUtils.hasText(queryString)) { solrQuery.setParam(CommonParams.Q, queryString); }/*from w ww . ja v a 2s .c o m*/ appendTermsOptionsToSolrQuery(query.getTermsOptions(), solrQuery); processTermsFields(solrQuery, query); appendRequestHandler(solrQuery, query.getRequestHandler()); return solrQuery; }
From source file:slina.mb.smb.DefaultSmbSessionFactory.java
@Override public Session getSession() { Assert.notNull(this.domain, "domain must not be null"); Assert.hasText(this.user, "user must not be empty"); Assert.isTrue(StringUtils.hasText(this.password), "password is required"); try {/* w ww . j ava 2 s .c o m*/ NtlmPasswordAuthentication ntlmAuth = new NtlmPasswordAuthentication(domain, user, password); Session smbSession = new SmbSessionImpl(ntlmAuth); return smbSession; } catch (Exception e) { throw new IllegalStateException("failed to create SMB Session", e); } }
From source file:org.openregistry.core.service.identifier.SSNIdentifierAssigner.java
public void addIdentifierTo(final SorPerson sorPerson, final Person person) { if (StringUtils.hasText(sorPerson.getSsn())) { final Identifier ssn = findPrimaryIdentifier(person, this.getIdentifierType()); if (ssn == null) { final Identifier identifier = person .addIdentifier(referenceRepository.findIdentifierType(identifierType), sorPerson.getSsn()); identifier.setDeleted(false); identifier.setPrimary(true); } else { // check that we aren't given a different SSN value if (!ssn.getValue().equals(sorPerson.getSsn())) { // TODO Throw error here!!! or log }/* w w w. jav a 2 s . c o m*/ } } }
From source file:com.consol.citrus.demo.voting.selenium.pages.VotingListPage.java
/** * Submits new voting.// w w w. j a v a 2s .com * @param title * @param options */ public void submit(String title, String options) { newVotingForm.findElement(By.id("title")).sendKeys(title); if (StringUtils.hasText(options)) { newVotingForm.findElement(By.id("options")).sendKeys(options.replaceAll(":", "\n")); } newVotingForm.submit(); }
From source file:org.xacml4j.spring.repository.InMemoryPolicyRepositoryDefinitionParser.java
protected void doParse(Element element, BeanDefinitionBuilder bean) { bean.addConstructorArgValue(element.getAttribute("id")); bean.addPropertyReference("policies", element.getAttribute("policies")); if (StringUtils.hasText(element.getAttribute("extensionFunctions"))) { bean.addPropertyReference("extensionFunctions", element.getAttribute("extensionFunctions")); }//from w w w .j av a 2s . c om if (StringUtils.hasText(element.getAttribute("extensionCombiningAlgorithms"))) { bean.addPropertyReference("extensionCombiningAlgorithms", element.getAttribute("extensionCombiningAlgorithms")); } }
From source file:org.sarons.spring4me.web.page.config.AbstractPageConfigFactory.java
public PageConfig findPage(String path) { if (isCacheable()) { return getCachedPage(path); }/*from w w w .j a v a 2 s . c o m*/ // PageConfig pageConfig = loadPage(path); if (StringUtils.hasText(pageConfig.getParent())) { PageConfig parentPageConfig = loadPage(pageConfig.getParent()); margePageConfig(pageConfig, parentPageConfig); } // return pageConfig; }
From source file:org.openmrs.reporting.export.CohortColumn.java
public CohortColumn(String columnName, Integer cohortId, Integer filterId, Integer patientSearchId, String valueIfTrue, String valueIfFalse) { this.columnName = columnName; this.valueIfTrue = valueIfTrue; this.valueIfFalse = StringUtils.hasText(valueIfFalse) ? valueIfFalse : ""; if (cohortId != null) { this.cohortId = cohortId; if (!StringUtils.hasText(columnName)) { this.columnName = Context.getCohortService().getCohort(cohortId).getName(); }/*from w w w . j a va 2s. c om*/ if (!StringUtils.hasText(valueIfTrue)) { this.valueIfTrue = Context.getCohortService().getCohort(cohortId).getName(); } } else if (filterId != null) { this.filterId = filterId; if (!StringUtils.hasText(columnName)) { this.columnName = Context.getService(ReportObjectService.class).getPatientFilterById(filterId) .getName(); } if (!StringUtils.hasText(valueIfTrue)) { this.valueIfTrue = Context.getService(ReportObjectService.class).getPatientFilterById(filterId) .getName(); } } else { // assert patientSearchId != null this.patientSearchId = patientSearchId; if (!StringUtils.hasText(columnName)) { this.columnName = Context.getService(ReportObjectService.class).getReportObject(patientSearchId) .getName(); } if (!StringUtils.hasText(valueIfTrue)) { this.valueIfTrue = Context.getService(ReportObjectService.class).getReportObject(patientSearchId) .getName(); } } }