meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
sap_hybris_commerce:sap_hybris_persistence_mechanism [2019/08/26 16:26] – [Hybris Enumerations] Antonio Robirosa | sap_hybris_commerce:sap_hybris_persistence_mechanism [2019/12/18 19:44] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 219: | Line 219: | ||
* When your field contains a collection of String or Enumeration values. | * When your field contains a collection of String or Enumeration values. | ||
* When your field is dynamic because you aren't persisting the collection in the database. | * When your field is dynamic because you aren't persisting the collection in the database. | ||
- | * **Getter of a Collection**: | + | * **Getter of a Collection**: |
* **Relations with enumerations: | * **Relations with enumerations: | ||
* **One to Many**: Either endpoint cannot be copied easily because the information of the relation is kept in the instance of each class. | * **One to Many**: Either endpoint cannot be copied easily because the information of the relation is kept in the instance of each class. | ||
* **Many to Many**: Can be copied and searched. The relations are kept in a separated table, so they can be searched with FlexibleQuery or SQL. | * **Many to Many**: Can be copied and searched. The relations are kept in a separated table, so they can be searched with FlexibleQuery or SQL. | ||
- | * Don't create attributes in relations because they aren't supported by the model layer. If you need a relation with fields, create an association object. | + | * Don't create attributes in relations because they aren't supported by the model layer. If you need a relation with fields, create an association object |
====== How to persist and load items ====== | ====== How to persist and load items ====== | ||
Line 229: | Line 229: | ||
In every case you must use the **modelService**: | In every case you must use the **modelService**: | ||
- | < | + | < |
- | @Component(" | + | @Component(" |
- | </ | + | public class DeploymentScript2ExecutionConverter implements Converter< |
+ | | ||
- | To **retrieve** the model you may use ModelService# | + | @Autowired |
+ | private | ||
- | ====== Localization | + | /* |
+ | * (non-Javadoc) | ||
+ | * | ||
+ | * @see de.hybris.platform.servicelayer.dto.converter.Converter# | ||
+ | */ | ||
+ | @Override | ||
+ | public ScriptExecutionModel convert(final DeploymentScript source) throws ConversionException { | ||
+ | return this.convert(source, | ||
+ | } | ||
- | The names and descriptions of the Hybris types, enumerations, | + | /* |
+ | * (non-Javadoc) | ||
+ | * | ||
+ | * @see de.hybris.platform.servicelayer.dto.converter.Converter# | ||
+ | */ | ||
+ | @Override | ||
+ | public ScriptExecutionModel convert(final DeploymentScript source, final ScriptExecutionModel execution) | ||
+ | throws ConversionException { | ||
+ | ServicesUtil.validateParameterNotNullStandardMessage(" | ||
+ | ServicesUtil.validateParameterNotNullStandardMessage(" | ||
+ | if (DeploymentScript2ExecutionConverter.LOG.isDebugEnabled()) { | ||
+ | DeploymentScript2ExecutionConverter.LOG.debug(" | ||
+ | } | ||
+ | execution.setExtensionName(source.getExtensionName()); | ||
+ | execution.setScriptName(source.getName()); | ||
+ | execution.setResult(null); | ||
+ | execution.setPhase(source.getPhase()); | ||
- | < | + | return execution; |
- | File arecoDeploymentScriptsManager/ | + | } |
- | </ | + | |
- | This sets the name of a Hybris type, an enumeration and two attributes in German. | + | } |
- | ====== General Recommendations ====== | + | @Service |
+ | public class ArecoDeploymentScriptsRunner implements DeploymentScriptRunner { | ||
- | | + | |
- | | + | |
+ | private ModelService modelService; | ||
- | \\ Based on Hybris 6.3 | + | (...) |
- | <!-- | + | private void saveAndLogScriptExecution(final UpdatingSystemExtensionContext context, |
- | var jcomments=new JComments(64, ' | + | final ScriptExecutionModel scriptExecution) { |
- | jcomments.setList%%(' | + | this.modelService.save(scriptExecution); // The model is stored into the database |
- | %%//%%--> | + | |
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | To **retrieve** the model you may use ModelService# | ||
+ | You can **remove** an item using ModelService# | ||
+ | You can **update the item with the contents of the database** using ModelService# | ||
- | === Add comment | + | ====== Localization of Hybris types and attributes ====== |
- | Name (required) | + | The names and descriptions of the Hybris types, enumerations, |
- | E-mail (required, but will not display) | + | < |
+ | File arecoDeploymentScriptsManager/ | ||
+ | (...) | ||
+ | type.DeploymentEnvironment.name=Deployment Umgebungen | ||
+ | type.DeploymentEnvironment.name.name=Name | ||
+ | type.DeploymentEnvironment.description.name=Beschreibung | ||
- | | + | type.SystemPhase.name=Phase des Systems |
+ | type.SystemPhase.INITIALIZATION.name=Initialization | ||
+ | type.SystemPhase.UPDATE.name=Aktualisierung | ||
+ | (...) | ||
+ | </ | ||
- | {{: | + | This sets the name of a Hybris type, an enumeration and two attributes in German. |
- | | + | ====== |
- | + | * Please read [[https://www.sap.com/ | |
- | [[# | + | * Don't use the menu Backoffice > System > Types to modify the Hybris types on runtime because you changes will be lost after an update running system |
- | + | ||
- | [[# | + | |
- | + | ||
- | + | ||
- | + | ||
- | <!-- | + | |
- | function JCommentsInitializeForm() | + | |
- | { | + | |
- | var jcEditor | + | |
- | jcEditor.initSmiles%%('/ | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addSmile%%(' | + | |
- | jcEditor.addCounter(1000, | + | |
- | jcomments.setForm(new JCommentsForm%%(' | + | |
- | } | + | |
- | + | ||
- | if (window.addEventListener) {window.addEventListener%%(' | + | |
- | else if (document.addEventListener){document.addEventListener%%(' | + | |
- | else if (window.attachEvent){window.attachEvent%%(' | + | |
- | else {if (typeof window.onload==' | + | |
- | %%// | + | |
- | + | ||
- | + | ||
- | [[http://www.joomlatune.com|JComments]] | + | |
- | * You are here: | + | --Based on Hybris |
- | * [[:|Home]] {{: | + | |
- | * Hybris' persistence mechanism | + |