|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.relations.CmsRelationSystemValidator
public class CmsRelationSystemValidator
Validates relations of resources in the OpenCms VFS.
Relations are, for instance, href attribs in anchor tags and src attribs in image tags, as well as OpenCmsVfsFile values in Xml Content.
External links to targets outside the OpenCms VFS don't get validated.
Objects using this class are responsible to handle detected broken links.
Field Summary | |
---|---|
protected CmsDriverManager |
m_driverManager
The driver manager. |
Constructor Summary | |
---|---|
CmsRelationSystemValidator(CmsDriverManager driverManager)
Default constructor. |
Method Summary | |
---|---|
protected boolean |
checkLinkForDeletedLinkTarget(String link,
Map<String,CmsResource> fileLookup)
Checks a link to a resource which has been deleted. |
protected boolean |
checkLinkForNewOrChangedLinkSource(CmsDbContext dbc,
CmsResource resource,
CmsRelation relation,
String link,
CmsProject project,
Map<String,CmsResource> fileLookup)
Checks a link from a resource which has changed. |
protected boolean |
checkLinkValid(CmsDbContext dbc,
CmsResource resource,
CmsRelation relation,
String link,
CmsProject project,
Map<String,CmsResource> fileLookup)
Checks whether publishing will not invalidate a link. |
protected List<CmsRelation> |
getLinkRelations(CmsDbContext dbc,
CmsProject project,
CmsResource resource)
Returns the list of link relations for a resource. |
protected List<CmsRelation> |
validateLinks(CmsDbContext dbc,
CmsResource resource,
Map<String,CmsResource> fileLookup,
CmsProject project,
I_CmsReport report)
Validates the links for the specified resource. |
Map<String,List<CmsRelation>> |
validateResources(CmsDbContext dbc,
CmsPublishList publishList,
I_CmsReport report)
Validates the relations against the online project. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CmsDriverManager m_driverManager
Constructor Detail |
---|
public CmsRelationSystemValidator(CmsDriverManager driverManager)
driverManager
- The Cms driver managerMethod Detail |
---|
public Map<String,List<CmsRelation>> validateResources(CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) throws Exception
The result is printed to the given report.
Validating references means to answer the question, whether we would have broken links in the online project if the given publish list would get published.
dbc
- the database contextpublishList
- the publish list to validatereport
- a report to print messages
CmsRelation
}
objects)
keyed by root paths
Exception
- if something goes wrongprotected boolean checkLinkForDeletedLinkTarget(String link, Map<String,CmsResource> fileLookup)
link
- the URI of the resource which has a link to the deleted resourcefileLookup
- a lookup table of files to be published
protected boolean checkLinkForNewOrChangedLinkSource(CmsDbContext dbc, CmsResource resource, CmsRelation relation, String link, CmsProject project, Map<String,CmsResource> fileLookup)
dbc
- the current dbcresource
- the link sourcerelation
- the relationlink
- the link targetproject
- the current projectfileLookup
- a lookup table which contains the files which are going to be publishedsitemapCache
-
protected boolean checkLinkValid(CmsDbContext dbc, CmsResource resource, CmsRelation relation, String link, CmsProject project, Map<String,CmsResource> fileLookup)
dbc
- the current dbcresource
- the target resource of the link if it is going to be deleted, else the source of the linkrelation
- the relation which should be checkedlink
- the link URIproject
- the current projectfileLookup
- a lookup table which contains the files which are going to be publishedsitemapCache
-
protected List<CmsRelation> getLinkRelations(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsException
If the resource is going to be deleted, the ingoing relations will be collected, else the outgoing relations.
dbc
- the current database contextproject
- the project to useresource
- the resource for which the relations should be collected
CmsException
- if something goes wrongprotected List<CmsRelation> validateLinks(CmsDbContext dbc, CmsResource resource, Map<String,CmsResource> fileLookup, CmsProject project, I_CmsReport report)
dbc
- the database contextresource
- the resource that will be validatedfileLookup
- a map for faster lookup with all resources keyed by their rootpathsitemapCache
- the sitemap cache for checking sitemap linksproject
- the project to validatereport
- the report to write to
CmsRelation
objects for the specified resource,
or an empty list if no broken links were found
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |