Merged V2.1 to HEAD

6958: Fix for WCM-823
   6959: Merged V1.4 to V2.1
      6943: Upgrade scripts for transaction commit time and indexes for QName columns on alf_child_assoc
   6960: Fixed script patch "applied on" date updates.
   6961: Retry transactions on ConstraintViolationException.
   6964: Added svn revision number to be substituted into build string if build number is not passed.
   6965: Daylight savings for FTP. Fix for AR-1776.
   6966: Added catch blocks for the AVMLockingException. WCM-877.
   6967: Interim fix for WCM-866 (large link validation report causes SQL exception)
   6968: Fixes for AWC-1309 "Broken preview image for Web Projects in MySpaces" and similar AWC-1635 "Broken/Missing images in MySpaces Web Script".
   6970: Force DB write ordering of the NodeStatus vs Node object.
   6971: More transaction demarcation fixes for special cases of non-executed script patches.
   6972: Switch off session size management for the mass archive and restore test.
   6973: Fixed AR-1801: Boolean isMultiValued() no longer returns null


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7370 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-11-13 00:24:19 +00:00
parent 6acffcba73
commit 224a6b2fb8
6 changed files with 308 additions and 256 deletions

View File

@@ -60,6 +60,7 @@ public class LinkValidationState
private String store;
private String webapp;
private boolean checkBeenReRun = false;
private boolean maxLinksReached = false;
private Date checkCompletedAt;
private int noFilesCheckedStart = -1;
@@ -82,6 +83,8 @@ public class LinkValidationState
private int baseSnapshotVersion = 0;
private int latestSnapshotVersion = 0;
private int maxNumberLinksInReport = -1;
private List<String> brokenStaticFilesStart;
private List<String> brokenFormsStart;
@@ -237,7 +240,7 @@ public class LinkValidationState
*/
public int getBaseSnapshotVersion()
{
return baseSnapshotVersion;
return this.baseSnapshotVersion;
}
/**
@@ -245,7 +248,23 @@ public class LinkValidationState
*/
public int getLatestSnapshotVersion()
{
return latestSnapshotVersion;
return this.latestSnapshotVersion;
}
/**
* @return The maximum number of links a report can have
*/
public int getMaxNumberLinksInReport()
{
return this.maxNumberLinksInReport;
}
/**
* @return true if the maximum number of links was exceeded in the last check
*/
public boolean hasMaxNumberLinksExceeded()
{
return this.maxLinksReached;
}
/**
@@ -360,6 +379,11 @@ public class LinkValidationState
// get the snapshot versions
this.baseSnapshotVersion = report.getBaseSnapshotVersion();
this.latestSnapshotVersion = report.getLatestSnapshotVersion();
// get whether the max number of links was exceeded for the report
// and the maximum number of links allowed
this.maxLinksReached = report.hasMaxNumberLinksExceeded();
this.maxNumberLinksInReport = report.getMaxNumberLinksInReport();
if (this.cause == null)
{

View File

@@ -119,206 +119,213 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
if (logger.isDebugEnabled())
logger.debug("Rendering report from state object: " + linkState);
if (linkState.getError() == null && linkState.getNumberBrokenLinks() > 0)
if (linkState != null)
{
// determine whether the generated files and broken links sections
// should be expanded
boolean sectionsExpanded = this.getItemsExpanded();
// render the required JavaScript
String selectedTab = this.getInitialTab();
out.write("<script type='text/javascript'>");
out.write("var _alfCurrentTab = '");
out.write(selectedTab);
out.write("';</script>\n");
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/yahoo/dom/dom-min.js'></script>\n");
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/link-validation-report.js'></script>\n");
// gather count data for tab titles
int numStaticFiles = linkState.getStaticFilesWithBrokenLinks().size();
int numForms = linkState.getFormsWithBrokenLinks().size();
int numBrokenFileLinks = linkState.getNoBrokenLinksInStaticFiles();
int numBrokenFormLinks = linkState.getNoBrokenLinksInForms();
int numFixedItems = linkState.getNumberFixedItems();
String pattern = bundle.getString("static_tab");
String staticTabTitle = MessageFormat.format(pattern,
new Object[] {numStaticFiles});
pattern = bundle.getString("generated_tab");
String generatedTabTitle = MessageFormat.format(pattern,
new Object[] {numForms});
// render the tabs
out.write("<div class='tabs'><ul><li><span class='tabLabel'>");
out.write(bundle.getString("broken"));
out.write(":</span></li><li id='staticTab'");
if (selectedTab.equals("staticTab"))
if (linkState.getError() == null && linkState.getNumberBrokenLinks() > 0)
{
out.write(" class='selectedTab'");
}
out.write("><a href=\"");
out.write("javascript:Alfresco.tabSelected('static');\"><span>");
out.write(staticTabTitle);
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' />");
out.write(Integer.toString(numBrokenFileLinks));
out.write(")</span></a></li><li id='generatedTab'");
if (selectedTab.equals("generatedTab"))
{
out.write(" class='selectedTab'");
}
out.write("><a href=\"");
out.write("javascript:Alfresco.tabSelected('generated');\"><span>");
out.write(generatedTabTitle);
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' />");
out.write(Integer.toString(numBrokenFormLinks));
out.write(")</span></a></li><li><span class='tabLabel'>");
out.write(bundle.getString("fixed"));
out.write(":</span></li><li id='fixedTab'>");
if (selectedTab.equals("fixedTab"))
{
out.write(" class='selectedTab'");
}
out.write("<a href=\"");
out.write("javascript:Alfresco.tabSelected('fixed');\"><span>");
out.write(bundle.getString("all_items_tab"));
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/green_tick.gif' />");
out.write(Integer.toString(numFixedItems));
out.write(")</span></a></li>");
out.write("<li><span class='tabButton'>");
// render the update status button
UICommand updateStatusAction = aquireUpdateStatusAction(context,
"update_status_" + linkState.getStore());
Utils.encodeRecursive(context, updateStatusAction);
out.write("</span></li></ul></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of broken files and their contained links
out.write("<div id='staticTabContent'");
if (selectedTab.equals("staticTab") == false)
{
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "staticTab", true);
out.write("<div id='staticTabBody' class='linkValTabContentBody'>");
// determine whether the generated files and broken links sections
// should be expanded
boolean sectionsExpanded = this.getItemsExpanded();
List<String> brokenFiles = linkState.getStaticFilesWithBrokenLinks();
if (brokenFiles == null || brokenFiles.size() == 0)
{
renderNoItems(out, context);
}
else
{
UIActions actions = aquireFileActions("broken_file_actions", getValue().getStore());
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
int rootPathIndex = AVMUtil.buildSandboxRootPath(linkState.getStore()).length();
String dns = AVMUtil.lookupStoreDNS(linkState.getStore());
ClientConfigElement config = Application.getClientConfig(context);
String wcmDomain = config.getWCMDomain();
String wcmPort = config.getWCMPort();
// render each broken file
for (String file : brokenFiles)
{
renderBrokenFile(context, out, file, linkState, actions, avmService,
rootPathIndex, wcmDomain, wcmPort, dns, sectionsExpanded);
}
}
out.write("</div></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of broken forms, the files it generated and their contained links
out.write("<div id='generatedTabContent'");
if (selectedTab.equals("generatedTab") == false)
{
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "generatedTab", true);
out.write("<div id='generatedTabBody' class='linkValTabContentBody'>");
List<String> brokenForms = linkState.getFormsWithBrokenLinks();
if (brokenForms == null || brokenForms.size() == 0)
{
renderNoItems(out, context);
}
else
{
UIActions actions = aquireFileActions("broken_form_actions", getValue().getStore());
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
// render the required JavaScript
String selectedTab = this.getInitialTab();
out.write("<script type='text/javascript'>");
out.write("var _alfCurrentTab = '");
out.write(selectedTab);
out.write("';</script>\n");
for (String form : brokenForms)
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/yahoo/dom/dom-min.js'></script>\n");
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/link-validation-report.js'></script>\n");
// gather count data for tab titles
int numStaticFiles = linkState.getStaticFilesWithBrokenLinks().size();
int numForms = linkState.getFormsWithBrokenLinks().size();
int numBrokenFileLinks = linkState.getNoBrokenLinksInStaticFiles();
int numBrokenFormLinks = linkState.getNoBrokenLinksInForms();
int numFixedItems = linkState.getNumberFixedItems();
String pattern = bundle.getString("static_tab");
String staticTabTitle = MessageFormat.format(pattern,
new Object[] {numStaticFiles});
pattern = bundle.getString("generated_tab");
String generatedTabTitle = MessageFormat.format(pattern,
new Object[] {numForms});
// render the tabs
out.write("<div class='tabs'><ul><li><span class='tabLabel'>");
out.write(bundle.getString("broken"));
out.write(":</span></li><li id='staticTab'");
if (selectedTab.equals("staticTab"))
{
renderBrokenForm(context, out, form, linkState, actions,
avmService, sectionsExpanded);
out.write(" class='selectedTab'");
}
}
out.write("</div></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of fixed items
out.write("<div id='fixedTabContent'");
if (selectedTab.equals("fixedTab") == false)
{
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "fixedTab", false);
out.write("<div id='fixedTabBody' class='linkValTabContentBody'>");
int fixedItems = 0;
List<String> fixedFiles = linkState.getFixedFiles();
List<String> fixedForms = linkState.getFixedForms();
if (fixedFiles != null)
{
fixedItems = fixedFiles.size();
}
if (fixedForms != null)
{
fixedItems += fixedForms.size();
}
if (fixedItems == 0)
{
renderNoItems(out, context);
}
else
{
for (String file : fixedFiles)
out.write("><a href=\"");
out.write("javascript:Alfresco.tabSelected('static');\"><span>");
out.write(staticTabTitle);
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' />");
out.write(Integer.toString(numBrokenFileLinks));
out.write(")</span></a></li><li id='generatedTab'");
if (selectedTab.equals("generatedTab"))
{
renderFixedItem(context, out, file, linkState);
out.write(" class='selectedTab'");
}
out.write("><a href=\"");
out.write("javascript:Alfresco.tabSelected('generated');\"><span>");
out.write(generatedTabTitle);
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' />");
out.write(Integer.toString(numBrokenFormLinks));
out.write(")</span></a></li><li><span class='tabLabel'>");
out.write(bundle.getString("fixed"));
out.write(":</span></li><li id='fixedTab'>");
if (selectedTab.equals("fixedTab"))
{
out.write(" class='selectedTab'");
}
out.write("<a href=\"");
out.write("javascript:Alfresco.tabSelected('fixed');\"><span>");
out.write(bundle.getString("all_items_tab"));
out.write("&nbsp;(<img class='tabTitleBrokenLinkIcon' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/green_tick.gif' />");
out.write(Integer.toString(numFixedItems));
out.write(")</span></a></li>");
out.write("<li><span class='tabButton'>");
// render the update status button
UICommand updateStatusAction = aquireUpdateStatusAction(context,
"update_status_" + linkState.getStore());
Utils.encodeRecursive(context, updateStatusAction);
out.write("</span></li></ul></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of broken files and their contained links
out.write("<div id='staticTabContent'");
if (selectedTab.equals("staticTab") == false)
{
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "staticTab", true);
out.write("<div id='staticTabBody' class='linkValTabContentBody'>");
List<String> brokenFiles = linkState.getStaticFilesWithBrokenLinks();
if (brokenFiles == null || brokenFiles.size() == 0)
{
renderNoItems(out, context);
}
else
{
UIActions actions = aquireFileActions("broken_file_actions", getValue().getStore());
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
int rootPathIndex = AVMUtil.buildSandboxRootPath(linkState.getStore()).length();
String dns = AVMUtil.lookupStoreDNS(linkState.getStore());
ClientConfigElement config = Application.getClientConfig(context);
String wcmDomain = config.getWCMDomain();
String wcmPort = config.getWCMPort();
// render each broken file
for (String file : brokenFiles)
{
renderBrokenFile(context, out, file, linkState, actions, avmService,
rootPathIndex, wcmDomain, wcmPort, dns, sectionsExpanded);
}
}
for (String file : fixedForms)
out.write("</div></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of broken forms, the files it generated and their contained links
out.write("<div id='generatedTabContent'");
if (selectedTab.equals("generatedTab") == false)
{
renderFixedItem(context, out, file, linkState);
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "generatedTab", true);
out.write("<div id='generatedTabBody' class='linkValTabContentBody'>");
List<String> brokenForms = linkState.getFormsWithBrokenLinks();
if (brokenForms == null || brokenForms.size() == 0)
{
renderNoItems(out, context);
}
else
{
UIActions actions = aquireFileActions("broken_form_actions", getValue().getStore());
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
for (String form : brokenForms)
{
renderBrokenForm(context, out, form, linkState, actions,
avmService, sectionsExpanded);
}
}
out.write("</div></div>");
// reset the oddRow flag
this.oddRow = true;
// render the list of fixed items
out.write("<div id='fixedTabContent'");
if (selectedTab.equals("fixedTab") == false)
{
out.write(" style='display: none;'");
}
out.write(">");
renderTabHeader(out, context, "fixedTab", false);
out.write("<div id='fixedTabBody' class='linkValTabContentBody'>");
int fixedItems = 0;
List<String> fixedFiles = linkState.getFixedFiles();
List<String> fixedForms = linkState.getFixedForms();
if (fixedFiles != null)
{
fixedItems = fixedFiles.size();
}
if (fixedForms != null)
{
fixedItems += fixedForms.size();
}
if (fixedItems == 0)
{
renderNoItems(out, context);
}
else
{
for (String file : fixedFiles)
{
renderFixedItem(context, out, file, linkState);
}
for (String file : fixedForms)
{
renderFixedItem(context, out, file, linkState);
}
}
out.write("</div></div>");
}
else
{
out.write("<div>&nbsp;</div>");
}
out.write("</div></div>");
}
else
{

View File

@@ -115,83 +115,99 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
out.write("</div>");
}
if (linkState.getError() == null)
if (linkState != null)
{
// render the main summary info
int latestVersion = linkState.getLatestSnapshotVersion();
int baseVersion = linkState.getBaseSnapshotVersion();
String pattern = bundle.getString("link_check_completed_at");
Date checkAt = linkState.getCheckCompletedAt();
String checkTime = Utils.getDateTimeFormat(context).format(checkAt);
String checkTimeSummary = MessageFormat.format(pattern,
new Object[] {checkTime, baseVersion});
out.write("<div class='linkValSummaryText'>");
out.write(checkTimeSummary);
// NOTE: Whenever latestVersion > baseVersion, link validation is "behind".
if (latestVersion > baseVersion)
if (linkState.getError() == null)
{
pattern = bundle.getString("link_check_not_latest");
String latestVersionInfo =
MessageFormat.format(
pattern, new Object[] { new Integer( latestVersion )});
// render the main summary info
int latestVersion = linkState.getLatestSnapshotVersion();
int baseVersion = linkState.getBaseSnapshotVersion();
String pattern = bundle.getString("link_check_completed_at");
Date checkAt = linkState.getCheckCompletedAt();
String checkTime = Utils.getDateTimeFormat(context).format(checkAt);
String checkTimeSummary = MessageFormat.format(pattern,
new Object[] {checkTime, baseVersion});
out.write("<div class='linkValSummaryText'>");
out.write(checkTimeSummary);
// NOTE: Whenever latestVersion > baseVersion, link validation is "behind".
if (latestVersion > baseVersion)
{
pattern = bundle.getString("link_check_not_latest");
String latestVersionInfo =
MessageFormat.format(
pattern, new Object[] { new Integer( latestVersion )});
out.write("&nbsp;<img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/warning.gif' />&nbsp;");
out.write( latestVersionInfo );
}
pattern = bundle.getString("link_check_items_found");
String checkedSummary = MessageFormat.format(pattern,
new Object[] {linkState.getNumberFilesChecked(),
linkState.getNumberLinksChecked()});
pattern = bundle.getString("link_check_items_broken");
String numBrokenLinks = Integer.toString(linkState.getNumberBrokenLinks());
if (linkState.hasMaxNumberLinksExceeded())
{
numBrokenLinks = Integer.toString(linkState.getMaxNumberLinksInReport()) + "+";
}
String brokenSummary = MessageFormat.format(pattern,
new Object[] {numBrokenLinks, linkState.getNumberBrokenFiles()});
out.write("</div><div class='linkValSummaryText'>");
out.write(checkedSummary);
out.write("&nbsp;<img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/warning.gif' />&nbsp;");
out.write( latestVersionInfo );
}
pattern = bundle.getString("link_check_items_found");
String checkedSummary = MessageFormat.format(pattern,
new Object[] {linkState.getNumberFilesChecked(),
linkState.getNumberLinksChecked()});
pattern = bundle.getString("link_check_items_broken");
String brokenSummary = MessageFormat.format(pattern,
new Object[] {linkState.getNumberBrokenLinks(),
linkState.getNumberBrokenFiles()});
out.write("</div><div class='linkValSummaryText'>");
out.write(checkedSummary);
out.write("&nbsp;<img src='");
out.write(context.getExternalContext().getRequestContextPath());
if (linkState.getNumberBrokenLinks() == 0)
{
out.write("/images/icons/info_icon.gif' />&nbsp;");
out.write(bundle.getString("link_check_no_broken"));
if (linkState.getNumberBrokenLinks() == 0)
{
out.write("/images/icons/info_icon.gif' />&nbsp;");
out.write(bundle.getString("link_check_no_broken"));
}
else
{
out.write("/images/icons/warning.gif' />&nbsp;");
out.write(brokenSummary);
}
out.write("</div>");
}
else
{
out.write("/images/icons/warning.gif' />&nbsp;");
out.write(brokenSummary);
// render the error that occurred
String pattern = bundle.getString("link_check_error");
Date initialCheck = linkState.getCheckCompletedAt();
String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck);
String initialCheckSummary = MessageFormat.format(pattern,
new Object[] {initialCheckTime});
out.write(initialCheckSummary);
out.write("&nbsp;<span class='errorMessage'>");
String err = linkState.getError().getMessage();
if (err == null)
{
out.write(linkState.getError().toString());
}
else
{
out.write(err);
}
out.write("</span>");
}
out.write("</div>");
}
else
{
// render the error that occurred
String pattern = bundle.getString("link_check_error");
Date initialCheck = linkState.getCheckCompletedAt();
String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck);
String initialCheckSummary = MessageFormat.format(pattern,
new Object[] {initialCheckTime});
out.write(initialCheckSummary);
out.write("&nbsp;<span class='errorMessage'>");
String err = linkState.getError().getMessage();
if (err == null)
{
out.write(linkState.getError().toString());
}
else
{
out.write(err);
}
// if the report was not found at all, show an error to that effect
out.write("<span class='errorMessage'>");
out.write(bundle.getString("failed_to_find_validation_report"));
out.write("</span>");
}