Package de.hybris.platform.commons.jalo
Class CommonsManager
- java.lang.Object
-
- de.hybris.platform.jalo.Manager
-
- de.hybris.platform.jalo.extension.Extension
-
- de.hybris.platform.commons.jalo.GeneratedCommonsManager
-
- de.hybris.platform.commons.jalo.CommonsManager
-
- All Implemented Interfaces:
ItemLifecycleListener,java.io.Serializable
public class CommonsManager extends GeneratedCommonsManager
This extension contains some useful logic for the platform.
These are:
- Formatter (via Velocity, FOP, etc.)
- Translator (Supports translation of e.g. HTML text to another format you specify)
- ...
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommonsManager.ItemMethodInterceptor-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.extension.Extension
Extension.RestrictedLanguagesProvider, Extension.RightsProvider
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Manager
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.commons.jalo.GeneratedCommonsManager
DEFAULT_INITIAL_ATTRIBUTES, FORMAT2COMTYPREL_MARKMODIFIED, FORMAT2COMTYPREL_SRC_ORDERED, FORMAT2COMTYPREL_TGT_ORDERED, ITEMDOCRRELATIONALLDOCUMENTSHANDLER
-
-
Constructor Summary
Constructors Constructor Description CommonsManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TranslatorConfigurationgetDefaultTranslatorConfiguration()Returns a TranslatorConfiguration that is prepared for common InDesign translations
(or null, if the TranslatorConfiguration could not be created)java.util.Collection<Document>getDocuments(Item item, Format format)java.util.List<Format>getFormats(SessionContext ctx, ComposedType ct)Generated method - Getter of theComposedType.formatsattribute.java.util.List<Format>getFormats(ComposedType ct)Generated method - Getter of theComposedType.formatsattribute.java.util.Collection<Format>getFormatsForItem(Item item)static CommonsManagergetInstance()JaloTranslatorConfigurationgetJaloTranslatorConfigurationByCode(java.lang.String code)Returns the first found JaloTranslatorConfiguration for the given codejava.util.Collection<JaloVelocityRenderer>getJaloVelocityRenderers()Returns all available VelocityHmcRenderersstatic java.lang.StringgetJarFileAsString(java.lang.String filename, java.lang.String encoding)Returns a file from this extension's JAR file as String (incl.java.util.Collection<RenderersProperty>getRenderersPropertyList()Returns all available RenderersPropertysorg.apache.velocity.app.VelocityEnginegetVelocityEngine(java.util.Properties p)Deprecated.since 6.6protected static voidregisterProductSampleEnhancer()Shows how to use configure theCommonsManager.ItemMethodInterceptorfor arbitrary item classes.voidrender(RendererTemplate template, java.lang.Object context, java.io.Writer output)Deprecated.since ages - as of release 4.3, please useRendererService.render(de.hybris.platform.commons.model.renderer.RendererTemplateModel, Object, Writer)voidsetDocuments(Item item, Format format, java.util.Collection<Document> documents)java.lang.Stringtransform(java.io.InputStream inputXMLStream, Media inputXSLMedia, boolean appendHeaders)java.lang.Stringtransform(java.io.InputStream inputXMLStream, java.io.InputStream inputXSLStream, boolean appendHeaders)Applies an XML Transformation on the inputXMLSTream of Datajava.lang.Stringtransform(java.lang.String inputXML, Media inputXSLMedia, boolean appendHeaders)Applies an XML Transformation on the inputXMLSTream of Datajava.lang.Stringtransform(java.lang.String inputXML, java.io.InputStream inputXSLStream, boolean appendHeaders)Applies an XML Transformation on the inputXML data based on the specified XSL-
Methods inherited from class de.hybris.platform.commons.jalo.GeneratedCommonsManager
addToAllDocuments, addToAllDocuments, addToFormats, addToFormats, createCustomOrder2XML, createCustomOrder2XML, createDocument, createDocument, createFOPFormatter, createFOPFormatter, createFormat, createFormat, createJaloTranslatorConfiguration, createJaloTranslatorConfiguration, createJaloVelocityRenderer, createJaloVelocityRenderer, createParserProperty, createParserProperty, createRenderersProperty, createRenderersProperty, createRendererTemplate, createRendererTemplate, createVelocityFormatter, createVelocityFormatter, createXMLTransformFormatter, createXMLTransformFormatter, getAllDocuments, getAllDocuments, getDefaultAttributeModes, getFormatsCount, getFormatsCount, getName, removeFromAllDocuments, removeFromAllDocuments, removeFromFormats, removeFromFormats, setAllDocuments, setAllDocuments, setFormats, setFormats
-
Methods inherited from class de.hybris.platform.jalo.extension.Extension
checkBeforeInitialization, checkBeforeItemRemoval, createEssentialData, createProjectData, createSampleData, getCreatorDescription, getCreatorName, getCreatorParameterDefault, getCreatorParameterNames, getCreatorParameterPossibleValues, getRemote, isCreatorDisabled, notifyInitializationEnd, notifyInitializationStart, notifyItemRemoval, onFirstSessionCreation, writeReplace
-
Methods inherited from class de.hybris.platform.jalo.Manager
afterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, init, setAttribute, setTenant, setTransientObject, wrap
-
-
-
-
Method Detail
-
getInstance
public static CommonsManager getInstance()
- Returns:
- instance of this manager
-
getJarFileAsString
public static java.lang.String getJarFileAsString(java.lang.String filename, java.lang.String encoding) throws JaloInvalidParameterException, JaloItemNotFoundException, java.io.IOException, java.io.UnsupportedEncodingExceptionReturns a file from this extension's JAR file as String (incl. original line break symbols)- Parameters:
filename- The name of the file in the JAR fileencoding- The encoding that the resulting String shall be encoded with- Returns:
- A String with the content of the original file
- Throws:
JaloInvalidParameterException- If the filename is not specifiedJaloItemNotFoundException- If the file could not be found in the JAR filejava.io.IOException- If an error occurs while reading the filejava.io.UnsupportedEncodingException- If the specified encoding is not supported
-
getVelocityEngine
@Deprecated(since="6.6", forRemoval=false) public org.apache.velocity.app.VelocityEngine getVelocityEngine(java.util.Properties p) throws java.lang.ExceptionDeprecated.since 6.6Deprecated - use Velocity singleton instead. Only used inVelocityFormatterdue the creation of the VelocityEngine takes much time. So the engine will be hold by the CommonsManager and is only created once. Remember to set the correct properties, they will be given over to the VelocityEngine.init method.- Parameters:
p- the init properties or the engine- Returns:
- the VelocityEngine
- Throws:
java.lang.Exception
-
getFormats
public java.util.List<Format> getFormats(ComposedType ct)
Description copied from class:GeneratedCommonsManagerGenerated method - Getter of theComposedType.formatsattribute.- Overrides:
getFormatsin classGeneratedCommonsManager- Parameters:
ct- the ComposedType- Returns:
- for the given ComposedType a Collection with all possible
Formats.
-
getFormats
public java.util.List<Format> getFormats(SessionContext ctx, ComposedType ct)
Description copied from class:GeneratedCommonsManagerGenerated method - Getter of theComposedType.formatsattribute.- Overrides:
getFormatsin classGeneratedCommonsManager- Parameters:
ctx- the SessionContextct- the ComposedType- Returns:
- for the given ComposedType ant SessionContext a Collection with all possible
Formats.
-
getFormatsForItem
public java.util.Collection<Format> getFormatsForItem(Item item)
- Parameters:
item- the item- Returns:
- a Collection with all Formats for the given item
-
getDocuments
public java.util.Collection<Document> getDocuments(Item item, Format format)
- Parameters:
item- the itemformat- the format- Returns:
- a Collection with all
Documentfor the given item and the given format
-
setDocuments
public void setDocuments(Item item, Format format, java.util.Collection<Document> documents) throws ConsistencyCheckException
Sets for the given item and the givenFormatallDocuments which are in the Collection documents. A JaloInvalidParameterException is thrown if a document of the Collection belongs not to the item.- Parameters:
item- the item which can have documentsformat- the Format which creates documentsdocuments- a Collection ofDocuments- Throws:
ConsistencyCheckException
-
transform
public java.lang.String transform(java.lang.String inputXML, java.io.InputStream inputXSLStream, boolean appendHeaders)Applies an XML Transformation on the inputXML data based on the specified XSL- Parameters:
inputXML-inputXSLStream-appendHeaders-
-
transform
public java.lang.String transform(java.io.InputStream inputXMLStream, java.io.InputStream inputXSLStream, boolean appendHeaders)Applies an XML Transformation on the inputXMLSTream of Data- Parameters:
inputXMLStream- specifies the inputXMLStream to be used.inputXSLStream- specifies the XSL DataStream to be used for XML transformationappendHeaders- specifies whether to make the convert data to well formed HTML.
-
transform
public java.lang.String transform(java.lang.String inputXML, Media inputXSLMedia, boolean appendHeaders)Applies an XML Transformation on the inputXMLSTream of Data- Parameters:
inputXML- specifies the inputXMLStream to be used.inputXSLMedia- specifies the XSL to be used for XML transformationappendHeaders- specifies whether to make the convert data to well formed HTML.
-
transform
public java.lang.String transform(java.io.InputStream inputXMLStream, Media inputXSLMedia, boolean appendHeaders)
-
registerProductSampleEnhancer
protected static void registerProductSampleEnhancer()
Shows how to use configure theCommonsManager.ItemMethodInterceptorfor arbitrary item classes.
-
getJaloVelocityRenderers
public java.util.Collection<JaloVelocityRenderer> getJaloVelocityRenderers()
Returns all available VelocityHmcRenderers
-
getRenderersPropertyList
public java.util.Collection<RenderersProperty> getRenderersPropertyList()
Returns all available RenderersPropertys
-
getJaloTranslatorConfigurationByCode
public JaloTranslatorConfiguration getJaloTranslatorConfigurationByCode(java.lang.String code)
Returns the first found JaloTranslatorConfiguration for the given code
-
getDefaultTranslatorConfiguration
public TranslatorConfiguration getDefaultTranslatorConfiguration()
Returns a TranslatorConfiguration that is prepared for common InDesign translations
(or null, if the TranslatorConfiguration could not be created)- Returns:
- A TranslatorConfiguration that is prepared for common InDesign translations (or null, if the TranslatorConfiguration could not be created)
-
render
@Deprecated(since="ages", forRemoval=false) public void render(RendererTemplate template, java.lang.Object context, java.io.Writer output)Deprecated.since ages - as of release 4.3, please useRendererService.render(de.hybris.platform.commons.model.renderer.RendererTemplateModel, Object, Writer)Renders a template using the context PLA-5986
- Parameters:
template- contains the template contentcontext- contains the content of value, which will replace the macro in the templateoutput- saves the result
-
-