mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Various Invite Service fixes
- removed unnecessary siteService property from 'invites' web script - removed unnecessary getSentDateFromInvite(...)) method from InviteHelper.java - added comments to property getters in InviteInfo.java - return sentInviteDate, inviteeSiteRole and invitationStatus from 'invites' Web Script git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10493 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -327,7 +327,6 @@
|
|||||||
parent="webscript">
|
parent="webscript">
|
||||||
<property name="workflowService" ref="WorkflowService"/>
|
<property name="workflowService" ref="WorkflowService"/>
|
||||||
<property name="namespaceService" ref="NamespaceService"/>
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
<property name="siteService" ref="SiteService"/>
|
|
||||||
<property name="personService" ref="PersonService"/>
|
<property name="personService" ref="PersonService"/>
|
||||||
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.web.scripts.invite;
|
package org.alfresco.repo.web.scripts.invite;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
@@ -93,53 +92,4 @@ public class InviteHelper
|
|||||||
return inviteeSiteRole;
|
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 <pre>null</pre> 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<WorkflowTask> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -102,25 +102,53 @@ public class InviteInfo
|
|||||||
return inviteId;
|
return inviteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptNode getInviteePerson() {
|
/**
|
||||||
|
* Gets the invitee person
|
||||||
|
*
|
||||||
|
* @return the invitee person
|
||||||
|
*/
|
||||||
|
public ScriptNode getInviteePerson()
|
||||||
|
{
|
||||||
return inviteePerson;
|
return inviteePerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptNode getInviterPerson() {
|
/**
|
||||||
|
* Gets the inviter person
|
||||||
|
*
|
||||||
|
* @return the inviter person
|
||||||
|
*/
|
||||||
|
public ScriptNode getInviterPerson()
|
||||||
|
{
|
||||||
return inviterPerson;
|
return inviterPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getSentInviteDate() {
|
/**
|
||||||
|
* Gets the sent invite date
|
||||||
|
*
|
||||||
|
* @return the sent invite date
|
||||||
|
*/
|
||||||
|
public Date getSentInviteDate()
|
||||||
|
{
|
||||||
return sentInviteDate;
|
return sentInviteDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInvitationStatus() {
|
/**
|
||||||
|
* Gets the invitation status
|
||||||
|
*
|
||||||
|
* @return the invitation status
|
||||||
|
*/
|
||||||
|
public String getInvitationStatus()
|
||||||
|
{
|
||||||
return invitationStatus;
|
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;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.repo.jscript.ScriptNode;
|
import org.alfresco.repo.jscript.ScriptNode;
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
@@ -78,11 +77,15 @@ public class Invites extends DeclarativeWebScript
|
|||||||
// model key names
|
// model key names
|
||||||
private static final String MODEL_KEY_NAME_INVITES = "invites";
|
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
|
// service instances
|
||||||
private WorkflowService workflowService;
|
private WorkflowService workflowService;
|
||||||
private NamespaceService namespaceService;
|
private NamespaceService namespaceService;
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
private SiteService siteService;
|
|
||||||
private ServiceRegistry serviceRegistry;
|
private ServiceRegistry serviceRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,10 +118,6 @@ public class Invites extends DeclarativeWebScript
|
|||||||
this.serviceRegistry = serviceRegistry;
|
this.serviceRegistry = serviceRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSiteService(SiteService siteService) {
|
|
||||||
this.siteService = siteService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
@@ -261,14 +260,16 @@ public class Invites extends DeclarativeWebScript
|
|||||||
// as "inviteId" onto model
|
// as "inviteId" onto model
|
||||||
String workflowId = workflowTask.path.instance.id;
|
String workflowId = workflowTask.path.instance.id;
|
||||||
|
|
||||||
// TODO: fetch correct workflow start date
|
// set the invite start date to the time the workflow instance
|
||||||
Date sentInviteDate = new Date();
|
// (associated with the task) was started
|
||||||
|
Date sentInviteDate = workflowTask.path.instance.startDate;
|
||||||
|
|
||||||
// TODO: fetchh correct role
|
// get role that invitee was invited to the site as
|
||||||
String role = "SiteManager";
|
String role = InviteHelper.getInviteeSiteRoleFromInvite(inviteId, workflowService, namespaceService);
|
||||||
|
|
||||||
// TODO: assign correct state
|
// TODO: glen johnson at alfresco com - as this web script only returns
|
||||||
String invitationStatus = "pending"; // "accepted", "declined"
|
// 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
|
// check whether we can find a person node for inviter/invitee
|
||||||
NodeRef inviterRef = personService.getPerson(inviterUserNameProp);
|
NodeRef inviterRef = personService.getPerson(inviterUserNameProp);
|
||||||
|
Reference in New Issue
Block a user