Changed validation check within 'start invite' operation (which checks that the task retrieved off the newly started workflow is the 'inviteToSite' task) to no longer look at the task title (which now picks up the title from the invite workflow message properties)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10774 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Glen Johnson
2008-09-05 12:06:14 +00:00
parent cdc0ccf4ef
commit 4bfa120a9c
3 changed files with 27 additions and 8 deletions

View File

@@ -339,6 +339,7 @@
<property name="nodeService" ref="NodeService"/>
<property name="userNameGenerator" ref="userNameGenerator"/>
<property name="passwordGenerator" ref="passwordGenerator"/>
<property name="namespaceService" ref="NamespaceService" />
</bean>
<!-- -->

View File

@@ -45,6 +45,8 @@ import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowPath;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.GUID;
import org.alfresco.web.scripts.DeclarativeWebScript;
@@ -92,6 +94,7 @@ public class Invite extends DeclarativeWebScript
private MutableAuthenticationDao mutableAuthenticationDao;
private SiteService siteService;
private NodeService nodeService;
private NamespaceService namespaceService;
// user name and password generation beans
private UserNameGenerator usernameGenerator;
@@ -191,6 +194,17 @@ public class Invite extends DeclarativeWebScript
this.nodeService = nodeService;
}
/**
* Set the namespace service property
*
* @param namespaceService
* the namespace service to set
*/
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/*
* (non-Javadoc)
*
@@ -612,10 +626,16 @@ public class Invite extends DeclarativeWebScript
"No workflow tasks where found on workflow path ID: " + wfPathId);
}
// first task in workflow task list associated with the workflow path id above
// should be "wf:inviteToSiteTask", otherwise throw web script exception
String wfTaskTitle = wfTasks.get(0).title;
if (!wfTaskTitle.equals("wf:inviteToSiteTask"))
//
// first task in workflow task list (there should only be one) associated
// with the workflow path id (above) should be "wf:inviteToSiteTask", otherwise
// throw web script exception
//
String wfTaskName = wfTasks.get(0).name;
QName wfTaskNameQName = QName.createQName(wfTaskName, this.namespaceService);
QName inviteToSiteTaskQName = InviteWorkflowModel.WF_INVITE_TASK_INVITE_TO_SITE;
if (!wfTaskNameQName.equals(inviteToSiteTaskQName))
{
throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
"First workflow task found on workflow path ID: " + wfPathId

View File

@@ -330,10 +330,8 @@ public class InviteServiceTest extends BaseWebScriptTest
String inviteeLastName, String inviteeSiteRole, String siteShortName, int expectedStatus)
throws Exception
{
// String inviteeEmail = INVITEE_EMAIL_PREFIX +
// RandomStringUtils.randomAlphanumeric(6)
// + "@" + INVITEE_EMAIL_DOMAIN;
String inviteeEmail = "glen.johnson@alfresco.com";
String inviteeEmail = INVITEE_EMAIL_PREFIX + RandomStringUtils.randomAlphanumeric(6)
+ "@" + INVITEE_EMAIL_DOMAIN;
return startInvite(inviteeFirstName, inviteeLastName, inviteeEmail, inviteeSiteRole, siteShortName,
expectedStatus);