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:
Mark Rogers
2009-06-19 14:50:58 +00:00
parent 7b1fdf1d2f
commit ceb954c0f1

View File

@@ -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,43 +116,39 @@ 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;
for(WorkflowInstance oldInstance : currentInstances) int count = 0;
{
String oldWorkflowId = oldInstance.id;
try for(WorkflowInstance oldInstance : currentInstances)
{ {
String oldWorkflowId = oldInstance.id;
convertOldInvite(oldWorkflowId); convertOldInvite(oldWorkflowId);
}
catch (Exception e) // Cancel the old workflow instance
{ workflowService.cancelWorkflow(oldWorkflowId);
// swallow error - a lost invitation is not a show stopper
logger.error("unable to re-invite oldInstance:" + oldWorkflowId, e); count++;
} }
// Cancel the old workflow instance // build the result message
workflowService.cancelWorkflow(oldWorkflowId); String msg = I18NUtil.getMessage(MSG_SUCCESS, count);
return msg;
count++; }
else
{
logger.debug("no invites to cancel");
String msg = I18NUtil.getMessage(MSG_NO_INVITES);
return msg;
} }
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS, count);
return msg;
} }
public void setWorkflowService(WorkflowService workflowService) public void setWorkflowService(WorkflowService workflowService)