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.evozon.evoportal.myaccount.builder.validators.LicensePlateValidator.java

private String trimLicensePlate() {
    String trimedLicensePalte = licensePlateToValidate.replaceAll("-", StringUtils.EMPTY);
    trimedLicensePalte = trimedLicensePalte.replaceAll(",", StringUtils.EMPTY);
    trimedLicensePalte = trimedLicensePalte.replaceAll(" ", StringUtils.EMPTY);
    return trimedLicensePalte;
}

From source file:com.wineaccess.winelicensedetail.WineLicenseDetailAdapterHelper.java

/**
 * This method is used to update the WineLicenseDetail in the database.
 * /* w w  w  .  j a  va  2s. co m*/
 * @param wineLicenseDetailUpdatePO
 *            is used to take the input in this PO.
 * @return output map containing response
 */
public static Map<String, Object> updateWineLicenseDetail(
        final WineLicenseDetailUpdatePO wineLicenseDetailUpdatePO) {

    logger.info("start updateWineLicenseDetail method");

    String errorMsg = StringUtils.EMPTY;

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

    Response response = null;

    try {

        MasterData caLicenseType = null;
        WineModel wine = null;
        WineLicenseDetailModel wineLicenseDetailModel = null;

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

                        SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_CA_LICENSE_TYPE,
                        SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_CA_LICENSE_TYPE_TEXT, SUCCESS_CODE);

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

        ProductItemModel productModel = ProductItemRepository
                .getProductItemById(Long.parseLong(wineLicenseDetailUpdatePO.getProductId()));
        if (productModel == null) {
            response = ApplicationUtils.errorMessageGenerate(

                    SystemErrorCode.UPDATE_WINE_PRODUCT_NOT_EXISTS,
                    SystemErrorCode.UPDATE_WINE_PRODUCT_NOT_EXISTS_TEXT, SUCCESS_CODE);

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

        if (response == null) {
            wine = WineRepository.getWineById(productModel.getItemId());
            if (wine == null) {
                // wine not exist
                response = ApplicationUtils.errorMessageGenerate(

                        SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_WINE,
                        SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_WINE_TEXT, SUCCESS_CODE);

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

        if (response == null) {

            wineLicenseDetailModel = WineLicenseDetailRepository.getWineLicenseDetailByWine(wine);

            if (wineLicenseDetailModel == null) {

                WineryLicenseDetailModel wineryLicenseDetailModel = WineryLicenseDetailRepository
                        .getWineryLicenseDetailByWinery(wine.getWineryId());

                if (wineryLicenseDetailModel == null) {
                    // WineLicenseDetail not exist
                    response = ApplicationUtils.errorMessageGenerate(

                            SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_WINE_LICENSE_ID,
                            SystemErrorCode.UPDATE_WINE_LICENSE_INVALID_WINE_LICENSE_ID_TEXT, SUCCESS_CODE);

                    logger.error("Wine License detail not exist");
                } else {
                    wineLicenseDetailModel = new WineLicenseDetailModel();

                    wineLicenseDetailModel.setCaLicenseType(wineryLicenseDetailModel.getCaLicenseType());
                    wineLicenseDetailModel.setWine(wine);
                    wineLicenseDetailModel.setContractExecuted(wineryLicenseDetailModel.getContractExecuted());
                    wineLicenseDetailModel.setShipCompliant(wineryLicenseDetailModel.getShipCompliant());
                    wineLicenseDetailModel.setShipEscrowNo(wineryLicenseDetailModel.getShipEscrowNo());

                    WineLicenseDetailRepository.save(wineLicenseDetailModel);

                    WineLicenseDetailVO wineLicenseDetailVO = new WineLicenseDetailVO(
                            SystemErrorCode.UPDATE_WINE_LICENSE_SUCCESS_TEXT);

                    BeanUtils.copyProperties(wineLicenseDetailVO, wineLicenseDetailModel);

                    wineLicenseDetailVO.setProductId(productModel.getId());
                    wineLicenseDetailVO.setWineId(wineLicenseDetailModel.getWine().getId());

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

        if (response == null) {

            wineLicenseDetailModel.setCaLicenseType(caLicenseType);

            wineLicenseDetailModel.setWine(wine);

            if (wineLicenseDetailUpdatePO.getContractExecuted() != null) {
                wineLicenseDetailModel.setContractExecuted(
                        Boolean.parseBoolean(wineLicenseDetailUpdatePO.getContractExecuted()));
            }

            if (wineLicenseDetailUpdatePO.getShipCompliant() != null) {
                wineLicenseDetailModel
                        .setShipCompliant(Boolean.parseBoolean(wineLicenseDetailUpdatePO.getShipCompliant()));
            }

            if (wineLicenseDetailUpdatePO.getShipEscrowNo() != null) {
                wineLicenseDetailModel.setShipEscrowNo(wineLicenseDetailUpdatePO.getShipEscrowNo());
            }

            if (wineLicenseDetailUpdatePO.getShipCompliantProductKey() != null) {
                wineLicenseDetailModel
                        .setShipCompliantProductKey(wineLicenseDetailUpdatePO.getShipCompliantProductKey());
            }

            if (wineLicenseDetailUpdatePO.getPriceToRetailer() != null) {
                wineLicenseDetailModel
                        .setPriceToRetailer(Double.parseDouble(wineLicenseDetailUpdatePO.getPriceToRetailer()));
            }

            if (wineLicenseDetailUpdatePO.getColaNumber() != null) {
                wineLicenseDetailModel.setColaNumber(wineLicenseDetailUpdatePO.getColaNumber());
            }

            WineLicenseDetailRepository.update(wineLicenseDetailModel);

            WineLicenseDetailVO wineLicenseDetailVO = new WineLicenseDetailVO(
                    SystemErrorCode.UPDATE_WINE_LICENSE_SUCCESS_TEXT);

            BeanUtils.copyProperties(wineLicenseDetailVO, wineLicenseDetailModel);

            wineLicenseDetailVO.setProductId(productModel.getId());
            wineLicenseDetailVO.setWineId(wineLicenseDetailModel.getWine().getId());

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

    } catch (Exception e) {

        errorMsg = e.getCause().getMessage();
    }

    if (errorMsg.contains("uk_wine_id")) {
        response = ApplicationUtils.errorMessageGenerate(SystemErrorCode.UPDATE_WINE_LICENSE_ALREADY_EXISTS,
                SystemErrorCode.UPDATE_WINE_LICENSE_ALREADY_EXISTS_TEXT, SUCCESS_CODE);

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

    output.put(OUPUT_PARAM_KEY, response);

    logger.info("exit updateWineLicenseDetail method");

    return output;
}

From source file:com.cognifide.cq.cqsm.core.models.ViewFileModel.java

public ViewFileModel(SlingHttpServletRequest request) {
    this.fileName = PropertiesUtil.toString(request.getParameter(FILENAME_PARAMETER_NAME), StringUtils.EMPTY);
    this.filePath = PropertiesUtil.toString(request.getParameter(FILEPATH_PARAMETER_NAME), StringUtils.EMPTY);
}

From source file:com.atlassian.jira.rest.client.internal.json.FilterJsonParserTest.java

@Test
public void testParseWithoutShares() throws Exception {
    final Filter actual = parseFilter("/json/filter/valid-no-shares.json");
    final Filter expectedOld = new Filter(toUri("http://localhost:8090/jira/rest/api/latest/filter/10000"),
            10000L, "Bugs in Test project", StringUtils.EMPTY, "project = TST AND issuetype = Bug",
            toUri("http://localhost:8090/jira/secure/IssueNavigator.jspa?mode=hide&requestId=10000"),
            toUri("http://localhost:8090/jira/rest/api/latest/search?jql=project+%3D+TST+AND+issuetype+%3D+Bug"),
            USER_ADMIN_BASIC_LATEST, true);
    final Filter expectedNew = new Filter(toUri("http://localhost:8090/jira/rest/api/latest/filter/10000"),
            10000L, "Bugs in Test project", StringUtils.EMPTY, "project = TST AND issuetype = Bug",
            toUri("http://localhost:8090/jira/secure/issues/?filter=10000"),
            toUri("http://localhost:8090/jira/rest/api/latest/search?jql=project+%3D+TST+AND+issuetype+%3D+Bug"),
            USER_ADMIN_BASIC_LATEST, true);
    assertThat(actual, anyOf(is(expectedOld), is(expectedNew)));
}

From source file:info.magnolia.cms.util.AlertUtil.java

/**
 * Creates a string message out of an exception. Handles nested exceptions.
 * @param e/*from www . j a  va 2  s  .  co  m*/
 * @return the message
 */
public static String getExceptionMessage(Exception e) {
    String message = e.getMessage();
    if (StringUtils.isEmpty(message)) {
        if (e.getCause() != null) {
            message = e.getCause().getMessage();
        }
        if (message == null) {
            message = StringUtils.EMPTY;
        }
    }
    return message;
}

From source file:com.microsoft.alm.plugin.idea.common.settings.TeamServicesSecrets.java

public static String readPassword(final String key) {
    String password = StringUtils.EMPTY;
    try {//from  w ww . j  av a2s .  co  m
        password = PasswordSafe.getInstance().getPassword(null, TeamServicesSecrets.class, key);
    } catch (PasswordSafeException e) {
        logger.warn("Failed to read password", e);
    } catch (Throwable t) {
        logger.warn("Failed to read password", t);
    }
    return password;
}

From source file:edu.northwestern.bioinformatics.studycalendar.xml.validators.ActivityXMLValidatorTest.java

public void testInvalid() {
    BindException errors = new BindException(invalid, StringUtils.EMPTY);
    ValidationUtils.invokeValidator(SPRING_ACTIVITY_VALIDATOR_INSTANCE, invalid, errors);

    assertTrue(errors.hasErrors());/*from  w ww.java 2 s.com*/
    assertEquals("Wrong error count", 1, errors.getErrorCount());
    assertEquals("Wrong error code", "error.file.not.valid", errors.getGlobalError().getCode());
}

From source file:com.hortonworks.streamline.streams.common.StreamlineEventImplTest.java

@Test
public void testGetFieldsAndValues() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("a", "aval");
    map.put("b", "bval");

    StreamlineEvent event = new StreamlineEventImpl(map, StringUtils.EMPTY);

    assertEquals(map, event);/*from  www .ja va 2 s .c om*/
}

From source file:cn.cuizuoli.gotour.model.Common.java

public String getCreateTimeFormat() {
    if (createTime != null) {
        return new DateTime(createTime.getTime()).toString(DATETIME_FORMATTER);
    }/*  w w w . j a  va 2s.  co  m*/
    return StringUtils.EMPTY;
}

From source file:com.amalto.core.history.action.NoOpAction.java

public String getSource() {
    return StringUtils.EMPTY;
}