List of usage examples for com.liferay.portal.kernel.util ContentTypes APPLICATION_VND_MS_EXCEL
String APPLICATION_VND_MS_EXCEL
To view the source code for com.liferay.portal.kernel.util ContentTypes APPLICATION_VND_MS_EXCEL.
Click Source Link
From source file:com.liferay.sevencogs.hook.upgrade.v1_0_0.UpgradeCompany.java
License:Open Source License
protected List<User> setupUsers(long companyId) throws Exception { // Roles// w w w . j a v a 2s. c om Role adminRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); Role portalContentReviewer = RoleLocalServiceUtil.getRole(companyId, "Portal Content Reviewer"); Role powerUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); Role publisherRole = RoleLocalServiceUtil.getRole(companyId, "Publisher"); Role writerRole = RoleLocalServiceUtil.getRole(companyId, "Writer"); // Users long[] roleIds = { adminRole.getRoleId(), powerUserRole.getRoleId() }; User brunoUser = addUser(companyId, "bruno", "Bruno", "Admin", true, "Administrator", roleIds); List<User> users = new ArrayList<User>(); users.add(brunoUser); roleIds = new long[] { powerUserRole.getRoleId() }; User kendraUser = addUser(companyId, "kendra", "Kendra", "Regular", true, "Employee", roleIds); users.add(kendraUser); roleIds = new long[] { powerUserRole.getRoleId(), writerRole.getRoleId() }; User michelleUser = addUser(companyId, "michelle", "Michelle", "Writer", false, "Writer", roleIds); users.add(michelleUser); roleIds = new long[] { powerUserRole.getRoleId(), publisherRole.getRoleId(), portalContentReviewer.getRoleId() }; User richardUser = addUser(companyId, "richard", "Richard", "Publisher", true, "Publisher", roleIds); users.add(richardUser); // Asset AssetCategory learningAssetCategory = _assetCategories.get("Learning"); AssetCategory liferayAssetCategory = _assetCategories.get("Liferay"); // Blogs ServiceContext serviceContext = new ServiceContext(); serviceContext.setAssetTagNames(new String[] { "new", "features", "control panel" }); serviceContext.setAssetCategoryIds( new long[] { learningAssetCategory.getCategoryId(), liferayAssetCategory.getCategoryId() }); serviceContext.setScopeGroupId(brunoUser.getGroupId()); addBlogsEntry(brunoUser.getUserId(), "New Control Panel!!", "/users/blogs/controlpanel.xml", serviceContext); serviceContext.setAssetCategoryIds( new long[] { learningAssetCategory.getCategoryId(), liferayAssetCategory.getCategoryId() }); serviceContext.setAssetTagNames(new String[] { "configuration", "portal.properties", "customization" }); addBlogsEntry(brunoUser.getUserId(), "Configuration of the portal: portal.properties", "/users/blogs/portalproperties.xml", serviceContext); serviceContext.setAssetCategoryIds( new long[] { learningAssetCategory.getCategoryId(), liferayAssetCategory.getCategoryId() }); serviceContext.setAssetTagNames(new String[] { "new", "wiki", "knowledge" }); serviceContext.setScopeGroupId(kendraUser.getGroupId()); addBlogsEntry(kendraUser.getUserId(), "Using the wiki", "/users/blogs/wiki.xml", serviceContext); serviceContext.setAssetCategoryIds( new long[] { learningAssetCategory.getCategoryId(), liferayAssetCategory.getCategoryId() }); serviceContext.setAssetTagNames(new String[] { "new", "chat", "communications", "features" }); serviceContext.setScopeGroupId(michelleUser.getGroupId()); addBlogsEntry(michelleUser.getUserId(), "We have an amazing Chat!", "/users/blogs/chat.xml", serviceContext); // Document library Folder folder = addDLFolder(brunoUser.getUserId(), brunoUser.getGroupId(), "Important Documents", "Documents related with the company"); serviceContext.setAssetTagNames(new String[] { "document", "budget", "2009" }); addDLFileEntry(brunoUser.getUserId(), folder.getGroupId(), folder.getFolderId(), "/users/document_library/Budget.xls", "Budget.xls", ContentTypes.APPLICATION_VND_MS_EXCEL, "Budget", "Budgets for the current year", serviceContext); addDLFolder(michelleUser.getUserId(), michelleUser.getGroupId(), "My Documents", "Personal docs"); folder = addDLFolder(michelleUser.getUserId(), michelleUser.getGroupId(), "Work Documents", "Works docs"); serviceContext.setAssetTagNames(new String[] { "document", "notes", "meeting" }); addDLFileEntry(michelleUser.getUserId(), folder.getGroupId(), folder.getFolderId(), "/users/document_library/Notes from the last meeting.doc", "Notes from the last meeting.doc", ContentTypes.APPLICATION_MSWORD, "Notes from the last meeting", "Important notes", serviceContext); addDLFolder(richardUser.getUserId(), richardUser.getGroupId(), "Documentation", StringPool.BLANK); folder = addDLFolder(richardUser.getUserId(), richardUser.getGroupId(), "Innovation", "New things"); serviceContext.setAssetTagNames(new String[] { "new", "features", "2009" }); addDLFileEntry(richardUser.getUserId(), folder.getGroupId(), folder.getFolderId(), "/users/document_library/New Features.ppt", "New Features.ppt", ContentTypes.APPLICATION_VND_MS_POWERPOINT, "New Features", "Features for the current year", serviceContext); // Message boards Organization sevenCogsOrganization = OrganizationLocalServiceUtil.getOrganization(companyId, "7Cogs, Inc."); serviceContext.setScopeGroupId(sevenCogsOrganization.getGroupId()); MBCategory mbCategory = addMBCategory(brunoUser.getUserId(), "Using the forum", "Some advice on using the forum", serviceContext); serviceContext.setAssetTagNames(new String[] { "forums", "liferay", "7cogs" }); addMBMessage(brunoUser.getUserId(), brunoUser.getFullName(), mbCategory.getGroupId(), mbCategory.getCategoryId(), 0, 0, "Nice Forums", "/sample/message_boards/general.xml", serviceContext); mbCategory = addMBCategory(brunoUser.getUserId(), "General Questions", "Product questions and more!", serviceContext); serviceContext.setAssetTagNames(new String[] { "vix-998", "liferay" }); MBMessage vix1Message = addMBMessage(brunoUser.getUserId(), brunoUser.getFullName(), mbCategory.getGroupId(), mbCategory.getCategoryId(), 0, 0, "About the Vix-998", "/sample/message_boards/vix1.xml", serviceContext); serviceContext.setAssetTagNames(new String[] { "vix-998", "latin" }); MBMessage vix2Message = addMBMessage(richardUser.getUserId(), richardUser.getFullName(), mbCategory.getGroupId(), mbCategory.getCategoryId(), vix1Message.getThreadId(), vix1Message.getMessageId(), "RE: About the Vix-998", "/sample/message_boards/vix2.xml", serviceContext); serviceContext.setAssetTagNames(new String[] { "vix-998", "vulgo" }); addMBMessage(michelleUser.getUserId(), michelleUser.getFullName(), mbCategory.getGroupId(), mbCategory.getCategoryId(), vix1Message.getThreadId(), vix2Message.getMessageId(), "RE: About the Vix-998", "/sample/message_boards/vix3.xml", serviceContext); // Social addSocialRequest(michelleUser, brunoUser, true); addSocialRequest(michelleUser, kendraUser, true); addSocialRequest(michelleUser, richardUser, true); addSocialRequest(kendraUser, brunoUser, false); addSocialRequest(kendraUser, richardUser, false); return users; }