Package org.intermine.web.logic.config
Class WebConfig
- java.lang.Object
-
- org.intermine.web.logic.config.WebConfig
-
public class WebConfig extends java.lang.ObjectConfiguration object for web site- Author:
- Andrew Varley
-
-
Constructor Summary
Constructors Constructor Description WebConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReportDisplayer(ReportDisplayerConfig reportDisplayerConfig)Add config for a report page displayer.voidaddTableExportConfig(TableExportConfig tableExportConfig)Add an TableExportConfig to the Map of TableExportConfig objects using tableExportConfig.getId() as the Map key.voidaddType(Type type)Add a type to the WebConfig Map.voidaddWidget(WidgetConfig widget)booleanequals(java.lang.Object obj)FieldConfiggetFieldConfig(java.lang.String clsName, java.lang.String fieldName)Return the FieldConfig for a particular field of the specified field, or null if field not configured.java.util.Collection<FieldConfig>getFieldConfigs(java.lang.String clsName)Return a FieldConfigs for a particular class or an empty list if no config is defined.java.util.List<ReportDisplayerConfig>getReportDisplayerConfigs()Fetch config for the report page displayers.java.util.Map<java.lang.String,TableExportConfig>getTableExportConfigs()Return a Map of TableExportConfig.id to TableExportConfig objects.java.util.Map<java.lang.String,Type>getTypes()Get a map from fully qualified class name to the Type config for that classjava.util.Map<java.lang.String,WidgetConfig>getWidgets()inthashCode()static WebConfigparse(javax.servlet.ServletContext context, Model model)Parse a WebConfig XML filejava.lang.StringtoString()Return an XML String of this WebConfig objectjava.lang.StringvalidateWidgetsConfig(Model model)Validate the content (the paths) in the widget config
-
-
-
Method Detail
-
parse
public static WebConfig parse(javax.servlet.ServletContext context, Model model) throws java.io.IOException, org.xml.sax.SAXException, java.lang.ClassNotFoundException
Parse a WebConfig XML file- Parameters:
context- The servlet context we are in.model- the Model to use when reading - used for checking class names and for finding sub and super classes- Returns:
- a WebConfig object
- Throws:
org.xml.sax.SAXException- if there is an error in the XML filejava.io.IOException- if there is an error reading the XML filejava.lang.ClassNotFoundException- if a class is mentioned in the XML that isn't in the model
-
validateWidgetsConfig
public java.lang.String validateWidgetsConfig(Model model)
Validate the content (the paths) in the widget config- Parameters:
model- the model used to validate the paths- Returns:
- the message containing the errors or an empty String
-
addType
public void addType(Type type)
Add a type to the WebConfig Map.- Parameters:
type- the Type to add
-
getTypes
public java.util.Map<java.lang.String,Type> getTypes()
Get a map from fully qualified class name to the Type config for that class- Returns:
- the types
-
getFieldConfigs
public java.util.Collection<FieldConfig> getFieldConfigs(java.lang.String clsName)
Return a FieldConfigs for a particular class or an empty list if no config is defined.- Parameters:
clsName- the class to fetch field configs for- Returns:
- the FieldConfigs or an empty collection
-
getFieldConfig
public FieldConfig getFieldConfig(java.lang.String clsName, java.lang.String fieldName)
Return the FieldConfig for a particular field of the specified field, or null if field not configured.- Parameters:
clsName- the class to fetch field config forfieldName- the field to fetch config for- Returns:
- Collection
-
getWidgets
public java.util.Map<java.lang.String,WidgetConfig> getWidgets()
- Returns:
- the widgets - a map from widget name to config details.
-
addWidget
public void addWidget(WidgetConfig widget)
- Parameters:
widget- the widget
-
addReportDisplayer
public void addReportDisplayer(ReportDisplayerConfig reportDisplayerConfig)
Add config for a report page displayer. This checks that a type has been specified before adding the config.- Parameters:
reportDisplayerConfig- config for an individual report page displayer
-
getReportDisplayerConfigs
public java.util.List<ReportDisplayerConfig> getReportDisplayerConfigs()
Fetch config for the report page displayers.- Returns:
- report page displayer config in the order specified in the config file
-
addTableExportConfig
public void addTableExportConfig(TableExportConfig tableExportConfig)
Add an TableExportConfig to the Map of TableExportConfig objects using tableExportConfig.getId() as the Map key.- Parameters:
tableExportConfig- the TableExportConfig to add
-
getTableExportConfigs
public java.util.Map<java.lang.String,TableExportConfig> getTableExportConfigs()
Return a Map of TableExportConfig.id to TableExportConfig objects.- Returns:
- the TableExportConfig Map
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the Object to compare with- Returns:
- true if this is equal to obj
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashCode for this WebConfig object
-
toString
public java.lang.String toString()
Return an XML String of this WebConfig object- Overrides:
toStringin classjava.lang.Object- Returns:
- a String version of this WebConfig object
-
-