Example usage for com.liferay.portal.kernel.util StringPool BACK_SLASH

List of usage examples for com.liferay.portal.kernel.util StringPool BACK_SLASH

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool BACK_SLASH.

Prototype

String BACK_SLASH

To view the source code for com.liferay.portal.kernel.util StringPool BACK_SLASH.

Click Source Link

Usage

From source file:com.liferay.rtl.tools.RtlCssBuilder.java

License:Open Source License

private String _normalizeFileName(String dirName, String fileName) {
    return StringUtil.replace(dirName + StringPool.SLASH + fileName,
            new String[] { StringPool.BACK_SLASH, StringPool.DOUBLE_SLASH },
            new String[] { StringPool.SLASH, StringPool.SLASH });
}

From source file:com.liferay.tools.sourceformatter.BaseSourceProcessor.java

License:Open Source License

protected String format(String fileName) throws Exception {
    File file = new File(fileName);

    if (!file.exists()) {
        file = new File(BASEDIR + fileName);
    }//from  w  w w .  jav a  2  s .co m

    fileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

    String absolutePath = getAbsolutePath(file);

    String content = fileUtil.read(file);

    String newContent = format(file, fileName, absolutePath, content);

    processFormattedFile(file, fileName, content, newContent);

    return newContent;
}

From source file:com.liferay.tools.sourceformatter.BaseSourceProcessor.java

License:Open Source License

protected Map<String, String> getCompatClassNamesMap() throws IOException {
    if (_compatClassNamesMap != null) {
        return _compatClassNamesMap;
    }/*from www  . ja  v  a  2s.  co  m*/

    Map<String, String> compatClassNamesMap = new HashMap<String, String>();

    String[] includes = new String[] { "**\\portal-compat-shared\\src\\com\\liferay\\compat\\**\\*.java" };

    String basedir = BASEDIR;

    List<String> fileNames = new ArrayList<String>();

    for (int i = 0; i < 3; i++) {
        fileNames = getFileNames(basedir, new String[0], includes);

        if (!fileNames.isEmpty()) {
            break;
        }

        basedir = "../" + basedir;
    }

    for (String fileName : fileNames) {
        if (!fileName.startsWith("shared")) {
            break;
        }

        File file = new File(basedir + fileName);

        String content = fileUtil.read(file);

        fileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

        fileName = StringUtil.replace(fileName, StringPool.SLASH, StringPool.PERIOD);

        int pos = fileName.indexOf("com.");

        String compatClassName = fileName.substring(pos);

        compatClassName = compatClassName.substring(0, compatClassName.length() - 5);

        String extendedClassName = StringUtil.replace(compatClassName, "compat.", StringPool.BLANK);

        if (content.contains("extends " + extendedClassName)) {
            compatClassNamesMap.put(compatClassName, extendedClassName);
        }
    }

    _compatClassNamesMap = compatClassNamesMap;

    return _compatClassNamesMap;
}

From source file:com.liferay.tools.sourceformatter.JSPSourceProcessor.java

License:Open Source License

@Override
protected void format() throws Exception {
    _moveFrequentlyUsedImportsToCommonInit = GetterUtil
            .getBoolean(getProperty("move.frequently.used.imports.to.common.init"));
    _unusedVariablesExclusions = getPropertyList("jsp.unused.variables.excludes.files");

    String[] excludes = new String[] { "**\\null.jsp", "**\\tools\\**" };
    String[] includes = new String[] { "**\\*.jsp", "**\\*.jspf", "**\\*.vm" };

    List<String> fileNames = getFileNames(excludes, includes);

    Pattern pattern = Pattern.compile("\\s*@\\s*include\\s*file=['\"](.*)['\"]");

    for (String fileName : fileNames) {
        File file = new File(BASEDIR + fileName);

        fileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

        String absolutePath = getAbsolutePath(file);

        String content = fileUtil.read(file);

        Matcher matcher = pattern.matcher(content);

        String newContent = content;

        while (matcher.find()) {
            newContent = StringUtil.replaceFirst(newContent, matcher.group(),
                    "@ include file=\"" + matcher.group(1) + "\"", matcher.start());
        }/*from   w w  w .j av  a2 s .  com*/

        processFormattedFile(file, fileName, content, newContent);

        if (portalSource && _moveFrequentlyUsedImportsToCommonInit && fileName.endsWith("/init.jsp")
                && !absolutePath.contains("/modules/") && !fileName.endsWith("/common/init.jsp")) {

            addImportCounts(content);
        }

        _jspContents.put(fileName, newContent);
    }

    if (portalSource && _moveFrequentlyUsedImportsToCommonInit) {
        moveFrequentlyUsedImportsToCommonInit(4);
    }

    for (String fileName : fileNames) {
        format(fileName);
    }
}

From source file:com.liferay.tools.sourceformatter.SourceFormatterHelper.java

License:Open Source License

public void printError(String fileName, String message) {
    if (_useProperties) {
        String encodedFileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

        _properties.remove(encodedFileName);
    }/*from  ww w  . j a  v a2  s. c  om*/

    System.out.println(message);
}

From source file:com.liferay.tools.sourceformatter.SourceFormatterHelper.java

License:Open Source License

public List<String> scanForFiles(DirectoryScanner directoryScanner) {
    directoryScanner.scan();//from ww w  .  j  a va2s.com

    String[] fileNamesArray = directoryScanner.getIncludedFiles();

    if (!_useProperties) {
        return ListUtil.toList(fileNamesArray);
    }

    List<String> fileNames = new ArrayList<String>(fileNamesArray.length);

    for (String fileName : fileNamesArray) {
        File file = new File(fileName);

        String encodedFileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

        long timestamp = GetterUtil.getLong(_properties.getProperty(encodedFileName));

        if (timestamp < file.lastModified()) {
            fileNames.add(fileName);

            _properties.setProperty(encodedFileName, String.valueOf(file.lastModified()));
        }
    }

    return fileNames;
}

From source file:com.liferay.util.bridges.mvc.MVCPortlet.java

License:Open Source License

@Override
public void init() throws PortletException {
    super.init();

    templatePath = _getInitParameter("template-path");

    if (Validator.isNull(templatePath)) {
        templatePath = StringPool.SLASH;
    } else if (templatePath.contains(StringPool.BACK_SLASH) || templatePath.contains(StringPool.DOUBLE_SLASH)
            || templatePath.contains(StringPool.PERIOD) || templatePath.contains(StringPool.SPACE)) {

        throw new PortletException("template-path " + templatePath + " has invalid characters");
    } else if (!templatePath.startsWith(StringPool.SLASH) || !templatePath.endsWith(StringPool.SLASH)) {

        throw new PortletException("template-path " + templatePath + " must start and end with a /");
    }/*from   w w w.  j a  v a  2 s  .  c  om*/

    aboutTemplate = _getInitParameter("about-template");
    configTemplate = _getInitParameter("config-template");
    editTemplate = _getInitParameter("edit-template");
    editDefaultsTemplate = _getInitParameter("edit-defaults-template");
    editGuestTemplate = _getInitParameter("edit-guest-template");
    helpTemplate = _getInitParameter("help-template");
    previewTemplate = _getInitParameter("preview-template");
    printTemplate = _getInitParameter("print-template");
    viewTemplate = _getInitParameter("view-template");

    clearRequestParameters = GetterUtil.getBoolean(getInitParameter("clear-request-parameters"));
    copyRequestParameters = GetterUtil.getBoolean(getInitParameter("copy-request-parameters"));

    String packagePrefix = getInitParameter(ActionCommandCache.ACTION_PACKAGE_NAME);

    if (Validator.isNotNull(packagePrefix)) {
        _actionCommandCache = new ActionCommandCache(packagePrefix);
    }
}

From source file:com.stoxx.portlet.controller.RegistrationController.java

@RenderMapping
public String handleRenderRequest(RenderRequest renderRequest, RenderResponse renderResponse, Model model,
        @ModelAttribute(REGISTRATION_BEAN) RegistrationBean registrationBean) {
    log.info("STOXXRegistrationController.handleRenderRequest()");
    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
    Boolean isExistingUser = Boolean.FALSE;
    Boolean isDeletedUser = Boolean.FALSE;
    try {/*from  w  ww.j  av a 2  s.c  o  m*/
        log.info("the action parameter is " + renderRequest.getParameter(ACTION));
        String portalUrl = PortalUtil.getCurrentURL(renderRequest);
        log.info("current Portal url>>>> " + portalUrl);
        String businessEmailAddressEncrypted = null;
        registrationBean = getListDetails(registrationBean, themeDisplay);
        registrationBean.setCompanyId(themeDisplay.getCompanyId());
        registrationBean.setIsExistingUser(isExistingUser);
        registrationBean.setIsDeletedUser(isDeletedUser);
        if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileTRANSLATOR")) {
            log.info("for Translator and the email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS
                    + registrationBean.getBusinessEmailAddress());
            if (Validator.isNotNull(businessEmailAddress)) {
                registrationBean.setBusinessEmailAddress(businessEmailAddress);
            }
            log.info("user type is" + registrationBean.getUserType());
            if (registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_VENDOR_USER)) {
                registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean);
                log.info("Company Name >>>>> is" + registrationBean.getCompanyName());
                log.info("Translator agency ID >>>>> is" + registrationBean.getTranslatorAgencyId());
            }
            if (registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER)) {
                registrationBean.setCompanyName(RegistrationConstants.STAFF_COMPANY);
                log.info("Company Name >>>>> is" + registrationBean.getCompanyName());
            }
            if (registrationDelegator.checkIfRegistered(registrationBean.getBusinessEmailAddress())) {
                registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean);
                if (null != registrationBean.getUserType() && registrationBean.getUserType()
                        .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) {
                    String packageDetails = registrationDelegator
                            .getPackageDetails(registrationBean.getSalesEntryId());
                    log.info(THE_PACKAGE_DETAILS + packageDetails);
                    registrationBean.setPackageDetails(packageDetails);
                }
            }
            registrationBean = getListDetails(registrationBean, themeDisplay);
            registrationBean.setIsExistingUser(isExistingUser);
            registrationBean.setIsDeletedUser(isDeletedUser);
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            return RegistrationConstants.SETUP_PROFILE;
        } else if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase("userExists")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase("invalidEmail")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileGENERALLICENSED")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileSTAFF")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileGENERAL")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase("linkAlreadysent")) {
            log.info("email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS
                    + registrationBean.getBusinessEmailAddress());
            businessEmailAddress = registrationBean.getBusinessEmailAddress();
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            return RegistrationConstants.INITIATE_REGISTRATION;
        } else if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase("CaptchaException")) {
            log.info("email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS
                    + registrationBean.getBusinessEmailAddress());
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            return RegistrationConstants.SETUP_PROFILE;
        } else if (portalUrl.contains(StringPool.QUESTION) && portalUrl.contains(StringPool.DOLLAR)) {
            log.info("inside registration link validation with dollar and questionmark");
            getUserTypeandEmalaIdfromEncrptedUrl(model, registrationBean, portalUrl);
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            if (Validator.isNotNull(businessEmailAddress) && !registrationBean.getIsExistingUser()) {
                log.info("businessEmailAddress>>>>>>>>>>>>>>>>>>>>>>>>>>" + businessEmailAddress);
                log.info("USER_>>>>>>>>>>>>>>>" + registrationDelegator
                        .checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress));
                registrationBean.setCompanyId(themeDisplay.getCompanyId());
                boolean isUserExistInCustomDB = registrationDelegator
                        .checkIfUserExistsInLiferay(registrationBean, businessEmailAddress);
                log.info("STOXX_USER" + isUserExistInCustomDB);
                if (registrationDelegator.checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress)
                        && registrationDelegator.checkIfUserExistsInLiferay(registrationBean,
                                businessEmailAddress)
                        && Validator.isNotNull(registrationBean.getIsDeletedUser())
                        && !registrationBean.getIsDeletedUser()) {
                    log.info("inside dupplicate registration block with dollar an questionmark");
                    SessionErrors.add(renderRequest, USER_EXISTS_KEY);
                } else {
                    if (Validator.isNotNull(registrationBean.getIsDeletedUser())
                            && registrationBean.getIsDeletedUser()) {
                        return RegistrationConstants.INITIATE_REGISTRATION;
                    }
                    if (!isUserExistInCustomDB) {
                        SessionErrors.add(renderRequest, USER_DELETED_KEY);
                    } else {
                        log.info("inside registration block for new registration with dollar an questionmark");
                        if (fetchActivationLinkCreateDateDiff(registrationBean.getBusinessEmailAddress())) {
                            SessionErrors.add(renderRequest, RegistrationConstants.REGISTRATION_LINK_EXPIRED);
                        }
                        if (registrationDelegator.checkIfUserExistsInLiferay(registrationBean)
                                && registrationBean.getUserType()
                                        .equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER)
                                && registrationBean.getUserType()
                                        .equalsIgnoreCase(STOXXConstants.STOXX_GENERAL_USER)) {
                            SessionMessages.add(renderRequest, "user-activation-link-already-sent");
                        }
                    }
                }
            }
            SessionMessages.add(renderRequest, "user-validation-done");
            return RegistrationConstants.INITIATE_REGISTRATION;
        } else if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase(EXISTING_USER)) {
            log.info("FOR EXISTING USER STEO 1 >>>>> email address is $$$$" + businessEmailAddress
                    + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress());
            registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean);
            if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus())
                    && registrationBean.getStatus() == 3) {
                isExistingUser = Boolean.TRUE;
                registrationBean.setIsExistingUser(isExistingUser);
                registrationBean.setIsDeletedUser(isDeletedUser);
            }
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            SessionMessages.add(renderRequest, EXISTING_USER);
            return RegistrationConstants.INITIATE_REGISTRATION;
        }

        else if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase(CUST_USER_EXCEEDED)) {
            log.info("FOR EXCEEDING CUSTOMER  USER STEO 1 >>>>> email address is $$$$"
                    + registrationBean.getBusinessEmailAddress());

            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            SessionMessages.add(renderRequest, CUST_USER_EXCEEDED);
            return RegistrationConstants.INITIATE_REGISTRATION;
        }

        else if (portalUrl.contains(StringPool.QUESTION + EXISTING)) {
            log.info("new existing logic");
            registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean);
            if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus())
                    && registrationBean.getStatus() == 3) {
                isExistingUser = Boolean.TRUE;
                registrationBean.setIsExistingUser(isExistingUser);
            }
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            SessionErrors.add(renderRequest, USER_EXISTS_MIGRATION_KEY);
            return RegistrationConstants.INITIATE_REGISTRATION;
        } else if (null != renderRequest.getParameter(ACTION)
                && renderRequest.getParameter(ACTION).equalsIgnoreCase("existingUserStep2")
                || null != renderRequest.getParameter(ACTION)
                        && renderRequest.getParameter(ACTION).equalsIgnoreCase(DELETED_USER)) {
            log.info("FOR EXISTING USER STEP 2 >>>>> email address is $$$$" + businessEmailAddress
                    + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress());
            registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean, businessEmailAddress);
            log.info("Sales entry id is >>>>>>>>>" + registrationBean.getSalesEntryId()
                    + " and the usertype is >>>>>>" + registrationBean.getUserType());

            if (Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 4
                    && registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)
                    && !Validator.isNotNull(registrationBean.getSalesEntryId())) {
                registrationDelegator.updateUserType(registrationBean.getBusinessEmailAddress(),
                        STOXXConstants.STOXX_GENERAL_USER);
                registrationBean.setUserType(STOXXConstants.STOXX_GENERAL_USER);
            }
            User liferayStoxxUser = UserLocalServiceUtil.fetchUserByEmailAddress(themeDisplay.getCompanyId(),
                    businessEmailAddress);

            if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus())
                    && registrationBean.getStatus() == 3) {
                isExistingUser = Boolean.TRUE;
                registrationBean.setIsExistingUser(isExistingUser);
                registrationBean.setIsDeletedUser(isDeletedUser);
                if (Validator.isNotNull(liferayStoxxUser)) {
                    registrationBean = populateFields(registrationBean, themeDisplay, liferayStoxxUser);
                }
                if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType()
                        .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) {
                    String packageDetails = registrationDelegator
                            .getPackageDetails(registrationBean.getSalesEntryId());
                    log.info(THE_PACKAGE_DETAILS + packageDetails);
                    registrationBean.setPackageDetails(packageDetails);
                }
                getListDetails(registrationBean, themeDisplay);
            }
            if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus())
                    && registrationBean.getStatus() == 4) {
                isDeletedUser = Boolean.TRUE;
                isExistingUser = Boolean.FALSE;
                registrationBean.setIsDeletedUser(isDeletedUser);
                registrationBean.setIsExistingUser(isExistingUser);
                if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType()
                        .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) {
                    String packageDetails = registrationDelegator
                            .getPackageDetails(registrationBean.getSalesEntryId());
                    log.info(THE_PACKAGE_DETAILS + packageDetails);
                    registrationBean.setPackageDetails(packageDetails);
                }
                User liferayDeletedUser = UserLocalServiceUtil.fetchUserByEmailAddress(
                        themeDisplay.getCompanyId(), registrationBean.getBusinessEmailAddress());
                if (Validator.isNotNull(liferayDeletedUser)) {
                    registrationBean = populateFields(registrationBean, themeDisplay, liferayStoxxUser);
                }

                registrationBean = getListDetails(registrationBean, themeDisplay);
                registrationBean = registrationDelegator
                        .getUserPreferenceDetails(registrationBean.getBusinessEmailAddress(), registrationBean);

            }

            if (!Validator.isNotNull(registrationBean.getStatus()) && liferayStoxxUser.getStatus() == 1
                    && Validator.isNotNull(registrationBean.getSalesEntryId())) {
                log.info("For customer who are going to add by admin into application after deletion.");
                isDeletedUser = Boolean.TRUE;
                isExistingUser = Boolean.FALSE;
                registrationBean.setIsDeletedUser(isDeletedUser);
                registrationBean.setIsExistingUser(isExistingUser);
                if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType()
                        .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) {
                    String packageDetails = registrationDelegator
                            .getPackageDetails(registrationBean.getSalesEntryId());
                    log.info(THE_PACKAGE_DETAILS + packageDetails);
                    registrationBean.setPackageDetails(packageDetails);
                }
                getListDetails(registrationBean, themeDisplay);
            }

            registrationBean.setIsExistingUser(isExistingUser);
            registrationBean.setIsDeletedUser(isDeletedUser);
            model.addAttribute(REGISTRATION_BEAN, registrationBean);
            return RegistrationConstants.SETUP_PROFILE;
        }

        else if (portalUrl.contains(StringPool.QUESTION)) {
            SessionMessages.add(renderRequest, "user-validation-done");
            registrationBean = new RegistrationBean();
            businessEmailAddressEncrypted = portalUrl.split(StringPool.BACK_SLASH + StringPool.QUESTION)[1];
            log.info("businessEmailAddress value>>>> " + businessEmailAddressEncrypted);
            businessEmailAddress = STOXXEncrypter.decrypt(businessEmailAddressEncrypted, ENCRYPTION_KEY);
            log.info("decrypted email id is>>> " + businessEmailAddress);
            RegistrationBean registrationBean2 = registrationDelegator.fetchFromStoxxUser(registrationBean,
                    businessEmailAddress);
            if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus())
                    && registrationBean2.getStatus() == 3) {
                log.info("<<<<<<<<<the user is an eisting user>>>>>>>>");
                isExistingUser = Boolean.TRUE;
                isDeletedUser = Boolean.FALSE;
            }
            registrationBean.setIsExistingUser(isExistingUser);
            registrationBean.setIsDeletedUser(isDeletedUser);
            log.info("inside registration link validation with questionmark");
            registrationBean.setCompanyId(themeDisplay.getCompanyId());
            if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus())
                    && registrationBean2.getStatus() == 4 && registrationDelegator
                            .isInactiveUser(registrationBean.getCompanyId(), businessEmailAddress)) {
                log.info("<<<<<<<<< the user has been  deleted previously >>>>>>>>");
                isDeletedUser = Boolean.TRUE;
                isExistingUser = Boolean.FALSE;
            }
            log.info("registrationBean.getIsDeletedUser() " + isDeletedUser);

            if (Validator.isNotNull(businessEmailAddress) && !registrationBean.getIsExistingUser()) {
                if (registrationDelegator.checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress)
                        && registrationDelegator.checkIfUserExistsInLiferay(registrationBean,
                                businessEmailAddress)
                        && !isDeletedUser) {
                    log.info("inside dupplicate registration block with questionmark");
                    SessionErrors.add(renderRequest, USER_EXISTS_KEY);
                } else {
                    boolean isUserExistInCustomDB = registrationDelegator
                            .checkIfUserExistsInLiferay(registrationBean, businessEmailAddress);
                    log.info("isUserExistInCustomDB : " + isUserExistInCustomDB);
                    if (!isUserExistInCustomDB && !isDeletedUser) {
                        SessionErrors.add(renderRequest, USER_DELETED_KEY);
                    } else {
                        log.info("inside registration block for new registration with questionmark");
                        registrationBean.setBusinessEmailAddress(businessEmailAddress);
                        registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean);
                        registrationBean.setBusinessEmailAddress(businessEmailAddress);
                        log.info(
                                "registartion bean email address" + registrationBean.getBusinessEmailAddress());
                        log.info("the user type is " + registrationBean.getUserType());
                        if (fetchActivationLinkCreateDateDiff(registrationBean.getBusinessEmailAddress())) {
                            SessionErrors.add(renderRequest, RegistrationConstants.REGISTRATION_LINK_EXPIRED);
                        }
                        if (registrationDelegator.checkIfUserExistsInLiferay(registrationBean)
                                && registrationBean.getUserType()
                                        .equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER)
                                && registrationBean.getUserType()
                                        .equalsIgnoreCase(STOXXConstants.STOXX_GENERAL_USER)) {
                            SessionMessages.add(renderRequest, "user-activation-link-already-sent");
                        }
                    }
                }
            }
            registrationBean.setIsDeletedUser(isDeletedUser);
        }
        registrationBean.setIsExistingUser(isExistingUser);
        registrationBean.setIsDeletedUser(isDeletedUser);
        log.info("registrationBean.toString() : " + registrationBean.toString());
        model.addAttribute(REGISTRATION_BEAN, registrationBean);

    } catch (STOXXException e) {
        log.error("STOXXException in handleRenderRequest", e);
    } catch (Exception e) {
        log.error("Exception in handleRenderRequest", e);
    }
    registrationBean.setIsExistingUser(isExistingUser);
    registrationBean.setIsDeletedUser(isDeletedUser);
    return RegistrationConstants.INITIATE_REGISTRATION;
}

From source file:com.stoxx.portlet.controller.RegistrationController.java

private void getUserTypeandEmalaIdfromEncrptedUrl(Model model, RegistrationBean registrationBean,
        String portalUrl) {/*  w w  w.  jav a  2  s  . c  o m*/
    String businessEmailAddressEncrypted;
    String userTypEncrypted;
    Boolean isExistingUser = Boolean.FALSE;
    Boolean isDeletedUser = Boolean.FALSE;
    try {
        businessEmailAddressEncrypted = portalUrl.substring(portalUrl.indexOf(StringPool.QUESTION) + 1,
                portalUrl.indexOf(StringPool.DOLLAR));
        businessEmailAddress = STOXXEncrypter.decrypt(businessEmailAddressEncrypted, ENCRYPTION_KEY);
        log.info("decrypted email id is&&&&& " + businessEmailAddress);
        registrationBean.setBusinessEmailAddress(businessEmailAddress);
        log.info("registartion bean email address" + registrationBean.getBusinessEmailAddress());
        userTypEncrypted = portalUrl.split(StringPool.BACK_SLASH + StringPool.DOLLAR)[1];
        userType = STOXXEncrypter.decrypt(userTypEncrypted, ENCRYPTION_KEY);
        registrationBean.setUserType(userType);
        RegistrationBean registrationBean2 = registrationDelegator.fetchFromStoxxUser(registrationBean);
        if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus())
                && registrationBean2.getStatus() == 3) {
            log.info("<<<<<<<<<the user is an eisting user>>>>>>>>");
            isExistingUser = Boolean.TRUE;
        }
        if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus())
                && registrationBean2.getStatus() == 4) {
            log.info("<<<<<<<<<the user has been  deleted previously>>>>>>>>");
            isDeletedUser = Boolean.TRUE;
        }
        registrationBean.setIsExistingUser(isExistingUser);
        registrationBean.setIsDeletedUser(isDeletedUser);
    } catch (STOXXException e) {
        log.error("STOXXException ", e);
    } catch (Exception e) {
        log.error("Exception", e);
    }
    log.info("the user type is " + registrationBean.getUserType());
    model.addAttribute(REGISTRATION_BEAN, registrationBean);
}