Package org.ametys.odf.export
Class ExportCatalogByLevelsGenerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.xml.AbstractXMLProducer
-
- org.apache.cocoon.generation.AbstractGenerator
-
- org.apache.cocoon.generation.ServiceableGenerator
-
- org.ametys.odf.export.ExportCatalogByLevelsGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
ExportCatalogByLevelsGenerator
public class ExportCatalogByLevelsGenerator extends ServiceableGenerator
Generate the ODF structure with 2 levels (metadata), the catalog and the lang. It's possible to determine a metadataset to sax data. You should call this generator with the following parameters : - catalog : identifier of the catalog - lang : language code (fr, en, etc.) - level1 : name of the attribute for the first level - level2 : name of the attribute for the second level - metadataSet (optional) : name of the view to sax values
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ExportCatalogByLevelsGenerator.FilteredByVersionLabelIterable<P extends VersionAwareAmetysObject>
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypesHelper
_contentTypesHelper
The content type helperprotected OdfClassificationHandler
_odfClassificationHandler
The ODF classification handlerprotected ODFHelper
_odfHelper
The ODF helperprotected OdfReferenceTableHelper
_odfRefTableHelper
The helper for reference tablesprotected AmetysObjectResolver
_resolver
The AmetysObject resolver-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description ExportCatalogByLevelsGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addLevelAttributes(AttributesImpl attrs, String value, String lang)
Add attributes for classification levelprivate void
_saxChildren(Program parentProgram, ProgramItem programItem, String viewName, Map<String,String> wsParameters)
Explore and sax children of the passed program item.private void
_saxStructure(Program parentProgram, ProgramItem programItem, String viewName, Map<String,String> wsParameters)
Generates SAX events for the structure of the parentProgram by exploring its children and generating SAX events for the passed view.void
generate()
protected AmetysObjectIterable<Program>
getConcernedPrograms(Map<String,String> wsParameters)
Get the programs to SAX.protected AttributesImpl
getContentAttributes(ProgramItem programItem, Program parentProgram, Map<String,String> wsParameters)
Get attributes for the current saxed content (title, id, etc.).protected String
getParameter(Request request, String parameterName)
Get the parameter from the request and test if it's not null or blank.protected boolean
getParameters(Map<String,String> wsParameters)
Get the parameters from the request and test it.void
service(ServiceManager smanager)
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The AmetysObject resolver
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content type helper
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_odfClassificationHandler
protected OdfClassificationHandler _odfClassificationHandler
The ODF classification handler
-
_odfRefTableHelper
protected OdfReferenceTableHelper _odfRefTableHelper
The helper for reference tables
-
-
Constructor Detail
-
ExportCatalogByLevelsGenerator
public ExportCatalogByLevelsGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_addLevelAttributes
protected void _addLevelAttributes(AttributesImpl attrs, String value, String lang)
Add attributes for classification level- Parameters:
attrs
- The XML attributesvalue
- The level's valuelang
- The language
-
getParameters
protected boolean getParameters(Map<String,String> wsParameters) throws SAXException
Get the parameters from the request and test it.- Parameters:
wsParameters
- Map of parameters to fill- Returns:
- false if a parameter is missing or something going wrong with the parameters, otherwise true
- Throws:
SAXException
- if an error occured
-
getParameter
protected String getParameter(Request request, String parameterName) throws SAXException
Get the parameter from the request and test if it's not null or blank. Sax an error if the parameter is missing or empty.- Parameters:
request
- The requestparameterName
- The parameter name- Returns:
- null when the parameter is missing or empty, otherwise the parameter value
- Throws:
SAXException
- if an error occured
-
getConcernedPrograms
protected AmetysObjectIterable<Program> getConcernedPrograms(Map<String,String> wsParameters)
Get the programs to SAX.- Parameters:
wsParameters
- Parameters of the web service- Returns:
- A Collection of programs
-
_saxStructure
private void _saxStructure(Program parentProgram, ProgramItem programItem, String viewName, Map<String,String> wsParameters) throws AmetysRepositoryException, SAXException, IOException
Generates SAX events for the structure of the parentProgram by exploring its children and generating SAX events for the passed view.- Parameters:
parentProgram
- Initial programprogramItem
- Part of the program to exploreviewName
- Name of the view to SAXwsParameters
- Parameters of the web service- Throws:
AmetysRepositoryException
- if an error occurredSAXException
- if an error occurredIOException
- if an error occurred
-
_saxChildren
private void _saxChildren(Program parentProgram, ProgramItem programItem, String viewName, Map<String,String> wsParameters) throws AmetysRepositoryException, SAXException, IOException
Explore and sax children of the passed program item.- Parameters:
parentProgram
- Initial programprogramItem
- Part of the program to exploreviewName
- Name of the view to SAXwsParameters
- Parameters of the web service- Throws:
AmetysRepositoryException
- if an error occurredSAXException
- if an error occurredIOException
- if an error occurred
-
getContentAttributes
protected AttributesImpl getContentAttributes(ProgramItem programItem, Program parentProgram, Map<String,String> wsParameters)
Get attributes for the current saxed content (title, id, etc.).- Parameters:
programItem
- Part of the program to get attributesparentProgram
- Initial programwsParameters
- Parameters of the web service- Returns:
- The attributes to sax
-
-