public class MetadataSaxer extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Modifier and Type | Field and Description |
---|---|
protected Context |
_context
The avalon context.
|
protected JSONUtils |
_jsonUtils
The JSON conversion utilities.
|
protected AmetysObjectResolver |
_resolver
Ametys object resolver
|
protected UserManager |
_userManager
The user manager
|
static String |
ROLE
The Avalon Role.
|
Constructor and Description |
---|
MetadataSaxer() |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
_binaryAsJson(BinaryMetadata binaryMetadata,
String prefix,
String metadataName)
Get the JSON representation of a
BinaryMetadata |
protected List<String> |
_getRefAmetysObjectIds(TraversableAmetysObject objectCollection)
Get the id of child Ametys objects
|
protected void |
_saxAllMetadata(ContentHandler contentHandler,
CompositeMetadata metadata,
String prefix,
Locale locale)
SAX all the metadata of a given composite metadata, with the given prefix.
|
protected void |
_saxBinaryMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix)
SAX a binary metadata.
|
protected void |
_saxDateMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix)
SAX a metadata as a Date.
|
protected void |
_saxEnumeratedStringMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
Enumerator enumerator)
SAX a string metadata.
|
protected void |
_saxMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix,
Locale locale)
SAX a single metadata.
|
protected void |
_saxMultilingualStringMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix,
Locale currentLocale)
SAX a multilingual string metadata.
|
protected void |
_saxMultipleUserMetadataAsJson(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName)
SAX a metadata as a User as JSON.
|
protected void |
_saxObject(ContentHandler contentHandler,
AmetysObject object,
String prefix,
boolean isDeep,
Locale locale)
SAX an Object, i.e.
|
protected void |
_saxRichTextMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix)
SAX a rich-text metadata.
|
protected void |
_saxSingleUserMetadataAsJson(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName)
SAX a metadata as a User as JSON.
|
protected void |
_saxStringMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName,
String prefix)
SAX a string metadata.
|
protected void |
_saxUserMetadata(ContentHandler contentHandler,
CompositeMetadata parentMetadata,
String metadataName)
SAX a metadata as a User.
|
protected Map<String,Object> |
_userAsJson(UserIdentity userIdentity)
Get the JSON representation of a User metadata
|
void |
contextualize(Context context) |
void |
saxMetadata(ContentHandler contentHandler,
CompositeMetadata compositeMetadata)
SAXes a composite metadata.
|
void |
saxMetadata(ContentHandler contentHandler,
CompositeMetadata compositeMetadata,
Locale locale)
SAXes a composite metadata.
|
void |
service(ServiceManager manager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected JSONUtils _jsonUtils
protected AmetysObjectResolver _resolver
protected UserManager _userManager
public MetadataSaxer()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void saxMetadata(ContentHandler contentHandler, CompositeMetadata compositeMetadata) throws AmetysRepositoryException, SAXException, IOException
contentHandler
- the content handler where to SAX into.compositeMetadata
- the composite metadata.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.public void saxMetadata(ContentHandler contentHandler, CompositeMetadata compositeMetadata, Locale locale) throws AmetysRepositoryException, SAXException, IOException
contentHandler
- the content handler where to SAX into.compositeMetadata
- the composite metadata.locale
- The locale to use for localized metadata, such as MultilingualString
. Can be null to sax all existing locales.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.protected void _saxAllMetadata(ContentHandler contentHandler, CompositeMetadata metadata, String prefix, Locale locale) throws AmetysRepositoryException, SAXException, IOException
contentHandler
- the content handler where to SAX into.metadata
- the composite metadata.prefix
- the metadata path prefix.locale
- The locale to use for localized metadata, such as MultilingualString
. Can be null to sax all existing locales.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.protected void _saxMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix, Locale locale) throws AmetysRepositoryException, SAXException, IOException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefix.locale
- The locale to use for localized metadata, such as MultilingualString
. Can be null to sax all existing locales.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.protected void _saxBinaryMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix) throws AmetysRepositoryException, SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefix.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.protected void _saxRichTextMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix) throws AmetysRepositoryException, SAXException, IOException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefix.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.protected void _saxStringMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix) throws AmetysRepositoryException, SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefix.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.protected void _saxMultilingualStringMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix, Locale currentLocale) throws AmetysRepositoryException, SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefixcurrentLocale
- The current locale. Can be null.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.protected void _saxEnumeratedStringMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, Enumerator enumerator) throws AmetysRepositoryException, SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.enumerator
- The enumerator for labelisable valuesAmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.protected void _saxDateMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName, String prefix) throws AmetysRepositoryException, SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.prefix
- the metadata path prefix.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.protected void _saxUserMetadata(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName) throws SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.SAXException
- if an error occursprotected void _saxSingleUserMetadataAsJson(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName) throws SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.SAXException
- if an error occursprotected void _saxMultipleUserMetadataAsJson(ContentHandler contentHandler, CompositeMetadata parentMetadata, String metadataName) throws SAXException
contentHandler
- the content handler where to SAX into.parentMetadata
- the parent composite metadata.metadataName
- the metadata name.SAXException
- if an error occursprotected void _saxObject(ContentHandler contentHandler, AmetysObject object, String prefix, boolean isDeep, Locale locale) throws AmetysRepositoryException, IOException, SAXException
contentHandler
- the content handler where to SAX into.object
- the AmetysObject
to sax.prefix
- the metadata path prefix.isDeep
- If true
and the AmetysObject is a MetadataAwareAmetysObject
, its metadata will be saxed.locale
- The locale to use for localized metadata, such as MultilingualString
. Can be null to sax all existing locales.AmetysRepositoryException
- if an error occurs.SAXException
- if an error occurs.IOException
- if an error occurs.protected List<String> _getRefAmetysObjectIds(TraversableAmetysObject objectCollection)
objectCollection
- The parent object collectionprotected Map<String,Object> _userAsJson(UserIdentity userIdentity)
userIdentity
- The user identityprotected Map<String,Object> _binaryAsJson(BinaryMetadata binaryMetadata, String prefix, String metadataName)
BinaryMetadata
binaryMetadata
- The metadataprefix
- The prefixmetadataName
- The metadata name