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:
Mark Rogers
2009-03-13 16:54:45 +00:00
parent 308e60373d
commit b6f80309fb
6 changed files with 56 additions and 19 deletions

View File

@@ -396,18 +396,34 @@ public class InvitationServiceImpl implements InvitationService
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();
// set the given invite ID as the workflow process ID in the workflow query
wfTaskQuery.setProcessId(invitationId);
// complete the wf:invitePendingTask along the 'cancel' transition
// because the invitation has been cancelled
InviteHelper
.completeInviteTask(
invitationId,
WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING,
WorkflowModelNominatedInvitation.WF_TRANSITION_CANCEL,
this.workflowService);
// find incomplete invite workflow tasks with given task name
wfTaskQuery.setActive(Boolean.TRUE);
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
// 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)
@@ -421,9 +437,11 @@ public class InvitationServiceImpl implements InvitationService
/**
* Get an invitation from its invitation id
* <BR />
*
* @throws InvitationExceptionNotFound
* the invitation does not exist.
* Invitations are returned which may be in progress or completed.
*
* @throws InvitationExceptionNotFound the invitation does not exist.
* @throws InvitationExceptionUserError
* @return the invitation.
*/
@@ -453,11 +471,10 @@ public class InvitationServiceImpl implements InvitationService
// This is a nominated invitation
WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
wfTaskQuery.setProcessId(invitationId);
// filter to find only the start task which contains the properties.
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
wfTaskQuery
.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_TO_SITE);
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_TO_SITE);
// query for invite workflow task associate
List<WorkflowTask> inviteStartTasks = workflowService
@@ -610,7 +627,7 @@ public class InvitationServiceImpl implements InvitationService
// query only active workflows
wfTaskQuery.setActive(Boolean.TRUE);
// pick up the start task
// pick up the pending task
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);

View File

@@ -163,7 +163,7 @@ public class InvitationServiceImplTest extends BaseAlfrescoSpringTest
String inviteeFirstName = PERSON_FIRSTNAME;
String inviteeLastName = PERSON_LASTNAME;
String inviteeEmail = "123";
String inviteeEmail = "123@alfrescotesting.com";
String inviteeUserName = null;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
@@ -256,6 +256,12 @@ public class InvitationServiceImplTest extends BaseAlfrescoSpringTest
List<Invitation> it4 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
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
*/

View File

@@ -49,6 +49,7 @@ import java.util.Map;
private String inviteeFirstName;
private String inviteeLastName;
private String inviteeEmail;
private String inviterUserName;
private String roleName;
private String serverPath;
private String acceptUrl;
@@ -76,6 +77,7 @@ import java.util.Map;
inviteeFirstName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_FIRSTNAME);
inviteeLastName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_LASTNAME);
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);
setResourceName( (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME));
@@ -176,4 +178,12 @@ import java.util.Map;
return inviteeUserName;
}
public String getInviterUserName() {
return inviterUserName;
}
public void setInviterUserName(String inviterUserName) {
this.inviterUserName= inviterUserName;
}
}

View File

@@ -66,7 +66,7 @@ public class InviteHelper
// set process name to "wf:invite" so that only tasks associated with
// 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
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);

View File

@@ -56,6 +56,8 @@ public interface NominatedInvitation extends Invitation
public String getRejectUrl();
public Date getSentInviteDate();
public String getInviterUserName();
public String getTicket();