Files
alfresco-community-repo/source/java/org/alfresco/web/bean/wcm/ManageLinkValidationTaskDialog.java
Derek Hulley 97b5b391c8 Merged V2.1 to HEAD
6436: Support for virtualized cookie paths, aggressive cleanup of sockets when virt server is down.
   6439: Fix for WCM-619 & WCM-571
   6440: Encoding of text/html files created inline using the web-client now has sensible default. AWC-1324.
   6442: Fix for WCM-621 (reviewer can not view or run links report)
   6443: Fix for AWC-1488. Dashboard
   6444: Fix for WCM-693 issue with submitting a deleted directory if no workflow associated with web project.
   6445: Icons for use in fix for WCM-522
   6446: Office Add-Ins: Fix for AWC-1481 - Login dialog can appear recursively


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6733 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2007-09-10 22:07:27 +00:00

146 lines
5.2 KiB
Java

/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.linkvalidation.LinkValidationReport;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.sandbox.SandboxConstants;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.workflow.ManageTaskDialog;
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 link validation related WCM tasks.
*
* @author gavinc
*/
public class ManageLinkValidationTaskDialog extends ManageTaskDialog
{
protected String store;
protected String webapp;
protected AVMBrowseBean avmBrowseBean;
private static final Log logger = LogFactory.getLog(ManageLinkValidationTaskDialog.class);
// ------------------------------------------------------------------------------
// Implementation
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
// reset any previous link validation state
this.avmBrowseBean.setLinkValidationState(null);
this.avmBrowseBean.setLinkValidationMonitor(null);
// try and retrieve the deployment report from the workflow
// store, if present setup the validation state on AVMBrowseBean
String storeName = this.workflowPackage.getStoreRef().getIdentifier();
if (logger.isDebugEnabled())
logger.debug("Retrieving link validation report from store '" + storeName + "'");
PropertyValue val = this.avmService.getStoreProperty(storeName,
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
if (val != null)
{
LinkValidationReport report = (LinkValidationReport)val.getSerializableValue();
if (report != null)
{
this.store = report.getStore();
this.webapp = report.getWebapp();
if (logger.isDebugEnabled())
logger.debug("Found link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
LinkValidationState state = new LinkValidationState(report);
this.avmBrowseBean.setLinkValidationState(state);
if (logger.isDebugEnabled())
logger.debug("Stored link validation state: " + state);
}
}
// commit the changes
tx.commit();
}
catch (Throwable e)
{
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e), e);
}
}
// ------------------------------------------------------------------------------
// Event handlers
public String viewLinkReport()
{
if (logger.isDebugEnabled())
logger.debug("Viewing link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
Map<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
params.put("webapp", this.webapp);
params.put("compareToStaging", "true");
Application.getDialogManager().setupParameters(params);
return "dialog:linkValidation";
}
// ------------------------------------------------------------------------------
// Getters and Setters
/**
* @param avmBrowseBean AVMBrowseBean instance
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
}