Browse files

Remove unused 7cogs

  • Loading branch information...
1 parent e47b0b6 commit 4144a5d1886438fee141b96679264c7e4ad61448 @brianchandotcom brianchandotcom committed Jun 20, 2012
Showing with 0 additions and 5,618 deletions.
  1. +0 −23 hooks/sevencogs-hook/.classpath
  2. +0 −16 hooks/sevencogs-hook/.project
  3. +0 −6 hooks/sevencogs-hook/build.xml
  4. +0 −1 hooks/sevencogs-hook/docroot/WEB-INF/.gitignore
  5. +0 −6 hooks/sevencogs-hook/docroot/WEB-INF/liferay-hook.xml
  6. +0 −17 hooks/sevencogs-hook/docroot/WEB-INF/liferay-plugin-package.properties
  7. +0 −10 hooks/sevencogs-hook/docroot/WEB-INF/liferay-releng.properties
  8. BIN hooks/sevencogs-hook/docroot/WEB-INF/releng/icons/90x90.png
  9. +0 −70 ...s/sevencogs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade/UpgradeProcess_1_0_0.java
  10. +0 −2,296 .../sevencogs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade/v1_0_0/UpgradeCompany.java
  11. +0 −9 hooks/sevencogs-hook/docroot/WEB-INF/src/portal.properties
  12. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/cell_bg.png
  13. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_1.png
  14. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_2.png
  15. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_3.png
  16. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_4.png
  17. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_5.png
  18. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_6.png
  19. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/customer_7.png
  20. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/portal_mashup.png
  21. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/sevencogs_ad.png
  22. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/shared_workspaces.png
  23. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/social_network.png
  24. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/images/web_publishing.png
  25. +0 −13 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/articles/sample_site_ad.xml
  26. +0 −234 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/articles/welcome.xml
  27. +0 −128 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/articles/welcome_login.xml
  28. +0 −27 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/articles/welcome_note.xml
  29. +0 −6 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/structures/single_image.xml
  30. +0 −9 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/guest/journal/templates/single_image.xml
  31. +0 −1 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/preferences/highlight.json
  32. +0 −39 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/activity/counters/asset.activities.csv
  33. +0 −39 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/activity/counters/contribution.csv
  34. +0 −52 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/activity/counters/participation.csv
  35. +0 −13 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/activity/counters/user.message-posts.csv
  36. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/blogs_icon.png
  37. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/cog_blue.png
  38. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/cog_light_blue.png
  39. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/cog_network_advertisement.png
  40. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/cog_orange.png
  41. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/forums_icon.png
  42. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/home_page_banner.png
  43. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/liferay_logo.png
  44. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/logo.png
  45. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/product_landing.png
  46. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/images/products_icon.png
  47. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/about_us_banner.xml
  48. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/blogs_banner.xml
  49. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/documents_shared_docs.xml
  50. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/forums_banner.xml
  51. +0 −24 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_7cogs_about_us.xml
  52. +0 −15 ...sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_7cogs_private_pages.xml
  53. +0 −31 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_cog_network_ad.xml
  54. +0 −13 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_page_banner.xml
  55. +0 −24 ...s/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_page_blogs_button.xml
  56. +0 −24 .../sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_page_forums_button.xml
  57. +0 −33 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_page_intro.xml
  58. +0 −24 ...evencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/home_page_products_button.xml
  59. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/products_banner.xml
  60. +0 −74 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/products_catalog.xml
  61. +0 −13 ...s/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/products_landing_intro.xml
  62. +0 −33 ...encogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/products_landing_intro_info.xml
  63. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/articles/wiki_banner.xml
  64. +0 −6 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/structures/single_image.xml
  65. +0 −9 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/journal/templates/single_image.xml
  66. +0 −10 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/message_boards/general.xml
  67. +0 −1 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/message_boards/vix1.xml
  68. +0 −3 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/message_boards/vix2.xml
  69. +0 −3 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/message_boards/vix3.xml
  70. +0 −5 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/wiki/FrontPage.xml
  71. 0 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/sample/wiki/Vix-998.xml
  72. +0 −11 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/blogs/chat.xml
  73. +0 −31 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/blogs/controlpanel.xml
  74. +0 −15 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/blogs/portalproperties.xml
  75. +0 −15 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/blogs/wiki.xml
  76. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/document_library/Budget.xls
  77. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/document_library/New Features.ppt
  78. BIN ...vencogs-hook/docroot/WEB-INF/src/resources/users/document_library/Notes from the last meeting.doc
  79. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/images/bruno_portrait.jpg
  80. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/images/kendra_portrait.jpg
  81. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/images/michelle_portrait.jpg
  82. BIN hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/images/richard_portrait.jpg
  83. +0 −35 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/my_community_bruno.xml
  84. +0 −19 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/my_community_kendra.xml
  85. +0 −19 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/my_community_michelle.xml
  86. +0 −23 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/my_community_richard.xml
  87. +0 −55 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/private_pages_bruno.xml
  88. +0 −55 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/private_pages_kendra.xml
  89. +0 −55 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/private_pages_michelle.xml
  90. +0 −53 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/private_pages_richard.xml
  91. +0 −15 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/articles/workspace_docs.xml
  92. +0 −6 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/structures/single_image.xml
  93. +0 −9 hooks/sevencogs-hook/docroot/WEB-INF/src/resources/users/journal/templates/single_image.xml
  94. +0 −38 themes/sevencogs-theme/build.xml
  95. +0 −5 themes/sevencogs-theme/docroot/.gitignore
  96. +0 −9 themes/sevencogs-theme/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/.gitignore
  97. +0 −15 ...e/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/category_columns_action.jspf
  98. +0 −15 ...me/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/category_subscriptions.jspf
  99. +0 −15 ...EB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/subscribed_category_columns_action.jspf
  100. +0 −15 ...eme/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/thread_columns_action.jspf
  101. +0 −15 .../docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/thread_columns_last_post.jspf
  102. +0 −15 ...ocroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/user_thread_columns_action.jspf
  103. +0 −15 ...oot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/user_thread_columns_last_post.jspf
  104. +0 −125 ...heme/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/view_category_default.jsp
  105. +0 −226 ...theme/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/view_message_content.jsp
  106. +0 −419 ...theme/docroot/WEB-INF/custom_jsps/html/seven_cogs/portlet/message_boards/view_thread_message.jspf
  107. +0 −7 themes/sevencogs-theme/docroot/WEB-INF/liferay-hook.xml
  108. +0 −23 themes/sevencogs-theme/docroot/WEB-INF/liferay-look-and-feel.xml
  109. +0 −9 themes/sevencogs-theme/docroot/WEB-INF/liferay-plugin-package.properties
  110. +0 −10 themes/sevencogs-theme/docroot/WEB-INF/liferay-releng.properties
  111. BIN themes/sevencogs-theme/docroot/WEB-INF/releng/icons/90x90.png
  112. +0 −1 themes/sevencogs-theme/docroot/WEB-INF/src/portal.properties
  113. +0 −551 themes/sevencogs-theme/docroot/_diffs/css/custom.css
  114. BIN themes/sevencogs-theme/docroot/_diffs/images/custom/arrow.png
  115. BIN themes/sevencogs-theme/docroot/_diffs/images/custom/marker.png
  116. BIN themes/sevencogs-theme/docroot/_diffs/images/custom/page-banner_bg.png
  117. BIN themes/sevencogs-theme/docroot/_diffs/images/screenshot.png
  118. BIN themes/sevencogs-theme/docroot/_diffs/images/thumbnail.png
  119. +0 −3 themes/sevencogs-theme/docroot/_diffs/js/main.js
  120. BIN themes/sevencogs-theme/docroot/_diffs/layouttpl/custom/home.png
  121. +0 −61 themes/sevencogs-theme/docroot/_diffs/layouttpl/custom/home.tpl
  122. +0 −9 themes/sevencogs-theme/docroot/_diffs/templates/html/portlet/message_boards/view.ftl
  123. +0 −9 themes/sevencogs-theme/docroot/_diffs/templates/html/portlet/message_boards/view_message.ftl
  124. +0 −7 themes/sevencogs-theme/docroot/_diffs/templates/html/taglib/ui/asset_categories_summary/page.ftl
  125. +0 −7 themes/sevencogs-theme/docroot/_diffs/templates/html/taglib/ui/asset_tags_summary/page.ftl
  126. +0 −7 themes/sevencogs-theme/docroot/_diffs/templates/html/taglib/ui/ratings/page.ftl
  127. +0 −47 themes/sevencogs-theme/docroot/_diffs/templates/navigation.ftl
  128. +0 −98 themes/sevencogs-theme/docroot/_diffs/templates/portal_normal.ftl
View
23 hooks/sevencogs-hook/.classpath
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<classpath>
- <classpathentry excluding="**/.svn/**|.svn/" kind="src" path="docroot/WEB-INF/src" />
- <classpathentry kind="src" path="/portal-trunk" />
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
- <classpathentry kind="lib" path="/portal-trunk/lib/development/activation.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/development/annotations.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/development/jsp-api.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/development/mail.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/development/servlet-api.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/global/portlet.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/portal/commons-logging.jar" />
- <classpathentry kind="lib" path="/portal-trunk/lib/portal/log4j.jar" />
- <classpathentry kind="lib" path="/portal-trunk/portal-service/portal-service.jar" />
- <classpathentry kind="lib" path="/portal-trunk/util-bridges/util-bridges.jar" />
- <classpathentry kind="lib" path="/portal-trunk/util-java/util-java.jar" />
- <classpathentry kind="lib" path="/portal-trunk/util-taglib/util-taglib.jar" />
- <classpathentry kind="lib" path="docroot/WEB-INF/lib/kaleo-web-service.jar" />
- <classpathentry kind="lib" path="docroot/WEB-INF/lib/mail-portlet-service.jar" />
- <classpathentry kind="lib" path="docroot/WEB-INF/lib/social-networking-portlet-service.jar" />
- <classpathentry kind="output" path="bin" />
-</classpath>
View
16 hooks/sevencogs-hook/.project
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<projectDescription>
- <name>sevencogs-hook-trunk</name>
- <comment></comment>
- <projects></projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments></arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
View
6 hooks/sevencogs-hook/build.xml
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE project>
-
-<project name="sevencogs-hook" basedir="." default="deploy">
- <import file="../build-common-hook.xml" />
-</project>
View
1 hooks/sevencogs-hook/docroot/WEB-INF/.gitignore
@@ -1 +0,0 @@
-/lib
View
6 hooks/sevencogs-hook/docroot/WEB-INF/liferay-hook.xml
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
-
-<hook>
- <portal-properties>portal.properties</portal-properties>
-</hook>
View
17 hooks/sevencogs-hook/docroot/WEB-INF/liferay-plugin-package.properties
@@ -1,17 +0,0 @@
-name=7Cogs
-module-group-id=liferay
-module-incremental-version=1
-tags=
-short-description=This hook contains custom configuration used for Liferay's demo website.
-change-log=
-page-url=http://www.liferay.com
-author=Liferay, Inc.
-licenses=LGPL
-
-required-deployment-contexts=\
- google-maps-portlet,\
- kaleo-web,\
- mail-portlet,\
- sevencogs-theme,\
- social-networking-portlet,\
- web-form-portlet
View
10 hooks/sevencogs-hook/docroot/WEB-INF/liferay-releng.properties
@@ -1,10 +0,0 @@
-bundle=false
-category=
-compatibility=6.2.0
-demo-url=
-labs=true
-marketplace=true
-parent-app=
-public=true
-standalone-app=true
-supported=true
View
BIN hooks/sevencogs-hook/docroot/WEB-INF/releng/icons/90x90.png
Deleted file not rendered
View
70 ...ogs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade/UpgradeProcess_1_0_0.java
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
-
-package com.liferay.sevencogs.hook.upgrade;
-
-import com.liferay.portal.NoSuchUserException;
-import com.liferay.portal.kernel.upgrade.UpgradeProcess;
-import com.liferay.portal.model.Company;
-import com.liferay.portal.service.CompanyLocalServiceUtil;
-import com.liferay.portal.service.UserLocalServiceUtil;
-import com.liferay.sevencogs.hook.upgrade.v1_0_0.UpgradeCompany;
-
-import java.util.List;
-
-/**
- * @author Ryan Park
- */
-public class UpgradeProcess_1_0_0 extends UpgradeProcess {
-
- @Override
- public int getThreshold() {
- return 100;
- }
-
- @Override
- protected void doUpgrade() throws Exception {
- if (!isFirstRun()) {
- return;
- }
-
- upgrade(UpgradeCompany.class);
- }
-
- protected boolean isFirstRun() throws Exception {
- List<Company> companies = CompanyLocalServiceUtil.getCompanies();
-
- if (companies.isEmpty() || companies.size() > 1) {
- return false;
- }
-
- Company company = companies.get(0);
-
- long companyId = company.getCompanyId();
-
- try {
-
- // If Bruno exists, do not run again
-
- UserLocalServiceUtil.getUserByScreenName(companyId, "bruno");
-
- return false;
- }
- catch (NoSuchUserException nsue) {
- }
-
- return true;
- }
-
-}
View
2,296 ...gs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade/v1_0_0/UpgradeCompany.java
@@ -1,2296 +0,0 @@
-/**
- * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
-
-package com.liferay.sevencogs.hook.upgrade.v1_0_0;
-
-import com.liferay.portal.kernel.dao.orm.QueryUtil;
-import com.liferay.portal.kernel.repository.model.FileEntry;
-import com.liferay.portal.kernel.repository.model.Folder;
-import com.liferay.portal.kernel.upgrade.UpgradeProcess;
-import com.liferay.portal.kernel.util.ContentTypes;
-import com.liferay.portal.kernel.util.FileUtil;
-import com.liferay.portal.kernel.util.GetterUtil;
-import com.liferay.portal.kernel.util.LocaleUtil;
-import com.liferay.portal.kernel.util.ObjectValuePair;
-import com.liferay.portal.kernel.util.OrderByComparator;
-import com.liferay.portal.kernel.util.PropsKeys;
-import com.liferay.portal.kernel.util.PropsUtil;
-import com.liferay.portal.kernel.util.StringBundler;
-import com.liferay.portal.kernel.util.StringPool;
-import com.liferay.portal.kernel.util.StringUtil;
-import com.liferay.portal.kernel.workflow.WorkflowConstants;
-import com.liferay.portal.model.Group;
-import com.liferay.portal.model.GroupConstants;
-import com.liferay.portal.model.Layout;
-import com.liferay.portal.model.LayoutConstants;
-import com.liferay.portal.model.LayoutTypePortlet;
-import com.liferay.portal.model.Organization;
-import com.liferay.portal.model.OrganizationConstants;
-import com.liferay.portal.model.PortletConstants;
-import com.liferay.portal.model.ResourceConstants;
-import com.liferay.portal.model.Role;
-import com.liferay.portal.model.RoleConstants;
-import com.liferay.portal.model.User;
-import com.liferay.portal.security.auth.PrincipalThreadLocal;
-import com.liferay.portal.security.permission.ActionKeys;
-import com.liferay.portal.service.GroupLocalServiceUtil;
-import com.liferay.portal.service.LayoutLocalServiceUtil;
-import com.liferay.portal.service.LayoutSetLocalServiceUtil;
-import com.liferay.portal.service.OrganizationLocalServiceUtil;
-import com.liferay.portal.service.ResourceLocalServiceUtil;
-import com.liferay.portal.service.ResourcePermissionLocalServiceUtil;
-import com.liferay.portal.service.RoleLocalServiceUtil;
-import com.liferay.portal.service.ServiceContext;
-import com.liferay.portal.service.UserLocalServiceUtil;
-import com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil;
-import com.liferay.portal.service.permission.PortletPermissionUtil;
-import com.liferay.portal.theme.ThemeDisplay;
-import com.liferay.portal.util.PortalUtil;
-import com.liferay.portal.util.PortletKeys;
-import com.liferay.portlet.PortletPreferencesFactoryUtil;
-import com.liferay.portlet.asset.model.AssetCategory;
-import com.liferay.portlet.asset.model.AssetEntry;
-import com.liferay.portlet.asset.model.AssetVocabulary;
-import com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil;
-import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
-import com.liferay.portlet.asset.service.AssetVocabularyLocalServiceUtil;
-import com.liferay.portlet.asset.service.persistence.AssetEntryQuery;
-import com.liferay.portlet.blogs.model.BlogsEntry;
-import com.liferay.portlet.blogs.service.BlogsEntryLocalServiceUtil;
-import com.liferay.portlet.documentlibrary.DuplicateFileException;
-import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
-import com.liferay.portlet.journal.model.JournalArticle;
-import com.liferay.portlet.journal.model.JournalArticleConstants;
-import com.liferay.portlet.journal.model.JournalStructure;
-import com.liferay.portlet.journal.model.JournalTemplate;
-import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil;
-import com.liferay.portlet.journal.service.JournalStructureLocalServiceUtil;
-import com.liferay.portlet.journal.service.JournalTemplateLocalServiceUtil;
-import com.liferay.portlet.messageboards.model.MBCategory;
-import com.liferay.portlet.messageboards.model.MBMessage;
-import com.liferay.portlet.messageboards.model.MBMessageConstants;
-import com.liferay.portlet.messageboards.service.MBCategoryLocalServiceUtil;
-import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
-import com.liferay.portlet.social.model.SocialActivityCounter;
-import com.liferay.portlet.social.model.SocialActivityCounterConstants;
-import com.liferay.portlet.social.model.SocialRequest;
-import com.liferay.portlet.social.model.SocialRequestConstants;
-import com.liferay.portlet.social.service.SocialActivityCounterLocalServiceUtil;
-import com.liferay.portlet.social.service.SocialActivitySettingLocalServiceUtil;
-import com.liferay.portlet.social.service.SocialRequestLocalServiceUtil;
-import com.liferay.portlet.social.util.SocialCounterPeriodUtil;
-import com.liferay.portlet.wiki.model.WikiNode;
-import com.liferay.portlet.wiki.model.WikiPage;
-import com.liferay.portlet.wiki.service.WikiNodeLocalServiceUtil;
-import com.liferay.portlet.wiki.service.WikiPageLocalServiceUtil;
-
-import java.io.InputStream;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.portlet.PortletPreferences;
-
-/**
- * @author Brian Wing Shun Chan
- * @author Ryan Park
- */
-public class UpgradeCompany extends UpgradeProcess {
-
- protected AssetCategory addAssetCategory(
- long userId, long parentCategoryId, String title, long vocabularyId,
- ServiceContext serviceContext)
- throws Exception {
-
- Map<Locale, String> titleMap = new HashMap<Locale, String>();
-
- setLocalizedValue(titleMap, title);
-
- return AssetCategoryLocalServiceUtil.addCategory(
- userId, parentCategoryId, titleMap, null, vocabularyId, null,
- serviceContext);
- }
-
- protected AssetVocabulary addAssetVocabulary(
- long userId, String title, ServiceContext serviceContext)
- throws Exception {
-
- Map<Locale, String> titleMap = new HashMap<Locale, String>();
-
- setLocalizedValue(titleMap, title);
-
- return AssetVocabularyLocalServiceUtil.addVocabulary(
- userId, StringPool.BLANK, titleMap, null, null, serviceContext);
- }
-
- protected BlogsEntry addBlogsEntry(
- long userId, String title, String fileName,
- ServiceContext serviceContext)
- throws Exception {
-
- String content = getString(fileName);
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return BlogsEntryLocalServiceUtil.addEntry(
- userId, title, StringPool.BLANK, content, 1, 1, 2008, 0, 0, false,
- false, new String[0], false, null, null, null, serviceContext);
- }
-
- protected FileEntry addDLFileEntry(
- long userId, long groupId, long folderId, String fileName,
- String name, String mimeType, String title, String description,
- ServiceContext serviceContext)
- throws Exception {
-
- byte[] bytes = getBytes(fileName);
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(false);
-
- try {
- return DLAppLocalServiceUtil.addFileEntry(
- userId, groupId, folderId, fileName, mimeType, title,
- description, StringPool.BLANK, bytes, serviceContext);
- }
- catch (DuplicateFileException dfe) {
- return DLAppLocalServiceUtil.updateFileEntry(
- userId, groupId, name, mimeType, title, description,
- StringPool.BLANK, true, bytes, serviceContext);
- }
- }
-
- protected FileEntry addDLFileEntry(
- long userId, long folderId, String filePath,
- ServiceContext serviceContext)
- throws Exception {
-
- String fileName = StringUtil.extractLast(filePath, StringPool.SLASH);
-
- byte[] bytes = getBytes(filePath);
-
- return DLAppLocalServiceUtil.addFileEntry(
- userId, serviceContext.getScopeGroupId(), folderId, fileName,
- "image/png", fileName, StringPool.BLANK, StringPool.BLANK, bytes,
- serviceContext);
- }
-
- protected Folder addDLFolder(
- long userId, long groupId, String name, String description)
- throws Exception {
-
- ServiceContext serviceContext = new ServiceContext();
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(false);
-
- return DLAppLocalServiceUtil.addFolder(
- userId, groupId, 0, name, description, serviceContext);
- }
-
- protected JournalArticle addJournalArticle(
- long userId, long groupId, String title, String fileName,
- ServiceContext serviceContext)
- throws Exception {
-
- return addJournalArticle(
- userId, groupId, title, fileName, StringPool.BLANK,
- StringPool.BLANK, serviceContext);
- }
-
- protected JournalArticle addJournalArticle(
- long userId, long groupId, String title, String fileName,
- String structureId, String templateId,
- ServiceContext serviceContext)
- throws Exception {
-
- String content = getString(fileName);
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- Map<Locale, String> titleMap = new HashMap<Locale, String>();
-
- setLocalizedValue(titleMap, title);
-
- JournalArticle journalArticle =
- JournalArticleLocalServiceUtil.addArticle(
- userId, groupId, 0, 0, 0, StringPool.BLANK, true,
- JournalArticleConstants.VERSION_DEFAULT, titleMap, null,
- content, "general", structureId, templateId, StringPool.BLANK,
- 1, 1, 2008, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, 0, 0, 0, true,
- true, false, StringPool.BLANK, null, null, StringPool.BLANK,
- serviceContext);
-
- JournalArticleLocalServiceUtil.updateStatus(
- userId, groupId, journalArticle.getArticleId(),
- journalArticle.getVersion(), WorkflowConstants.STATUS_APPROVED,
- StringPool.BLANK, serviceContext);
-
- return journalArticle;
- }
-
- protected JournalStructure addJournalStructure(
- long userId, long groupId, String fileName)
- throws Exception {
-
- Map<Locale, String> nameMap = new HashMap<Locale, String>();
-
- setLocalizedValue(nameMap, "Single Image");
-
- Map<Locale, String> descriptionMap = new HashMap<Locale, String>();
-
- setLocalizedValue(descriptionMap, "A single image, optional link");
-
- String xsd = getString(fileName);
-
- ServiceContext serviceContext = new ServiceContext();
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return JournalStructureLocalServiceUtil.addStructure(
- userId, groupId, "SINGLE-IMAGE", false, StringPool.BLANK, nameMap,
- descriptionMap, xsd, serviceContext);
- }
-
- protected JournalTemplate addJournalTemplate(
- long userId, long groupId, String fileName)
- throws Exception {
-
- Map<Locale, String> descriptionMap = new HashMap<Locale, String>();
-
- setLocalizedValue(descriptionMap, "A single image, optional URL");
-
- Map<Locale, String> nameMap = new HashMap<Locale, String>();
-
- setLocalizedValue(nameMap, "Single Image");
-
- String xsl = getString(fileName);
-
- ServiceContext serviceContext = new ServiceContext();
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return JournalTemplateLocalServiceUtil.addTemplate(
- userId, groupId, "SINGLE-IMAGE", false, "SINGLE-IMAGE", nameMap,
- descriptionMap, xsl, true, "vm", true, false, StringPool.BLANK,
- null, serviceContext);
- }
-
- protected Layout addLayout(
- Group group, String name, boolean privateLayout, String friendlyURL,
- String layouteTemplateId)
- throws Exception {
-
- ServiceContext serviceContext = new ServiceContext();
-
- Layout layout = LayoutLocalServiceUtil.addLayout(
- group.getCreatorUserId(), group.getGroupId(), privateLayout,
- LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, name, StringPool.BLANK,
- StringPool.BLANK, LayoutConstants.TYPE_PORTLET, false, friendlyURL,
- serviceContext);
-
- LayoutTypePortlet layoutTypePortlet =
- (LayoutTypePortlet)layout.getLayoutType();
-
- layoutTypePortlet.setLayoutTemplateId(0, layouteTemplateId, false);
-
- addResources(layout, PortletKeys.DOCKBAR);
-
- return layout;
- }
-
- protected MBCategory addMBCategory(
- long userId, String name, String description,
- ServiceContext serviceContext)
- throws Exception {
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return MBCategoryLocalServiceUtil.addCategory(
- userId, 0, name, description, "default", StringPool.BLANK,
- StringPool.BLANK, StringPool.BLANK, 0, false, StringPool.BLANK,
- StringPool.BLANK, 1, StringPool.BLANK, false, StringPool.BLANK, 0,
- false, StringPool.BLANK, StringPool.BLANK, false, false,
- serviceContext);
- }
-
- protected MBMessage addMBMessage(
- long userId, String userName, long groupId, long categoryId,
- long threadId, long parentMessageId, String subject,
- String filePath, ServiceContext serviceContext)
- throws Exception {
-
- String fileName = StringUtil.extractLast(filePath, StringPool.SLASH);
-
- String body = getString(filePath);
-
- List<ObjectValuePair<String, InputStream>> inputStreamOVPs =
- new ArrayList<ObjectValuePair<String, InputStream>>();
-
- InputStream inputStream = getInputStream(filePath);
-
- ObjectValuePair<String, InputStream> inputStreamOVP =
- new ObjectValuePair<String, InputStream>(fileName, inputStream);
-
- inputStreamOVPs.add(inputStreamOVP);
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return MBMessageLocalServiceUtil.addMessage(
- userId, userName, groupId, categoryId, threadId, parentMessageId,
- subject, body, MBMessageConstants.DEFAULT_FORMAT, inputStreamOVPs,
- false, -1.0, false, serviceContext);
- }
-
- protected String addPortletId(
- Layout layout, String portletId, String columnId)
- throws Exception {
-
- LayoutTypePortlet layoutTypePortlet =
- (LayoutTypePortlet)layout.getLayoutType();
-
- portletId = layoutTypePortlet.addPortletId(
- 0, portletId, columnId, -1, false);
-
- addResources(layout, portletId);
- updateLayout(layout);
-
- return portletId;
- }
-
- protected void addResources(Layout layout, String portletId)
- throws Exception{
-
- String rootPortletId = PortletConstants.getRootPortletId(portletId);
-
- String portletPrimaryKey = PortletPermissionUtil.getPrimaryKey(
- layout.getPlid(), portletId);
-
- ResourceLocalServiceUtil.addResources(
- layout.getCompanyId(), layout.getGroupId(), 0, rootPortletId,
- portletPrimaryKey, true, true, true);
- }
-
- protected void addSocialActivityCounter(
- Group group, List<User> users, String socialActivityCounterName,
- String line,
- Map<String, SocialActivityCounter> socialActivityCounters)
- throws Exception {
-
- String[] lineParts = StringUtil.split(line);
-
- int endPeriodOffset = GetterUtil.getInteger(lineParts[3]);
-
- int endPeriod = SocialCounterPeriodUtil.getEndPeriod(endPeriodOffset);
-
- if (endPeriod < 0) {
- return;
- }
-
- String className = lineParts[0];
-
- long classNameId = PortalUtil.getClassNameId(className);
-
- String classPKString = lineParts[1];
-
- long classPK = 12345;
-
- if (className.equals(User.class.getName())) {
- if (classPKString.equals("0")) {
- int index = getRandomNumber(0, 3);
-
- User user = users.get(index);
-
- classPK = user.getUserId();
- }
- else {
- for (User user : users) {
- if (classPKString.equalsIgnoreCase(user.getScreenName())) {
- classPK = user.getUserId();
- }
- }
- }
- }
- else {
- AssetEntryQuery assetEntryQuery = new AssetEntryQuery();
-
- assetEntryQuery.setClassName(className);
- assetEntryQuery.setGroupIds(new long[] {group.getGroupId()});
-
- List<AssetEntry> assetEntries =
- AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);
-
- if (!assetEntries.isEmpty()) {
- int index = getRandomNumber(0, assetEntries.size() - 1);
-
- AssetEntry assetEntry = assetEntries.get(index);
-
- classPK = assetEntry.getClassPK();
- }
- }
-
- int ownerType = SocialActivityCounterConstants.TYPE_ACTOR;
-
- if (socialActivityCounterName.startsWith("asset.")) {
- ownerType = SocialActivityCounterConstants.TYPE_ASSET;
- }
- else if (socialActivityCounterName.equals("contribution")) {
- ownerType = SocialActivityCounterConstants.TYPE_CREATOR;
- }
-
- int startPeriodOffset = GetterUtil.getInteger(lineParts[2]);
-
- int startPeriod = SocialCounterPeriodUtil.getStartPeriod(
- startPeriodOffset);
-
- SocialActivityCounter socialActivityCounter =
- SocialActivityCounterLocalServiceUtil.
- fetchActivityCounterByStartPeriod(
- group.getGroupId(), classNameId, classPK,
- socialActivityCounterName, ownerType, startPeriod);
-
- int currentValue = getRandomNumber(0, 100);
- int totalValue = currentValue;
-
- if (socialActivityCounter != null) {
- totalValue = totalValue + socialActivityCounter.getTotalValue();
- }
-
- StringBundler sb = new StringBundler(7);
-
- sb.append(StringUtil.toHexString(group.getGroupId()));
- sb.append(StringPool.POUND);
- sb.append(StringUtil.toHexString(classNameId));
- sb.append(StringPool.POUND);
- sb.append(StringUtil.toHexString(classPK));
- sb.append(StringPool.POUND);
- sb.append(StringUtil.toHexString(socialActivityCounterName));
-
- String key = sb.toString();
-
- SocialActivityCounter latestSocialActivityCounter =
- socialActivityCounters.get(key);
-
- if (latestSocialActivityCounter != null) {
- totalValue =
- totalValue + latestSocialActivityCounter.getTotalValue();
- }
-
- if ((socialActivityCounter == null) ||
- (socialActivityCounter.getStartPeriod() != startPeriod)) {
-
- if (endPeriodOffset == 0) {
- endPeriod = -1;
- }
-
- socialActivityCounter =
- SocialActivityCounterLocalServiceUtil.addActivityCounter(
- group.getGroupId(), classNameId, classPK,
- socialActivityCounterName, ownerType, 0, 0, startPeriod,
- endPeriod);
- }
-
- socialActivityCounter.setCurrentValue(
- socialActivityCounter.getCurrentValue() + currentValue);
- socialActivityCounter.setTotalValue(totalValue);
-
- SocialActivityCounterLocalServiceUtil.updateSocialActivityCounter(
- socialActivityCounter);
-
- socialActivityCounters.put(key, socialActivityCounter);
- }
-
- protected void addSocialActivityCounters(
- Group group, List<User> users, String socialActivityCounterName)
- throws Exception {
-
- String content = getString(
- "/sample/activity/counters/" + socialActivityCounterName + ".csv");
-
- String[] lines = StringUtil.splitLines(content);
-
- Map<String, SocialActivityCounter> socialActivityCounters =
- new HashMap<String, SocialActivityCounter>();
-
- for (String line : lines) {
- addSocialActivityCounter(
- group, users, socialActivityCounterName, line,
- socialActivityCounters);
- }
- }
-
- protected void addSocialRequest(
- User user, User receiverUser, boolean confirm)
- throws Exception {
-
- SocialRequest socialRequest = SocialRequestLocalServiceUtil.addRequest(
- user.getUserId(), 0, User.class.getName(), user.getUserId(),
- _SN_FRIENDS_REQUEST_KEYS_ADD_FRIEND, StringPool.BLANK,
- receiverUser.getUserId());
-
- if (confirm) {
- SocialRequestLocalServiceUtil.updateRequest(
- socialRequest.getRequestId(),
- SocialRequestConstants.STATUS_CONFIRM, new ThemeDisplay());
- }
- }
-
- 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";
- long facebookId = 0;
- String openId = StringPool.BLANK;
- Locale locale = LocaleUtil.getDefault();
- 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 = new ServiceContext();
-
- serviceContext.setScopeGroupId(guestGroup.getGroupId());
-
- User user = UserLocalServiceUtil.addUser(
- creatorUserId, companyId, 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);
-
- UserLocalServiceUtil.updateLastLogin(
- user.getUserId(), user.getLoginIP());
-
- UserLocalServiceUtil.updatePasswordReset(user.getUserId(), false);
-
- byte[] portrait = getBytes(
- "/users/images/" + 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);
-
- serviceContext.setAssetTagNames(new String[] {"community", "tips"});
-
- String fileName =
- "/users/journal/articles/my_community_" + user.getScreenName() +
- ".xml";
-
- JournalArticle journalArticle = addJournalArticle(
- user.getUserId(), group.getGroupId(),
- "Public Pages " + user.getScreenName(), fileName, serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- addPortletId(layout, "1_WAR_socialnetworkingportlet", "column-1");
- addPortletId(layout, PortletKeys.REQUESTS, "column-1");
- addPortletId(layout, "2_WAR_socialnetworkingportlet", "column-1");
- addPortletId(layout, PortletKeys.ACTIVITIES, "column-2");
- addPortletId(layout, "3_WAR_socialnetworkingportlet", "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_socialnetworkingportlet", "column-1");
- addPortletId(layout, PortletKeys.REQUESTS, "column-1");
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- highlightPortlet(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"social", "tips"});
-
- fileName =
- "/users/journal/articles/private_pages_" + user.getScreenName() +
- ".xml";
-
- journalArticle = addJournalArticle(
- user.getUserId(), group.getGroupId(),
- "Public Pages " + user.getScreenName(), fileName, serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- addPortletId(layout, "4_WAR_socialnetworkingportlet", "column-2");
-
- portletId = addPortletId(layout, PortletKeys.IFRAME, "column-1");
-
- Map<String, String> preferences = new HashMap<String, String>();
-
- preferences.put("portlet-setup-show-borders", Boolean.FALSE.toString());
-
- if (screenName.equals("kendra") || screenName.equals("bruno")) {
- preferences.put("src","http://m.digg.com");
- preferences.put("height-normal","400");
- }
- else if (screenName.equals("michelle")) {
- preferences.put("src","http://m.digg.com");
- preferences.put("height-normal","400");
- }
- else if (screenName.equals("richard")) {
- preferences.put("src","http://m.linkedin.com");
- preferences.put("height-normal","350");
- }
-
- updatePortletSetup(layout, portletId, preferences);
-
- // 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.MEDIA_GALLERY_DISPLAY, "column-1");
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- highlightPortlet(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"documents", "tips"});
-
- journalArticle = addJournalArticle(
- user.getUserId(), group.getGroupId(), "My documents",
- "/users/journal/articles/workspace_docs.xml", serviceContext);
-
- 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;
- }
-
- protected WikiPage addWikiPage(
- long userId, long nodeId, String title, String fileName,
- ServiceContext serviceContext)
- throws Exception {
-
- String content = getString(fileName);
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- return WikiPageLocalServiceUtil.addPage(
- userId, nodeId, title, content, "New", false, serviceContext);
- }
-
- protected void clearData(long companyId) throws Exception {
-
- // Users
-
- List<User> users = UserLocalServiceUtil.search(
- companyId, null, WorkflowConstants.STATUS_ANY, null,
- QueryUtil.ALL_POS, QueryUtil.ALL_POS, (OrderByComparator)null);
-
- for (User user : users) {
- String screenName = user.getScreenName();
-
- String defaultAdminScreenName = PropsUtil.get(
- PropsKeys.DEFAULT_ADMIN_SCREEN_NAME);
-
- if (screenName.equals("joebloggs") || screenName.equals("test") ||
- screenName.equals(defaultAdminScreenName)) {
-
- continue;
- }
-
- UserLocalServiceUtil.deleteUser(user.getUserId());
- }
-
- // Organizations
-
- deleteOrganizations(
- companyId, OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID);
-
- // Groups
-
- List<Group> groups = GroupLocalServiceUtil.search(
- companyId, null, null, null, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
-
- for (Group group : groups) {
- if (!PortalUtil.isSystemGroup(group.getName())) {
- GroupLocalServiceUtil.deleteGroup(group.getGroupId());
- }
- else {
- ServiceContext serviceContext = new ServiceContext();
-
- DLAppLocalServiceUtil.deleteAll(group.getGroupId());
-
- JournalArticleLocalServiceUtil.deleteArticles(
- group.getGroupId());
- JournalTemplateLocalServiceUtil.deleteTemplates(
- group.getGroupId());
- JournalStructureLocalServiceUtil.deleteStructures(
- group.getGroupId());
-
- LayoutLocalServiceUtil.deleteLayouts(
- group.getGroupId(), false, serviceContext);
- LayoutLocalServiceUtil.deleteLayouts(
- group.getGroupId(), true, serviceContext);
- }
- }
- }
-
- protected void configureGroupStatistics(
- Layout layout, String portletId, String[][] chartData)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- String[] indexes = new String[chartData.length];
-
- for (int i=0; i < chartData.length; i++) {
- indexes[i] = String.valueOf(i);
-
- portletSetup.setValue("chartType" + (i), chartData[i][1]);
- portletSetup.setValue("chartWidth" + (i), chartData[i][3]);
- portletSetup.setValue("dataRange" + (i), chartData[i][2]);
- portletSetup.setValue(
- "displayActivityCounterName" + (i), chartData[i][0]);
- }
-
- portletSetup.setValue(
- "displayActivityCounterNameIndexes", StringUtil.merge(indexes));
-
- portletSetup.store();
- }
-
- protected void configureJournalContent(
- Layout layout, String portletId, String articleId)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- portletSetup.setValue("groupId", String.valueOf(layout.getGroupId()));
- portletSetup.setValue("articleId", articleId);
-
- portletSetup.store();
- }
-
- protected void configurePortletTitle(
- Layout layout, String portletId, String title)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- portletSetup.setValue("portletSetupTitle", title);
-
- portletSetup.store();
- }
-
- protected void configureUserStatistics(
- Layout layout, String portletId,
- String[] socialActivityCounterNames)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- String[] indexes = new String[socialActivityCounterNames.length + 1];
-
- indexes[0] = "0";
-
- for (int i=0; i < socialActivityCounterNames.length; i++) {
- indexes[i + 1] = String.valueOf(i + 1);
-
- portletSetup.setValue(
- "displayActivityCounterName" + (i + 1),
- socialActivityCounterNames[i]);
- }
-
- portletSetup.setValue(
- "displayActivityCounterNameIndexes", StringUtil.merge(indexes));
- portletSetup.setValue("showHeaderText", "false");
- portletSetup.setValue("showTotals", "false");
-
- portletSetup.store();
- }
-
- protected void deleteOrganizations(
- long companyId, long parentOrganizationId)
- throws Exception {
-
- List<Organization> organizations = OrganizationLocalServiceUtil.search(
- companyId, parentOrganizationId, null, null, null, null, null,
- QueryUtil.ALL_POS, QueryUtil.ALL_POS, (OrderByComparator)null);
-
- for (Organization organization : organizations) {
- deleteOrganizations(companyId, organization.getOrganizationId());
- }
-
- if (parentOrganizationId > 0) {
- long[] userIds = UserLocalServiceUtil.getOrganizationUserIds(
- parentOrganizationId);
-
- UserLocalServiceUtil.unsetOrganizationUsers(
- parentOrganizationId, userIds);
-
- OrganizationLocalServiceUtil.deleteOrganization(
- parentOrganizationId);
- }
- }
-
- @Override
- protected void doUpgrade() throws Exception {
- String name = PrincipalThreadLocal.getName();
-
- try {
- long companyId = PortalUtil.getDefaultCompanyId();
-
- long defaultUserId = UserLocalServiceUtil.getDefaultUserId(
- companyId);
-
- PrincipalThreadLocal.setName(defaultUserId);
-
- clearData(companyId);
- setupSites(companyId, defaultUserId);
-
- Organization organization = setupOrganizations(
- companyId, defaultUserId);
-
- setupRoles(companyId, defaultUserId);
-
- List<User> users = setupUsers(companyId);
-
- setupSocialActivityCounters(organization.getGroup(), users);
- setupWorkflow(companyId, defaultUserId);
- }
- finally {
- PrincipalThreadLocal.setName(name);
- }
- }
-
- protected void enableSocialActivities(long groupId) throws Exception {
- SocialActivitySettingLocalServiceUtil.updateActivitySetting(
- groupId, BlogsEntry.class.getName(), true);
- SocialActivitySettingLocalServiceUtil.updateActivitySetting(
- groupId, MBMessage.class.getName(), true);
- SocialActivitySettingLocalServiceUtil.updateActivitySetting(
- groupId, WikiPage.class.getName(), true);
- }
-
- protected byte[] getBytes(String path) throws Exception {
- return FileUtil.getBytes(getInputStream(path));
- }
-
- protected InputStream getInputStream(String path) throws Exception {
- Class<?> clazz = getClass();
-
- return clazz.getResourceAsStream("/resources" + path);
- }
-
- protected int getRandomNumber(int min, int max) {
- return (int)(Math.round(min + Math.random() * (max-min)));
- }
-
- protected String getString(String path) throws Exception {
- return new String(getBytes(path));
- }
-
- protected void highlightPortlet(Layout layout, String portletId)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- portletSetup.setValue(
- "portletSetupShowBorders", String.valueOf(Boolean.FALSE));
- portletSetup.setValue(
- "portletSetupCss", getString("/preferences/highlight.json"));
-
- portletSetup.store();
- }
-
- protected void removePortletBorder(Layout layout, String portletId)
- throws Exception {
-
- PortletPreferences portletSetup =
- PortletPreferencesFactoryUtil.getLayoutPortletSetup(
- layout, portletId);
-
- portletSetup.setValue(
- "portletSetupShowBorders", String.valueOf(Boolean.FALSE));
-
- portletSetup.store();
- }
-
- protected void setLocalizedValue(Map<Locale, String> map, String value) {
- Locale locale = LocaleUtil.getDefault();
-
- map.put(locale, value);
-
- if (!locale.equals(Locale.US)) {
- map.put(Locale.US, value);
- }
- }
-
- protected void setRolePermissions(
- Role role, String name, String[] actionIds)
- throws Exception {
-
- long roleId = role.getRoleId();
- long companyId = role.getCompanyId();
- int scope = ResourceConstants.SCOPE_COMPANY;
- String primKey = String.valueOf(companyId);
-
- ResourcePermissionLocalServiceUtil.setResourcePermissions(
- companyId, name, scope, primKey, roleId, actionIds);
- }
-
- protected Organization 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;
-
- ServiceContext serviceContext = new ServiceContext();
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
-
- Organization organization =
- OrganizationLocalServiceUtil.addOrganization(
- userId, parentOrganizationId, name, type, recursable, regionId,
- countryId, statusId, comments, true, serviceContext);
-
- // Group
-
- Group group = organization.getGroup();
-
- GroupLocalServiceUtil.updateFriendlyURL(group.getGroupId(), "/7cogs");
-
- serviceContext.setScopeGroupId(group.getGroupId());
-
- // Layout set
-
- LayoutSetLocalServiceUtil.updateLogo(
- group.getGroupId(), false, true,
- getInputStream("/sample/images/logo.png"));
-
- LayoutSetLocalServiceUtil.updateLookAndFeel(
- group.getGroupId(), false, "sevencogs_WAR_sevencogstheme", "01", "",
- false);
-
- // Asset
-
- AssetVocabulary topicAssetVocabulary = addAssetVocabulary(
- defaultUserId, "Topic", serviceContext);
-
- AssetVocabulary imageAssetVocabulary = addAssetVocabulary(
- defaultUserId, "Image Type", serviceContext);
-
- AssetCategory iconAssetCategory = addAssetCategory(
- defaultUserId, 0, "Icon", imageAssetVocabulary.getVocabularyId(),
- serviceContext);
-
- AssetCategory bannerAssetCategory = addAssetCategory(
- defaultUserId, 0, "Banner", imageAssetVocabulary.getVocabularyId(),
- serviceContext);
-
- AssetCategory learningAssetCategory = addAssetCategory(
- defaultUserId, 0, "Learning",
- topicAssetVocabulary.getVocabularyId(), serviceContext);
-
- AssetCategory productsAssetCategory = addAssetCategory(
- defaultUserId, 0, "Products",
- topicAssetVocabulary.getVocabularyId(), serviceContext);
-
- AssetCategory liferayAssetCategory = addAssetCategory(
- defaultUserId, 0, "Liferay", topicAssetVocabulary.getVocabularyId(),
- serviceContext);
-
- _assetCategories = new HashMap<String, AssetCategory>();
-
- _assetCategories.put("Icon", iconAssetCategory);
- _assetCategories.put("Banner", bannerAssetCategory);
- _assetCategories.put("Learning", learningAssetCategory);
- _assetCategories.put("Products", productsAssetCategory);
- _assetCategories.put("Liferay", liferayAssetCategory);
-
- // Journal
-
- addJournalStructure(
- defaultUserId, group.getGroupId(),
- "/sample/journal/structures/single_image.xml");
- addJournalTemplate(
- defaultUserId, group.getGroupId(),
- "/sample/journal/templates/single_image.xml");
-
- // Image gallery
-
- serviceContext.setScopeGroupId(group.getGroupId());
-
- Folder folder = DLAppLocalServiceUtil.addFolder(
- defaultUserId, group.getGroupId(), 0, "7Cogs Web Content",
- "Images used for content", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"icons"});
- serviceContext.setAssetCategoryIds(
- new long[] {iconAssetCategory.getCategoryId()});
-
- FileEntry cogBlueIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/sample/images/cog_blue.png",
- serviceContext);
-
- FileEntry cogLightBlueIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/cog_light_blue.png", serviceContext);
-
- FileEntry cogOrangeIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/cog_orange.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"home page", "blogs"});
- serviceContext.setAssetCategoryIds(
- new long[] {iconAssetCategory.getCategoryId()});
-
- FileEntry blogsIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/blogs_icon.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"home page"});
- serviceContext.setAssetCategoryIds(
- new long[] {productsAssetCategory.getCategoryId()});
-
- FileEntry cogNetworkAdFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/cog_network_advertisement.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"home page", "forums"});
- serviceContext.setAssetCategoryIds(
- new long[] {iconAssetCategory.getCategoryId()});
-
- FileEntry forumsIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/forums_icon.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"liferay", "logo"});
- serviceContext.setAssetCategoryIds(
- new long[] {liferayAssetCategory.getCategoryId()});
-
- FileEntry liferayLogoFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/liferay_logo.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"home page"});
- serviceContext.setAssetCategoryIds(
- new long[] {bannerAssetCategory.getCategoryId()});
-
- FileEntry homePageBannerFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/home_page_banner.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"home page", "products"});
- serviceContext.setAssetCategoryIds(
- new long[] {iconAssetCategory.getCategoryId()});
-
- FileEntry productsIconFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/products_icon.png", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"products"});
- serviceContext.setAssetCategoryIds(
- new long[] {productsAssetCategory.getCategoryId()});
-
- FileEntry productLandingFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/sample/images/product_landing.png", serviceContext);
-
- // Home layout
-
- Layout layout = addLayout(group, "Home", false, "/home", "home");
-
- // Home Page Banner content portlet
-
- String portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"liferay", "7cogs"});
-
- JournalArticle journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Banner",
- "/sample/journal/articles/home_page_banner.xml", serviceContext);
-
- String content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$HOME_PAGE_BANNER_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(homePageBannerFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Home Page Products Button content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Products Button",
- "/sample/journal/articles/home_page_products_button.xml",
- serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$HOME_PAGE_PRODUCTS_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(productsIconFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Home Page Blogs Button content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-3");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Blogs Button",
- "/sample/journal/articles/home_page_blogs_button.xml",
- serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$HOME_PAGE_BLOGS_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(blogsIconFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Home Page Forums Button content porltet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-4");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Forums Button",
- "/sample/journal/articles/home_page_forums_button.xml",
- serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$HOME_PAGE_FORUMS_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(forumsIconFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Home Page Intro content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-5");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"front"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Home Page Intro",
- "/sample/journal/articles/home_page_intro.xml", serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$PRODUCT_LANDING_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(productLandingFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Cog Network Ad content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-6");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"liferay", "enterprise"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Cog Network Ad",
- "/sample/journal/articles/home_cog_network_ad.xml", serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$COG_NETWORK_AD_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(cogNetworkAdFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Products layout
-
- layout = addLayout(
- group, "Products", false, "/products", "1_2_columns_ii");
-
- // Products Banner content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"Vix-998", "7cogs"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Products Banner",
- "/sample/journal/articles/products_banner.xml", serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Products Landing Intro content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"products"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Products Landing Intro",
- "/sample/journal/articles/products_landing_intro.xml",
- serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$PRODUCT_LANDING_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(productLandingFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Products Landing Intro Info content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"products"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Products Landing Intro Info",
- "/sample/journal/articles/products_landing_intro_info.xml",
- serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Introducing Vix content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-3");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"Vix-998", "7cogs"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Products Catalog",
- "/sample/journal/articles/products_catalog.xml", serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$COG_BLUE_R_FE_UUID$]", "[$COG_LIGHT_BLUE_R_FE_UUID$]",
- "[$COG_ORANGE_R_FE_UUID$]", "[$GROUP_ID$]"
- },
- new String[] {
- String.valueOf(cogBlueIconFileEntry.getUuid()),
- String.valueOf(cogLightBlueIconFileEntry.getUuid()),
- String.valueOf(cogOrangeIconFileEntry.getUuid()),
- String.valueOf(group.getGroupId())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Blogs layout
-
- layout = addLayout(group, "Blogs", false, "/blogs", "1_2_columns_i");
-
- // Blogs Banner content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Blogs Banner",
- "/sample/journal/articles/blogs_banner.xml", serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Recent Bloggers portlet
-
- addPortletId(layout, PortletKeys.RECENT_BLOGGERS, "column-2");
-
- // Blogs Aggregator portlet
-
- portletId = addPortletId(
- layout, PortletKeys.BLOGS_AGGREGATOR, "column-3");
-
- configurePortletTitle(layout, portletId, "Blogs");
-
- // Wiki layout
-
- layout = addLayout(group, "Wiki", false, "/wiki", "1_column");
-
- // Wiki Banner content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Wiki Banner",
- "/sample/journal/articles/wiki_banner.xml", serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Wiki portlet
-
- portletId = addPortletId(layout, PortletKeys.WIKI, "column-1");
-
- removePortletBorder(layout, portletId);
-
- WikiNode wikiNode = WikiNodeLocalServiceUtil.addNode(
- defaultUserId, "Main", StringPool.BLANK, serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"new", "features"});
- serviceContext.setAssetCategoryIds(
- new long[] {learningAssetCategory.getCategoryId()});
-
- addWikiPage(
- defaultUserId, wikiNode.getNodeId(), "FrontPage",
- "/sample/wiki/FrontPage.xml", serviceContext);
-
- serviceContext.setAssetTagNames(new String[] {"vix-998", "features"});
- serviceContext.setAssetCategoryIds(
- new long[] {productsAssetCategory.getCategoryId()});
-
- addWikiPage(
- defaultUserId, wikiNode.getNodeId(), "Vix-998",
- "/sample/wiki/Vix-998.xml", serviceContext);
-
- // Forums layout
-
- layout = addLayout(group, "Forums", false, "/forums", "1_column");
-
- // Forums Banner content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Forums Banner",
- "/sample/journal/articles/forums_banner.xml", serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Message Boards portlet
-
- portletId = addPortletId(
- layout, PortletKeys.MESSAGE_BOARDS, "column-1");
-
- removePortletBorder(layout, portletId);
-
- // Dashboard layout
-
- layout = addLayout(
- group, "Dashboard", false, "/dashboard", "2_columns_ii");
-
- portletId = addPortletId(
- layout, PortletKeys.USER_STATISTICS, "column-1");
-
- configureUserStatistics(
- layout, portletId,
- new String[] {"user.message-posts", "user.blogs", "user.wikis"});
-
- // Group Statistics portlet
-
- portletId = addPortletId(
- layout, PortletKeys.GROUP_STATISTICS, "column-2");
-
- String[][] chartData = new String[3][4];
-
- chartData[0] =
- new String[] {"user.message-posts", "area", "12months", "40"};
- chartData[1] =
- new String[] {"asset.activities", "pie", "12months", "50"};
- chartData[2] =
- new String[] {"asset.activities", "tag-cloud", "12months", "40"};
-
- configureGroupStatistics(layout, portletId, chartData);
-
- // Activities portlet
-
- portletId = addPortletId(layout, PortletKeys.ACTIVITIES, "column-2");
-
- // About Us layout
-
- layout = addLayout(
- group, "About Us", false, "/about_us", "1_2_columns_ii");
-
- // About Us Banner content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "About Us Banner",
- "/sample/journal/articles/about_us_banner.xml", serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // About Us content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- highlightPortlet(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"liferay"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "About Us",
- "/sample/journal/articles/home_7cogs_about_us.xml", serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$LIFERAY_LOGO_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()),
- String.valueOf(liferayLogoFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Google Maps
-
- portletId = addPortletId(layout, "1_WAR_googlemapsportlet", "column-2");
-
- Map<String, String> preferences = new HashMap<String, String>();
-
- preferences.put("mapAddress", "Los Angeles, USA");
- preferences.put("height", "300");
-
- updatePortletSetup(layout, portletId, preferences);
-
- // Web Form
-
- addPortletId(layout, "1_WAR_webformportlet", "column-3");
-
- // Home layout
-
- layout = addLayout(group, "Home", true, "/home", "2_columns_ii");
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- highlightPortlet(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"7cogs", "tips"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Home",
- "/sample/journal/articles/home_7cogs_private_pages.xml",
- serviceContext);
-
- 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.MEDIA_GALLERY_DISPLAY, "column-1");
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- highlightPortlet(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"documents", "sharing"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Shared Documents",
- "/sample/journal/articles/documents_shared_docs.xml",
- serviceContext);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- return organization;
- }
-
- protected void setupRoles(long companyId, long defaultUserId)
- throws Exception {
-
- Map<Locale, String> descriptionMap = new HashMap<Locale, String>();
-
- setLocalizedValue(
- descriptionMap,
- "Publishers are responsible for publishing content.");
-
- Role publisherRole = RoleLocalServiceUtil.fetchRole(
- companyId, "Publisher");
-
- if (publisherRole == null) {
- publisherRole = RoleLocalServiceUtil.addRole(
- defaultUserId, companyId, "Publisher", null, descriptionMap,
- RoleConstants.TYPE_REGULAR);
- }
-
- setRolePermissions(
- publisherRole, PortletKeys.JOURNAL,
- new String[] {ActionKeys.ACCESS_IN_CONTROL_PANEL});
-
- setRolePermissions(
- publisherRole, "com.liferay.portlet.journal",
- new String[] {
- ActionKeys.ADD_ARTICLE, ActionKeys.ADD_FEED,
- ActionKeys.ADD_STRUCTURE, ActionKeys.ADD_TEMPLATE
- });
-
- setRolePermissions(
- publisherRole, JournalArticle.class.getName(),
- new String[] {
- ActionKeys.ADD_DISCUSSION, ActionKeys.DELETE, ActionKeys.EXPIRE,
- ActionKeys.PERMISSIONS, ActionKeys.UPDATE, ActionKeys.VIEW
- });
-
- descriptionMap.clear();
-
- setLocalizedValue(
- descriptionMap, "Writers are responsible for creating content.");
-
- Role writerRole = RoleLocalServiceUtil.fetchRole(companyId, "Writer");
-
- if (writerRole == null) {
- writerRole = RoleLocalServiceUtil.addRole(
- defaultUserId, companyId, "Writer", null, descriptionMap,
- RoleConstants.TYPE_REGULAR);
- }
-
- setRolePermissions(
- writerRole, PortletKeys.JOURNAL,
- new String[] {ActionKeys.ACCESS_IN_CONTROL_PANEL});
-
- setRolePermissions(
- writerRole, "com.liferay.portlet.journal",
- new String[] {
- ActionKeys.ADD_ARTICLE, ActionKeys.ADD_FEED,
- ActionKeys.ADD_STRUCTURE, ActionKeys.ADD_TEMPLATE
- });
-
- setRolePermissions(
- writerRole, JournalArticle.class.getName(),
- new String[] {ActionKeys.UPDATE, ActionKeys.VIEW});
- }
-
- protected void setupSites(long companyId, long defaultUserId)
- throws Exception {
-
- // Guest site
-
- Group group = GroupLocalServiceUtil.getGroup(
- companyId, GroupConstants.GUEST);
-
- // Journal
-
- addJournalStructure(
- defaultUserId, group.getGroupId(),
- "/guest/journal/structures/single_image.xml");
- addJournalTemplate(
- defaultUserId, group.getGroupId(),
- "/guest/journal/templates/single_image.xml");
-
- // Image gallery
-
- ServiceContext serviceContext = new ServiceContext();
-
- serviceContext.setAddGroupPermissions(true);
- serviceContext.setAddGuestPermissions(true);
- serviceContext.setScopeGroupId(group.getGroupId());
-
- Folder folder = DLAppLocalServiceUtil.addFolder(
- defaultUserId, group.getGroupId(), 0, "Web Content",
- "Images used for content", serviceContext);
-
- FileEntry cellBgFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/cell_bg.png",
- serviceContext);
-
- FileEntry customer1FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_1.png",
- serviceContext);
-
- FileEntry customer2FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_2.png",
- serviceContext);
-
- FileEntry customer3FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_3.png",
- serviceContext);
-
- FileEntry customer4FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_4.png",
- serviceContext);
-
- FileEntry customer5FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_5.png",
- serviceContext);
-
- FileEntry customer6FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_6.png",
- serviceContext);
-
- FileEntry customer7FileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(), "/guest/images/customer_7.png",
- serviceContext);
-
- FileEntry portalMashupFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/guest/images/portal_mashup.png", serviceContext);
-
- FileEntry sevenCogsAdFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/guest/images/sevencogs_ad.png", serviceContext);
-
- FileEntry sharedWorkspacesFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/guest/images/shared_workspaces.png", serviceContext);
-
- FileEntry socialNetworkingFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/guest/images/social_network.png", serviceContext);
-
- FileEntry webPublishingFileEntry = addDLFileEntry(
- defaultUserId, folder.getFolderId(),
- "/guest/images/web_publishing.png", serviceContext);
-
- // Site theme settings
-
- String noPortletBorders =
- "lfr-theme:regular:portlet-setup-show-borders-default=false";
-
- LayoutSetLocalServiceUtil.updateSettings(
- group.getGroupId(), false, noPortletBorders);
-
- // Welcome layout
-
- Layout layout = addLayout(
- group, "Welcome", false, "/home", "2_columns_iii");
-
- // Welcome content portlet
-
- String portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-1");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"liferay", "welcome"});
-
- JournalArticle journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "Welcome",
- "/guest/journal/articles/welcome.xml", serviceContext);
-
- String content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$CELL_BG_R_FE_UUID$]", "[$CUSTOMER_1_R_FE_UUID$]",
- "[$CUSTOMER_2_R_FE_UUID$]", "[$CUSTOMER_3_R_FE_UUID$]",
- "[$CUSTOMER_4_R_FE_UUID$]", "[$CUSTOMER_5_R_FE_UUID$]",
- "[$CUSTOMER_6_R_FE_UUID$]", "[$CUSTOMER_7_R_FE_UUID$]",
- "[$GROUP_ID$]", "[$PORTAL_MASHUPS_R_FE_UUID$]",
- "[$SHARED_WORKSPACES_R_FE_UUID$]",
- "[$SOCIAL_NETWORKING_R_FE_UUID$]",
- "[$WEB_PUBLISHING_R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(cellBgFileEntry.getUuid()),
- String.valueOf(customer1FileEntry.getUuid()),
- String.valueOf(customer2FileEntry.getUuid()),
- String.valueOf(customer3FileEntry.getUuid()),
- String.valueOf(customer4FileEntry.getUuid()),
- String.valueOf(customer5FileEntry.getUuid()),
- String.valueOf(customer6FileEntry.getUuid()),
- String.valueOf(customer7FileEntry.getUuid()),
- String.valueOf(group.getGroupId()),
- String.valueOf(portalMashupFileEntry.getUuid()),
- String.valueOf(sharedWorkspacesFileEntry.getUuid()),
- String.valueOf(socialNetworkingFileEntry.getUuid()),
- String.valueOf(webPublishingFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // 7Cogs Ad content portlet
-
- portletId = addPortletId(
- layout, PortletKeys.JOURNAL_CONTENT, "column-2");
-
- removePortletBorder(layout, portletId);
-
- serviceContext.setAssetTagNames(new String[] {"liferay", "7cogs"});
-
- journalArticle = addJournalArticle(
- defaultUserId, group.getGroupId(), "7Cogs Ad",
- "/guest/journal/articles/sample_site_ad.xml", serviceContext);
-
- content = StringUtil.replace(
- journalArticle.getContent(),
- new String[] {
- "[$GROUP_ID$]", "[$GROUP_URL$]", "[$R_FE_UUID$]"
- },
- new String[] {
- String.valueOf(group.getGroupId()), "/web/7cogs/home",
- String.valueOf(sevenCogsAdFileEntry.getUuid())
- });
-
- JournalArticleLocalServiceUtil.updateContent(
- group.getGroupId(), journalArticle.getArticleId(),
- journalArticle.getVersion(), content);
-
- configureJournalContent(
- layout, portletId, journalArticle.getArticleId());
-
- // Welcome Note content portlet
-