To create a new Collaboration project from a remote application, use the IProjectManager interface in the IDK.
Method | Description | Copies |
---|---|---|
copyProjectContent | Copies all project content from the source project to the target project. The copied project will be stored permanently. Security is mapped isomorphically from the source project to the target project; if the ProjectMember role in the source project has access level 1 on object X, and object X is copied to object Y, then the ProjectMember role in the target project will have access level 1 on object Y. |
|
copyProjectMetadata | Copies the basic metadata and all IRole objects from the source project to the target project. The copied project will be stored permanently. No store method is required. The old roles in the target project will be overwritten with the copied roles from the source project. |
|
Java
<%@page import="com.plumtree.remote.prc.IRemoteSession, com.plumtree.remote.prc.RemoteSessionFactory, com.plumtree.remote.prc.collaboration.*,com.plumtree.remote.prc.collaboration.project.*, com.plumtree.remote.portlet.*,java.util.*,java.text.*" %> <% //get the project manager private IProjectManager getProjectManager(HttpServletRequest req, HttpServletResponse res, JspWriter pout) throws Exception { IProjectManager projectManager = null; IPortletContext portletContext = PortletContextFactory.createPortletContext(req, res); IPortletRequest portletRequest = portletContext.getRequest(); String loginToken = portletRequest.getLoginToken(); if (null == loginToken) { pout.println("Unable to retrieve the login token. Confirm that the login token has been checked in the Advanced Settings page of the Web Service."); } //get the remote session com.plumtree.remote.prc.IRemoteSession portalSession = portletContext.getRemotePortalSession(); //get a collab factory and a project manager ICollaborationFactory collabFactory = portalSession.getCollaborationFactory(); projectManager = collabFactory.getProjectManager(); return projectManager; } //create a project and print out the project id name = (null == name) ? "ExampleProject" : name; description = (null == description) ? "ExampleProjectDescription" : description; //create the project IProjectManager projectManager = getProjectManager(request, response, out); IProject project = projectManager.createProject(name, description); //to set additional properties, you must call store() after making changes //for example: /* project.setStatus(ProjectStatus.NOT_STARTED); project.setStartDate(new Date()); */ //call store before asking for the ID. project.store(); //get the new project ID project.getID() %>
.NET (C# - Project Page)
<%@ Page language="c#" Codebehind="ProjectSample.aspx.cs" AutoEventWireup="false" Inherits="WebProjectSample.ProjectSample" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html> <body> //create a project and print out the project id <% { name = (null == name) ? "ExampleProject" : name; description = (null == description) ? "ExampleProjectDescription" : description; //create the project Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response); Plumtree.Remote.PRC.Collaboration.Project.IProject project = projectManager.CreateProject(name, description); //to set additional properties, you must call store() after making changes //for example: /* project.Status = ProjectStatus.NotStarted; project.StartDate = new Date(); */ //call store before asking for the id. project.Store(); } %> <table> <tr> <td> <% Response.Write("ID of newly created project is " + project.ID); %> </td> </tr> </table> </body> </html>
.NET (C# - Code-Behind Page)
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Plumtree.Remote.PRC; using Plumtree.Remote.PRC.Collaboration; using Plumtree.Remote.PRC.Collaboration.Project; using Plumtree.Remote.Portlet; namespace WebProjectSample { public class ProjectSample: System.Web.UI.Page { //name and description for new project public String name = "ExampleProject"; public String description = "ExampleProjectDescription"; //get the Project Manager public IProjectManager GetProjectManager(HttpRequest req, HttpResponse res) { IProjectManager projectManager = null; IPortletContext portletContext = PortletContextFactory.CreatePortletContext(req, res); IPortletRequest portletRequest = portletContext.GetRequest(); String loginToken = portletRequest.GetLoginToken(); if (null == loginToken) { res.Write("Unable to retrieve the login token. Confirm that the login token has been checked in the Advanced Settings page of the Web Service."); } //get the remote session Plumtree.Remote.PRC.IRemoteSession portalSession = portletContext.GetRemotePortalSession(); //get a collab factory and a project manager ICollaborationFactory collabFactory = portalSession.GetCollaborationFactory(); projectManager = collabFactory.GetProjectManager(); return projectManager; } } }
.NET (VB - Project Page)
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ProjectSample.aspx.vb" Inherits="TestProjectVB.ProjectSample"%> <!DOCTYPE HTML PUBLIC "-'W3C'DTD HTML 4.0 Transitional'EN" > <html> <body> <% 'create a project and print out the project id name = "ExampleProject" description = "ExampleProjectDescription" 'create the project dim projectManager as Plumtree.Remote.PRC.Collaboration.Project.IProjectManager = GetProjectManager(Request, Response) dim project as Plumtree.Remote.PRC.Collaboration.Project.IProject = projectManager.CreateProject(name, description) 'to set additional properties, you must call store() after making changes 'for example: 'project.Status = ProjectStatus.NotStarted 'project.StartDate = new Date() 'call store before asking for the id. project.Store() %> <table> <tr> <td> <% Response.Write("ID of newly created project is " + Cstr(project.ID)) %> </td> </tr> </table> </body> </html>
.NET (VB - Code-Behind Page)
Imports System Imports System.Collections Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Web Imports System.Web.SessionState Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Imports Plumtree.Remote.PRC Imports Plumtree.Remote.PRC.Collaboration Imports Plumtree.Remote.PRC.Collaboration.Project Imports Plumtree.Remote.Portlet Public Class ProjectSample Inherits System.Web.UI.Page 'get the project manager Public Function GetProjectManager(ByVal req As HttpRequest, ByVal res As HttpResponse) As IProjectManager Dim projectManager As IProjectManager = Nothing Dim portletContext As IPortletContext = PortletContextFactory.CreatePortletContext(req, res) Dim portletRequest As IPortletRequest = portletContext.GetRequest() Dim loginToken As String = portletRequest.GetLoginToken() If loginToken Is Nothing Then res.Write("Unable to retrieve the login token. Confirm that the login token has been checked in the Advanced Settings page of the Web Service.") End If 'get the remote session Dim portalSession As Plumtree.Remote.PRC.IRemoteSession = portletContext.GetRemotePortalSession() 'get a collab factory and a project manager Dim collabFactory As ICollaborationFactory = portalSession.GetCollaborationFactory() projectManager = collabFactory.GetProjectManager() Return projectManager End Function End Class