mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Removed exception handling from invitation patch.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14809 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,6 +31,8 @@ import java.util.Map;
|
|||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
import org.alfresco.repo.invitation.InvitationServiceImpl;
|
import org.alfresco.repo.invitation.InvitationServiceImpl;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||||
|
|
||||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||||
import org.alfresco.repo.invitation.site.AcceptInviteAction;
|
import org.alfresco.repo.invitation.site.AcceptInviteAction;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
@@ -114,33 +116,22 @@ public class InvitationMigrationPatch extends AbstractPatch
|
|||||||
@Override
|
@Override
|
||||||
protected String applyInternal() throws Exception
|
protected String applyInternal() throws Exception
|
||||||
{
|
{
|
||||||
List<WorkflowInstance> currentInstances = null;
|
|
||||||
try
|
WorkflowDefinition def = workflowService.getDefinitionByName(OldInviteModel.WORKFLOW_DEFINITION_NAME);
|
||||||
|
|
||||||
|
if(def != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get the process properties.
|
// Get the process properties.
|
||||||
currentInstances = workflowService.getActiveWorkflows(OldInviteModel.WF_PROCESS_INVITE.toPrefixString());
|
List<WorkflowInstance> currentInstances = workflowService.getActiveWorkflows(def.getId());
|
||||||
}
|
|
||||||
catch (WorkflowException we)
|
|
||||||
{
|
|
||||||
logger.debug("no invites to cancel" , we);
|
|
||||||
String msg = I18NUtil.getMessage(MSG_NO_INVITES);
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(WorkflowInstance oldInstance : currentInstances)
|
for(WorkflowInstance oldInstance : currentInstances)
|
||||||
{
|
{
|
||||||
String oldWorkflowId = oldInstance.id;
|
String oldWorkflowId = oldInstance.id;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
convertOldInvite(oldWorkflowId);
|
convertOldInvite(oldWorkflowId);
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// swallow error - a lost invitation is not a show stopper
|
|
||||||
logger.error("unable to re-invite oldInstance:" + oldWorkflowId, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cancel the old workflow instance
|
// Cancel the old workflow instance
|
||||||
workflowService.cancelWorkflow(oldWorkflowId);
|
workflowService.cancelWorkflow(oldWorkflowId);
|
||||||
@@ -152,6 +143,13 @@ public class InvitationMigrationPatch extends AbstractPatch
|
|||||||
String msg = I18NUtil.getMessage(MSG_SUCCESS, count);
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, count);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.debug("no invites to cancel");
|
||||||
|
String msg = I18NUtil.getMessage(MSG_NO_INVITES);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setWorkflowService(WorkflowService workflowService)
|
public void setWorkflowService(WorkflowService workflowService)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user