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

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

Introduction

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

Prototype

String EMPTY

To view the source code for org.apache.commons.lang StringUtils EMPTY.

Click Source Link

Document

The empty String "".

Usage

From source file:com.google.code.configprocessor.util.PropertiesUtilsTest.java

@Test
public void getAsTextEmptyValue() {
    executeExportingTest("", StringUtils.EMPTY);
}

From source file:com.nec.harvest.model.AbstractEntity.java

/**
 * Check a string is empty or null//from w w  w  .  j a  v a  2 s.c  o  m
 * 
 * @param text
 * @return
 */
@Transient
protected static String value(String text) {
    return StringUtils.isEmpty(text) ? StringUtils.EMPTY : text;
}

From source file:co.cask.cdap.client.rest.TestUtils.java

public static String getStreamNameFromUri(String uri) {
    String streamName = StringUtils.EMPTY;
    if (StringUtils.isNotEmpty(uri)) {
        Pattern p = Pattern.compile("streams/.*?/");
        Matcher m = p.matcher(uri);
        if (m.find()) {
            String b = m.group();
            streamName = b.substring(b.indexOf("/") + 1, b.length() - 1);
        }//from  ww  w. j  a va  2 s .c om
    }
    return streamName;
}

From source file:com.amalto.core.server.routing.NoOpService.java

@Override
public String getDocumentation(String twoLettersLanguageCode) {
    return StringUtils.EMPTY;
}

From source file:com.codenjoy.dojo.kata.model.levels.NullAlgorithm.java

@Override
public String description() {
    return StringUtils.EMPTY;
}

From source file:com.googlecode.easymockrule.EasyMockUtils.java

/**
 * Get the mock control "type" field value or empty string on error.
 * // w  w w  .  j a  v a 2  s  .  com
 * @param mock
 * @return
 */
public static String getMockType(Object mock) {

    try {
        MocksControl mockControl = getMockControl(mock);

        Field mockTypeField = mockControl.getClass().getDeclaredField("type");
        mockTypeField.setAccessible(true);

        MockType mockType = (MockType) mockTypeField.get(mockControl);

        return mockType.toString();

    } catch (Exception e) {
        return StringUtils.EMPTY;
    }
}

From source file:com.microsoft.alm.plugin.idea.git.starters.SimpleCheckoutStarterTest.java

@Test
public void testCreateWithGitUrlHappyLimitedRefs() {
    SimpleCheckoutStarter starter = SimpleCheckoutStarter
            .createWithGitUrl(VALID_GIT_URL.replace("_git/", "_git/_optimized/"), StringUtils.EMPTY);
    Assert.assertEquals(VALID_GIT_URL.replace("_git/", "_git/_optimized/"), starter.getGitUrl());
}

From source file:com.commerce4j.model.dao.jdbc.ConfigDAOImpl.java

public String findById(String param) {
    String sql = "SELECT config_value FROM c4j_config WHERE config_id = ? ";
    Object o = getJdbcTemplate().queryForObject(sql, new Object[] { param }, String.class);
    return (o != null) ? o.toString() : StringUtils.EMPTY;
}

From source file:com.haulmont.cuba.gui.components.formatters.CollectionFormatter.java

@Override
public String format(Collection value) {
    if (value == null) {
        return StringUtils.EMPTY;
    }//from www .  jav  a2 s.  c  om

    //noinspection unchecked
    return ((Collection<Object>) value).stream().map(metadataTools::format).collect(Collectors.joining(", "));
}

From source file:com.wineaccess.winerylicensedetail.WineryLicenseDetailAdapterHelper.java

/**
 * This method is used to update the WineryLicenseDetail in the database.
 * //from  w w w. ja  va  2 s  .c o  m
 * @param wineryLicenseDetailUpdatePO
 *            is used to take the input in this PO.
 * @return output map containing response
 */
public static Map<String, Object> updateWineryLicenseDetail(
        final WineryLicenseDetailUpdatePO wineryLicenseDetailUpdatePO) {

    logger.info("start updateWineryLicenseDetail method");

    String errorMsg = StringUtils.EMPTY;

    final Map<String, Object> output = new ConcurrentHashMap<String, Object>();

    Response response = null;

    try {

        MasterData caLicenseType = null;
        WineryModel winery = null;
        WineryLicenseDetailModel wineryLicenseDetailModel = null;

        if ((wineryLicenseDetailUpdatePO.getCaLicenseTypeId() != null)
                && !(wineryLicenseDetailUpdatePO.getCaLicenseTypeId().isEmpty())) {
            caLicenseType = MasterDataRepository
                    .getMasterDataById(Long.parseLong(wineryLicenseDetailUpdatePO.getCaLicenseTypeId()));
            if (caLicenseType == null) {
                // caLicenseType not exist
                response = ApplicationUtils.errorMessageGenerate(

                        SystemErrorCode.UPDATE_WINERY_LICENSE_INVALID_CA_LICENSE_TYPE,
                        SystemErrorCode.UPDATE_WINERY_LICENSE_INVALID_CA_LICENSE_TYPE_TEXT, SUCCESS_CODE);

                logger.error("CA License Type not exist");
            }
        }

        if (response == null && wineryLicenseDetailUpdatePO.getWineryId() != null) {
            winery = WineryRepository.getWineryById(Long.parseLong(wineryLicenseDetailUpdatePO.getWineryId()));
            if (winery == null) {
                // winery not exist
                response = ApplicationUtils.errorMessageGenerate(

                        SystemErrorCode.UPDATE_WINERY_LICENSE_INVALID_WINERY,
                        SystemErrorCode.UPDATE_WINERY_LICENSE_INVALID_WINERY_TEXT, SUCCESS_CODE);

                logger.error("winery not exist");
            }
        }

        if (response == null) {

            wineryLicenseDetailModel = WineryLicenseDetailRepository.getWineryLicenseDetailByWinery(winery);

            if (wineryLicenseDetailModel == null) {

                wineryLicenseDetailModel = new WineryLicenseDetailModel();

                wineryLicenseDetailModel.setCaLicenseType(caLicenseType);

                wineryLicenseDetailModel.setWinery(winery);

                if (wineryLicenseDetailUpdatePO.getContractExecuted() != null) {
                    wineryLicenseDetailModel.setContractExecuted(
                            Boolean.parseBoolean(wineryLicenseDetailUpdatePO.getContractExecuted()));
                } else {
                    wineryLicenseDetailModel.setContractExecuted(false);
                }

                if (wineryLicenseDetailUpdatePO.getShipCompliant() != null) {
                    wineryLicenseDetailModel.setShipCompliant(
                            Boolean.parseBoolean(wineryLicenseDetailUpdatePO.getShipCompliant()));
                } else {
                    wineryLicenseDetailModel.setShipCompliant(false);
                }

                if (wineryLicenseDetailUpdatePO.getShipEscrowNo() != null) {
                    wineryLicenseDetailModel.setShipEscrowNo(wineryLicenseDetailUpdatePO.getShipEscrowNo());
                }

                WineryLicenseDetailRepository.save(wineryLicenseDetailModel);

                WineryLicenseDetailVO wineryLicenseDetailVO = new WineryLicenseDetailVO(
                        SystemErrorCode.UPDATE_WINERY_LICENSE_SUCCESS_TEXT);

                BeanUtils.copyProperties(wineryLicenseDetailVO, wineryLicenseDetailModel);

                wineryLicenseDetailVO.setWineryId(wineryLicenseDetailModel.getWinery().getId());

                response = new com.wineaccess.response.SuccessResponse(wineryLicenseDetailVO, SUCCESS_CODE);
            }
        }

        if (response == null) {

            //if (caLicenseType != null) {
            wineryLicenseDetailModel.setCaLicenseType(caLicenseType);
            //}

            wineryLicenseDetailModel.setWinery(winery);

            if (wineryLicenseDetailUpdatePO.getContractExecuted() != null) {
                wineryLicenseDetailModel.setContractExecuted(
                        Boolean.parseBoolean(wineryLicenseDetailUpdatePO.getContractExecuted()));
            }

            if (wineryLicenseDetailUpdatePO.getShipCompliant() != null) {
                wineryLicenseDetailModel
                        .setShipCompliant(Boolean.parseBoolean(wineryLicenseDetailUpdatePO.getShipCompliant()));
            }

            if (wineryLicenseDetailUpdatePO.getShipEscrowNo() != null) {
                wineryLicenseDetailModel.setShipEscrowNo(wineryLicenseDetailUpdatePO.getShipEscrowNo());
            }

            WineryLicenseDetailRepository.update(wineryLicenseDetailModel);

            WineryLicenseDetailVO wineryLicenseDetailVO = new WineryLicenseDetailVO(
                    SystemErrorCode.UPDATE_WINERY_LICENSE_SUCCESS_TEXT);

            BeanUtils.copyProperties(wineryLicenseDetailVO, wineryLicenseDetailModel);

            wineryLicenseDetailVO.setWineryId(wineryLicenseDetailModel.getWinery().getId());

            response = new com.wineaccess.response.SuccessResponse(wineryLicenseDetailVO, SUCCESS_CODE);
        }

    } catch (Exception e) {
        errorMsg = e.getCause().getMessage();
    }

    if (errorMsg.contains("uk_winery_id")) {
        response = ApplicationUtils.errorMessageGenerate(SystemErrorCode.UPDATE_WINERY_LICENSE_ALREADY_EXISTS,
                SystemErrorCode.UPDATE_WINERY_LICENSE_ALREADY_EXISTS_TEXT, SUCCESS_CODE);

        logger.error("winery license detail already exists");
    }

    output.put(OUPUT_PARAM_KEY, response);

    logger.info("exit updateWineryLicenseDetail method");

    return output;
}