Package com.microstrategy.web.transform
Class StyleCatalogImpl
- java.lang.Object
-
- com.microstrategy.utils.config.AbstractConfigurationElement
-
- com.microstrategy.web.transform.AbstractStyleCatalogElement
-
- com.microstrategy.web.transform.StyleCatalogImpl
-
- All Implemented Interfaces:
ConfigurationElement
,ConfigurationFile
,StyleCatalog
,java.lang.Cloneable
public class StyleCatalogImpl extends AbstractStyleCatalogElement implements StyleCatalog
- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
AbstractConfigurationElement.FilteredList
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ATT_DESCRIPTION
protected static java.lang.String
ATT_NAME
protected static java.lang.String
ATT_VERSION
static java.lang.String
DTD_FILE
protected static java.lang.String
NODE_STYLE_CATALOG
-
Fields inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
ATT_CONFIG_SRC, ATT_DELETED, ATT_POSITION, ATT_PROTOTYPE, ATT_USE_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description StyleCatalogImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteTransformDefnFromStyles(TransformDefn trDef, boolean removeStyles)
Cleans all the possible associatios made to the TransformDefn object specified.BeanDefn
getBeanDefn(TransformDefn tDefn)
Returns the BeanDefn for a bean supported by this transform.BeanDefns
getBeanDefns()
Returns the BeanDefns collection.java.lang.String
getDescription()
Returns the textual description of the style catalog.protected java.lang.String
getDTDFileName()
Returns the name of a DTD file that will be added as SystemID to the XML resulting from serializing the contents of this ConfigurationElement into a file;null
by default.java.lang.String
getFileName()
Returns the file name used by the style catalog.protected java.lang.String
getKeyAttribute()
This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override thegetKey
andsetKey
methods.LayoutParserDefns
getLayoutParserDefns()
Gets the collection of layout parser definition objects.LayoutSourceDefns
getLayoutSourceDefns()
Gets the collection of layout source definition objects.MapperDefns
getMapperDefns()
Returns the collection fo mapper definitions.java.lang.String
getName()
Returns the name of the style catalog.SourceLookup
getSourceLookup(java.lang.String source)
Returns the registered SourceLookup object with the specified name.StyleMaps
getStyleMaps()
Returns the collection of style maps.Styles
getStyles()
Returns the Styles collection.Transform
getTransformByStyle(java.lang.String styleName)
Returns the transform object associated with the specified style.Transform
getTransformByStyle(java.lang.String styleName, StyleRequestContext context)
Returns the transform object associated with the specified style.TransformDefns
getTransformDefns()
Returns the TransformDefns collection.java.lang.String
getVersion()
Returns the current version of the styleCatalogboolean
hasChanged()
Equivalent toAbstractConfigurationElement.isDirty()
.protected void
initDefaultAttributes()
This method can be overridden to set default values for attributes.Styles
listStyles(TransformDefn trDef, int sortBy)
Lists all styles for a specified transform.Styles
listStylesForBean(java.lang.String beanName, int sortBy)
Lists styles filtered by the bean type and/or sorted by bean type.TransformDefns
listTransformDefns(java.lang.String beanName, int sortBy)
Lists transform definitions filtered by the bean type and/or sorted by bean type.void
loadFromDocument(org.w3c.dom.Document styleCatalog)
void
reset()
Reloads the previous style catalog file - undoing any in-memory changes reverting back to the file definition.void
save()
Saves thisConfigurationElement
back into the files where it was loaded from.StyleCatalog
saveAs(java.lang.String fileName, boolean overwrite)
Saves the contents of the style catalog in a new instance and to disk.void
setDescription(java.lang.String value)
Sets the textual description of the style catalog.void
setFileName(java.lang.String fileName)
Sets the name of the file used by the style catalog.void
setName(java.lang.String value)
Sets the name of the style catalog.void
setSourceLookup(java.lang.String source, SourceLookup sourceLookup)
Registers a SourceLookup object with the specified key.void
setVersion(java.lang.String value)
Sets the version of the style catalog.-
Methods inherited from class com.microstrategy.web.transform.AbstractStyleCatalogElement
clearCaches, copyContents, getStyleCatalog, reload, resetChanged, setStrAttribute
-
Methods inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
addFileSource, applyCustomization, applyCustomizations, cleanUpDeletedElements, clone, delete, deltas, deltas, equalAtts, equalElements, equalNodeValues, equals, equalsIncludingDeletedElements, exportAttributesToXML, exportElementsToXML, exportNodeValueToXML, getAttribute, getAttributes, getBoolAttribute, getChildKey, getConfigSrc, getElement, getElement, getElements, getFileLoader, getIntAttribute, getIntAttribute, getKey, getLineNumber, getList, getNextKey, getNodeName, getNodeValue, getNodeValue, getOrCreateElement, getParent, getPosition, getPrototype, getRegisteredClass, getSelfInitPath, getSource, getStrAttribute, getUseDefault, getXMLParserParameters, getXMLSerializerParameters, hashCode, hashCodeAtts, hashCodeElements, hashCodeNodeValues, hasRegisteredClass, initAttributesFromXML, initElementFromXML, initElementsFromXML, initFromFile, initFromResource, initFromXML, initFromXML, initNodeValueFromXML, initPrototype, isActive, isCustomized, isDeleted, isDirty, isInSource, isKeyAttribute, load, mergeChanges, newChildInstance, newSource, original, populate, printAttributes, printElements, printNodeValue, refreshLists, registerClass, registerElement, registerElement, registerElementList, reloadPrototype, removeAttribute, removeDefaults, replaceList, restore, save, saveChangesAs, saveConfig, saveFlatXML, saveNode, saveSource, setAttribute, setBoolAttribute, setChildOriginals, setConfigSrc, setCustomized, setElement, setFileLoader, setIntAttribute, setKey, setLineNumber, setNodeName, setNodeValue, setPosition, setPrototype, setSelfInitPath, setUseDefault, setUseValidation, throwConfigParseException, toString, toXML, toXML, toXML, toXML, useNodeValue, useValidation
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.microstrategy.utils.config.ConfigurationElement
getAttribute, getAttributes, getElement, getElements, getKey, getNodeName, getStrAttribute, initFromXML, reload, toXML
-
Methods inherited from interface com.microstrategy.utils.config.ConfigurationFile
applyCustomization, applyCustomizations, load, reload, save, setUseValidation, useValidation
-
-
-
-
Field Detail
-
ATT_NAME
protected static final java.lang.String ATT_NAME
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
ATT_DESCRIPTION
protected static final java.lang.String ATT_DESCRIPTION
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
ATT_VERSION
protected static final java.lang.String ATT_VERSION
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
NODE_STYLE_CATALOG
protected static final java.lang.String NODE_STYLE_CATALOG
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
DTD_FILE
public static final java.lang.String DTD_FILE
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDTDFileName
protected java.lang.String getDTDFileName()
Description copied from class:AbstractConfigurationElement
Returns the name of a DTD file that will be added as SystemID to the XML resulting from serializing the contents of this ConfigurationElement into a file;null
by default. This method should be extended if the concrete instance of an element has a predefined DTD file associated.- Overrides:
getDTDFileName
in classAbstractConfigurationElement
- Since:
- MicroStrategy Web 9.0.0
-
initDefaultAttributes
protected void initDefaultAttributes()
Description copied from class:AbstractConfigurationElement
This method can be overridden to set default values for attributes. Simply extend this method and callAbstractConfigurationElement.setAttribute(java.lang.String, java.lang.Object)
- Overrides:
initDefaultAttributes
in classAbstractConfigurationElement
- Since:
- MicroStrategy Web 9.0.0
-
getFileName
public java.lang.String getFileName()
Description copied from interface:StyleCatalog
Returns the file name used by the style catalog.- Specified by:
getFileName
in interfaceStyleCatalog
- Returns:
- the file name used by the style catalog.
-
setFileName
public void setFileName(java.lang.String fileName)
Description copied from interface:StyleCatalog
Sets the name of the file used by the style catalog.- Specified by:
setFileName
in interfaceStyleCatalog
- Parameters:
fileName
- the file name used by the style catalog.
-
getName
public java.lang.String getName()
Description copied from interface:StyleCatalog
Returns the name of the style catalog.- Specified by:
getName
in interfaceStyleCatalog
- Returns:
- the name of the style catalog.
-
setName
public void setName(java.lang.String value)
Description copied from interface:StyleCatalog
Sets the name of the style catalog.- Specified by:
setName
in interfaceStyleCatalog
- Parameters:
value
- the name of the style catalog.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:StyleCatalog
Returns the textual description of the style catalog.- Specified by:
getDescription
in interfaceStyleCatalog
- Returns:
- the description of the style catalog.
-
setDescription
public void setDescription(java.lang.String value)
Description copied from interface:StyleCatalog
Sets the textual description of the style catalog.- Specified by:
setDescription
in interfaceStyleCatalog
- Parameters:
value
- the description of the style catalog.
-
getStyles
public Styles getStyles()
Description copied from interface:StyleCatalog
Returns the Styles collection.- Specified by:
getStyles
in interfaceStyleCatalog
- Returns:
- the
Styles
object.
-
getTransformDefns
public TransformDefns getTransformDefns()
Description copied from interface:StyleCatalog
Returns the TransformDefns collection.- Specified by:
getTransformDefns
in interfaceStyleCatalog
- Returns:
- the
TransformDefns
object.
-
getBeanDefn
public BeanDefn getBeanDefn(TransformDefn tDefn)
Description copied from interface:StyleCatalog
Returns the BeanDefn for a bean supported by this transform.- Specified by:
getBeanDefn
in interfaceStyleCatalog
- Returns:
- the
BeanDefn
for a bean supported by this transform.
-
getBeanDefns
public BeanDefns getBeanDefns()
Description copied from interface:StyleCatalog
Returns the BeanDefns collection.- Specified by:
getBeanDefns
in interfaceStyleCatalog
- Returns:
- the
BeanDefns
object.
-
hasChanged
public boolean hasChanged()
Description copied from class:AbstractStyleCatalogElement
Equivalent toAbstractConfigurationElement.isDirty()
. Maintained for binary compatibility.- Specified by:
hasChanged
in interfaceStyleCatalog
- Overrides:
hasChanged
in classAbstractStyleCatalogElement
- Returns:
- whether the style catalog changed.
-
save
public void save() throws WebTransformException
Description copied from class:AbstractConfigurationElement
Saves thisConfigurationElement
back into the files where it was loaded from. All in-memory changes are automatically applied into the lastElementSource
used to load this element.- Specified by:
save
in interfaceConfigurationFile
- Specified by:
save
in interfaceStyleCatalog
- Overrides:
save
in classAbstractConfigurationElement
- Throws:
WebTransformException
- thrown if an error saving to the file occurs.
-
saveAs
public StyleCatalog saveAs(java.lang.String fileName, boolean overwrite) throws WebTransformException, java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Saves the contents of the style catalog in a new instance and to disk.- Specified by:
saveAs
in interfaceStyleCatalog
- Parameters:
fileName
- the name of the file for the new StyleCatalog object.overwrite
- whether it overwrites the file if already exists.- Returns:
- a new instance of the StyleCatalog object with the copied contents.
- Throws:
WebTransformException
- thrown if an error saving to the file occurs.java.lang.IllegalArgumentException
- thrown if the file name exists and it can't overwrite it.
-
loadFromDocument
public void loadFromDocument(org.w3c.dom.Document styleCatalog) throws WebTransformException
- Throws:
WebTransformException
-
getStyleMaps
public StyleMaps getStyleMaps()
Description copied from interface:StyleCatalog
Returns the collection of style maps.- Specified by:
getStyleMaps
in interfaceStyleCatalog
- Returns:
StyleMaps
a collection ofStyleMap
.- Since:
- MicroStrategy Web 9.0.0
-
getMapperDefns
public MapperDefns getMapperDefns()
Description copied from interface:StyleCatalog
Returns the collection fo mapper definitions.- Specified by:
getMapperDefns
in interfaceStyleCatalog
- Returns:
MapperDefns
a collection ofMapperDefn
.- Since:
- MicroStrategy Web 9.0.0
-
listTransformDefns
public TransformDefns listTransformDefns(java.lang.String beanName, int sortBy) throws java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Lists transform definitions filtered by the bean type and/or sorted by bean type.- Specified by:
listTransformDefns
in interfaceStyleCatalog
- Parameters:
beanName
- the filer bean type. Must be a valid bean type or FILTER_NONE, in which case no filtering will be performed.sortBy
- Defines sorting order. FromEnumSortBy
- Returns:
- a subset of TransformDefinition objects filtered according to the beanName parameter and sorted according to the sortBy parameter. Returned subset is read-only, calling any update method on it will result in UnsupportedOperationException.
- Throws:
java.lang.IllegalArgumentException
- thrown if the sortBy parameter is invalid.
-
listStylesForBean
public Styles listStylesForBean(java.lang.String beanName, int sortBy) throws java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Lists styles filtered by the bean type and/or sorted by bean type.- Specified by:
listStylesForBean
in interfaceStyleCatalog
- Parameters:
beanName
- the filer bean type. Must be a valid bean type or FILTER_NONE, in which case no filtering will be performed.sortBy
- Defines sorting order. FromEnumSortBy
- Returns:
- a subset of Style objects filtered according to the beanName parameter and sorted according to the sortBy parameter. Returned subset is read-only, calling any update method on it will result in UnsupportedOperationException.
- Throws:
java.lang.IllegalArgumentException
- thrown if the sortBy parameter is invalid.
-
listStyles
public Styles listStyles(TransformDefn trDef, int sortBy) throws java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Lists all styles for a specified transform. Styles will be sorted according to the sortBy value.- Specified by:
listStyles
in interfaceStyleCatalog
- Parameters:
trDef
- theTransformDefn
object used to filter the list of styles.sortBy
- Defines sorting order. FromEnumSortBy
- Returns:
- a subset of Style objects belonging to the specified TransformDefinition and sorted according to the sortBy parameter Returned subset is read-only, calling any update method on it will result in UnsupportedOperationException.
- Throws:
java.lang.IllegalArgumentException
- thrown if the sortBy parameter is invalid or the TransformDefn object is null.
-
deleteTransformDefnFromStyles
public void deleteTransformDefnFromStyles(TransformDefn trDef, boolean removeStyles) throws java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Cleans all the possible associatios made to the TransformDefn object specified. It will have the option to remove all the Style objects associated with this TransformDefn object.- Specified by:
deleteTransformDefnFromStyles
in interfaceStyleCatalog
- Parameters:
trDef
- theTransformDefn
object you want to remove.removeStyles
- inicates whether you want to remove the styles associated with this TransformDefn object or not.- Throws:
java.lang.IllegalArgumentException
- thrown if the TransformDefn object is null.
-
getTransformByStyle
public Transform getTransformByStyle(java.lang.String styleName) throws WebTransformException, java.lang.IllegalArgumentException
Returns the transform object associated with the specified style.- Specified by:
getTransformByStyle
in interfaceStyleCatalog
- Parameters:
styleName
- the name of the style.- Returns:
- an instance of the
Transform
object. - Throws:
WebTransformException
- thrown if there is an error getting a new instance of the transform or if the system style catalog has not been set.java.lang.IllegalArgumentException
- thrown if the style name was not found in the system style catalog.
-
getLayoutParserDefns
public LayoutParserDefns getLayoutParserDefns()
Description copied from interface:StyleCatalog
Gets the collection of layout parser definition objects.- Specified by:
getLayoutParserDefns
in interfaceStyleCatalog
- Returns:
- The collection of layout parser definition objects.
- Since:
- MicroStrategy Web 8.0.0
-
getLayoutSourceDefns
public LayoutSourceDefns getLayoutSourceDefns()
Description copied from interface:StyleCatalog
Gets the collection of layout source definition objects.- Specified by:
getLayoutSourceDefns
in interfaceStyleCatalog
- Returns:
- The collection of layout source definition objects.
- Since:
- MicroStrategy Web 8.0.0
-
reset
public void reset() throws WebTransformException
Description copied from interface:StyleCatalog
Reloads the previous style catalog file - undoing any in-memory changes reverting back to the file definition. Nothing happens if a style catalog was not previously loaded.
- Specified by:
reset
in interfaceStyleCatalog
- Throws:
WebTransformException
- Since:
- MicroStrategy Web 8.0.0
-
getVersion
public java.lang.String getVersion()
Description copied from interface:StyleCatalog
Returns the current version of the styleCatalog- Specified by:
getVersion
in interfaceStyleCatalog
- Returns:
- the version of the styleCatalog
- Since:
- MicroStrategy Web 8.0.0
-
setVersion
public void setVersion(java.lang.String value)
Sets the version of the style catalog. The version must be in the form of: "major.minor" where both major and minor must be valid numbers. If not in this form it throws an InvalidArgumentException.- Parameters:
value
- Version number.- Since:
- MicroStrategy Web 8.1.0
-
getSourceLookup
public SourceLookup getSourceLookup(java.lang.String source)
Description copied from interface:StyleCatalog
Returns the registered SourceLookup object with the specified name.- Specified by:
getSourceLookup
in interfaceStyleCatalog
- Parameters:
source
- the name used to look up the SourceLookup object.- Returns:
- the SourceLookup object with the specified name.
- Since:
- MicroStrategy Web 8.0.0
-
setSourceLookup
public void setSourceLookup(java.lang.String source, SourceLookup sourceLookup)
Description copied from interface:StyleCatalog
Registers a SourceLookup object with the specified key.- Specified by:
setSourceLookup
in interfaceStyleCatalog
- Parameters:
source
- the key mapped to the SourceLookup objectsourceLookup
- theSourceLookup
object to register- Since:
- MicroStrategy Web 8.0.0
-
getTransformByStyle
public Transform getTransformByStyle(java.lang.String styleName, StyleRequestContext context) throws WebTransformException, java.lang.IllegalArgumentException
Description copied from interface:StyleCatalog
Returns the transform object associated with the specified style.- Specified by:
getTransformByStyle
in interfaceStyleCatalog
- Parameters:
styleName
- the name of the style.context
- the StyleRequestContext object used to resolve dynamic actual parameter values.- Returns:
- an instance of the
Transform
object. - Throws:
WebTransformException
- thrown if there is an error getting a new instance of the transformjava.lang.IllegalArgumentException
- thrown if the style name was not found in this style catalog.- Since:
- MicroStrategy Web 8.0.0
-
getKeyAttribute
protected java.lang.String getKeyAttribute()
Description copied from class:AbstractConfigurationElement
This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override thegetKey
andsetKey
methods.- Specified by:
getKeyAttribute
in classAbstractConfigurationElement
- Since:
- MicroStrategy Web 9.0.0
-
-