(1);
properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
diff --git a/source/java/org/alfresco/repo/site/script/ScriptSiteService.java b/source/java/org/alfresco/repo/site/script/ScriptSiteService.java
index 77c35da12d..3d80f29c31 100644
--- a/source/java/org/alfresco/repo/site/script/ScriptSiteService.java
+++ b/source/java/org/alfresco/repo/site/script/ScriptSiteService.java
@@ -28,9 +28,11 @@ import java.util.ArrayList;
import java.util.List;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
-import org.alfresco.repo.site.SiteInfo;
-import org.alfresco.repo.site.SiteService;
import org.alfresco.service.ServiceRegistry;
+import org.alfresco.service.cmr.site.SiteInfo;
+import org.alfresco.service.cmr.site.SiteService;
+import org.alfresco.service.cmr.site.SiteVisibility;
+import org.alfresco.util.ParameterCheck;
/**
@@ -40,6 +42,11 @@ import org.alfresco.service.ServiceRegistry;
*/
public class ScriptSiteService extends BaseScopableProcessorExtension
{
+ /** Visibility helper constants */
+ public static final String PUBLIC_SITE = "PUBLIC";
+ public static final String MODERATED_SITE = "MODERATED";
+ public static final String PRIVATE_SITE = "PRIVATE";
+
/** Service Registry */
private ServiceRegistry serviceRegistry;
@@ -66,6 +73,23 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
this.siteService = siteService;
}
+ /**
+ * @see {@link #createSite(String, String, String, String, String)}
+ *
+ * @param sitePreset site preset
+ * @param shortName site short name
+ * @param title site title
+ * @param description site description
+ * @param isPublic whether the site is public or not
+ * @return Site the created site
+ * @deprecated as of version 3.2, replaced by {@link #createSite(String, String, String, String, String)}
+ */
+ public Site createSite(String sitePreset, String shortName, String title, String description, boolean isPublic)
+ {
+ SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, isPublic);
+ return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
+ }
+
/**
* Create a new site.
*
@@ -74,13 +98,15 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
* @param sitePreset site preset
* @param shortName site short name
* @param title site title
- * @param description site description
- * @param isPublic whether the site is public or not
+ * @param description site description
+ * @param visibility visibility of the site (public|moderated|private)
* @return Site the created site
*/
- public Site createSite(String sitePreset, String shortName, String title, String description, boolean isPublic)
- {
- SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, isPublic);
+ public Site createSite(String sitePreset, String shortName, String title, String description, String visibility)
+ {
+ ParameterCheck.mandatoryString("visibility", visibility);
+ SiteVisibility siteVisibility = SiteVisibility.valueOf(visibility);
+ SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, siteVisibility);
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
}
@@ -142,7 +168,7 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
}
/**
- * Returns an array of all the roles that can be assigned to a memeber of a site.
+ * Returns an array of all the roles that can be assigned to a member of a site.
*
* @return String[] roles available to assign to a member of a site
*/
diff --git a/source/java/org/alfresco/repo/site/script/Site.java b/source/java/org/alfresco/repo/site/script/Site.java
index 382390c61e..1382fd1ff5 100644
--- a/source/java/org/alfresco/repo/site/script/Site.java
+++ b/source/java/org/alfresco/repo/site/script/Site.java
@@ -37,14 +37,16 @@ import org.alfresco.repo.jscript.ScriptNode.NodeValueConverter;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.permissions.AccessDeniedException;
-import org.alfresco.repo.site.SiteInfo;
import org.alfresco.repo.site.SiteModel;
-import org.alfresco.repo.site.SiteService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.cmr.site.SiteInfo;
+import org.alfresco.service.cmr.site.SiteService;
+import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.ParameterCheck;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
@@ -158,7 +160,8 @@ public class Site implements Serializable
/**
* Gets whether the site is public or not
*
- * @return true is public false otherwise
+ * @return true is public false otherwise
+ * @deprecated since version 3.2, replaced by {@link #getVisibility()}
*/
public boolean getIsPublic()
{
@@ -169,6 +172,7 @@ public class Site implements Serializable
* Set whether the site is public or not
*
* @param isPublic true the site is public false otherwise
+ * @deprecated since version 3.2, replaced by {@link #setVisibility(String)}
*/
public void setIsPublic(boolean isPublic)
{
@@ -176,6 +180,29 @@ public class Site implements Serializable
this.siteInfo.setIsPublic(isPublic);
}
+ /**
+ * Get the site visibility
+ *
+ * @return String site visibility
+ */
+ public String getVisibility()
+ {
+ return this.siteInfo.getVisibility().toString();
+ }
+
+ /**
+ * Set the site visibility
+ *
+ * @param visibility site visibility (public|moderated|private)
+ */
+ public void setVisibility(String visibility)
+ {
+ ParameterCheck.mandatoryString("visibility", visibility);
+ SiteVisibility siteVisibility = SiteVisibility.valueOf(visibility);
+ this.siteInfo.setVisibility(siteVisibility);
+ this.isDirty = true;
+ }
+
/**
* Get the site node, null if none
*
diff --git a/source/java/org/alfresco/repo/site/script/test_siteService.js b/source/java/org/alfresco/repo/site/script/test_siteService.js
index e34911d6f4..b00c14ea2e 100644
--- a/source/java/org/alfresco/repo/site/script/test_siteService.js
+++ b/source/java/org/alfresco/repo/site/script/test_siteService.js
@@ -1,11 +1,11 @@
-function checkSite(site, sitePreset, shortName, title, description, isPublic)
+function checkSite(site, sitePreset, shortName, title, description, visibility)
{
test.assertNotNull(site);
test.assertEquals(sitePreset, site.sitePreset);
test.assertEquals(shortName, site.shortName);
test.assertEquals(title, site.title);
test.assertEquals(description, site.description);
- test.assertEquals(isPublic, site.isPublic);
+ test.assertEquals(visibility, site.visibility);
test.assertNotNull(site.node);
test.assertTrue(site.node.isTagScope);
}
@@ -17,21 +17,21 @@ function testCRUD()
test.assertNull(site, "Site should not have been found.");
// Try and create a site
- site = siteService.createSite("sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
- checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
+ site = siteService.createSite("sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
+ checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
// Try and get the created site
site = siteService.getSite("siteShortNameCRUD");
- checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
+ checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
// Try and update the values of the site
site.title = "abc123abc";
site.description = "abc123abc";
- site.isPublic = false;
- checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", false);
+ site.visibility = siteService.PRIVATE_SITE;
+ checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", siteService.PRIVATE_SITE);
site.save();
site = siteService.getSite("siteShortNameCRUD");
- checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", false);
+ checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", siteService.PRIVATE_SITE);
// Delete the site
site.deleteSite();
@@ -42,8 +42,8 @@ function testCRUD()
function testListSites()
{
// Create a couple of sites
- siteService.createSite("sitePreset", "siteShortName", "siteTitle", "siteDescription", true);
- siteService.createSite("sitePreset", "siteShortName2", "siteTitle", "siteDescription", true);
+ siteService.createSite("sitePreset", "siteShortName", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
+ siteService.createSite("sitePreset", "siteShortName2", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
// List all the site
var sites = siteService.listSites(null, null);
@@ -133,7 +133,7 @@ function testContainer()
function testPermissions()
{
- var site = siteService.createSite("sitePreset", "siteShortNameToo", "siteTitle", "siteDescription", false);
+ var site = siteService.createSite("sitePreset", "siteShortNameToo", "siteTitle", "siteDescription", siteService.PRIVATE_SITE);
test.assertNotNull(site);
var container = site.createContainer("test.permissions");
test.assertNotNull(container);
@@ -164,7 +164,7 @@ function testRolesAndGroups()
test.assertNotNull(roles);
test.assertFalse(roles.length == 0);
- var site = siteService.createSite("sitePreset", "sn", "siteTitle", "siteDescription", false);
+ var site = siteService.createSite("sitePreset", "sn", "siteTitle", "siteDescription", siteService.PRIVATE_SITE);
var siteGroup = site.siteGroup;
test.assertNotNull(siteGroup);
test.assertEquals("GROUP_site_sn", siteGroup);
diff --git a/source/java/org/alfresco/service/ServiceRegistry.java b/source/java/org/alfresco/service/ServiceRegistry.java
index b4d86dd386..051449a777 100644
--- a/source/java/org/alfresco/service/ServiceRegistry.java
+++ b/source/java/org/alfresco/service/ServiceRegistry.java
@@ -28,7 +28,6 @@ import java.util.Collection;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.forms.FormService;
-import org.alfresco.repo.site.SiteService;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.attributes.AttributeService;
@@ -39,6 +38,7 @@ import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.cmr.invitation.InvitationService;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.EditionService;
@@ -59,6 +59,7 @@ import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.OwnableService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
+import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.tagging.TaggingService;
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
import org.alfresco.service.cmr.version.VersionService;
@@ -135,6 +136,7 @@ public interface ServiceRegistry
static final QName SANDBOX_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SandboxService");
static final QName ASSET_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AssetService");
static final QName FORM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FormService");
+ static final QName INVITATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "InvitationService");
/**
* Get the list of services provided by the Repository
@@ -456,4 +458,11 @@ public interface ServiceRegistry
*/
@NotAuditable
FormService getFormService();
+
+ /**
+ * Get the invitation service (or null if one is not provided)
+ * @return the invitation service
+ */
+ @NotAuditable
+ InvitationService getInvitationService();
}
diff --git a/source/java/org/alfresco/service/cmr/invitation/Invitation.java b/source/java/org/alfresco/service/cmr/invitation/Invitation.java
new file mode 100644
index 0000000000..8fa29130de
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/Invitation.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+
+/**
+ * The invitation request is a command object for who, needs to be added or removed
+ * from which resource with which attributes.
+ *
+ * Invitations are processed by the InvitationService
+ *
+ * @see org.alfresco.service.cmr.invitation.InvitationService
+ *
+ * @author mrogers
+ */
+public interface Invitation
+{
+ /**
+ * What sort of Resource Web Project, Web Site, Node
+ * (Just Web site for now)
+ */
+ enum ResourceType
+ {
+ WEB_SITE
+ }
+
+ /**
+ * What sort of resource is it, for example a WEB_SITE?
+ * @return the resource type
+ */
+ public ResourceType getResourceType();
+
+ /**
+ * What is the resource name ?
+ * @return the name of the resource
+ */
+ public String getResourceName();
+
+ /**
+ * Who is this invitation for ?
+ * @return the user name of the invitee
+ */
+ public String getInviteeUserName();
+
+ /**
+ * What is the unique reference for this invitation ?
+ * @return the unique reference for this invitation
+ */
+ public String getInviteId();
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationException.java b/source/java/org/alfresco/service/cmr/invitation/InvitationException.java
new file mode 100644
index 0000000000..7053971c54
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+
+/**
+ * Thrown when there is a problem with an invitation.
+ */
+public class InvitationException extends AlfrescoRuntimeException
+{
+ private static final long serialVersionUID = -3925105163386197586L;
+
+ public InvitationException(String msgId, Object ... args)
+ {
+ super(msgId, args);
+ }
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionForbidden.java b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionForbidden.java
new file mode 100644
index 0000000000..9b325163e4
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionForbidden.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+/**
+ * The current user has attempted to do something that they do not have
+ * the rights to do.
+ */
+public class InvitationExceptionForbidden extends InvitationException
+{
+
+ public InvitationExceptionForbidden(String msg, Object[] args) {
+ super(msg, args);
+ }
+
+ public InvitationExceptionForbidden(String msgId) {
+ super(msgId);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3083631235637184401L;
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionNotFound.java b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionNotFound.java
new file mode 100644
index 0000000000..0686eff17b
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionNotFound.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+/**
+ * The invitation does not exist.
+ */
+public class InvitationExceptionNotFound extends InvitationException
+{
+
+ public InvitationExceptionNotFound(String msgId, Object[] args)
+ {
+ super(msgId, args);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6112400396903083597L;
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionUserError.java b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionUserError.java
new file mode 100644
index 0000000000..590b9370dc
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationExceptionUserError.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+/**
+ * The current user has attempted to do something that is not valid.
+ */
+public class InvitationExceptionUserError extends InvitationException
+{
+
+ public InvitationExceptionUserError(String msgId, Object[] args)
+ {
+ super(msgId, args);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6112400396903083597L;
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationSearchCriteria.java b/source/java/org/alfresco/service/cmr/invitation/InvitationSearchCriteria.java
new file mode 100644
index 0000000000..941192402e
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationSearchCriteria.java
@@ -0,0 +1,50 @@
+package org.alfresco.service.cmr.invitation;
+
+/**
+ * Search criteria for invitation service
+ *
+ */
+public interface InvitationSearchCriteria
+{
+ /**
+ * What type of invitations to search for ?
+ *
+ */
+ public enum InvitationType
+ {
+ ALL,
+ MODERATED,
+ NOMINATED
+ }
+
+
+ /**
+ * Search by inviter (who started the invitation)
+ * @return
+ */
+ String getInviter();
+
+ /**
+ * Search by invitee (who is being invited, alfresco userid)
+ * @return
+ */
+ String getInvitee();
+
+ /**
+ * Search by resource name
+ * @return the resource name
+ */
+ String getResourceName();
+
+ /**
+ * Search by resource type
+ * @return the resource type
+ */
+ Invitation.ResourceType getResourceType();
+
+ /**
+ * Do you want to search for moderated, nominated or all invitations ?
+ * @return the type to search for.
+ */
+ InvitationType getInvitationType();
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/InvitationService.java b/source/java/org/alfresco/service/cmr/invitation/InvitationService.java
new file mode 100644
index 0000000000..2d803379d5
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/InvitationService.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+import java.util.List;
+
+/**
+ * The invitation service provides the ability to invite
+ * people to resources. For example adding a user to a shared web site.
+ *
+ * It manages the relationship between person, resource and requestType
+ * and may also pass along information such as who is to approve or the expected
+ * role of the user.
+ *
+ * @author mrogers
+ */
+public interface InvitationService
+{
+
+ /**
+ * Start the invitation process for a NominatedInvitation
+ *
+ * @param inviteeFirstName
+ * @param inviteeLastName
+ * @param inviteeEmail
+ * @param inviteeUserName the alfresco user name of the invitee, may be null for a new user
+ * @param Invitation.ResourceType resourceType
+ * @param resourceName
+ * @param inviteeRole
+ * @param serverPath
+ * @param acceptUrl
+ * @param rejectUrl
+ *
+ * @return the nominated invitation which will contain the invitationId and ticket which
+ * will uniquely identify this invitation.
+ *
+ * @throws InvitationException
+ * @throws InvitationExceptionUserError
+ * @throws InvitationExceptionForbidden
+ */
+ public NominatedInvitation inviteNominated(
+ String inviteeFirstName,
+ String inviteeLastName,
+ String inviteeEmail,
+ String inviteeUserName,
+ Invitation.ResourceType resourceType,
+ String resourceName,
+ String inviteeRole,
+ String serverPath,
+ String acceptUrl,
+ String rejectUrl);
+
+ /**
+ * Start the invitation process for a ModeratedInvitation
+ * @param inviteeUserName who is to be invited
+ * @param Invitation.ResourceType resourceType what resource type ?
+ * @param resourceName which resource
+ * @param inviteeRole which role ?
+ */
+ public ModeratedInvitation inviteModerated(
+ String inviteeComments,
+ String inviteeUserName,
+ Invitation.ResourceType resourceType,
+ String resourceName,
+ String inviteeRole);
+
+ /**
+ * For a Nominated Invitation invitee accepts this invitation
+ *
+ * @param request
+ * @param ticket
+ * @return the invitation
+ */
+ public Invitation accept(String invitationId, String ticket);
+
+
+ /**
+ * Moderator approves this invitation
+ *
+ * @param invitationId the request to approve
+ * @param reason - comments about the acceptance
+ */
+ public Invitation approve(String invitationId, String reason);
+
+
+
+
+ /**
+ * User or moderator rejects this request
+ * @param invitationId
+ * @param reason
+ */
+ public Invitation reject(String invitationId, String reason);
+
+
+ /**
+ * cancel this request
+ */
+ public Invitation cancel (String invitationId);
+
+ /**
+ * get an invitation from its invitation id
+ *
+ * @param invitationId;
+ */
+ public Invitation getInvitation(String invitationId) ;
+
+ /**
+ * list Invitations for a specific person
+ */
+ public List listPendingInvitationsForInvitee(String invitee);
+
+ /**
+ * list Invitations for a specific resource
+ * @param resourceType
+ * @param resourceName
+ */
+ public List listPendingInvitationsForResource(Invitation.ResourceType resourceType, String resourceName);
+
+ /**
+ * search invitation
+ *
+ * @param criteria
+ * @return the list of invitations
+ */
+ public List searchInvitation(InvitationSearchCriteria criteria);
+
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/ModeratedInvitation.java b/source/java/org/alfresco/service/cmr/invitation/ModeratedInvitation.java
new file mode 100644
index 0000000000..e6956e2803
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/ModeratedInvitation.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+
+/**
+ * The moderated invitation request is a model object for who, needs to be added or removed
+ * from which resource with which attributes.
+ *
+ * Invitations are processed by the InvitationService
+ *
+ * @see org.alfresco.service.cmr.invitation.InvitationService
+ *
+ * @author mrogers
+ */
+public interface ModeratedInvitation extends Invitation
+{
+ /**
+ * Which resource to be invited to?
+ * @return the resource name.
+ */
+ public String getResourceName();
+
+ /**
+ * Which role to be added with
+ * @return the roleName
+ */
+ public String getRoleName();
+
+ /**
+ * The invitee comments - why does the invitee want access ?
+ * @return invitee comments
+ */
+ public String getInviteeComments();
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/NominatedInvitation.java b/source/java/org/alfresco/service/cmr/invitation/NominatedInvitation.java
new file mode 100644
index 0000000000..7c198ffb20
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/NominatedInvitation.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program 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 General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.service.cmr.invitation;
+
+import java.util.Date;
+
+
+/**
+ * The nominated invitation is a model object for who, needs to be added or removed
+ * from which resource with which attributes.
+ *
+ * Invitations are processed by the InvitationService
+ *
+ * @see org.alfresco.service.cmr.invitation.InvitationService
+ *
+ * @author mrogers
+ */
+public interface NominatedInvitation extends Invitation
+{
+
+ public String getInviteeFirstName();
+
+ public String getInviteeLastName();
+
+ public String getInviteeEmail();
+
+ public String getResourceName();
+
+ public String getServerPath();
+
+ public String getAcceptUrl();
+
+ public String getRejectUrl();
+
+ public Date getSentInviteDate();
+
+ public String getTicket();
+
+ public String getRoleName();
+
+}
diff --git a/source/java/org/alfresco/service/cmr/invitation/package.html b/source/java/org/alfresco/service/cmr/invitation/package.html
new file mode 100644
index 0000000000..aa06b0e6b1
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/invitation/package.html
@@ -0,0 +1,2 @@
+The interface for the invitation service.
+
diff --git a/source/java/org/alfresco/service/cmr/site/SiteInfo.java b/source/java/org/alfresco/service/cmr/site/SiteInfo.java
new file mode 100644
index 0000000000..b61c7d4b72
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/site/SiteInfo.java
@@ -0,0 +1,106 @@
+package org.alfresco.service.cmr.site;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+
+public interface SiteInfo
+{
+ /**
+ * Get the site node reference
+ *
+ * @return NodeRef site node reference, null if not set
+ */
+ public abstract NodeRef getNodeRef();
+
+ /**
+ * Get the site preset
+ *
+ * @return String site preset
+ */
+ public abstract String getSitePreset();
+
+ /**
+ * Get the short name
+ *
+ * @return String short name
+ */
+ public abstract String getShortName();
+
+ /**
+ * Get the title
+ *
+ * @return String site title
+ */
+ public abstract String getTitle();
+
+ /**
+ * Set the title
+ *
+ * @param title site title
+ */
+ public abstract void setTitle(String title);
+
+ /**
+ * Get the description
+ *
+ * @return String site description
+ */
+ public abstract String getDescription();
+
+ /**
+ * Set the description
+ *
+ * @param description site description
+ */
+ public abstract void setDescription(String description);
+
+ /**
+ * Sets whether this site is public or not. If true the visibility is set to "public", if false
+ * the visibility is set to "private"
+ *
+ * @param isPublic true public, false private
+ * @deprecated as of version 3.2, replaced by {@link #setVisibility(SiteVisibility)}
+ */
+ public abstract void setIsPublic(boolean isPublic);
+
+ /**
+ * Indicates whether the site is public.
+ *
+ * @return boolean true if public, false either private or moderated
+ * @deprecated as of version 3.2, replaced by {@link #getVisibility()}
+ */
+ public abstract boolean getIsPublic();
+
+ /**
+ * Get the sites visibility
+ *
+ * @return SiteVisibility site visibility
+ */
+ public abstract SiteVisibility getVisibility();
+
+ /**
+ * Set the sites visibility
+ *
+ * @param visibility site visibility
+ */
+ public abstract void setVisibility(SiteVisibility visibility);
+
+ /**
+ * Get the custom property values
+ *
+ * @return Map map of custom property names and values
+ */
+ public abstract Map getCustomProperties();
+
+ /**
+ * Get the value of a custom property
+ *
+ * @param name name of custom property
+ * @return Serializable value of the property, null if not set or doesn't exist
+ */
+ public abstract Serializable getCustomProperty(QName name);
+
+}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/site/SiteService.java b/source/java/org/alfresco/service/cmr/site/SiteService.java
similarity index 64%
rename from source/java/org/alfresco/repo/site/SiteService.java
rename to source/java/org/alfresco/service/cmr/site/SiteService.java
index 74fc193cb4..77664bb6a1 100644
--- a/source/java/org/alfresco/repo/site/SiteService.java
+++ b/source/java/org/alfresco/service/cmr/site/SiteService.java
@@ -1,4 +1,4 @@
-package org.alfresco.repo.site;
+package org.alfresco.service.cmr.site;
import java.io.Serializable;
import java.util.List;
@@ -23,11 +23,24 @@ public interface SiteService
* @param shortName site short name, must be unique
* @param title site title
* @param description site description
- * @param isPublic whether the site is public or not
+ * @param isPublic whether the site is public or not (true = public, false = private)
* @return SiteInfo information about the created site
+ * @deprecated since version 3.2, replaced by {@link #createSite(String, String, String, String, SiteVisibility)}
*/
SiteInfo createSite(String sitePreset, String shortName, String title, String description, boolean isPublic);
+ /**
+ * Create a new site.
+ *
+ * @param sitePreset site preset name
+ * @param shortName site short name, must be unique
+ * @param title site title
+ * @param description site description
+ * @param visibility site visibility (public|moderated|private)
+ * @return SiteInfo information about the created site
+ */
+ SiteInfo createSite(String sitePreset, String shortName, String title, String description, SiteVisibility visibility);
+
/**
* List the available sites. This list can optionally be filtered by site name and/or site preset.
*
@@ -58,7 +71,7 @@ public interface SiteService
/**
* Update the site information.
*
- * Note that the shortname and sitepreset of a site can not be updated once the site has been created.
+ * Note that the short name and site preset of a site can not be updated once the site has been created.
*
* @param siteInfo site information
*/
@@ -72,51 +85,63 @@ public interface SiteService
void deleteSite(String shortName);
/**
- * List the memebers of the site.
+ * List the members of the site. This includes both users and groups.
*
* Name and role filters are optional and if not specified all the members of the site are returned.
*
* @param shortName site short name
* @param nameFilter name filter
* @param roleFilter role filter
- * @return Map the username and their role
+ * @return Map the authority name and their role
*/
Map listMembers(String shortName, String nameFilter, String roleFilter);
/**
- * Gets the role of the specified user
+ * List the members of the site. This includes both users and groups if collapseGroups is set to false, otherwise all
+ * groups that are members are collapsed into their component users and listed.
+ *
+ * @param shortName site short name
+ * @param nameFilter name filter
+ * @param roleFilter role filter
+ * @param collapseGroups true if collapse member groups into user list, false otherwise
+ * @return Map the authority name and their role
+ */
+ Map listMembers(String shortName, String nameFilter, String roleFilter, boolean collapseGroups);
+
+ /**
+ * Gets the role of the specified user.
*
* @param shortName site short name
- * @param userName user name
+ * @param authorityName authority name
* @return String site role, null if none
*/
- String getMembersRole(String shortName, String userName);
+ String getMembersRole(String shortName, String authorityName);
/**
- * Inidiactes whether a user is a member of a site or not
+ * Indicates whether an authority is a member of a site or not
*
* @param shortName site short name
- * @param userName user name
- * @return boolean true if the user is a member of the site, false otherwise
+ * @param authorityName authority name
+ * @return boolean true if the authority is a member of the site, false otherwise
*/
- boolean isMember(String shortName, String userName);
+ boolean isMember(String shortName, String authorityName);
/**
- * Sets the role of a user withint a site
+ * Sets the role of an authority within a site
*
* @param shortName site short name
- * @param userName user name
+ * @param authorityName authority name
* @param role site role
*/
- void setMembership(String shortName, String userName, String role);
+ void setMembership(String shortName, String authorityName, String role);
/**
- * Clears a users role within a site
+ * Clears an authorities role within a site
*
* @param shortName site short name
- * @param userName user name
+ * @param authorityName authority name
*/
- void removeMembership(String shortName, String userName);
+ void removeMembership(String shortName, String authorityName);
/**
* Creates a container for a component is a site of the given container type (must be a sub-type of st:siteContainer)
@@ -157,7 +182,7 @@ public interface SiteService
/**
* Gets a list of all the currently available roles that a user can perform on a site
*
- * @return List list of availble roles
+ * @return List list of available roles
*/
List getSiteRoles();
diff --git a/source/java/org/alfresco/service/cmr/site/SiteVisibility.java b/source/java/org/alfresco/service/cmr/site/SiteVisibility.java
new file mode 100644
index 0000000000..5335547738
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/site/SiteVisibility.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.alfresco.service.cmr.site;
+
+/**
+ * Enumeration representing the different site visibilities.
+ *
+ * @author Roy Wetherall
+ */
+public enum SiteVisibility
+{
+ PUBLIC, // Public site. Visible and accessible by all
+ MODERATED, // Moderated site. Visible to all, but only accessible via moderated invitation.
+ PRIVATE // Private site. Visible and accessible only to members of the site.
+}