Example usage for com.liferay.portal.kernel.util PropsUtil get

List of usage examples for com.liferay.portal.kernel.util PropsUtil get

Introduction

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

Prototype

public static String get(String key) 

Source Link

Usage

From source file:com.liferay.sample.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w  ww.  ja  va  2 s .  c o m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "employee-management-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("employee-management-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "employee-management-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.samplealloymvc.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }// w w  w . j av a  2 s  .c  om

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "sample-alloy-mvc-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("sample-alloy-mvc-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "sample-alloy-mvc-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.samplelar.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w  ww.  j a  v a2s. c  om*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "sample-lar-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("sample-lar-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "sample-lar-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.sampleservicebuilder.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from   w  w w  . ja  va  2s. co  m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "sample-service-builder-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("sample-service-builder-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "sample-service-builder-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.school.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from   w w  w .  j a va  2s.co  m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "school-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("school-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "school-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.server.manager.internal.executor.OutputLogExecutor.java

License:Open Source License

protected File getLogFile() {
    File logFile = null;/*  w  w  w  .  j av a 2  s.  co  m*/

    if (ServerDetector.isJBoss()) {
        File logDirectory = new File(System.getProperty("jboss.server.log.dir"));

        logFile = new File(logDirectory, "server.log");
    } else {
        logFile = new File(StringBundler.concat(PropsUtil.get(PropsKeys.LIFERAY_HOME), "/logs/liferay.",
                getLiferayDateString(), ".log"));
    }

    return logFile;
}

From source file:com.liferay.servermanager.executor.OutputLogExecutor.java

License:Open Source License

protected File getLogFile() {
    File logFile = null;//from  w w  w  . j  a  va2s .  com

    if (ServerDetector.isJBoss()) {
        File logDirectory = new File(System.getProperty("jboss.server.log.dir"));

        logFile = new File(logDirectory, "server.log");
    } else {
        logFile = new File(
                PropsUtil.get(PropsKeys.LIFERAY_HOME) + "/logs/liferay." + getLiferayDateString() + ".log");
    }

    return logFile;
}

From source file:com.liferay.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from w  ww  .ja  v  a2 s .c o  m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "FirstApplicationPortlet-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("FirstApplicationPortlet-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "FirstApplicationPortlet-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.liferay.sevencogs.hook.events.StartupAction.java

License:Open Source License

protected User addUser(long companyId, String screenName, String firstName, String lastName, boolean male,
        String jobTitle, long[] roleIds) throws Exception {

    long creatorUserId = 0;
    boolean autoPassword = false;
    String password1 = screenName;
    String password2 = password1;
    boolean autoScreenName = false;
    String emailAddress = screenName + "@7cogs.com";
    String openId = StringPool.BLANK;
    Locale locale = Locale.US;
    String middleName = StringPool.BLANK;
    int prefixId = 0;
    int suffixId = 0;
    int birthdayMonth = Calendar.JANUARY;
    int birthdayDay = 1;
    int birthdayYear = 1970;

    Group guestGroup = GroupLocalServiceUtil.getGroup(companyId, GroupConstants.GUEST);

    long[] groupIds = new long[] { guestGroup.getGroupId() };

    Organization sevenCogsOrganization = OrganizationLocalServiceUtil.getOrganization(companyId, "7Cogs, Inc.");

    long[] organizationIds = new long[] { sevenCogsOrganization.getOrganizationId() };

    long[] userGroupIds = null;
    boolean sendEmail = false;
    ServiceContext serviceContext = null;

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

    byte[] portrait = getBytes("/users/" + screenName + "/portrait.jpg");

    UserLocalServiceUtil.updatePortrait(user.getUserId(), portrait);

    String[] questions = StringUtil.split(PropsUtil.get("users.reminder.queries.questions"));

    String question = questions[0];
    String answer = "1234";

    UserLocalServiceUtil.updateReminderQuery(user.getUserId(), question, answer);

    Group group = user.getGroup();

    // Profile layout

    Layout layout = addLayout(group, "Profile", false, "/profile", "2_columns_ii");

    String portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    highlightPortlet(layout, portletId);

    JournalArticle journalArticle = addJournalArticle(user.getUserId(), group.getGroupId(),
            "Public Pages " + user.getScreenName(), "my_community_" + user.getScreenName() + ".xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    addPortletId(layout, "1_WAR_wolportlet", "column-1");
    addPortletId(layout, PortletKeys.REQUESTS, "column-1");
    addPortletId(layout, "4_WAR_wolportlet", "column-1");
    addPortletId(layout, PortletKeys.ACTIVITIES, "column-2");
    addPortletId(layout, "5_WAR_wolportlet", "column-2");

    // Blog layout

    layout = addLayout(group, "Blog", false, "/blog", "2_columns_ii");

    addPortletId(layout, PortletKeys.RECENT_BLOGGERS, "column-1");
    addPortletId(layout, PortletKeys.BLOGS, "column-2");

    // Social layout

    layout = addLayout(group, "Social", true, "/social", "2_columns_ii");

    addPortletId(layout, "1_WAR_wolportlet", "column-1");
    addPortletId(layout, PortletKeys.REQUESTS, "column-1");

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(user.getUserId(), group.getGroupId(),
            "Public Pages " + user.getScreenName(), "private_pages_" + user.getScreenName() + ".xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    addPortletId(layout, "6_WAR_wolportlet", "column-2");

    portletId = addPortletId(layout, PortletKeys.IFRAME, "column-1");

    Map iframePreferences = new HashMap();

    iframePreferences.put("portlet-setup-show-borders", String.valueOf(Boolean.FALSE));

    if (screenName.equals("bruno") || screenName.equals("john")) {
        iframePreferences.put("src", "http://iphone.facebook.com");
        iframePreferences.put("height-normal", "460");
    } else if (screenName.equals("michelle")) {
        iframePreferences.put("src", "https://twitterforiphone.com/login");
        iframePreferences.put("height-normal", "400");
    } else if (screenName.equals("richard")) {
        iframePreferences.put("src", "http://m.linkedin.com");
        iframePreferences.put("height-normal", "350");
    }/*from  w ww . j a va2s . com*/

    updatePortletSetup(layout, portletId, iframePreferences);

    // Workspace layout

    layout = addLayout(group, "Workspace", true, "/workspace", "2_columns_i");

    addPortletId(layout, PortletKeys.RECENT_DOCUMENTS, "column-1");
    addPortletId(layout, PortletKeys.DOCUMENT_LIBRARY, "column-1");
    addPortletId(layout, PortletKeys.IMAGE_GALLERY, "column-1");

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(user.getUserId(), group.getGroupId(), "My documents",
            "workspace_docs.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    addPortletId(layout, PortletKeys.CALENDAR, "column-2");

    // Email layout

    layout = addLayout(group, "Email", true, "/email", "1_column");

    addPortletId(layout, "1_WAR_mailportlet", "column-1");

    return user;
}

From source file:com.liferay.sevencogs.hook.events.StartupAction.java

License:Open Source License

protected void setupOrganizations(long companyId, long defaultUserId) throws Exception {

    // 7Cogs, Inc. organization

    long userId = defaultUserId;
    long parentOrganizationId = OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID;
    String name = "7Cogs, Inc.";
    String type = OrganizationConstants.TYPE_REGULAR_ORGANIZATION;
    boolean recursable = true;
    long regionId = 0;
    long countryId = 0;
    int statusId = GetterUtil
            .getInteger(PropsUtil.get("sql.data.com.liferay.portal.model.ListType.organization.status"));
    String comments = null;/*from   ww  w. ja  v a  2s.co  m*/

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddCommunityPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    Organization organization = OrganizationLocalServiceUtil.addOrganization(userId, parentOrganizationId, name,
            type, recursable, regionId, countryId, statusId, comments, serviceContext);

    // Group

    Group group = organization.getGroup();

    GroupLocalServiceUtil.updateFriendlyURL(group.getGroupId(), "/7cogs");

    // Layout set

    LayoutSetLocalServiceUtil.updateLogo(group.getGroupId(), false, true,
            getInputStream("/images/seven_cogs_log.png"));

    LayoutSetLocalServiceUtil.updateLookAndFeel(group.getGroupId(), false, "sevencogs_WAR_sevencogstheme", "01",
            "", false);

    // Journal

    addJournalStructure(defaultUserId, group.getGroupId());
    addJournalTemplate(defaultUserId, group.getGroupId());

    // Image gallery

    serviceContext.setScopeGroupId(group.getGroupId());

    IGFolder igFolder = IGFolderLocalServiceUtil.addFolder(defaultUserId, 0, "7Cogs Web Content",
            "Images used for content", serviceContext);

    IGImage addIconIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "add_icon.png", serviceContext);

    IGImage configurationIconIGImage = addIGImage(defaultUserId, igFolder.getFolderId(),
            "configuration_icon.png", serviceContext);

    IGImage editIconIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "edit_icon.png",
            serviceContext);

    IGImage eeAdIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "ee_ad.png", serviceContext);

    IGImage gartnerIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "gartner.png", serviceContext);

    IGImage introducingIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "introducing.png",
            serviceContext);

    IGImage liferayLogoIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "liferay_logo.png",
            serviceContext);

    IGImage lookIconIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "look_icon.png",
            serviceContext);

    IGImage productsIGImage = addIGImage(defaultUserId, igFolder.getFolderId(), "products.png", serviceContext);

    // Home layout

    Layout layout = addLayout(group, "Home", false, "/home", "1_2_columns_ii");

    // Banner content portlet

    String portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    removePortletBorder(layout, portletId);

    JournalArticle journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Banner",
            "front_page_banner.xml");

    String content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$GROUP_ID$]", "[$INTRODUCING_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(group.getGroupId()), String.valueOf(introducingIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Front Page Intro content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    removePortletBorder(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Front Page Intro",
            "front_page_intro.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Fron Page - Edit and Create content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    configurePortletTitle(layout, portletId, "Edit and Add Content");

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Fron Page - Edit and Create",
            "front_page_edit_and_create.xml");

    content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$ADD_ICON_IG_IMAGE_UUID$]", "[$CONFIGURATION_ICON_IG_IMAGE_UUID$]",
                    "[$EDIT_ICON_IG_IMAGE_UUID$]", "[$GROUP_ID$]", "[$LOOK_ICON_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(addIconIGImage.getUuid()),
                    String.valueOf(configurationIconIGImage.getUuid()),
                    String.valueOf(editIconIGImage.getUuid()), String.valueOf(group.getGroupId()),
                    String.valueOf(lookIconIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Front Page - EE Ad content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-3");

    configurePortletTitle(layout, portletId, "Advertisement");

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Front Page - EE Ad", "ee_ad.xml");

    content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$GROUP_ID$]", "[$EE_AD_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(group.getGroupId()), String.valueOf(eeAdIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Front Page - Permissions content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-3");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Front Page - Permissions",
            "front_page_permissions.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Products layout

    layout = addLayout(group, "Products", false, "/products", "2_columns_iii");

    // Products Image content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    removePortletBorder(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Products Image",
            "products_banner.xml");

    content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$GROUP_ID$]", "[$PRODUCTS_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(group.getGroupId()), String.valueOf(productsIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // News content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    configurePortletTitle(layout, portletId, "News");

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Gartner", "gartner.xml");

    content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$GROUP_ID$]", "[$GARTNER_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(group.getGroupId()), String.valueOf(gartnerIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Introducing Vix content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    removePortletBorder(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Introducing Vix",
            "introducing_vix.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Products - More Information content portlet

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Products - More Information",
            "products_more.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    // Blogs

    layout = addLayout(group, "Blogs", false, "/blogs", "2_columns_ii");

    addPortletId(layout, PortletKeys.RECENT_BLOGGERS, "column-1");
    addPortletId(layout, PortletKeys.BLOGS_AGGREGATOR, "column-2");

    // Wiki layout

    layout = addLayout(group, "Wiki", false, "/wiki", "1_column");

    addPortletId(layout, PortletKeys.WIKI, "column-1");

    // Wiki

    WikiNode wikiNode = WikiNodeLocalServiceUtil.addNode(defaultUserId, "Main", StringPool.BLANK,
            serviceContext);

    addWikiPage(defaultUserId, wikiNode.getNodeId(), "FrontPage", "FrontPage.xml", serviceContext);

    addWikiPage(defaultUserId, wikiNode.getNodeId(), "Vix-998", "Vix-998.xml", serviceContext);

    // Forums layout

    layout = addLayout(group, "Forums", false, "/forums", "1_column");

    addPortletId(layout, PortletKeys.MESSAGE_BOARDS, "column-1");

    // About Us layout

    layout = addLayout(group, "About Us", false, "/about_us", "2_columns_ii");

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "About Us", "7cogs_about_us.xml");

    content = StringUtil.replace(journalArticle.getContent(),
            new String[] { "[$GROUP_ID$]", "[$LIFERAY_LOGO_IG_IMAGE_UUID$]" },
            new String[] { String.valueOf(group.getGroupId()), String.valueOf(liferayLogoIGImage.getUuid()) });

    JournalArticleLocalServiceUtil.updateContent(group.getGroupId(), journalArticle.getArticleId(),
            journalArticle.getVersion(), content);

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    addPortletId(layout, "1_WAR_webformportlet", "column-2");

    portletId = addPortletId(layout, "1_WAR_googlemapsportlet", "column-1");

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

    preferences.put("map-address", "Los Angeles, USA");
    preferences.put("height", "300");

    updatePortletSetup(layout, portletId, preferences);

    // Home layout

    layout = addLayout(group, "Home", true, "/home", "2_columns_ii");

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-1");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Home", "7cogs_private_pages.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());

    portletId = addPortletId(layout, PortletKeys.ACTIVITIES, "column-2");

    configurePortletTitle(layout, portletId, "Last Activities in 7Cogs Organization");

    // Documents layout

    layout = addLayout(group, "Documents", true, "/documents", "2_columns_iii");

    addPortletId(layout, PortletKeys.DOCUMENT_LIBRARY, "column-1");
    addPortletId(layout, PortletKeys.IMAGE_GALLERY, "column-1");

    portletId = addPortletId(layout, PortletKeys.JOURNAL_CONTENT, "column-2");

    highlightPortlet(layout, portletId);

    journalArticle = addJournalArticle(defaultUserId, group.getGroupId(), "Shared Documents",
            "shared_docs.xml");

    configureJournalContent(layout, portletId, journalArticle.getArticleId());
}