Example usage for org.apache.commons.lang StringUtils isNotBlank

List of usage examples for org.apache.commons.lang StringUtils isNotBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotBlank.

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:edu.usu.sdl.openstorefront.web.action.test.ServiceTest.java

@HandlesEvent("RunTest")
public Resolution runTest() {
    testSuites = listOfTestSuites();/*from   w  w w. j  ava 2 s. c  om*/

    if (StringUtils.isNotBlank(suite)) {
        testSuites = testSuites.stream().filter(item -> item.getName().equals(suite))
                .collect(Collectors.toList());
        if (StringUtils.isNotBlank(test)) {
            TestSuiteModel specificTestModel = new TestSuiteModel();
            specificTestModel.setName("Single Test");
            for (TestSuiteModel testSuiteModel : testSuites) {
                specificTestModel.getTests().addAll(testSuiteModel.getTests().stream()
                        .filter(item -> item.getDescription().equals(test)).collect(Collectors.toList()));
            }
            testSuites = new ArrayList<>();
            testSuites.add(specificTestModel);
        }
    }
    testSuites.forEach(testSuite -> {
        testSuite.runAllTests();
    });
    return printAndSendReport(testSuites);
}

From source file:mobile.vo.rns.RequireDetailVO.java

public static RequireDetailVO create(Require po) {
    ObjectMapper objectMapper = JackJsonUtil.getMapperInstance(false);
    RequireDetailVO vo = new RequireDetailVO();

    vo.setId(po.getId());/*from   w  w w .ja v a2  s.  c o m*/

    SkillTag industry = po.getIndustry();
    if (null != industry) {
        vo.setIndustryId(industry.getId());
        vo.setIndustryName(industry.getTagName());
    }

    vo.setTitle(po.getTitle());
    vo.setInfo(po.getInfo());

    if (null == po.getBudget()) {
        vo.setBudget("-1"); // -1 - ?
    } else {
        vo.setBudget(new BigDecimal(po.getBudget()).setScale(1, BigDecimal.ROUND_HALF_UP).toString());
    }

    vo.setCreateDate(new DateTime(po.getCreateDate()).toString("yyyy-MM-dd HH:mm:ss"));

    if (StringUtils.isNotBlank(po.getTags())) {
        try {
            @SuppressWarnings("unchecked")
            List<String> readValue = objectMapper.readValue(po.getTags(), List.class);
            vo.setTags(readValue);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    Iterator<AttachOfRequire> iterator = po.getCaseAttachs().iterator();
    while (iterator.hasNext()) {
        AttachOfRequire attachOfRequire = iterator.next();
        HashMap<String, Object> pair = new HashMap<String, Object>();
        pair.put("attachId", attachOfRequire.id);
        pair.put("filename", attachOfRequire.fileName);
        pair.put("url", Assets.at(attachOfRequire.path));
        vo.getAttachs().add(pair);
    }

    Expert ownerExpert = po.getOwner().getExperts().iterator().next();
    vo.setOwner(User.create(ownerExpert));

    return vo;
}

From source file:io.renren.modules.job.utils.ScheduleRunnable.java

@Override
public void run() {
    try {/* w ww .  j a  va 2  s  .c om*/
        ReflectionUtils.makeAccessible(method);
        if (StringUtils.isNotBlank(params)) {
            method.invoke(target, params);
        } else {
            method.invoke(target);
        }
    } catch (Exception e) {
        throw new RRException("", e);
    }
}

From source file:com.ms.commons.result.Result.java

public Result setMessage(String message) {
    if (StringUtils.isNotBlank(message)) {
        this.message = new StringBuilder(message);
    } else {//from  w w  w  .j a va 2 s  .  c om
        this.message = new StringBuilder();// 
    }
    return this;
}

From source file:com.sfs.whichdoctor.search.http.OrganisationBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*from www  .  jav a  2  s .  c  o  m*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = organisationSqlHandler.initiate(user);
    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    OrganisationBean searchCriteria = (OrganisationBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:de.hybris.platform.acceleratorservices.payment.cybersource.converters.populators.response.CustomerInfoResultPopulator.java

@Override
public void populate(final Map<String, String> source, final CreateSubscriptionResult target)
        throws ConversionException {
    validateParameterNotNull(source, "Parameter [Map<String, String>] source cannot be null");
    validateParameterNotNull(target, "Parameter [CreateSubscriptionResult] target cannot be null");

    final CustomerInfoData data = new CustomerInfoData();
    data.setBillToCity(source.get("billTo_city"));
    data.setBillToCompany(source.get("billTo_company"));
    data.setBillToCompanyTaxId(source.get("billTo_companyTaxID"));

    final String countryIso = source.get("billTo_country");
    if (StringUtils.isNotBlank(countryIso)) {
        data.setBillToCountry(countryIso.toUpperCase(Locale.getDefault()));
    }/*from ww  w  .j ava2  s . c  om*/
    data.setBillToCustomerIdRef(source.get("billTo_customerID"));
    data.setBillToDateOfBirth(source.get("billTo_dateOfBirth"));
    data.setBillToEmail(source.get("billTo_email"));
    data.setBillToFirstName(source.get("billTo_firstName"));
    data.setBillToLastName(source.get("billTo_lastName"));
    data.setBillToPhoneNumber(source.get("billTo_phoneNumber"));
    data.setBillToPostalCode(source.get("billTo_postalCode"));
    data.setBillToState(source.get("billTo_state"));
    data.setBillToStreet1(source.get("billTo_street1"));
    data.setBillToStreet2(source.get("billTo_street2"));

    target.setCustomerInfoData(data);
}

From source file:au.org.ala.delta.translation.parameter.Specifications.java

@Override
public void translateParameter(OutputParameter parameter) {
    StringBuilder specs = new StringBuilder();
    specs.append(_command).append(" ");
    if (StringUtils.isNotBlank(_itemsLabel)) {
        specs.append(_itemsLabel).append("=");
    }/*from ww  w.jav  a2 s  . co  m*/
    specs.append(_dataSet.getNumberOfFilteredItems());
    specs.append(" ");
    if (StringUtils.isNotBlank(_charsLabel)) {
        specs.append(_charsLabel).append("=");
    }
    specs.append(_dataSet.getNumberOfFilteredCharacters());
    command(specs.toString());
    if (_blanks > 0) {
        _outputFile.writeBlankLines(_blanks, 0);
    }
}

From source file:com.dianping.phoenix.dev.core.tools.generator.stable.ServiceMetaGenerator.java

@Override
protected Object getArgs(ServiceMetaContext context) throws Exception {
    Map<String, Integer> servicePortMapping = new LinkedHashMap<String, Integer>();

    Class.forName(context.getDriverClass());

    Connection conn = null;// ww w . j  av a  2s . c o  m
    Statement stmt = null;
    try {
        if (StringUtils.isNotBlank(context.getUser())) {
            conn = DriverManager.getConnection(context.getUrl(), context.getUser(), context.getPwd());
        } else {
            conn = DriverManager.getConnection(context.getUrl());
        }
        stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(
                "SELECT s.serviceName AS serviceName, h.port1 AS port FROM jrobin_host h, service s WHERE s.projectId = h.projectId AND h.port1 IS NOT NULL ORDER BY PORT ASC;");
        while (rs.next()) {
            String serviceName = rs.getString("serviceName");
            int port = rs.getInt("port");
            if (StringUtils.isNotBlank(serviceName)) {
                servicePortMapping.put(serviceName, port);
            }
        }
    } finally {
        if (stmt != null) {
            try {
                stmt.close();
            } catch (Exception e) {

            }
        }
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {

            }
        }
    }

    return servicePortMapping;

}

From source file:com.suryadisoft.exception.test.ValidatorTest.java

/**
 * Test method for {@link com.suryadisoft.exception.Validator#validateName(java.lang.String, java.lang.String)}.
 *//*from  w w w.j a v a  2s  .c o  m*/
@Test
public void testValidateName() {
    try {
        validator.validateName(null, "Doe");
        fail("Not yet implemented");
    } catch (ValidationException ex) {
        assertNotNull(ex.getResponse());
        assertTrue(StringUtils.isNotBlank(ex.getResponse().getErrorMessage()));
        System.out.println(ex.getResponse().getErrorMessage());
    }
}

From source file:com.sfs.whichdoctor.search.http.ReimbursementBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*from   w  ww . ja  v  a  2  s.  c  om*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = reimbursementSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    ReimbursementBean searchCriteria = (ReimbursementBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}