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;
}
}

View File

@@ -29,7 +29,10 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.component.UIComponent;
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
@@ -51,9 +54,12 @@ import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.DeploymentUtil;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.PanelGenerator;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.repo.component.UIActions;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.StringUtils;
@@ -65,7 +71,22 @@ import org.springframework.util.StringUtils;
*/
public class UIDeploymentReports extends SelfRenderingComponent
{
// date filters
public static final String FILTER_DATE_TODAY = "today";
public static final String FILTER_DATE_YESTERDAY = "yesterday";
public static final String FILTER_DATE_WEEK = "week";
public static final String FILTER_DATE_MONTH = "month";
public static final String FILTER_DATE_ALL = "all";
protected String store;
protected String dateFilter;
protected Boolean showPrevious;
protected NodeRef attempt;
private static final String MSG_ATTEMPT_DATE = "deploy_attempt_date";
private static final String MSG_SERVERS = "deployed_to_servers";
private static final String MSG_SNAPSHOT = "snapshot";
private static final String MSG_SELECT_ATTEMPT = "select_deploy_attempt";
private static Log logger = LogFactory.getLog(UIDeploymentReports.class);
@@ -86,14 +107,20 @@ public class UIDeploymentReports extends SelfRenderingComponent
// standard component attributes are restored by the super class
super.restoreState(context, values[0]);
this.store = (String)values[1];
this.dateFilter = (String)values[2];
this.showPrevious = (Boolean)values[3];
this.attempt = (NodeRef)values[4];
}
public Object saveState(FacesContext context)
{
Object values[] = new Object[2];
Object values[] = new Object[5];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.store;
values[2] = this.dateFilter;
values[3] = this.showPrevious;
values[4] = this.attempt;
return values;
}
@@ -121,50 +148,14 @@ public class UIDeploymentReports extends SelfRenderingComponent
throw new IllegalArgumentException("The store must be specified.");
}
if (logger.isDebugEnabled())
logger.debug("Rendering deployment reports for store: " + storeName);
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
ContentService contentService = Repository.getServiceRegistry(context).getContentService();
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
PropertyValue val = avmService.getStoreProperty(storeName, SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
String attemptId = null;
if (val != null)
boolean showPrevious = getShowPrevious();
if (showPrevious)
{
attemptId = val.getStringValue();
renderPreviousReports(context, out, storeName);
}
if (attemptId == null || attemptId.length() == 0)
else
{
throw new IllegalStateException("Failed to retrieve deployment attempt id");
}
if (logger.isDebugEnabled())
logger.debug("Retrieving deployment reports for attempt id: " + attemptId);
// get the deploymentattempt object
NodeRef attempt = DeploymentUtil.findDeploymentAttempt(attemptId);
if (attempt != null)
{
// render the supporting JavaScript
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/deployment.js'></script>\n");
// iterate through each deployment report
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : deployReportRefs)
{
// render each report
renderReport(context, out, ref.getChildRef(), nodeService, contentService);
}
// add some padding after the panels
out.write("\n<div style='padding-top:8px;'></div>\n");
renderAttempt(context, out, storeName);
}
tx.commit();
@@ -201,10 +192,262 @@ public class UIDeploymentReports extends SelfRenderingComponent
this.store = value;
}
/**
* @return The current dateFilter if previous reports are being shown
*/
public String getDateFilter()
{
ValueBinding vb = getValueBinding("dateFilter");
if (vb != null)
{
this.dateFilter = (String)vb.getValue(getFacesContext());
}
return this.dateFilter;
}
/**
* @param value The dateFilter to use when previous reports are being shown
*/
public void setDateFilter(String value)
{
this.dateFilter = value;
}
/**
* @return true if the component should show previous reports
*/
public boolean getShowPrevious()
{
ValueBinding vb = getValueBinding("showPrevious");
if (vb != null)
{
this.showPrevious = (Boolean)vb.getValue(getFacesContext());
}
if (this.showPrevious == null)
{
this.showPrevious = Boolean.FALSE;
}
return this.showPrevious.booleanValue();
}
/**
* @param showPrevious Determines whether previous reports are shown
*/
public void setShowPrevious(boolean showPrevious)
{
this.showPrevious = new Boolean(showPrevious);
}
/**
* @return NodeRef of the deploymentattempt to show the details for
*/
public NodeRef getAttempt()
{
ValueBinding vb = getValueBinding("attempt");
if (vb != null)
{
this.attempt = (NodeRef)vb.getValue(getFacesContext());
}
return this.attempt;
}
/**
* @param value The NodeRef of the deploymentattempt to show the details for
*/
public void setAttempt(NodeRef value)
{
this.attempt = value;
}
// ------------------------------------------------------------------------------
// Helpers
private void renderReport(FacesContext context, ResponseWriter out, NodeRef deploymentReport,
@SuppressWarnings("unchecked")
protected void renderPreviousReports(FacesContext context, ResponseWriter out, String store)
throws IOException
{
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
ResourceBundle bundle = Application.getBundle(context);
List<NodeRef> deployAttempts = null;
String dateFilter = getDateFilter();
if (logger.isDebugEnabled())
logger.debug("Rendering previous deployment reports for store '" + store +
"' using dateFilter: " + dateFilter);
if (dateFilter == null || dateFilter.equals(FILTER_DATE_ALL))
{
deployAttempts = DeploymentUtil.findDeploymentAttempts(store);
}
else
{
// get today's date
Date toDate = new Date();
// calculate the from date
Date fromDate;
if (FILTER_DATE_TODAY.equals(dateFilter))
{
fromDate = toDate;
}
else if (FILTER_DATE_YESTERDAY.equals(dateFilter))
{
fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L));
toDate = fromDate;
}
else if (FILTER_DATE_WEEK.equals(dateFilter))
{
fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*7L));
}
else if (FILTER_DATE_MONTH.equals(dateFilter))
{
fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*30L));
}
else
{
throw new IllegalArgumentException("Unknown date filter mode: " + dateFilter);
}
// get the filtered list of attempts
deployAttempts = DeploymentUtil.findDeploymentAttempts(store, fromDate, toDate);
}
if (deployAttempts.size() > 0)
{
out.write("<table class='deployMoreReportsList' cellspacing='3' cellpadding='3' width='100%'>");
out.write("<tr><th align='left'><nobr>");
out.write(bundle.getString(MSG_ATTEMPT_DATE));
out.write("</nobr></th><th align='left'><nobr>");
out.write(bundle.getString(MSG_SERVERS));
out.write("</nobr></th><th align='left'><nobr>");
out.write(bundle.getString(MSG_SNAPSHOT));
out.write("</th></tr>");
for (NodeRef attempt : deployAttempts)
{
Map<QName, Serializable> props = nodeService.getProperties(attempt);
String attemptId = (String)props.get(WCMAppModel.PROP_DEPLOYATTEMPTID);
Date attemptTime = (Date)props.get(WCMAppModel.PROP_DEPLOYATTEMPTTIME);
Integer version = (Integer)props.get(WCMAppModel.PROP_DEPLOYATTEMPTVERSION);
List<String> servers = (List<String>)props.get(WCMAppModel.PROP_DEPLOYATTEMPTSERVERS);
StringBuilder buffer = new StringBuilder();
if (servers != null)
{
for (String server : servers)
{
if (buffer.length() != 0)
{
buffer.append(", ");
}
buffer.append(server);
}
}
// format the date using the default pattern
String attemptDate = Utils.getDateTimeFormat(context).format(attemptTime);
out.write("<tr><td><nobr>");
Utils.encodeRecursive(context,
aquireViewAttemptAction(context, attemptId, attempt, attemptDate));
out.write("</nobr></td><td>");
out.write(buffer.toString());
out.write("</td><td>");
if (version != null)
{
out.write(version.toString());
}
out.write("</td></tr>");
}
out.write("</table>");
}
else
{
out.write("<div class='deployServersInfo'>");
out.write(Application.getMessage(context, "no_deploy_attempts"));
out.write("</div>\n");
}
}
protected void renderAttempt(FacesContext context, ResponseWriter out, String store)
throws IOException
{
// get services required
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
ContentService contentService = Repository.getServiceRegistry(context).getContentService();
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
// get the attempt node to show (if any)
NodeRef attempt = getAttempt();
if (attempt == null)
{
if (logger.isDebugEnabled())
logger.debug("Rendering last deployment report for store: " + store);
// get the last deployment attempt id, then locate the deploymentattempt node
PropertyValue val = avmService.getStoreProperty(store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
String attemptId = null;
if (val != null)
{
attemptId = val.getStringValue();
}
if (attemptId == null || attemptId.length() == 0)
{
throw new IllegalStateException("Failed to retrieve deployment attempt id");
}
if (logger.isDebugEnabled())
logger.debug("Retrieving deploymentattempt node with attempt id: " + attemptId);
// get the deploymentattempt object
attempt = DeploymentUtil.findDeploymentAttempt(attemptId);
}
// if we have an attempt node, render it
if (attempt != null)
{
if (logger.isDebugEnabled())
logger.debug("Rendering deployment reports for attempt: " + attempt);
// render the supporting JavaScript
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/deployment.js'></script>\n");
// iterate through each deployment report
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL);
if (deployReportRefs.size() > 0)
{
for (ChildAssociationRef ref : deployReportRefs)
{
// render each report
renderReport(context, out, ref.getChildRef(), nodeService, contentService);
}
}
else
{
out.write("<div class='deployInProgress'><img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/info_icon_large.gif' />&nbsp;");
out.write(Application.getMessage(context, "no_deploy_reports"));
out.write("</div>\n");
}
// add some padding after the panels
out.write("\n<div style='padding-top:12px;'></div>\n");
}
}
protected void renderReport(FacesContext context, ResponseWriter out, NodeRef deploymentReport,
NodeService nodeService, ContentService contentService)
throws IOException
{
@@ -260,6 +503,7 @@ public class UIDeploymentReports extends SelfRenderingComponent
String username = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAMEUSED);
String source = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATHUSED);
String target = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGETUSED);
String excludes = (String)serverProps.get(WCMAppModel.PROP_DEPLOYEXCLUDESUSED);
String failReason = (String)serverProps.get(WCMAppModel.PROP_DEPLOYFAILEDREASON);
String content = "";
@@ -374,6 +618,15 @@ public class UIDeploymentReports extends SelfRenderingComponent
out.write("</div>");
}
if (excludes != null)
{
out.write("<div style='margin-top: 3px;'>");
out.write(Application.getMessage(context, "deploy_server_excludes"));
out.write(":&nbsp;");
out.write(excludes);
out.write("</div>");
}
if (target != null)
{
out.write("<div style='margin-top: 3px;'>");
@@ -416,4 +669,53 @@ public class UIDeploymentReports extends SelfRenderingComponent
PanelGenerator.generatePanelEnd(out,
context.getExternalContext().getRequestContextPath(), "lightstorm");
}
@SuppressWarnings("unchecked")
protected UIActionLink aquireViewAttemptAction(FacesContext context,
String attemptId, NodeRef attemptRef, String attemptDate)
{
UIActionLink action = null;
String actionId = "va_" + attemptId;
// try find the action as a child of this component
for (UIComponent component : (List<UIComponent>)getChildren())
{
if (actionId.equals(component.getId()))
{
action = (UIActionLink)component;
break;
}
}
if (action == null)
{
// create the action and add as a child component
javax.faces.application.Application facesApp = context.getApplication();
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
action.setId(actionId);
action.setValue(attemptDate);
action.setTooltip(Application.getMessage(context, MSG_SELECT_ATTEMPT));
action.setShowLink(true);
action.setActionListener(facesApp.createMethodBinding(
"#{DialogManager.bean.attemptSelected}", UIActions.ACTION_CLASS_ARGS));
// add attemptRef param
UIParameter param1 = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
param1.setId(actionId + "_1");
param1.setName("attemptRef");
param1.setValue(attemptRef.toString());
action.getChildren().add(param1);
// add attemptDate param
UIParameter param2 = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
param2.setId(actionId + "_2");
param2.setName("attemptDate");
param2.setValue(attemptDate);
action.getChildren().add(param2);
this.getChildren().add(action);
}
return action;
}
}

View File

@@ -75,6 +75,7 @@ public class UIDeploymentServers extends UIInput
private static final String MSG_ALLOCATED = "deploy_server_allocated";
private static final String MSG_SOURCE = "deploy_server_source_path";
private static final String MSG_TARGET = "deploy_server_target_name";
private static final String MSG_EXCLUDES = "deploy_server_excludes";
private static final String MSG_AUTO_DEPLOY = "deploy_automatically";
private static final String MSG_EDIT = "edit_deploy_server";
private static final String MSG_DELETE = "delete_deploy_server";
@@ -189,8 +190,14 @@ public class UIDeploymentServers extends UIInput
out.write("</div>");
out.write("\n<script type='text/javascript'>");
out.write("window.onload=Alfresco.checkDeployConfigPage();");
out.write("</script>");
out.write("window.onload=Alfresco.checkDeployConfigPage();\n");
if (currentServer != null)
{
out.write("Alfresco.scrollToEditServer('");
out.write(currentServer.getId());
out.write("');\n");
}
out.write("</script>\n");
tx.commit();
}
@@ -334,7 +341,7 @@ public class UIDeploymentServers extends UIInput
out.write("</div></td></tr>");
out.write("<tr><td colspan='3'>");
out.write("<table cellpadding='0' cellspacing='0'>");
out.write("<tr><td><table cellpadding='3' cellspacing='0' class='deployConfigServerDetailsLeftCol'>");
out.write("<tr><td width='100%'><table cellpadding='3' cellspacing='0' class='deployConfigServerDetailsLeftCol'>");
out.write("<tr><td align='right'>");
out.write(bundle.getString(MSG_HOST));
out.write(":</td><td>");
@@ -389,20 +396,29 @@ public class UIDeploymentServers extends UIInput
out.write("</td></tr></table></td>");
out.write("<td valign='top'><table cellpadding='3' cellspacing='0' class='deployConfigServerDetailsRightCol'>");
out.write("<tr><td align='right'>");
out.write("<tr><td align='right'><nobr>");
out.write(bundle.getString(MSG_SOURCE));
out.write(":</td><td>");
out.write(":</nobr></td><td>");
if (server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH) != null)
{
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH));
}
out.write("</td></tr>");
out.write("<tr><td align='right'><nobr>");
out.write(bundle.getString(MSG_EXCLUDES));
out.write(":</nobr></td><td>");
if (server.getProperties().get(DeploymentServerConfig.PROP_EXCLUDES) != null)
{
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_EXCLUDES));
}
out.write("</td></tr>");
if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))
{
out.write("<tr><td align='right'>");
out.write("<tr><td align='right'><nobr>");
out.write(bundle.getString(MSG_TARGET));
out.write(":</td><td>");
out.write(":</nobr></td><td>");
if (server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME) != null)
{
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME));
@@ -413,9 +429,9 @@ public class UIDeploymentServers extends UIInput
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(
server.getProperties().get(DeploymentServerConfig.PROP_TYPE)))
{
out.write("<tr><td align='right'>");
out.write("<tr><td align='right'><nobr>");
out.write(bundle.getString(MSG_AUTO_DEPLOY));
out.write(":</td><td>");
out.write(":</nobr></td><td>");
if (server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL) != null)
{
Object obj = server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL);
@@ -434,9 +450,9 @@ public class UIDeploymentServers extends UIInput
if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(
server.getProperties().get(DeploymentServerConfig.PROP_TYPE)))
{
out.write("<tr><td align='right'>");
out.write("<tr><td align='right'><nobr>");
out.write(bundle.getString(MSG_ALLOCATED));
out.write(":</td><td>");
out.write(":</nobr></td><td>");
if (server.getProperties().get(DeploymentServerConfig.PROP_ALLOCATED_TO) != null)
{
String allocatedToTip = (String)server.getProperties().get(
@@ -466,7 +482,14 @@ public class UIDeploymentServers extends UIInput
String contextPath = context.getExternalContext().getRequestContextPath();
ResourceBundle bundle = Application.getBundle(context);
out.write("<div class='deployConfigServer'>");
out.write("<div class='deployConfigServer'");
if (edit)
{
out.write(" id='");
out.write(server.getId());
out.write("'");
}
out.write(">");
PanelGenerator.generatePanelStart(out, contextPath, "lightstorm", "#eaeff2");
out.write("<table width='100%'><tr><td><img class='deployConfigServerIcon' src='");
out.write(contextPath);
@@ -656,6 +679,22 @@ public class UIDeploymentServers extends UIInput
Utils.encodeRecursive(context, source);
out.write("</td></tr>");
// create the excludes field
out.write("<tr><td align='right'>");
out.write(bundle.getString(MSG_EXCLUDES));
out.write(":</td><td>");
UIComponent excludes = context.getApplication().createComponent(
UIInput.COMPONENT_TYPE);
FacesHelper.setupComponentId(context, excludes, null);
excludes.getAttributes().put("styleClass", "inputField");
ValueBinding vbExcludes = context.getApplication().createValueBinding(
"#{WizardManager.bean.editedDeployServerProperties." +
DeploymentServerConfig.PROP_EXCLUDES + "}");
excludes.setValueBinding("value", vbExcludes);
this.getChildren().add(excludes);
Utils.encodeRecursive(context, excludes);
out.write("</td></tr>");
if ((edit == false && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType())) ||
(edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())))
{

View File

@@ -490,7 +490,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
if (hasAllocatedTestServer)
{
UIActionLink releaseServer = createAction(context, mainStore, username,
ACT_SANDBOX_RELEASE_SERVER, "/images/icons/deploy_server.gif",
ACT_SANDBOX_RELEASE_SERVER, "/images/icons/release_server.gif",
"#{AVMBrowseBean.releaseTestServer}", null, null, null, false);
menu.getChildren().add(releaseServer);
}
@@ -1298,7 +1298,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
menu.getAttributes().put("itemSpacing", 4);
menu.getAttributes().put("image", "/images/icons/menu.gif");
menu.getAttributes().put("menuStyleClass", "moreActionsMenu");
menu.getAttributes().put("style", "white-space:nowrap; margin-left: 4px;");
menu.getAttributes().put("style", "white-space:nowrap; margin-left: 4px; margin-right: 6px;");
return menu;
}

View File

@@ -36,6 +36,9 @@ import org.alfresco.web.ui.common.tag.BaseComponentTag;
public class DeploymentReportsTag extends BaseComponentTag
{
private String value;
private String showPrevious;
private String dateFilter;
private String attempt;
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
@@ -61,6 +64,9 @@ public class DeploymentReportsTag extends BaseComponentTag
super.setProperties(component);
setStringProperty(component, "value", this.value);
setStringProperty(component, "dateFilter", this.dateFilter);
setStringProperty(component, "attempt", this.attempt);
setBooleanProperty(component, "showPrevious", this.showPrevious);
}
/**
@@ -70,6 +76,9 @@ public class DeploymentReportsTag extends BaseComponentTag
{
super.release();
this.value = null;
this.showPrevious = null;
this.dateFilter = null;
this.attempt = null;
}
/**
@@ -81,4 +90,19 @@ public class DeploymentReportsTag extends BaseComponentTag
{
this.value = value;
}
public void setShowPrevious(String showPrevious)
{
this.showPrevious = showPrevious;
}
public void setDateFilter(String dateFilter)
{
this.dateFilter = dateFilter;
}
public void setAttempt(String attempt)
{
this.attempt = attempt;
}
}