Merged V2.2 to HEAD

7462: Renamed ManageLinkValidationTaskDialog to ManageReviewTaskDialog as it is now more generic
         Enabled deployment and link validation in parallel review tasks
         Created separate JSP page for manage change request task dialog
         When a server is edited it is now scrolled to
         Some minor UI tidyup
   7467: Added ability to define excludes for a deployment via a regular expression
   7475: Incorporated new icons from Linton
   7492: Allows multiple callbacks for deployment. Adds new FAILED deployment event.
   7493: Added ability to view previous deployment attempts


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8380 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-02-26 14:19:37 +00:00
parent 6ce387a808
commit 4780da35d5
22 changed files with 6555 additions and 5687 deletions

View File

@@ -1462,9 +1462,9 @@ public class AVMBrowseBean implements IContextListener
}
/**
* Removes all deploymentreport nodes associated with the web project
* Deletes all deploymentreport nodes associated with the web project
*/
public String resetDeploymentHistory()
public String deleteAllDeploymentReports()
{
FacesContext context = FacesContext.getCurrentInstance();
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);

View File

@@ -49,6 +49,7 @@ public final class DeploymentServerConfig implements Serializable
public static final String PROP_URL = "url";
public static final String PROP_SOURCE_PATH = "sourcePath";
public static final String PROP_TARGET_NAME = "targetName";
public static final String PROP_EXCLUDES = "excludes";
public static final String PROP_ALLOCATED_TO = "allocatedTo";
public static final String PROP_ON_APPROVAL = "onApproval";
@@ -153,6 +154,11 @@ public final class DeploymentServerConfig implements Serializable
repoProps.put(WCMAppModel.PROP_DEPLOYSOURCEPATH, (Serializable)this.props.get(PROP_SOURCE_PATH));
}
if (this.props.get(PROP_EXCLUDES) != null && ((String)this.props.get(PROP_EXCLUDES)).length() > 0)
{
repoProps.put(WCMAppModel.PROP_DEPLOYEXCLUDES, (Serializable)this.props.get(PROP_EXCLUDES));
}
if (this.props.get(PROP_ALLOCATED_TO) != null && ((String)this.props.get(PROP_ALLOCATED_TO)).length() > 0)
{
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, (Serializable)this.props.get(PROP_ALLOCATED_TO));
@@ -217,6 +223,11 @@ public final class DeploymentServerConfig implements Serializable
this.props.put(PROP_SOURCE_PATH, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH));
}
if (repoProps.get(WCMAppModel.PROP_DEPLOYEXCLUDES) != null)
{
this.props.put(PROP_EXCLUDES, (String)repoProps.get(WCMAppModel.PROP_DEPLOYEXCLUDES));
}
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO) != null)
{
this.props.put(PROP_ALLOCATED_TO, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO));

View File

@@ -25,6 +25,9 @@
package org.alfresco.web.bean.wcm;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.faces.context.FacesContext;
@@ -34,6 +37,7 @@ import org.alfresco.model.WCMAppModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.util.ISO9075;
@@ -52,7 +56,28 @@ public final class DeploymentUtil
{
private static final Log logger = LogFactory.getLog(DeploymentUtil.class);
/**
* Returns all deployment attempts for the given store
*
* @param store The store to get the deployment attempts for
* @return List of NodeRef's representing the deployment attempts
*/
public static List<NodeRef> findDeploymentAttempts(String store)
{
// return all deployment attempts
return findDeploymentAttempts(store, null, null);
}
/**
* Returns all deployment attempts for the given store
*
* @param store The store to get the deployment attempts for
* @param fromDate If present only attempts after the given date are returned
* @param toDate If present only attempts before the given date are returned, if null
* toDate defaults to today's date
* @return List of NodeRef's representing the deployment attempts
*/
public static List<NodeRef> findDeploymentAttempts(String store, Date fromDate, Date toDate)
{
FacesContext fc = FacesContext.getCurrentInstance();
SearchService searchService = Repository.getServiceRegistry(fc).getSearchService();
@@ -66,14 +91,79 @@ public final class DeploymentUtil
query.append(":\"");
query.append(store);
query.append("\"");
// constrain the search by date if a fromDate is applied
if (fromDate != null)
{
if (toDate == null)
{
toDate = new Date();
}
// see if the dates are the same (ignoring the time)
boolean sameDate = false;
Calendar fromCal = new GregorianCalendar();
fromCal.setTime(fromDate);
Calendar toCal = new GregorianCalendar();
toCal.setTime(toDate);
if ((fromCal.get(Calendar.YEAR) == toCal.get(Calendar.YEAR)) &&
(fromCal.get(Calendar.MONTH) == toCal.get(Calendar.MONTH)) &&
(fromCal.get(Calendar.DAY_OF_MONTH) == toCal.get(Calendar.DAY_OF_MONTH)))
{
sameDate = true;
}
// add date to query
query.append(" AND @");
query.append(NamespaceService.WCMAPP_MODEL_PREFIX);
query.append("\\:");
query.append(WCMAppModel.PROP_DEPLOYATTEMPTTIME.getLocalName());
query.append(":");
if (sameDate)
{
// convert date into format needed for range query
String queryDate = formatLuceneQueryDate(fromDate, false);
// query for exact date
query.append("\"");
query.append(queryDate);
query.append("\"");
}
else
{
// convert to date into format needed for range query
String queryFromDate = formatLuceneQueryDate(fromDate, true);
String queryToDate = formatLuceneQueryDate(toDate, true);
// create a date range query
query.append("[");
query.append(queryFromDate);
query.append(" TO ");
query.append(queryToDate);
query.append("]");
}
}
if (logger.isDebugEnabled())
logger.debug("Finding deploymentattempt nodes using query: " + query.toString());
ResultSet results = null;
List<NodeRef> attempts = new ArrayList<NodeRef>();
try
{
// sort the results by deploymentattempttime
SearchParameters sp = new SearchParameters();
sp.addStore(Repository.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(query.toString());
sp.addSort("@" + WCMAppModel.PROP_DEPLOYATTEMPTTIME, false);
// execute the query
results = searchService.query(Repository.getStoreRef(),
SearchService.LANGUAGE_LUCENE, query.toString());
results = searchService.query(sp);
if (logger.isDebugEnabled())
logger.debug("Found " + results.length() + " deployment attempts");
for (NodeRef attempt : results.getNodeRefs())
{
@@ -218,7 +308,6 @@ public final class DeploymentUtil
return findServers(webProject, false, availableOnly);
}
private static List<NodeRef> findServers(NodeRef webProject, boolean live, boolean availableOnly)
{
FacesContext context = FacesContext.getCurrentInstance();
@@ -257,6 +346,9 @@ public final class DeploymentUtil
query.append("\"");
}
if (logger.isDebugEnabled())
logger.debug("Finding deployment servers using query: " + query.toString());
// execute the query
ResultSet results = null;
List<NodeRef> servers = new ArrayList<NodeRef>();
@@ -265,6 +357,9 @@ public final class DeploymentUtil
results = searchService.query(Repository.getStoreRef(),
SearchService.LANGUAGE_LUCENE, query.toString());
if (logger.isDebugEnabled())
logger.debug("Found " + results.length() + " deployment servers");
for (NodeRef server : results.getNodeRefs())
{
servers.add(server);
@@ -280,4 +375,28 @@ public final class DeploymentUtil
return servers;
}
private static String formatLuceneQueryDate(Date date, boolean range)
{
Calendar cal = new GregorianCalendar();
cal.setTime(date);
StringBuilder queryDate = new StringBuilder();
queryDate.append(cal.get(Calendar.YEAR));
if (range)
{
queryDate.append("\\");
}
queryDate.append("-");
queryDate.append((cal.get(Calendar.MONTH)+1));
if (range)
{
queryDate.append("\\");
}
queryDate.append("-");
queryDate.append(cal.get(Calendar.DAY_OF_MONTH));
queryDate.append("T00:00:00");
return queryDate.toString();
}
}

View File

@@ -77,10 +77,6 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog
{
super.init(parameters);
// reset any link validation state from other WCM task dialogs
this.avmBrowseBean.setLinkValidationState(null);
this.avmBrowseBean.setLinkValidationMonitor(null);
// reset the doResubmit flag
this.doResubmitNow = false;
}

View File

@@ -32,7 +32,6 @@ import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.linkvalidation.LinkValidationReport;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.sandbox.SandboxConstants;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -45,11 +44,11 @@ import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Manage Task" dialog when dealing
* with link validation related WCM tasks.
* with review related WCM tasks.
*
* @author gavinc
*/
public class ManageLinkValidationTaskDialog extends ManageTaskDialog
public class ManageReviewTaskDialog extends ManageTaskDialog
{
private static final long serialVersionUID = 59524560340308134L;
@@ -58,7 +57,7 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
protected NodeRef webProjectRef;
protected AVMBrowseBean avmBrowseBean;
private static final Log logger = LogFactory.getLog(ManageLinkValidationTaskDialog.class);
private static final Log logger = LogFactory.getLog(ManageReviewTaskDialog.class);
// ------------------------------------------------------------------------------
// Implementation
@@ -88,9 +87,6 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
String stagingStore = AVMUtil.getStoreId(this.store);
this.webProjectRef = AVMUtil.getWebProjectNodeFromStore(stagingStore);
if (logger.isDebugEnabled())
logger.debug("Retrieving link validation report from store '" + this.store + "'");
PropertyValue val = this.getAvmService().getStoreProperty(this.store,
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
if (val != null)
@@ -130,8 +126,8 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
public String viewLinkReport()
{
if (logger.isDebugEnabled())
logger.debug("Viewing link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
logger.debug("Viewing link validation report for: " +
AVMUtil.buildStoreWebappPath(this.store, this.webapp));
Map<String, String> params = new HashMap<String, String>(3);
params.put("store", this.store);

View File

@@ -24,12 +24,18 @@
*/
package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.common.component.UIModeList;
import org.alfresco.web.ui.wcm.component.UIDeploymentReports;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,6 +49,10 @@ public class ViewDeploymentReportDialog extends BaseDialogBean
private static final long serialVersionUID = -8054466371051782132L;
protected String store;
protected NodeRef attempt;
protected String attemptDate;
protected boolean panelExpanded = false;
protected String dateFilter = UIDeploymentReports.FILTER_DATE_WEEK;
private static final Log logger = LogFactory.getLog(ViewDeploymentReportDialog.class);
@@ -55,6 +65,10 @@ public class ViewDeploymentReportDialog extends BaseDialogBean
super.init(parameters);
this.store = parameters.get("store");
this.dateFilter = UIDeploymentReports.FILTER_DATE_WEEK;
this.panelExpanded = false;
this.attempt = null;
this.attemptDate = null;
if (this.store == null || this.store.length() == 0)
{
@@ -78,14 +92,105 @@ public class ViewDeploymentReportDialog extends BaseDialogBean
return outcome;
}
@Override
public String getContainerDescription()
{
String desc = null;
if (attempt == null)
{
desc = Application.getMessage(FacesContext.getCurrentInstance(),
"deployment_report_desc");
}
else
{
desc = Application.getMessage(FacesContext.getCurrentInstance(),
"deployment_previous_report_desc");
}
return desc;
}
@Override
public String getContainerTitle()
{
String title = null;
if (attempt == null)
{
title = Application.getMessage(FacesContext.getCurrentInstance(),
"deployment_report_title");
}
else
{
String pattern = Application.getMessage(FacesContext.getCurrentInstance(),
"deployment_previous_report_title");
title = MessageFormat.format(pattern, this.attemptDate);
}
return title;
}
// ------------------------------------------------------------------------------
// Event handlers
/**
* Action handler called when the Date filter is changed by the user
*/
public void dateFilterChanged(ActionEvent event)
{
UIModeList filterComponent = (UIModeList)event.getComponent();
setDateFilter(filterComponent.getValue().toString());
}
/**
* Action handler called when a deployment attempt is selected
*/
public void attemptSelected(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String attempt = params.get("attemptRef");
if (attempt != null && attempt.length() != 0)
{
this.attemptDate = params.get("attemptDate");
this.attempt = new NodeRef(attempt);
}
}
/**
* Action handler called when the panel is expanded or collapsed
*/
public void panelToggled(ActionEvent event)
{
this.panelExpanded = !this.panelExpanded;
}
// ------------------------------------------------------------------------------
// Bean getters and setters
/**
* @return The store to show deployment reports for
*/
public String getStore()
{
return this.store;
}
public String getDateFilter()
{
return this.dateFilter;
}
public void setDateFilter(String dateFilter)
{
this.dateFilter = dateFilter;
}
public NodeRef getAttempt()
{
return this.attempt;
}
public boolean getPanelExpanded()
{
return this.panelExpanded;
}
}