diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml
index cec2581437..82e57294a7 100644
--- a/config/alfresco/web-scripts-application-context.xml
+++ b/config/alfresco/web-scripts-application-context.xml
@@ -327,7 +327,6 @@
parent="webscript">
-
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/InviteHelper.java b/source/java/org/alfresco/repo/web/scripts/invite/InviteHelper.java
index ac69417298..a3547968b0 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/InviteHelper.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/InviteHelper.java
@@ -24,7 +24,6 @@
*/
package org.alfresco.repo.web.scripts.invite;
-import java.util.Date;
import java.util.List;
import org.alfresco.service.cmr.workflow.WorkflowService;
@@ -93,53 +92,4 @@ public class InviteHelper
return inviteeSiteRole;
}
}
-
- /**
- * Gets the date that the invite, with the given invite ID, was sent to the invitee
- *
- * @param inviteId the ID of the invitation
- * from which to retrieve the sent date
- * @return the date that the invite was sent to the invitee
- * Returns
null
if no invitation
- * found matching the given invite ID
- */
- static Date getSentDateFromInvite(String inviteId, WorkflowService workflowService,
- NamespaceService namespaceService)
- {
- // create workflow task query
- WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
-
- wfTaskQuery.setProcessId(inviteId);
-
- // set process name to "wf:invite" so that only tasks associated with
- // invite workflow instances are returned by query
- wfTaskQuery.setProcessName(QName.createQName("wf:invite", namespaceService));
-
- // pick up the start task because it has the "wf:inviteeSiteRole" property set with the
- // site role value that we want to retrieve
- wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
- wfTaskQuery.setTaskName(QName.createQName(Invite.WF_INVITE_TASK_INVITE_TO_SITE, namespaceService));
-
- // query for invite workflow task associate
- List inviteStartTasks = workflowService
- .queryTasks(wfTaskQuery);
-
- // if no results were returned for given inviteID, then return
- // site role as null
- if (inviteStartTasks.size() == 0)
- {
- return null;
- }
- else
- {
- // there should be only one start task returned for the given invite ID
- // so just take the first one in the list
- WorkflowTask inviteStartTask = inviteStartTasks.get(0);
-
- Date sentInviteDate = (Date) inviteStartTask.properties.get(
- QName.createQName(Invite.WF_PROP_SENT_INVITE_DATE, namespaceService));
-
- return sentInviteDate;
- }
- }
}
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/InviteInfo.java b/source/java/org/alfresco/repo/web/scripts/invite/InviteInfo.java
index 3fca2fd536..544997c2a6 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/InviteInfo.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/InviteInfo.java
@@ -102,25 +102,53 @@ public class InviteInfo
return inviteId;
}
- public ScriptNode getInviteePerson() {
+ /**
+ * Gets the invitee person
+ *
+ * @return the invitee person
+ */
+ public ScriptNode getInviteePerson()
+ {
return inviteePerson;
}
- public ScriptNode getInviterPerson() {
+ /**
+ * Gets the inviter person
+ *
+ * @return the inviter person
+ */
+ public ScriptNode getInviterPerson()
+ {
return inviterPerson;
}
- public Date getSentInviteDate() {
+ /**
+ * Gets the sent invite date
+ *
+ * @return the sent invite date
+ */
+ public Date getSentInviteDate()
+ {
return sentInviteDate;
}
- public String getInvitationStatus() {
+ /**
+ * Gets the invitation status
+ *
+ * @return the invitation status
+ */
+ public String getInvitationStatus()
+ {
return invitationStatus;
}
- public String getRole() {
+ /**
+ * Gets the role that invitee has been invited to the site as
+ *
+ * @return the role that the invitee has been invited to the site as
+ */
+ public String getRole()
+ {
return role;
}
-
-
}
diff --git a/source/java/org/alfresco/repo/web/scripts/invite/Invites.java b/source/java/org/alfresco/repo/web/scripts/invite/Invites.java
index 96db4cfda0..76ab6e5a2d 100644
--- a/source/java/org/alfresco/repo/web/scripts/invite/Invites.java
+++ b/source/java/org/alfresco/repo/web/scripts/invite/Invites.java
@@ -31,7 +31,6 @@ import java.util.List;
import java.util.Map;
import org.alfresco.repo.jscript.ScriptNode;
-import org.alfresco.repo.site.SiteService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.PersonService;
@@ -77,12 +76,16 @@ public class Invites extends DeclarativeWebScript
// model key names
private static final String MODEL_KEY_NAME_INVITES = "invites";
+
+ // invitation statuses
+ private static final String INVITATION_STATUS_PENDING = "pending";
+ private static final String INVITATION_STATUS_ACCEPTED = "accepted";
+ private static final String INVITATION_STATUS_REJECTED = "rejected";
// service instances
private WorkflowService workflowService;
private NamespaceService namespaceService;
private PersonService personService;
- private SiteService siteService;
private ServiceRegistry serviceRegistry;
/**
@@ -115,10 +118,6 @@ public class Invites extends DeclarativeWebScript
this.serviceRegistry = serviceRegistry;
}
- public void setSiteService(SiteService siteService) {
- this.siteService = siteService;
- }
-
/*
* (non-Javadoc)
*
@@ -261,14 +260,16 @@ public class Invites extends DeclarativeWebScript
// as "inviteId" onto model
String workflowId = workflowTask.path.instance.id;
- // TODO: fetch correct workflow start date
- Date sentInviteDate = new Date();
+ // set the invite start date to the time the workflow instance
+ // (associated with the task) was started
+ Date sentInviteDate = workflowTask.path.instance.startDate;
- // TODO: fetchh correct role
- String role = "SiteManager";
+ // get role that invitee was invited to the site as
+ String role = InviteHelper.getInviteeSiteRoleFromInvite(inviteId, workflowService, namespaceService);
- // TODO: assign correct state
- String invitationStatus = "pending"; // "accepted", "declined"
+ // TODO: glen johnson at alfresco com - as this web script only returns
+ // pending invites, this is hard coded to "pending" for now
+ String invitationStatus = INVITATION_STATUS_PENDING;
// check whether we can find a person node for inviter/invitee
NodeRef inviterRef = personService.getPerson(inviterUserNameProp);