Example usage for com.liferay.portal.kernel.util GetterUtil getBoolean

List of usage examples for com.liferay.portal.kernel.util GetterUtil getBoolean

Introduction

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

Prototype

public static boolean getBoolean(String value) 

Source Link

Document

Returns the String value as a boolean.

Usage

From source file:at.graz.meduni.bibbox.liferay.portlet.model.ApplicationInstanceClp.java

License:Open Source License

@Override
public void setModelAttributes(Map<String, Object> attributes) {
    Long applicationInstanceId = (Long) attributes.get("applicationInstanceId");

    if (applicationInstanceId != null) {
        setApplicationInstanceId(applicationInstanceId);
    }//from   w  ww.j  ava  2s  .c  o  m

    Long groupId = (Long) attributes.get("groupId");

    if (groupId != null) {
        setGroupId(groupId);
    }

    Long companyId = (Long) attributes.get("companyId");

    if (companyId != null) {
        setCompanyId(companyId);
    }

    Long userId = (Long) attributes.get("userId");

    if (userId != null) {
        setUserId(userId);
    }

    String userName = (String) attributes.get("userName");

    if (userName != null) {
        setUserName(userName);
    }

    Date createDate = (Date) attributes.get("createDate");

    if (createDate != null) {
        setCreateDate(createDate);
    }

    Date modifiedDate = (Date) attributes.get("modifiedDate");

    if (modifiedDate != null) {
        setModifiedDate(modifiedDate);
    }

    String instanceId = (String) attributes.get("instanceId");

    if (instanceId != null) {
        setInstanceId(instanceId);
    }

    String name = (String) attributes.get("name");

    if (name != null) {
        setName(name);
    }

    String shortName = (String) attributes.get("shortName");

    if (shortName != null) {
        setShortName(shortName);
    }

    String folderName = (String) attributes.get("folderName");

    if (folderName != null) {
        setFolderName(folderName);
    }

    String application = (String) attributes.get("application");

    if (application != null) {
        setApplication(application);
    }

    String version = (String) attributes.get("version");

    if (version != null) {
        setVersion(version);
    }

    String status = (String) attributes.get("status");

    if (status != null) {
        setStatus(status);
    }

    Boolean deleted = (Boolean) attributes.get("deleted");

    if (deleted != null) {
        setDeleted(deleted);
    }

    String shortdescription = (String) attributes.get("shortdescription");

    if (shortdescription != null) {
        setShortdescription(shortdescription);
    }

    String description = (String) attributes.get("description");

    if (description != null) {
        setDescription(description);
    }

    String adminnode = (String) attributes.get("adminnode");

    if (adminnode != null) {
        setAdminnode(adminnode);
    }

    String maintenance = (String) attributes.get("maintenance");

    if (maintenance != null) {
        setMaintenance(maintenance);
    }

    Boolean ismaintenance = (Boolean) attributes.get("ismaintenance");

    if (ismaintenance != null) {
        setIsmaintenance(ismaintenance);
    }

    String installlog = (String) attributes.get("installlog");

    if (installlog != null) {
        setInstalllog(installlog);
    }

    Boolean isinstalling = (Boolean) attributes.get("isinstalling");

    if (isinstalling != null) {
        setIsinstalling(isinstalling);
    }

    _entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
    _finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}

From source file:at.graz.meduni.bibbox.liferay.portlet.model.ApplicationInstanceContainerClp.java

License:Open Source License

@Override
public void setModelAttributes(Map<String, Object> attributes) {
    Long applicationInstanceContainerId = (Long) attributes.get("applicationInstanceContainerId");

    if (applicationInstanceContainerId != null) {
        setApplicationInstanceContainerId(applicationInstanceContainerId);
    }/*from  w  w w . j ava2s.  c  om*/

    Long groupId = (Long) attributes.get("groupId");

    if (groupId != null) {
        setGroupId(groupId);
    }

    Long companyId = (Long) attributes.get("companyId");

    if (companyId != null) {
        setCompanyId(companyId);
    }

    Long userId = (Long) attributes.get("userId");

    if (userId != null) {
        setUserId(userId);
    }

    String userName = (String) attributes.get("userName");

    if (userName != null) {
        setUserName(userName);
    }

    Date createDate = (Date) attributes.get("createDate");

    if (createDate != null) {
        setCreateDate(createDate);
    }

    Date modifiedDate = (Date) attributes.get("modifiedDate");

    if (modifiedDate != null) {
        setModifiedDate(modifiedDate);
    }

    String containerName = (String) attributes.get("containerName");

    if (containerName != null) {
        setContainerName(containerName);
    }

    Boolean needrunning = (Boolean) attributes.get("needrunning");

    if (needrunning != null) {
        setNeedrunning(needrunning);
    }

    Boolean running = (Boolean) attributes.get("running");

    if (running != null) {
        setRunning(running);
    }

    Long applicationInstanceId = (Long) attributes.get("applicationInstanceId");

    if (applicationInstanceId != null) {
        setApplicationInstanceId(applicationInstanceId);
    }

    _entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
    _finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}

From source file:at.graz.meduni.bibbox.liferay.portlet.model.ApplicationInstancePortClp.java

License:Open Source License

@Override
public void setModelAttributes(Map<String, Object> attributes) {
    Long applicationInstancePortId = (Long) attributes.get("applicationInstancePortId");

    if (applicationInstancePortId != null) {
        setApplicationInstancePortId(applicationInstancePortId);
    }/*from w w w  . ja v a2s.  com*/

    Long groupId = (Long) attributes.get("groupId");

    if (groupId != null) {
        setGroupId(groupId);
    }

    Long companyId = (Long) attributes.get("companyId");

    if (companyId != null) {
        setCompanyId(companyId);
    }

    Long userId = (Long) attributes.get("userId");

    if (userId != null) {
        setUserId(userId);
    }

    String userName = (String) attributes.get("userName");

    if (userName != null) {
        setUserName(userName);
    }

    Date createDate = (Date) attributes.get("createDate");

    if (createDate != null) {
        setCreateDate(createDate);
    }

    Date modifiedDate = (Date) attributes.get("modifiedDate");

    if (modifiedDate != null) {
        setModifiedDate(modifiedDate);
    }

    Long port = (Long) attributes.get("port");

    if (port != null) {
        setPort(port);
    }

    String portId = (String) attributes.get("portId");

    if (portId != null) {
        setPortId(portId);
    }

    Boolean primary = (Boolean) attributes.get("primary");

    if (primary != null) {
        setPrimary(primary);
    }

    String subdomain = (String) attributes.get("subdomain");

    if (subdomain != null) {
        setSubdomain(subdomain);
    }

    Long applicationInstanceId = (Long) attributes.get("applicationInstanceId");

    if (applicationInstanceId != null) {
        setApplicationInstanceId(applicationInstanceId);
    }

    _entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
    _finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}

From source file:at.graz.meduni.bibbox.liferay.portlet.model.ApplicationInstanceStatusClp.java

License:Open Source License

@Override
public void setModelAttributes(Map<String, Object> attributes) {
    Long applicationInstanceStatusId = (Long) attributes.get("applicationInstanceStatusId");

    if (applicationInstanceStatusId != null) {
        setApplicationInstanceStatusId(applicationInstanceStatusId);
    }//from  w w w.j  a v a 2  s.co  m

    Long groupId = (Long) attributes.get("groupId");

    if (groupId != null) {
        setGroupId(groupId);
    }

    Long companyId = (Long) attributes.get("companyId");

    if (companyId != null) {
        setCompanyId(companyId);
    }

    Long userId = (Long) attributes.get("userId");

    if (userId != null) {
        setUserId(userId);
    }

    String userName = (String) attributes.get("userName");

    if (userName != null) {
        setUserName(userName);
    }

    Date createDate = (Date) attributes.get("createDate");

    if (createDate != null) {
        setCreateDate(createDate);
    }

    Date modifiedDate = (Date) attributes.get("modifiedDate");

    if (modifiedDate != null) {
        setModifiedDate(modifiedDate);
    }

    Long applicationInstanceId = (Long) attributes.get("applicationInstanceId");

    if (applicationInstanceId != null) {
        setApplicationInstanceId(applicationInstanceId);
    }

    String status = (String) attributes.get("status");

    if (status != null) {
        setStatus(status);
    }

    _entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
    _finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}

From source file:br.com.thiagomoreira.liferay.plugins.MarkdownDisplayPortlet.java

License:Apache License

@Override
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {

    PortletPreferences preferences = request.getPreferences();
    String markdownURL = preferences.getValue("markdownURL", null);
    int timeToLive = 60 * GetterUtil.getInteger(preferences.getValue("timeToLive", "1"));
    boolean autolinks = GetterUtil.getBoolean(preferences.getValue("autolinks", "false"));
    boolean fencedBlockCodes = GetterUtil.getBoolean(preferences.getValue("fencedBlockCodes", "false"));
    boolean tables = GetterUtil.getBoolean(preferences.getValue("tables", "false"));

    if (Validator.isNotNull(markdownURL)) {
        PortalCache<Serializable, Object> portalCache = SingleVMPoolUtil
                .getCache(MarkdownDisplayPortlet.class.getName());

        String content = (String) portalCache.get(markdownURL);

        if (content == null) {
            int options = Extensions.NONE;
            if (autolinks) {
                options = options | Extensions.AUTOLINKS;
            }//from ww  w  .  j a  v  a2s.  c  om
            if (fencedBlockCodes) {
                options = options | Extensions.FENCED_CODE_BLOCKS;
            }
            if (tables) {
                options = options | Extensions.TABLES;
            }

            PegDownProcessor processor = new PegDownProcessor(options);

            String markdownSource = HttpUtil.URLtoString(markdownURL);
            content = processor.markdownToHtml(markdownSource);

            portalCache.put(markdownURL, content, timeToLive);
        }

        request.setAttribute("content", content);
    } else {
        request.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);
    }

    super.render(request, response);
}

From source file:com.abubusoft.liferay.linkedin.CreateAccountAction.java

License:Open Source License

protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
    HttpSession session = request.getSession();

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    long creatorUserId = 0;
    long facebookId = ParamUtil.getLong(actionRequest, "facebookId");
    boolean autoPassword = true;
    boolean autoScreenName = false;
    boolean male = ParamUtil.getBoolean(actionRequest, "male", true);
    boolean sendEmail = true;
    String linkedinId = ParamUtil.getString(actionRequest, "linkedinId");
    String emailAddress = ParamUtil.getString(actionRequest, "emailAddress");
    String screenName = ParamUtil.getString(actionRequest, "screenName");
    String firstName = ParamUtil.getString(actionRequest, "firstName");
    String lastName = ParamUtil.getString(actionRequest, "lastName");
    String middleName = ParamUtil.getString(actionRequest, "middleName");
    String password1 = StringPool.BLANK;
    String password2 = StringPool.BLANK;
    String jobTitle = ParamUtil.getString(actionRequest, "jobTitle");
    String openId = StringPool.BLANK;
    int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth");
    int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay");
    int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear");
    int prefixId = ParamUtil.getInteger(actionRequest, "prefixId");
    int suffixId = ParamUtil.getInteger(actionRequest, "suffixId");
    Locale locale = themeDisplay.getLocale();

    long[] groupIds = null;
    long[] organizationIds = null;
    long[] roleIds = null;
    long[] userGroupIds = null;

    if (GetterUtil.getBoolean(PropsUtil.get(PropsKeys.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD))) {
        autoPassword = false;/*from w w w .j a v a  2  s  .  com*/

        password1 = ParamUtil.getString(actionRequest, "password1");
        password2 = ParamUtil.getString(actionRequest, "password2");
    }

    ServiceContext serviceContext = new ServiceContext();

    User user = UserLocalServiceUtil.addUser(creatorUserId, company.getCompanyId(), autoPassword, password1,
            password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName,
            middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle,
            groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);

    user = UserLocalServiceUtil.updateLastLogin(user.getUserId(), user.getLoginIP());

    user = UserLocalServiceUtil.updatePasswordReset(user.getUserId(), false);

    user = UserLocalServiceUtil.updateEmailAddressVerified(user.getUserId(), false);

    ExpandoValueLocalServiceUtil.addValue(company.getCompanyId(), User.class.getName(),
            ExpandoTableConstants.DEFAULT_TABLE_NAME, "linkedinId", user.getUserId(), linkedinId);

    session.setAttribute(LinkedinConstants.LINKEDIN_ID_LOGIN, new Long(user.getUserId()));

    session.removeAttribute(LinkedinConstants.LINKEDIN_LOGIN_PENDING);

    PortletURL portletURL = PortletURLFactoryUtil.create(request, PortletKeys.FAST_LOGIN,
            themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);

    portletURL.setWindowState(LiferayWindowState.POP_UP);
    portletURL.setParameter("struts_action", "/login/login_redirect");

    actionResponse.sendRedirect(portletURL.toString());
}

From source file:com.abubusoft.liferay.twitter.CreateAccountAction.java

License:Open Source License

protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
    HttpSession session = request.getSession();

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    long creatorUserId = 0;
    long facebookId = ParamUtil.getLong(actionRequest, "facebookId");
    boolean autoPassword = true;
    boolean autoScreenName = false;
    boolean male = ParamUtil.getBoolean(actionRequest, "male", true);
    boolean sendEmail = true;
    String twitterId = ParamUtil.getString(actionRequest, "twitterId");
    String emailAddress = ParamUtil.getString(actionRequest, "emailAddress");
    String screenName = ParamUtil.getString(actionRequest, "screenName");
    String firstName = ParamUtil.getString(actionRequest, "firstName");
    String lastName = ParamUtil.getString(actionRequest, "lastName");
    String middleName = ParamUtil.getString(actionRequest, "middleName");
    String password1 = StringPool.BLANK;
    String password2 = StringPool.BLANK;
    String jobTitle = ParamUtil.getString(actionRequest, "jobTitle");
    String openId = StringPool.BLANK;
    int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth");
    int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay");
    int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear");
    int prefixId = ParamUtil.getInteger(actionRequest, "prefixId");
    int suffixId = ParamUtil.getInteger(actionRequest, "suffixId");
    Locale locale = themeDisplay.getLocale();

    long[] groupIds = null;
    long[] organizationIds = null;
    long[] roleIds = null;
    long[] userGroupIds = null;

    if (GetterUtil.getBoolean(PropsUtil.get(PropsKeys.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD))) {
        autoPassword = false;/*from   w w w.  j  a v  a  2  s.  c  o  m*/

        password1 = ParamUtil.getString(actionRequest, "password1");
        password2 = ParamUtil.getString(actionRequest, "password2");
    }

    ServiceContext serviceContext = new ServiceContext();

    User user = UserLocalServiceUtil.addUser(creatorUserId, company.getCompanyId(), autoPassword, password1,
            password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName,
            middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle,
            groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);

    user = UserLocalServiceUtil.updateLastLogin(user.getUserId(), user.getLoginIP());

    user = UserLocalServiceUtil.updatePasswordReset(user.getUserId(), false);

    user = UserLocalServiceUtil.updateEmailAddressVerified(user.getUserId(), false);

    ExpandoValueLocalServiceUtil.addValue(company.getCompanyId(), User.class.getName(),
            ExpandoTableConstants.DEFAULT_TABLE_NAME, TwitterConstants.TWITTER_ID_COLUMN_NAME, user.getUserId(),
            twitterId);

    session.setAttribute(TwitterConstants.TWITTER_ID_LOGIN, new Long(user.getUserId()));

    session.removeAttribute(TwitterConstants.TWITTER_LOGIN_PENDING);

    PortletURL portletURL = PortletURLFactoryUtil.create(request, PortletKeys.FAST_LOGIN,
            themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);

    portletURL.setWindowState(LiferayWindowState.POP_UP);
    portletURL.setParameter("struts_action", "/login/login_redirect");

    actionResponse.sendRedirect(portletURL.toString());
}

From source file:com.acs.DDMXSD.java

License:Open Source License

public String getHTML(PageContext pageContext, Element element, Fields fields, String namespace, String mode,
        boolean readOnly, Locale locale) throws Exception {

    StringBundler sb = new StringBundler();

    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String portletId = PortalUtil.getPortletId(request);

    String portletNamespace = PortalUtil.getPortletNamespace(portletId);

    List<Element> dynamicElementElements = element.elements("dynamic-element");

    for (Element dynamicElementElement : dynamicElementElements) {
        FreeMarkerContext freeMarkerContext = getFreeMarkerContext(dynamicElementElement, locale);

        freeMarkerContext.put("portletNamespace", portletNamespace);
        freeMarkerContext.put("namespace", namespace);

        if (fields != null) {
            freeMarkerContext.put("fields", fields);
        }/*  w ww.j  av  a 2 s.  c o  m*/

        Map<String, Object> field = (Map<String, Object>) freeMarkerContext.get("fieldStructure");

        String childrenHTML = getHTML(pageContext, dynamicElementElement, fields, namespace, mode, readOnly,
                locale);

        field.put("children", childrenHTML);

        String fieldNamespace = dynamicElementElement.attributeValue("fieldNamespace", _DEFAULT_NAMESPACE);

        String url = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
        url = url.substring(0, url.lastIndexOf('/'));
        String defaultResourcePath = url + "/" + _TPL_DEFAULT_PATH;

        boolean fieldReadOnly = GetterUtil.getBoolean(field.get("readOnly"));

        if ((fieldReadOnly && Validator.isNotNull(mode)
                && mode.equalsIgnoreCase(DDMTemplateConstants.TEMPLATE_MODE_EDIT)) || readOnly) {

            fieldNamespace = _DEFAULT_READ_ONLY_NAMESPACE;

            defaultResourcePath = _TPL_DEFAULT_READ_ONLY_PATH;
        }

        String type = dynamicElementElement.attributeValue("type");

        String templateName = StringUtil.replaceFirst(type, fieldNamespace.concat(StringPool.DASH),
                StringPool.BLANK);

        StringBundler resourcePath = new StringBundler(5);

        resourcePath.append(_TPL_PATH);
        resourcePath.append(fieldNamespace.toLowerCase());
        resourcePath.append(CharPool.SLASH);
        resourcePath.append(templateName);
        resourcePath.append(_TPL_EXT);

        sb.append(processFTL(pageContext, freeMarkerContext, resourcePath.toString(), defaultResourcePath));
    }

    return sb.toString();
}

From source file:com.beorn.paymentpluginapi.config.ConfigDescriptionUtil.java

License:Open Source License

private static List<ConfigGroup> parseConfigGroups(Node configNode) throws InvalidConfigDescriptionException {
    List<Node> configGroupNodes = configNode.selectNodes("group");
    List<ConfigGroup> configGroups = new ArrayList<ConfigGroup>(configGroupNodes.size());

    for (Node configGroupNode : configGroupNodes) {
        String key = getRequiredValue(configGroupNode, "key");
        String name = getRequiredValue(configGroupNode, "name");
        List<ConfigParameter> configParameters = parseGroupParameters(configGroupNode);
        boolean isRepeatable = GetterUtil.getBoolean(getOptionalValue(configGroupNode, "repeatable", "false"));

        configGroups.add(new ConfigGroup(key, name, configParameters, isRepeatable));
    }//  w w w.  ja v a2  s  . c o  m
    return configGroups;
}

From source file:com.cd.learning.hook.MBCategoryPermission.java

License:Open Source License

public static boolean contains(PermissionChecker permissionChecker, MBCategory category, String actionId)
        throws PortalException, SystemException {

    if (MBBanLocalServiceUtil.hasBan(category.getGroupId(), permissionChecker.getUserId())) {

        return false;
    }// w ww.  ja  v  a  2  s . c  om

    if (actionId.equals(ActionKeys.ADD_CATEGORY)) {
        actionId = ActionKeys.ADD_SUBCATEGORY;
    }

    Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, category.getGroupId(),
            MBCategory.class.getName(), category.getCategoryId(), PortletKeys.MESSAGE_BOARDS, actionId);

    if (hasPermission != null) {
        return hasPermission.booleanValue();
    }

    if (actionId.equals(ActionKeys.VIEW)
            && GetterUtil.getBoolean(PropsUtil.get(PropsKeys.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE))) {

        try {
            long categoryId = category.getCategoryId();

            while (categoryId != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) {

                category = MBCategoryLocalServiceUtil.getCategory(categoryId);

                if (!_hasPermission(permissionChecker, category, actionId)) {

                    return false;
                }

                categoryId = category.getParentCategoryId();
            }
        } catch (NoSuchCategoryException nsce) {
            if (!category.isInTrash()) {
                throw nsce;
            }
        }

        return true;
    }

    return _hasPermission(permissionChecker, category, actionId);
}