mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Removing over old invite service implementation to new service. And our first "deprecated" web script.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13628 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Invitation service
|
# Invitation service messages
|
||||||
#
|
#
|
||||||
|
|
||||||
invitation.error.noworkflow "Invitation workflow not found, workflow name : {0}"
|
invitation.error.noworkflow "Invitation workflow not found, workflow name : {0}"
|
||||||
invitation.error.not_found "Invitation not found, invitationId: {0}"
|
invitation.error.not_found "Invitation not found, invitationId: {0}"
|
||||||
invitation.error.invalid_inviteId_format "Invitation Id not valid format, valid formats are <engine>$<id> : {0}"
|
invitation.error.invalid_inviteId_format "Invitation Id not valid format, valid formats are <engine>$<id> : {0}"
|
||||||
|
invitation.invite.already_member "The user , {0} is already a member of {1} and cannot be invited again"
|
||||||
invitation.cancel.not_site_manager "Current user, {0}, cannot cancel invitation: {1} because they are not a Site Manager for site: {2}
|
invitation.cancel.not_site_manager "Current user, {0}, cannot cancel invitation: {1} because they are not a Site Manager for site: {2}
|
||||||
|
invitation.invite.not_site_manager "Current user, {0}, is not a Site Manager for site: {1}
|
||||||
invitation.invite.unable_generate_id "Unable to generate a user name for invitee, which doesn't already belong to someone else firstName:{0} lastName:{1} email:{2}"
|
invitation.invite.unable_generate_id "Unable to generate a user name for invitee, which doesn't already belong to someone else firstName:{0} lastName:{1} email:{2}"
|
@@ -396,18 +396,34 @@ public class InvitationServiceImpl implements InvitationService
|
|||||||
|
|
||||||
if (invitation instanceof NominatedInvitation) {
|
if (invitation instanceof NominatedInvitation) {
|
||||||
|
|
||||||
// TODO Who is allowed to cancel ??
|
// Check canceller is a site manager
|
||||||
|
String approverUserName = this.authenticationService.getCurrentUserName();
|
||||||
|
checkManagerRole(approverUserName, invitation.getResourceType(), invitation.getResourceName());
|
||||||
|
|
||||||
// Should you be allowed to cancel multiple times ?
|
// create workflow task query
|
||||||
|
WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
|
||||||
|
|
||||||
// complete the wf:invitePendingTask along the 'cancel' transition
|
// set the given invite ID as the workflow process ID in the workflow query
|
||||||
// because the invitation has been cancelled
|
wfTaskQuery.setProcessId(invitationId);
|
||||||
InviteHelper
|
|
||||||
.completeInviteTask(
|
// find incomplete invite workflow tasks with given task name
|
||||||
invitationId,
|
wfTaskQuery.setActive(Boolean.TRUE);
|
||||||
WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING,
|
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
|
||||||
WorkflowModelNominatedInvitation.WF_TRANSITION_CANCEL,
|
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
|
||||||
this.workflowService);
|
|
||||||
|
// set process name to "wf:invite" so that only
|
||||||
|
// invite workflow instances are considered by this query
|
||||||
|
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
||||||
|
|
||||||
|
// query for invite workflow tasks with the constructed query
|
||||||
|
List<WorkflowTask> wf_invite_tasks = workflowService
|
||||||
|
.queryTasks(wfTaskQuery);
|
||||||
|
|
||||||
|
// end all tasks found with this name
|
||||||
|
for (WorkflowTask workflowTask : wf_invite_tasks)
|
||||||
|
{
|
||||||
|
workflowService.endTask(workflowTask.id, WorkflowModelNominatedInvitation.WF_TRANSITION_CANCEL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invitation instanceof ModeratedInvitation)
|
if (invitation instanceof ModeratedInvitation)
|
||||||
@@ -421,9 +437,11 @@ public class InvitationServiceImpl implements InvitationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an invitation from its invitation id
|
* Get an invitation from its invitation id
|
||||||
|
* <BR />
|
||||||
*
|
*
|
||||||
* @throws InvitationExceptionNotFound
|
* Invitations are returned which may be in progress or completed.
|
||||||
* the invitation does not exist.
|
*
|
||||||
|
* @throws InvitationExceptionNotFound the invitation does not exist.
|
||||||
* @throws InvitationExceptionUserError
|
* @throws InvitationExceptionUserError
|
||||||
* @return the invitation.
|
* @return the invitation.
|
||||||
*/
|
*/
|
||||||
@@ -456,8 +474,7 @@ public class InvitationServiceImpl implements InvitationService
|
|||||||
|
|
||||||
// filter to find only the start task which contains the properties.
|
// filter to find only the start task which contains the properties.
|
||||||
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
|
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
|
||||||
wfTaskQuery
|
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_TO_SITE);
|
||||||
.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_TO_SITE);
|
|
||||||
|
|
||||||
// query for invite workflow task associate
|
// query for invite workflow task associate
|
||||||
List<WorkflowTask> inviteStartTasks = workflowService
|
List<WorkflowTask> inviteStartTasks = workflowService
|
||||||
@@ -610,7 +627,7 @@ public class InvitationServiceImpl implements InvitationService
|
|||||||
// query only active workflows
|
// query only active workflows
|
||||||
wfTaskQuery.setActive(Boolean.TRUE);
|
wfTaskQuery.setActive(Boolean.TRUE);
|
||||||
|
|
||||||
// pick up the start task
|
// pick up the pending task
|
||||||
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
|
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
|
||||||
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
|
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
|
||||||
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
||||||
|
@@ -163,7 +163,7 @@ public class InvitationServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
|
|
||||||
String inviteeFirstName = PERSON_FIRSTNAME;
|
String inviteeFirstName = PERSON_FIRSTNAME;
|
||||||
String inviteeLastName = PERSON_LASTNAME;
|
String inviteeLastName = PERSON_LASTNAME;
|
||||||
String inviteeEmail = "123";
|
String inviteeEmail = "123@alfrescotesting.com";
|
||||||
String inviteeUserName = null;
|
String inviteeUserName = null;
|
||||||
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
String resourceName = SITE_SHORT_NAME_INVITE;
|
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||||
@@ -256,6 +256,12 @@ public class InvitationServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
List<Invitation> it4 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
List<Invitation> it4 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
assertTrue("invitations is not empty", it4.isEmpty());
|
assertTrue("invitations is not empty", it4.isEmpty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now get the invitation that we accepted
|
||||||
|
*/
|
||||||
|
NominatedInvitation acceptedInvitation2 = (NominatedInvitation)invitationService.getInvitation(firstInvite.getInviteId());
|
||||||
|
assertNotNull("get after accept does not return", acceptedInvitation2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Now verify access control list
|
* Now verify access control list
|
||||||
*/
|
*/
|
||||||
|
@@ -49,6 +49,7 @@ import java.util.Map;
|
|||||||
private String inviteeFirstName;
|
private String inviteeFirstName;
|
||||||
private String inviteeLastName;
|
private String inviteeLastName;
|
||||||
private String inviteeEmail;
|
private String inviteeEmail;
|
||||||
|
private String inviterUserName;
|
||||||
private String roleName;
|
private String roleName;
|
||||||
private String serverPath;
|
private String serverPath;
|
||||||
private String acceptUrl;
|
private String acceptUrl;
|
||||||
@@ -76,6 +77,7 @@ import java.util.Map;
|
|||||||
inviteeFirstName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_FIRSTNAME);
|
inviteeFirstName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_FIRSTNAME);
|
||||||
inviteeLastName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_LASTNAME);
|
inviteeLastName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_LASTNAME);
|
||||||
inviteeEmail = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_EMAIL);
|
inviteeEmail = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_EMAIL);
|
||||||
|
inviterUserName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITER_USER_NAME);
|
||||||
// inviteePassword = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_GEN_PASSWORD);
|
// inviteePassword = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_GEN_PASSWORD);
|
||||||
setResourceName( (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME));
|
setResourceName( (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME));
|
||||||
|
|
||||||
@@ -176,4 +178,12 @@ import java.util.Map;
|
|||||||
return inviteeUserName;
|
return inviteeUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInviterUserName() {
|
||||||
|
return inviterUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviterUserName(String inviterUserName) {
|
||||||
|
this.inviterUserName= inviterUserName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ public class InviteHelper
|
|||||||
|
|
||||||
// set process name to "wf:invite" so that only tasks associated with
|
// set process name to "wf:invite" so that only tasks associated with
|
||||||
// invite workflow instances are returned by query
|
// invite workflow instances are returned by query
|
||||||
wfTaskQuery.setProcessName(QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "invite"));
|
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
||||||
|
|
||||||
// filter to find only the invite start task
|
// filter to find only the invite start task
|
||||||
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
|
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
|
||||||
|
@@ -57,6 +57,8 @@ public interface NominatedInvitation extends Invitation
|
|||||||
|
|
||||||
public Date getSentInviteDate();
|
public Date getSentInviteDate();
|
||||||
|
|
||||||
|
public String getInviterUserName();
|
||||||
|
|
||||||
public String getTicket();
|
public String getTicket();
|
||||||
|
|
||||||
public String getRoleName();
|
public String getRoleName();
|
||||||
|
Reference in New Issue
Block a user