Fixed ALF-4834: The invite task doesn't get a message set (properties.bpm_description)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23045 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2010-10-12 14:04:33 +00:00
parent e678bd935e
commit 59fd95ae98
2 changed files with 37 additions and 4 deletions

View File

@@ -5,7 +5,7 @@
invitation.error.noworkflow="Invitation workflow not found, workflow name : {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.invite.already_member="The user , {0} is already a member of {1} and cannot be invited again"
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.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}"
@@ -18,3 +18,7 @@ invitation.invitesender.email.role.SiteManager=Site Manager
invitation.invitesender.email.role.SiteCollaborator=Site Collaborator
invitation.invitesender.email.role.SiteContributor=Site Contributor
invitation.invitesender.email.role.SiteConsumer=Site Consumer
# Invitation workflow task description
invitation.nominated.workflow.description=Invitation to join {0} site
invitation.moderated.workflow.description=Request to join {0} site

View File

@@ -20,6 +20,7 @@
package org.alfresco.repo.invitation;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -68,6 +69,7 @@ import org.alfresco.util.GUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.util.PropertyCheck;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* Implementation of invitation service.
@@ -1010,7 +1012,7 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
// Get invitee person NodeRef to add as assignee
NodeRef inviteeNodeRef = this.personService.getPerson(inviteeUserName);
siteService.getSite(resourceName);
SiteInfo siteInfo = siteService.getSite(resourceName);
if (siteService.isMember(resourceName, inviteeUserName))
{
@@ -1023,11 +1025,15 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
String roleGroup = siteService.getSiteRoleGroup(resourceName, SiteModel.SITE_MANAGER);
// get the workflow description
String workflowDescription = generateWorkflowDescription(siteInfo, "invitation.moderated.workflow.description");
NodeRef wfPackage = this.workflowService.createPackage(null);
Map<QName, Serializable> workflowProps = new HashMap<QName, Serializable>(16);
workflowProps.put(WorkflowModel.ASSOC_PACKAGE, wfPackage);
workflowProps.put(WorkflowModel.ASSOC_ASSIGNEE, inviteeNodeRef);
workflowProps.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, workflowDescription);
workflowProps.put(WorkflowModelModeratedInvitation.ASSOC_GROUP_ASSIGNEE, roleGroup);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_COMMENTS, inviteeComments);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_ROLE, inviteeRole);
@@ -1257,8 +1263,13 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
{
siteDescription = siteDescription.substring(0, 255);
}
// get the workflow description
String workflowDescription = generateWorkflowDescription(siteInfo, "invitation.nominated.workflow.description");
// create workflow properties
Map<QName, Serializable> workflowProps = new HashMap<QName, Serializable>(16);
Map<QName, Serializable> workflowProps = new HashMap<QName, Serializable>(32);
workflowProps.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, workflowDescription);
workflowProps.put(WorkflowModelNominatedInvitation.WF_PROP_INVITER_USER_NAME, inviterUserName);
workflowProps.put(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_USER_NAME, inviteeUserName);
workflowProps.put(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_EMAIL, inviteeEmail);
@@ -1422,4 +1433,22 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
}
}, AuthenticationUtil.SYSTEM_USER_NAME);
}
/**
* Generates a description for the workflow
*
* @param siteInfo The site to generate a description for
* @param messageId The resource bundle key to use for the description
* @return The workflow description
*/
protected String generateWorkflowDescription(SiteInfo siteInfo, String messageId)
{
String siteTitle = siteInfo.getTitle();
if (siteTitle == null || siteTitle.length() == 0)
{
siteTitle = siteInfo.getShortName();
}
return I18NUtil.getMessage(messageId, siteTitle);
}
}