diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.desc.xml
index f14e42088a..02a6946f3f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.desc.xml
@@ -2,7 +2,7 @@
Invite
Processes Inviter actions ('start' or 'cancel' invite)
/api/invite/start?inviteeEmail={inviteeEmailAddress}&siteShortName={siteShortName}
- /api/invite/cancel?workflowId={workflowId}
+ /api/invite/cancel?inviteId={inviteId}
user
required
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.html.ftl
index e1c58e7756..c5ebe17011 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.html.ftl
@@ -1,7 +1,7 @@
<#if action == "start">
Invite to join site ${siteShortName} has been sent to ${inviteeUserName}
<#elseif action == "cancel">
- Invite process with workflow ID ${workflowId} has been cancelled
+ Invite with ID ${inviteId} has been cancelled
<#else>
Error: unknown invite action ${action}
#if>
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.json.ftl
index 890cd90664..50a9068239 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.json.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/invite.get.json.ftl
@@ -1,9 +1,9 @@
{
"action" : "${action}",
- <#if workflowId??>
- "workflowId" : "${workflowId}",
+ <#if inviteId??>
+ "inviteId" : "${inviteId}",
<#else>
- "workflowId" : undefined,
+ "inviteId" : undefined,
#if>
<#if inviteeUserName??>
"inviteeUserName" : "${inviteeUserName}",
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/inviteresponse.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/inviteresponse.get.desc.xml
index 9539128faf..6dd9bb8cf6 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/invite/inviteresponse.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/invite/inviteresponse.get.desc.xml
@@ -1,7 +1,7 @@
Invite Response
Processes invite response from Invitee
- /api/inviteresponse/{response}?workflowId={workflowId}&inviteeUserName={inviteeUserName}&siteShortName={siteShortName}
+ /api/inviteresponse/{response}?inviteId={inviteId}&inviteeUserName={inviteeUserName}&siteShortName={siteShortName}
guest
required
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/Invite.java b/source/java/org/alfresco/repo/web/scripts/invite/Invite.java
index b11565906a..e658ed6956 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/Invite.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/Invite.java
@@ -64,14 +64,14 @@ public class Invite extends DeclarativeWebScript
private static final String TRANSITION_SEND_INVITE = "sendInvite";
private static final String MODEL_PROP_KEY_ACTION = "action";
- private static final String MODEL_PROP_KEY_WORKFLOW_ID = "workflowId";
+ private static final String MODEL_PROP_KEY_INVITE_ID = "inviteId";
private static final String MODEL_PROP_KEY_INVITEE_USER_NAME = "inviteeUserName";
private static final String MODEL_PROP_KEY_SITE_SHORT_NAME = "siteShortName";
// URL request parameter names
private static final String PARAM_INVITEE_EMAIL = "inviteeEmail";
private static final String PARAM_SITE_SHORT_NAME = "siteShortName";
- private static final String PARAM_WORKFLOW_ID = "workflowId";
+ private static final String PARAM_INVITE_ID = "inviteId";
// services
private WorkflowService workflowService;
@@ -255,19 +255,19 @@ public class Invite extends DeclarativeWebScript
// else handle if provided 'action' is 'cancel'
else if (action.equals(ACTION_CANCEL))
{
- // check for 'workflowId' parameter not provided
- String workflowId = req.getParameter(PARAM_WORKFLOW_ID);
- if ((workflowId == null) || (workflowId.length() == 0))
+ // check for 'inviteId' parameter not provided
+ String inviteId = req.getParameter(PARAM_INVITE_ID);
+ if ((inviteId == null) || (inviteId.length() == 0))
{
- // handle workflowId URL parameter not provided
+ // handle inviteId URL parameter not provided
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
- "'workflowId' parameter has "
+ "'inviteId' parameter has "
+ "not been provided in URL for action '"
+ ACTION_CANCEL + "'");
}
// process action 'cancel' with provided parameters
- cancelInvite(model, workflowId);
+ cancelInvite(model, inviteId);
}
// handle action not recognised
else
@@ -401,7 +401,7 @@ public class Invite extends DeclarativeWebScript
// add model properties for template to render
model.put(MODEL_PROP_KEY_ACTION, ACTION_START);
- model.put(MODEL_PROP_KEY_WORKFLOW_ID, workflowId);
+ model.put(MODEL_PROP_KEY_INVITE_ID, workflowId);
model.put(MODEL_PROP_KEY_INVITEE_USER_NAME, inviteeUserName);
model.put(MODEL_PROP_KEY_SITE_SHORT_NAME, siteShortName);
}
@@ -413,25 +413,25 @@ public class Invite extends DeclarativeWebScript
* @param model
* model to add objects to, which will be passed to the template
* for rendering
- * @param workflowId
- * workflow id of the invite process that inviter wishes to
+ * @param inviteId
+ * invite id of the invitation that inviter wishes to
* cancel
*/
- private void cancelInvite(Map model, String workflowId)
+ private void cancelInvite(Map model, String inviteId)
{
- // handle workflow instance for given workflow ID does not exist
- if ((workflowId == null) || (workflowId.length() == 0))
+ // handle given invite ID null or empty
+ if ((inviteId == null) || (inviteId.length() == 0))
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
- "Workflow instance for given " + "workflow ID "
- + workflowId + " does not exist");
+ "Given invite ID " + inviteId + " null or empty");
}
- // cancel the workflow
- this.workflowService.cancelWorkflow(workflowId);
+ // cancel the workflow with the given invite ID
+ // which is actually the workflow ID
+ this.workflowService.cancelWorkflow(inviteId);
// add model properties for template to render
model.put(MODEL_PROP_KEY_ACTION, ACTION_CANCEL);
- model.put(MODEL_PROP_KEY_WORKFLOW_ID, workflowId);
+ model.put(MODEL_PROP_KEY_INVITE_ID, inviteId);
}
}
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/InviteResponse.java b/source/java/org/alfresco/repo/web/scripts/invite/InviteResponse.java
index 18bf9a1d89..f4b5a543b0 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/InviteResponse.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/InviteResponse.java
@@ -158,7 +158,7 @@ public class InviteResponse extends DeclarativeWebScript
Map model = new HashMap();
// get the URL parameter values
- String workflowId = req.getParameter("workflowId");
+ String inviteId = req.getParameter("inviteId");
String inviteeUserName = req.getParameter("inviteeUserName");
String siteShortName = req.getParameter("siteShortName");
@@ -172,12 +172,12 @@ public class InviteResponse extends DeclarativeWebScript
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
"response has not been provided as part of URL.");
}
- // check that workflow id URL parameter has been provided
- else if ((workflowId == null) || (workflowId.length() == 0))
+ // check that invite id URL parameter has been provided
+ else if ((inviteId == null) || (inviteId.length() == 0))
{
- // handle workflow id not provided
+ // handle invite id not provided
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
- "workflow id parameter has not been provided in the URL.");
+ "invite id parameter has not been provided in the URL.");
}
// check that inviteeUserName URL parameter has been provided
else if ((inviteeUserName == null) || (inviteeUserName.length() == 0))
@@ -197,10 +197,10 @@ public class InviteResponse extends DeclarativeWebScript
// process response
if (response.equals(RESPONSE_ACCEPT))
{
- acceptInvite(model, workflowId, inviteeUserName, siteShortName);
+ acceptInvite(model, inviteId, inviteeUserName, siteShortName);
} else if (response.equals(RESPONSE_REJECT))
{
- rejectInvite(model, workflowId, inviteeUserName, siteShortName);
+ rejectInvite(model, inviteId, inviteeUserName, siteShortName);
} else
{
/* handle unrecognised response */
@@ -219,18 +219,22 @@ public class InviteResponse extends DeclarativeWebScript
* @param model
* model to add objects to, which will be passed to the template
* for rendering
- * @param workflowId
- * string id of invite process workflow instance
+ * @param inviteId
+ * ID of invite
* @param inviteeUserName
- * string user name of invitee
+ * user name of invitee
* @param siteShortName
- * string short name of site for which invitee is accepting
+ * short name of site for which invitee is accepting
* invitation to join
*/
- private void acceptInvite(Map model, String workflowId,
+ private void acceptInvite(Map model, String inviteId,
String inviteeUserName, String siteShortName)
{
- // get workflow paths associated with given workflow ID
+ // get workflow ID from invite ID (of which the value is actually
+ // just the ID of the invite workflow instance)
+ String workflowId = inviteId;
+
+ // get workflow paths associated with workflow ID
List wfPaths = this.workflowService
.getWorkflowPaths(workflowId);
@@ -269,18 +273,22 @@ public class InviteResponse extends DeclarativeWebScript
* @param model
* model to add objects to, which will be passed to the template
* for rendering
- * @param workflowId
- * string id of invite process workflow instance
+ * @param inviteId
+ * ID of invite
* @param inviteeUserName
- * string user name of invitee
+ * user name of invitee
* @param siteShortName
- * string short name of site for which invitee is rejecting
+ * short name of site for which invitee is rejecting
* invitation to join
*/
- private void rejectInvite(Map model, String workflowId,
+ private void rejectInvite(Map model, String inviteId,
String inviteeUserName, String siteShortName)
{
- // get workflow paths associated with given workflow ID
+ // get workflow ID from invite ID (of which the value is actually
+ // just the ID of the invite workflow instance)
+ String workflowId = inviteId;
+
+ // get workflow paths associated with workflow ID
List wfPaths = this.workflowService
.getWorkflowPaths(workflowId);
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/InviteServiceTest.java b/source/java/org/alfresco/repo/web/scripts/invite/InviteServiceTest.java
index e3aafca4ce..df8a8302c3 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/InviteServiceTest.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/InviteServiceTest.java
@@ -235,24 +235,24 @@ public class InviteServiceTest extends BaseWebScriptTest
JSONObject result = startInvite(INVITEE_EMAIL, SITE_SHORT_NAME_INVITE,
Status.STATUS_OK);
- // get hold of workflow ID of started invite workflow instance
- String workflowId = result.getString("workflowId");
+ // get hold of invite ID of started invite
+ String inviteId = result.getString("inviteId");
// Inviter cancels pending invitation
String cancelInviteUrl = URL_INVITE_SERVICE + "/"
- + INVITE_ACTION_CANCEL + "?workflowId=" + workflowId;
+ + INVITE_ACTION_CANCEL + "?inviteId=" + inviteId;
MockHttpServletResponse response = getRequest(cancelInviteUrl,
Status.STATUS_OK);
}
public void testAcceptInvite() throws Exception
{
- // inviter starts invite workflow
+ // inviter starts invite (sends out invitation)
JSONObject result = startInvite(INVITEE_EMAIL, SITE_SHORT_NAME_INVITE,
Status.STATUS_OK);
- // get hold of workflow ID of started invite workflow instance
- String workflowId = result.getString("workflowId");
+ // get hold of invite ID of started invite
+ String inviteId = result.getString("inviteId");
// get hold of invitee user name that was generated as part of starting
// the invite
@@ -260,7 +260,7 @@ public class InviteServiceTest extends BaseWebScriptTest
// Invitee accepts invitation to a Site from Inviter
String acceptInviteUrl = URL_INVITERSP_SERVICE + "/"
- + INVITE_RSP_ACCEPT + "?workflowId=" + workflowId
+ + INVITE_RSP_ACCEPT + "?inviteId=" + inviteId
+ "&inviteeUserName=" + inviteeUserName + "&siteShortName="
+ SITE_SHORT_NAME_INVITE;
MockHttpServletResponse response = getRequest(acceptInviteUrl,
@@ -269,12 +269,12 @@ public class InviteServiceTest extends BaseWebScriptTest
public void testRejectInvite() throws Exception
{
- // inviter starts invite workflow
+ // inviter starts invite (sends out invitation)
JSONObject result = startInvite(INVITEE_EMAIL, SITE_SHORT_NAME_INVITE,
Status.STATUS_OK);
- // get hold of workflow ID of started invite workflow instance
- String workflowId = result.getString("workflowId");
+ // get hold of invite ID of started invite
+ String inviteId = result.getString("inviteId");
// get hold of invitee user name that was generated as part of starting
// the invite
@@ -282,7 +282,7 @@ public class InviteServiceTest extends BaseWebScriptTest
// Invitee rejects invitation to a Site from Inviter
String rejectInviteUrl = URL_INVITERSP_SERVICE + "/"
- + INVITE_RSP_REJECT + "?workflowId=" + workflowId
+ + INVITE_RSP_REJECT + "?inviteId=" + inviteId
+ "&inviteeUserName=" + inviteeUserName + "&siteShortName="
+ SITE_SHORT_NAME_INVITE;
MockHttpServletResponse response = getRequest(rejectInviteUrl,
@@ -297,7 +297,7 @@ public class InviteServiceTest extends BaseWebScriptTest
// get hold of workflow ID of started invite workflow instance
- String inviteId = startInviteResult.getString("workflowId");
+ String inviteId = startInviteResult.getString("inviteId");
assertEquals(true, ((inviteId != null) && (inviteId.length() != 0)));