/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see .
*/
package org.alfresco.web.bean.wcm;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair;
import org.alfresco.wcm.util.WCMUtil;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.workflow.ManageTaskDialog;
import org.alfresco.web.bean.workflow.WorkflowUtil;
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Manage Task" dialog when dealing
* with the "Change Request" task specifically.
*
* @author gavinc
*/
public class ManageChangeRequestTaskDialog extends ManageTaskDialog
{
private static final long serialVersionUID = -236829535702107101L;
protected boolean doResubmitNow = false;
protected AVMBrowseBean avmBrowseBean;
transient private AVMLockingService avmLockingService;
private final static Log logger = LogFactory.getLog(ManageChangeRequestTaskDialog.class);
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
public void init(Map parameters)
{
super.init(parameters);
// reset the doResubmit flag
this.doResubmitNow = false;
}
@Override
public List getAdditionalButtons()
{
List buttons = super.getAdditionalButtons();
buttons.add(new DialogButtonConfig(ID_PREFIX + "resubmit", null, "task_done_resubmit_all",
"#{DialogManager.bean.transitionAndResubmit}", "false", null));
return buttons;
}
// ------------------------------------------------------------------------------
// Event handlers
@Override
public String transition()
{
String outcome = getDefaultFinishOutcome();
if (logger.isDebugEnabled())
logger.debug("Transitioning change request task: " + this.getWorkflowTask().id);
final FacesContext context = FacesContext.getCurrentInstance();
try
{
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(FacesContext.getCurrentInstance());
RetryingTransactionCallback