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,Serializable
This extension contains some useful logic for the platform.
These are:
These are:
- Formatter (via Velocity, FOP, etc.)
- Translator (Supports translation of e.g. HTML text to another format you specify)
- ...
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class de.hybris.platform.jalo.extension.Extension
Extension.RestrictedLanguagesProvider, Extension.RightsProviderNested 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 -
Method Summary
Modifier and TypeMethodDescriptionReturns a TranslatorConfiguration that is prepared for common InDesign translations
(or null, if the TranslatorConfiguration could not be created)getDocuments(Item item, Format format) getFormats(SessionContext ctx, ComposedType ct) Generated method - Getter of theComposedType.formatsattribute.Generated method - Getter of theComposedType.formatsattribute.getFormatsForItem(Item item) static CommonsManagerReturns the first found JaloTranslatorConfiguration for the given codeReturns all available VelocityHmcRenderersstatic StringgetJarFileAsString(String filename, String encoding) Returns a file from this extension's JAR file as String (incl.Returns all available RenderersPropertysorg.apache.velocity.app.VelocityEngineDeprecated.since 6.6protected static voidShows how to use configure theCommonsManager.ItemMethodInterceptorfor arbitrary item classes.voidrender(RendererTemplate template, Object context, 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, Collection<Document> documents) transform(InputStream inputXMLStream, Media inputXSLMedia, boolean appendHeaders) transform(InputStream inputXMLStream, InputStream inputXSLStream, boolean appendHeaders) Applies an XML Transformation on the inputXMLSTream of DataApplies an XML Transformation on the inputXMLSTream of Datatransform(String inputXML, InputStream inputXSLStream, boolean appendHeaders) Applies an XML Transformation on the inputXML data based on the specified XSLMethods 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, setFormatsMethods 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, writeReplaceMethods 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
-
Constructor Details
-
CommonsManager
public CommonsManager()
-
-
Method Details
-
getInstance
- Returns:
- instance of this manager
-
getJarFileAsString
public static String getJarFileAsString(String filename, String encoding) throws JaloInvalidParameterException, JaloItemNotFoundException, IOException, UnsupportedEncodingException Returns 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 fileIOException- If an error occurs while reading the fileUnsupportedEncodingException- If the specified encoding is not supported
-
getVelocityEngine
@Deprecated(since="6.6", forRemoval=false) public org.apache.velocity.app.VelocityEngine getVelocityEngine(Properties p) throws Exception Deprecated.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:
Exception
-
getFormats
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
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
- Parameters:
item- the item- Returns:
- a Collection with all Formats for the given item
-
getDocuments
- 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, 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
Applies an XML Transformation on the inputXML data based on the specified XSL- Parameters:
inputXML-inputXSLStream-appendHeaders-
-
transform
public String transform(InputStream inputXMLStream, 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
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
-
registerProductSampleEnhancer
protected static void registerProductSampleEnhancer()Shows how to use configure theCommonsManager.ItemMethodInterceptorfor arbitrary item classes. -
getJaloVelocityRenderers
Returns all available VelocityHmcRenderers -
getRenderersPropertyList
Returns all available RenderersPropertys -
getJaloTranslatorConfigurationByCode
Returns the first found JaloTranslatorConfiguration for the given code -
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, Object context, 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
-