mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -33,6 +33,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Object representing the result of a link validation action being executed.
|
||||
@@ -54,7 +56,9 @@ public class LinkValidationReport implements Serializable
|
||||
private int numberBrokenLinks = -1;
|
||||
private int baseSnapshotVersion = -1;
|
||||
private int latestSnapshotVersion = -1;
|
||||
private int maxNumberLinksInReport = -1;
|
||||
private boolean successful = true;
|
||||
private boolean maxLinksReached = false;
|
||||
private Date completedAt;
|
||||
|
||||
private Throwable error;
|
||||
@@ -62,6 +66,7 @@ public class LinkValidationReport implements Serializable
|
||||
private Map<String, HrefManifestEntry> brokenLinksByFile;
|
||||
|
||||
private static final long serialVersionUID = 7562964706845609991L;
|
||||
private static Log logger = LogFactory.getLog(LinkValidationReport.class);
|
||||
|
||||
/**
|
||||
* Constructs a link validation report from the results of a check of the
|
||||
@@ -72,9 +77,11 @@ public class LinkValidationReport implements Serializable
|
||||
* @param manifest The manifest of broken links and snapshot info
|
||||
* @param noFilesChecked The number of files checked
|
||||
* @param noLinksChecked The number of links checked
|
||||
* @param maxNumberLinksInReport The maximum number of links to store in
|
||||
* the report, -1 will store all links passed in the manifest object
|
||||
*/
|
||||
public LinkValidationReport(String store, String webapp, HrefManifest manifest,
|
||||
int noFilesChecked, int noLinksChecked)
|
||||
int noFilesChecked, int noLinksChecked, int maxNumberLinksInReport)
|
||||
{
|
||||
this.store = store;
|
||||
this.webapp = webapp;
|
||||
@@ -84,6 +91,7 @@ public class LinkValidationReport implements Serializable
|
||||
this.numberLinksChecked = noLinksChecked;
|
||||
this.baseSnapshotVersion = manifest.getBaseSnapshotVersion();
|
||||
this.latestSnapshotVersion = manifest.getLatestSnapshotVersion();
|
||||
this.maxNumberLinksInReport = maxNumberLinksInReport;
|
||||
|
||||
// create list and map
|
||||
List<HrefManifestEntry> manifests = manifest.getManifestEntries();
|
||||
@@ -147,6 +155,16 @@ public class LinkValidationReport implements Serializable
|
||||
return this.numberBrokenLinks;
|
||||
}
|
||||
|
||||
public int getMaxNumberLinksInReport()
|
||||
{
|
||||
return this.maxNumberLinksInReport;
|
||||
}
|
||||
|
||||
public boolean hasMaxNumberLinksExceeded()
|
||||
{
|
||||
return this.maxLinksReached;
|
||||
}
|
||||
|
||||
public List<String> getFilesWithBrokenLinks()
|
||||
{
|
||||
return this.brokenFiles;
|
||||
@@ -199,6 +217,8 @@ public class LinkValidationReport implements Serializable
|
||||
buffer.append(" webapp=").append(this.webapp);
|
||||
buffer.append(" baseSnapshot=").append(this.baseSnapshotVersion);
|
||||
buffer.append(" latestSnapshot=").append(this.latestSnapshotVersion);
|
||||
buffer.append(" maxNumberLinksInReport=").append(this.maxNumberLinksInReport);
|
||||
buffer.append(" maxLinksReached=").append(this.maxLinksReached);
|
||||
buffer.append(" error=").append(this.error).append(")");
|
||||
return buffer.toString();
|
||||
}
|
||||
@@ -212,6 +232,7 @@ public class LinkValidationReport implements Serializable
|
||||
{
|
||||
ParameterCheck.mandatory("manifests", manifests);
|
||||
|
||||
// iterate over required amount of links and store them
|
||||
for (HrefManifestEntry manifest : manifests)
|
||||
{
|
||||
String fileName = manifest.getFileName();
|
||||
@@ -219,6 +240,20 @@ public class LinkValidationReport implements Serializable
|
||||
this.brokenFiles.add(fileName);
|
||||
this.brokenLinksByFile.put(fileName, manifest);
|
||||
this.numberBrokenLinks = this.numberBrokenLinks + manifest.getHrefs().size();
|
||||
|
||||
// check whether we have exceeded the maximum number
|
||||
// of links, if we have break out
|
||||
if (this.maxNumberLinksInReport != -1 &&
|
||||
(this.numberBrokenLinks > this.maxNumberLinksInReport))
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("Maximum number of links ("+ this.maxNumberLinksInReport +
|
||||
") for report has been exceeded at file number: " +
|
||||
this.brokenFiles.size());
|
||||
|
||||
this.maxLinksReached = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user