Package jadex.bridge
Class AbstractErrorReportBuilder
- java.lang.Object
-
- jadex.bridge.AbstractErrorReportBuilder
-
public abstract class AbstractErrorReportBuilder extends java.lang.Object
Helper class for building error reports.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]
categories
The element categories.protected MultiCollection<Tuple,java.lang.String>
entries
The parse errors (tuple(elements) -> {error messages}).protected java.util.Map<java.lang.String,java.lang.String>
externals
The external documents for links in html error reports (id -> html text).protected java.lang.String
filename
The file name with path (optional).protected java.lang.String
name
The unqualified (model/file) name.
-
Constructor Summary
Constructors Constructor Description AbstractErrorReportBuilder(java.lang.String name, java.lang.String filename, java.lang.String[] categories, MultiCollection<Tuple,java.lang.String> entries, java.util.Map<java.lang.String,java.lang.String> externals)
Build the error based on the given entries (if any).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description IErrorReport
buildErrorReport()
Build the error based on the given entries (if any).protected void
generateDetails(java.lang.StringBuffer buf, java.lang.String type, java.util.Set<java.lang.Object> elements)
Generate detail HTML code for the given elements.protected java.lang.String
generateErrorHTML()
Generate an html representation of the report.protected java.lang.String
generateErrorText()
Generate a string representation of the report.protected void
generateOverview(java.lang.StringBuffer buf, java.lang.String type, java.util.Set<java.lang.Object> elements)
Generate overview HTML code for the given elements.protected Tuple[]
getElementErrors(java.lang.Object ancestor)
Get all elements which have errors and are contained in the given element.protected Tuple[]
getElements()
Get all invalid elements.protected java.lang.String[]
getMessages(Tuple path)
Get the messages for a given element.protected java.lang.Object
getObject(Tuple element)
abstract java.lang.String
getObjectName(java.lang.Object obj)
Get the name of an object.protected java.util.Set<java.lang.Object>
getOtherErrors(java.util.Set<java.lang.Object> excludes)
Get other errors, not in the given tags.protected java.util.Set<java.lang.Object>
getOwnedElementErrors(java.lang.String category)
Get elements of the given owner type, which have errors or contain elements with errors.abstract java.lang.Object
getPathElementObject(java.lang.Object element)
Get the object of a path elementabstract boolean
isInCategory(java.lang.Object obj, java.lang.String category)
Test if an object belongs to a category.
-
-
-
Field Detail
-
name
protected java.lang.String name
The unqualified (model/file) name.
-
filename
protected java.lang.String filename
The file name with path (optional).
-
categories
protected java.lang.String[] categories
The element categories.
-
entries
protected MultiCollection<Tuple,java.lang.String> entries
The parse errors (tuple(elements) -> {error messages}).
-
externals
protected java.util.Map<java.lang.String,java.lang.String> externals
The external documents for links in html error reports (id -> html text).
-
-
Constructor Detail
-
AbstractErrorReportBuilder
public AbstractErrorReportBuilder(java.lang.String name, java.lang.String filename, java.lang.String[] categories, MultiCollection<Tuple,java.lang.String> entries, java.util.Map<java.lang.String,java.lang.String> externals)
Build the error based on the given entries (if any). Entries represent error messages mapped by the path to the xml element (as a tuple of stack elements).- Parameters:
name
- The unqualified (model/file) name.filename
- The file name with path (optional).categories
- The element categories.entries
- The parse errors (tuple(stack elements) -> {error messages}).externals
- The external documents for links in html error reports, if any (id -> html text).
-
-
Method Detail
-
buildErrorReport
public IErrorReport buildErrorReport()
Build the error based on the given entries (if any). Entries represent error messages mapped by the path to the xml element (as a tuple of stack elements).- Returns:
- The error report.
-
getPathElementObject
public abstract java.lang.Object getPathElementObject(java.lang.Object element)
Get the object of a path element- Parameters:
obj
- An item (entry) of a tuple in the multi collection.- Returns:
- The object corresponding to the entry.
-
isInCategory
public abstract boolean isInCategory(java.lang.Object obj, java.lang.String category)
Test if an object belongs to a category.- Parameters:
obj
- An item (entry) of a tuple in the multi collection.category
- the category name.- Returns:
- True, when the object belongs to the category.
-
getObjectName
public abstract java.lang.String getObjectName(java.lang.Object obj)
Get the name of an object.- Parameters:
obj
- An object having an error.- Returns:
- A human readable name of the object.
-
getElements
protected Tuple[] getElements()
Get all invalid elements.
-
getMessages
protected java.lang.String[] getMessages(Tuple path)
Get the messages for a given element.
-
generateErrorText
protected java.lang.String generateErrorText()
Generate a string representation of the report.
-
generateErrorHTML
protected java.lang.String generateErrorHTML()
Generate an html representation of the report.
-
getOwnedElementErrors
protected java.util.Set<java.lang.Object> getOwnedElementErrors(java.lang.String category)
Get elements of the given owner type, which have errors or contain elements with errors.
-
getOtherErrors
protected java.util.Set<java.lang.Object> getOtherErrors(java.util.Set<java.lang.Object> excludes)
Get other errors, not in the given tags.
-
getObject
protected java.lang.Object getObject(Tuple element)
-
getElementErrors
protected Tuple[] getElementErrors(java.lang.Object ancestor)
Get all elements which have errors and are contained in the given element.
-
generateOverview
protected void generateOverview(java.lang.StringBuffer buf, java.lang.String type, java.util.Set<java.lang.Object> elements)
Generate overview HTML code for the given elements.
-
generateDetails
protected void generateDetails(java.lang.StringBuffer buf, java.lang.String type, java.util.Set<java.lang.Object> elements)
Generate detail HTML code for the given elements.
-
-