diff --git a/delivery-slot-management-btp/README.md b/delivery-slot-management-btp/README.md index 8a78f1a..4770c56 100644 --- a/delivery-slot-management-btp/README.md +++ b/delivery-slot-management-btp/README.md @@ -64,7 +64,7 @@ Given this is a demo extension and not a production ready code, we have simplifi Here are the instructions to configure locally the extension and make it work. The extension has been developed to work with the standard `electronics-spa accelerator`, although it should easily work with other SAP accelerators as well with small changes. ### Install the BTP Kyma Microservice -Follow the instructions at https://github.tools.sap/cx-boosters/easy-btp-delivery-slot-management/blob/main/deliveryslotmanagement-btp/README.md +Follow the instructions at [Delivery Slot Management Services on BTP](https://github.tools.sap/cx-boosters/easy-btp-delivery-slot-management/blob/main/deliveryslotmanagement-btp/README.md) ### Install SAP Commerce Platform @@ -73,27 +73,14 @@ First thing is then to install the latest 2205 commerce version. Follow the offi - [Using the Installer Recipes](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/cb3ff964e4784073a70f06165efbac8a.html?locale=en-US&version=v2205) to install using the cx recipe - [Installing SAP Commerce Cloud Manually](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/8bf5cfea86691014a00e9705a3c84074.html?locale=en-US&version=v2205) to install manually if you know the required extensions to set up the electronics or apparel-uk accelerator -### Install the Easy Extension Framework -1. Download [Easy Extension Framework](https://github.com/SAP/easy-extension-framework) -2. Add Easy extensions to your `localextensions.xml` file: -``` - - - - -``` -3. Run `ant clean all` -4. Run `ant initialize -Dtenant=master` -5. Start SAP Commerce Cloud server with `/bin/platform/hybrisserver.sh` +### Install the Easy Framework +Install `Easy Extension Framework` as explained in the [documentation](https://sap.github.io/easy-extension-framework/install-for-existing-setup.html). -### Configure local Easy repository +### Configure Local Easy repository Next you'll have to configure the Git repository where the tutorial extension is stored. If you want to play around locally with the extension we suggest you to create a local easy repository that will simplify and speed up your development. -Follow these steps: -- Clone locally the [Easy Extension Sample](https://github.com/SAP-samples/easy-extension-samples) repository -- Login into the backoffice and find the Easy node on the Navigation Tree, open Easy Core, Repositories and click on the + button to create a new "local repository" -![img.png](./images/img.png) -- populate the wizard giving the repo a code, name and the path of your local File System where you've cloned the remote easy-extension-samples repo -![img_1.png](./images/img_1.png) +Follow these [steps](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice/): +- Clone locally the [Easy Extension Sample](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/easy-0.2) repository (branch compatible to the installed Easy Extension Framework version. For example: The compatible branch for `v0.x` of Easy Extension Framework is `easy-0.x`). +- Configure it as the Local Repository as explained in the [documentation](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice.html#configuring-a-local-repository). ### Install Delivery Slot Management Btp Easy extension Easy extensions have to be installed through the Administration Console: diff --git a/delivery-slot-management/README.md b/delivery-slot-management/README.md index 78afc11..7b84eb6 100644 --- a/delivery-slot-management/README.md +++ b/delivery-slot-management/README.md @@ -81,27 +81,14 @@ First thing is then to install the latest 2205 commerce version. Follow the offi - [Using the Installer Recipes](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/cb3ff964e4784073a70f06165efbac8a.html?locale=en-US&version=v2205) to install using the cx recipe - [Installing SAP Commerce Cloud Manually](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/8bf5cfea86691014a00e9705a3c84074.html?locale=en-US&version=v2205) to install manually if you know the required extensions to set up the electronics or apparel-uk accelerator -### Install the Easy Extension Framework -1. Download [Easy Extension Framework](https://github.com/SAP/easy-extension-framework) -2. Add Easy extensions to your `localextensions.xml` file: -``` - - - - -``` -3. Run `ant clean all` -4. Run `ant initialize -Dtenant=master` -5. Start SAP Commerce Cloud server with `/bin/platform/hybrisserver.sh` +### Install the Easy Framework +Install `Easy Extension Framework` as explained in the [documentation](https://sap.github.io/easy-extension-framework/install-for-existing-setup.html). -### Configure local Easy repository +### Configure Local Easy repository Next you'll have to configure the Git repository where the tutorial extension is stored. If you want to play around locally with the extension we suggest you to create a local easy repository that will simplify and speed up your development. Follow these [steps](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice/): -- Clone locally the [Easy Extension Sample](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/easy-0.2) repository (branch easy-0.2) -- Login into the backoffice and find the Easy node on the Navigation Tree, open Easy Core, Repositories and click on the + button to create a new "local repository" -![img.png](./images/img.png) -- populate the wizard giving the repo a code, name and the path of your local File System where you've cloned the remote easy-extension-samples repo -![img_1.png](./images/img_1.png) +- Clone locally the [Easy Extension Sample](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/easy-0.2) repository (branch compatible to the installed Easy Extension Framework version. For example: The compatible branch for `v0.x` of Easy Extension Framework is `easy-0.x`). +- Configure it as the Local Repository as explained in the [documentation](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice.html#configuring-a-local-repository). ### Install Delivery Slot Management Easy extension Easy extensions have to be installed through the Administration Console: diff --git a/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementCartModel.groovy b/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementCartModel.groovy deleted file mode 100644 index 89cacd6..0000000 --- a/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementCartModel.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. -* ---------------------------------------------------------------- -* --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE -* --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Thu Dec 07 15:41:05 GMT 2023 -* ---------------------------------------------------------------- -*/ - -package com.sap.cx.boosters.easy.deliveryslotmanagement.models - -import de.hybris.platform.core.model.order.CartModel -import com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementModel -import de.hybris.bootstrap.annotations.Accessor -import de.hybris.platform.servicelayer.model.ItemModelContext - -/** -* Generated model class for easy type Cart. -*/ -class DeliverySlotManagementCartModel extends CartModel { - - /**Generated model type code constant.*/ - public static final String _TYPECODE = "Cart" - - /** Generated constant - Attribute key of Cart.deliveryslotmanagement. */ - public static final String DELIVERYSLOTMANAGEMENT = "deliveryslotmanagement" - - /** - * Generated constructor - Default constructor for generic creation. - */ - DeliverySlotManagementCartModel() { - super() - } - - /** - * Generated constructor - Default constructor for creation with existing context - * @param ctx the model context to be injected, must not be null - */ - DeliverySlotManagementCartModel(final ItemModelContext ctx) { - super(ctx) - } - - - /** - * Generated method - Getter of the Cart.deliveryslotmanagement attribute. - * @return the deliveryslotmanagement - */ - @Accessor(qualifier = DELIVERYSLOTMANAGEMENT, type = Accessor.Type.GETTER) - DeliverySlotManagementModel getDeliveryslotmanagement() { - return getPersistenceContext().getDynamicValue(this, DELIVERYSLOTMANAGEMENT) - } - -} diff --git a/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementOrderModel.groovy b/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementOrderModel.groovy deleted file mode 100644 index 83e9775..0000000 --- a/delivery-slot-management/gensrc/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/models/DeliverySlotManagementOrderModel.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. -* ---------------------------------------------------------------- -* --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE -* --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Thu Dec 07 15:41:05 GMT 2023 -* ---------------------------------------------------------------- -*/ - -package com.sap.cx.boosters.easy.deliveryslotmanagement.models - -import de.hybris.platform.core.model.order.OrderModel -import com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementModel -import de.hybris.bootstrap.annotations.Accessor -import de.hybris.platform.servicelayer.model.ItemModelContext - -/** -* Generated model class for easy type Order. -*/ -class DeliverySlotManagementOrderModel extends OrderModel { - - /**Generated model type code constant.*/ - public static final String _TYPECODE = "Order" - - /** Generated constant - Attribute key of Order.deliveryslotmanagement. */ - public static final String DELIVERYSLOTMANAGEMENT = "deliveryslotmanagement" - - /** - * Generated constructor - Default constructor for generic creation. - */ - DeliverySlotManagementOrderModel() { - super() - } - - /** - * Generated constructor - Default constructor for creation with existing context - * @param ctx the model context to be injected, must not be null - */ - DeliverySlotManagementOrderModel(final ItemModelContext ctx) { - super(ctx) - } - - - /** - * Generated method - Getter of the Order.deliveryslotmanagement attribute. - * @return the deliveryslotmanagement - */ - @Accessor(qualifier = DELIVERYSLOTMANAGEMENT, type = Accessor.Type.GETTER) - DeliverySlotManagementModel getDeliveryslotmanagement() { - return getPersistenceContext().getDynamicValue(this, DELIVERYSLOTMANAGEMENT) - } - -} diff --git a/delivery-slot-management/src/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/populators/HomeDeliveryModeOrderPopulator.groovy b/delivery-slot-management/src/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/populators/HomeDeliveryModeOrderPopulator.groovy index ea18dce..2d673e8 100644 --- a/delivery-slot-management/src/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/populators/HomeDeliveryModeOrderPopulator.groovy +++ b/delivery-slot-management/src/main/groovy/com/sap/cx/boosters/easy/deliveryslotmanagement/populators/HomeDeliveryModeOrderPopulator.groovy @@ -1,6 +1,6 @@ package com.sap.cx.boosters.easy.deliveryslotmanagement.populators -import com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementOrderModel +import com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementModel import de.hybris.platform.commercefacades.order.data.OrderData import de.hybris.platform.converters.Populator import de.hybris.platform.core.model.order.OrderModel @@ -13,11 +13,10 @@ class HomeDeliveryModeOrderPopulator implements Populator @Override void populate(OrderModel source, OrderData orderData) throws ConversionException { - if (source instanceof DeliverySlotManagementOrderModel) { - def orderModel = source as DeliverySlotManagementOrderModel - if (orderModel.getDeliveryMode().getCode().startsWith("homedelivery")) { - def dsm = orderModel.getDeliveryslotmanagement() - orderData.getDeliveryMode().setDescription("You'll receive your items on: ${dsm.getDeliveryslot().getStarttime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}") + if (source.getDeliveryMode().getCode().startsWith("homedelivery")) { + DeliverySlotManagementModel dsm = source.getProperty('deliveryslotmanagement') as DeliverySlotManagementModel + if (null != dsm) { + orderData.deliveryMode.description = "You'll receive your items on: ${dsm.deliveryslot.starttime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}" } } } diff --git a/delivery-slot-management/src/main/resources/easy.properties b/delivery-slot-management/src/main/resources/easy.properties index f574431..e102305 100644 --- a/delivery-slot-management/src/main/resources/easy.properties +++ b/delivery-slot-management/src/main/resources/easy.properties @@ -6,7 +6,5 @@ easytype.Vehicle.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.mode easytype.DeliverySlot.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotModel easytype.DeliverySlotManagement.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementModel easytype.DeliverySlotStatus.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.enums.DeliverySlotStatus -easytype.Cart.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementCartModel -easytype.Order.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotManagementOrderModel homeDelivery.minimumLeadTime=1 homeDelivery.maximumLeadTime=7 diff --git a/delivery-slot-management/src/main/resources/easytypes.json b/delivery-slot-management/src/main/resources/easytypes.json index f976bb1..935f20d 100644 --- a/delivery-slot-management/src/main/resources/easytypes.json +++ b/delivery-slot-management/src/main/resources/easytypes.json @@ -374,8 +374,6 @@ "autocreate": "false", "generate": "false", "superType": "AbstractOrder", - "modelClassName" : "DeliverySlotManagementCartModel", - "superTypeModelClass": "de.hybris.platform.core.model.order.CartModel", "attributes": [ { "qualifier": "deliveryslotmanagement", @@ -403,8 +401,6 @@ "autocreate": "false", "generate": "false", "superType": "AbstractOrder", - "modelClassName" : "DeliverySlotManagementOrderModel", - "superTypeModelClass": "de.hybris.platform.core.model.order.OrderModel", "attributes": [ { "qualifier": "deliveryslotmanagement", diff --git a/easy-tutorial-step1/README.md b/easy-tutorial-step1/README.md index da2f4a5..93dd574 100644 --- a/easy-tutorial-step1/README.md +++ b/easy-tutorial-step1/README.md @@ -5,7 +5,6 @@ In this tutorial, we will build a new extension to add new features that do not To understand what we will build during this tutorial, you can check the final outcome: [delivery-slot-management](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/main/delivery-slot-management/README.md) extension. You will find in the documentation the list of features. In this tutorial, you will learn: -- [How to setup your development environment](#easy-tutorial-step-1---setup-your-development-environment) - [How to extend SAP Commerce data model](../easy-tutorial-step2) - [How to create and override Spring Beans](../easy-tutorial-step3) - [How to create new REST endpoints](../easy-tutorial-step4) @@ -15,7 +14,7 @@ In this tutorial, you will learn: # Easy Tutorial Step 1 - Setup your Development Environment ## Overview -In this step of the tutorial, you will learn how to setup Easy Extension Framework, install a new extension and setup your IDE. +In this step of the tutorial, you will learn how to setup Easy Extension Framework, install a new extension and set up your IDE. ## Setup Here are the instructions to configure locally the extension and make it works. The extension has been developed to work with the standard electronics-spa accelerator, although it can work easily with other spa accelerators as well with small changes. @@ -30,26 +29,13 @@ First thing is then to install the latest 2205 commerce version. Follow the offi - [Installing SAP Commerce Cloud Manually](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/8bf5cfea86691014a00e9705a3c84074.html?locale=en-US&version=v2205) to install manually if you know the required extensions to set up the electronics or apparel-uk accelerator ### Install the Easy Framework -1. Download [Easy Extension Framework](https://github.com/SAP/easy-extension-framework) -2. Add Easy extensions to your **localextensions.xml** file: -``` - - - - -``` -3. Run `ant clean all` -4. Run `ant initialize -Dtenant=master` -5. Start SAP Commerce Cloud server with `/bin/platform/hybrisserver.sh` - -### Configure local Easy repository +Install `Easy Extension Framework` as explained in the [documentation](https://sap.github.io/easy-extension-framework/install-for-existing-setup.html). + +### Configure Local Easy repository Next you'll have to configure the Git repository where the tutorial extension is stored. If you want to play around locally with the extension we suggest you to create a local easy repository that will simplify and speed up your development. Follow these [steps](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice/): -- clone locally the [Easy Extension Sample](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/easy-0.2) repository (branch easy-0.2) -- Login into the backoffice and find the Easy node on the Navigation Tree, open Easy Core, Repositories and click on the + button to create a new "local repository" -![img.png](./images/img.png) -- populate the wizard giving the repo a code, name and the path of your local File System where you've cloned the remote easy-extension-samples repo -![img_1.png](./images/img_1.png) +- Clone locally the [Easy Extension Sample](https://github.tools.sap/cx-boosters/easy-extension-samples/tree/easy-0.2) repository (branch compatible to the installed Easy Extension Framework version. For example: The compatible branch for `v0.x` of Easy Extension Framework is `easy-0.x`). +- Configure it as the Local Repository as explained in the [documentation](https://sap.github.io/easy-extension-framework/configuring-an-easy-repository-in-backoffice.html#configuring-a-local-repository). ### Configure Easy Extension Development Environment The easy extensions development environment setup is based on [Gradle](https://gradle.org/). Following are the steps to setup the environment: @@ -63,7 +49,7 @@ The easy extensions development environment setup is based on [Gradle](https://g sap.commerce.easy.api.key = 123456 # Path to the hybris home directory on your computer to add SAP Commerce Cloud libraries to your extension - sap.commerce.easy.platform.home= + sap.commerce.easy.platform.home= sap.commerce.easy.rest.base.url = https://localhost:9002/easyrest ``` diff --git a/easy-tutorial-step2/README.md b/easy-tutorial-step2/README.md index 0d69c11..cbccfe3 100644 --- a/easy-tutorial-step2/README.md +++ b/easy-tutorial-step2/README.md @@ -25,377 +25,379 @@ Modelling new item types in an Easy extension is a process that requires 2 steps This file is roughly the equivalent of standard items.xml files where the datamodel of traditional Commerce extensions is defined. The structure of the file, attribute names, etc. everything mirrors the same components in the items.xml files. Let's see an extract of the file: ```json -"enumtypes": [ - { - "code": "DeliverySlotStatus", - "name": [ - { - "lang": "en", - "value": "Delivery Slot Status" - } - ], - "values": [ - { - "code": "BOOKED", - "name": [ - { - "lang": "en", - "value": "Booked" - } - ] - }, - { - "code": "CONFIRMED", - "name": [ - { - "lang": "en", - "value": "Confirmed" - } - ] - } - ] - } -], -"itemtypes": [ - { - "code": "Vehicle", - "name": [ - { - "lang": "en", - "value": "Vehicle" - } - ], - "autocreate": "true", - "generate": "true", - "superType": "GenericItem", - "modelClassName": "VehicleModel", - "deployment": { - "table": "vehicles", - "typecode": "26000", - "propstable": "vehicleprops" - }, - "attributes": [ - { - "qualifier": "code", - "type": "java.lang.String", - "name": [ - { - "lang": "en", - "value": "Code" - } - ], - "persistence": { - "type": "property", - "column": "p_code" +{ + "enumtypes": [ + { + "code": "DeliverySlotStatus", + "name": [ + { + "lang": "en", + "value": "Delivery Slot Status" + } + ], + "values": [ + { + "code": "BOOKED", + "name": [ + { + "lang": "en", + "value": "Booked" + } + ] }, - "modifiers": { - "unique": "true", - "initial": "true", - "optional": "false", - "write": "false", - "partof": "false" + { + "code": "CONFIRMED", + "name": [ + { + "lang": "en", + "value": "Confirmed" + } + ] + } + ] + } + ], + "itemtypes": [ + { + "code": "Vehicle", + "name": [ + { + "lang": "en", + "value": "Vehicle" } + ], + "autocreate": "true", + "generate": "true", + "superType": "GenericItem", + "modelClassName": "VehicleModel", + "deployment": { + "table": "vehicles", + "typecode": "26000", + "propstable": "vehicleprops" }, - { - "qualifier": "name", - "type": "localized:java.lang.String", - "name": [ - { - "lang": "en", - "value": "Name" + "attributes": [ + { + "qualifier": "code", + "type": "java.lang.String", + "name": [ + { + "lang": "en", + "value": "Code" + } + ], + "persistence": { + "type": "property", + "column": "p_code" + }, + "modifiers": { + "unique": "true", + "initial": "true", + "optional": "false", + "write": "false", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_name" }, - "modifiers": { - "unique": "false", - "initial": "false", - "optional": "true", - "write": "true", - "partof": "false" + { + "qualifier": "name", + "type": "localized:java.lang.String", + "name": [ + { + "lang": "en", + "value": "Name" + } + ], + "persistence": { + "type": "property", + "column": "p_name" + }, + "modifiers": { + "unique": "false", + "initial": "false", + "optional": "true", + "write": "true", + "partof": "false" + } } - } - ] - }, - { - "code": "DeliverySlot", - "name": [ - { - "lang": "en", - "value": "Delivery Slot" - } - ], - "autocreate": "true", - "generate": "true", - "superType": "GenericItem", - "modelClassName": "DeliverySlotModel", - "deployment": { - "table": "deliveryslots", - "typecode": "26001", - "propstable": "deliveryslotprops" + ] }, - "attributes": [ - { - "qualifier": "code", - "type": "java.lang.String", - "name": [ - { - "lang": "en", - "value": "Code" - } - ], - "persistence": { - "type": "property", - "column": "p_code" - }, - "modifiers": { - "unique": "true", - "initial": "true", - "optional": "false", - "write": "false", - "partof": "false" + { + "code": "DeliverySlot", + "name": [ + { + "lang": "en", + "value": "Delivery Slot" } + ], + "autocreate": "true", + "generate": "true", + "superType": "GenericItem", + "modelClassName": "DeliverySlotModel", + "deployment": { + "table": "deliveryslots", + "typecode": "26001", + "propstable": "deliveryslotprops" }, - { - "qualifier": "warehouse", - "type": "Warehouse", - "typeClass": "de.hybris.platform.ordersplitting.model.WarehouseModel", - "name": [ - { - "lang": "en", - "value": "Warehouse" + "attributes": [ + { + "qualifier": "code", + "type": "java.lang.String", + "name": [ + { + "lang": "en", + "value": "Code" + } + ], + "persistence": { + "type": "property", + "column": "p_code" + }, + "modifiers": { + "unique": "true", + "initial": "true", + "optional": "false", + "write": "false", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_warehouse" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "vehicle", - "type": "Vehicle", - "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.models.VehicleModel", - "name": [ - { - "lang": "en", - "value": "Vehicle" + { + "qualifier": "warehouse", + "type": "Warehouse", + "typeClass": "de.hybris.platform.ordersplitting.model.WarehouseModel", + "name": [ + { + "lang": "en", + "value": "Warehouse" + } + ], + "persistence": { + "type": "property", + "column": "p_warehouse" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_vehicle" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "starttime", - "type": "java.util.Date", - "name": [ - { - "lang": "en", - "value": "Start Time" + { + "qualifier": "vehicle", + "type": "Vehicle", + "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.models.VehicleModel", + "name": [ + { + "lang": "en", + "value": "Vehicle" + } + ], + "persistence": { + "type": "property", + "column": "p_vehicle" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_starttime" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "endtime", - "type": "java.util.Date", - "name": [ - { - "lang": "en", - "value": "End Time" + { + "qualifier": "starttime", + "type": "java.util.Date", + "name": [ + { + "lang": "en", + "value": "Start Time" + } + ], + "persistence": { + "type": "property", + "column": "p_starttime" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_endtime" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "available", - "type": "java.lang.Integer", - "name": [ - { - "lang": "en", - "value": "Available" + { + "qualifier": "endtime", + "type": "java.util.Date", + "name": [ + { + "lang": "en", + "value": "End Time" + } + ], + "persistence": { + "type": "property", + "column": "p_endtime" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_available" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" + { + "qualifier": "available", + "type": "java.lang.Integer", + "name": [ + { + "lang": "en", + "value": "Available" + } + ], + "persistence": { + "type": "property", + "column": "p_available" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" + } } - } - ] - }, - { - "code": "DeliverySlotManagement", - "name": [ - { - "lang": "en", - "value": "Delivery Slot Management" - } - ], - "autocreate": "true", - "generate": "true", - "modelClassName": "DeliverySlotManagementModel", - "superType": "GenericItem", - "deployment": { - "table": "deliveryslotmanagements", - "typecode": "26002", - "propstable": "deliveryslotmanagementprops" + ] }, - "attributes": [ - { - "qualifier": "code", - "type": "java.lang.String", - "name": [ - { - "lang": "en", - "value": "Code" - } - ], - "persistence": { - "type": "property", - "column": "p_code" - }, - "modifiers": { - "unique": "true", - "initial": "true", - "optional": "false", - "write": "false", - "partof": "false" + { + "code": "DeliverySlotManagement", + "name": [ + { + "lang": "en", + "value": "Delivery Slot Management" } + ], + "autocreate": "true", + "generate": "true", + "modelClassName": "DeliverySlotManagementModel", + "superType": "GenericItem", + "deployment": { + "table": "deliveryslotmanagements", + "typecode": "26002", + "propstable": "deliveryslotmanagementprops" }, - { - "qualifier": "deliveryslot", - "type": "DeliverySlot", - "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotModel", - "name": [ - { - "lang": "en", - "value": "Delivery Slot" + "attributes": [ + { + "qualifier": "code", + "type": "java.lang.String", + "name": [ + { + "lang": "en", + "value": "Code" + } + ], + "persistence": { + "type": "property", + "column": "p_code" + }, + "modifiers": { + "unique": "true", + "initial": "true", + "optional": "false", + "write": "false", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_deliveryslot" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "abstractorder", - "type": "AbstractOrder", - "typeClass": "de.hybris.platform.core.model.order.AbstractOrderModel", - "name": [ - { - "lang": "en", - "value": "Abstract Order" + { + "qualifier": "deliveryslot", + "type": "DeliverySlot", + "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotModel", + "name": [ + { + "lang": "en", + "value": "Delivery Slot" + } + ], + "persistence": { + "type": "property", + "column": "p_deliveryslot" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_abstractorder" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "timestamp", - "type": "java.util.Date", - "name": [ - { - "lang": "en", - "value": "Timestamp" + { + "qualifier": "abstractorder", + "type": "AbstractOrder", + "typeClass": "de.hybris.platform.core.model.order.AbstractOrderModel", + "name": [ + { + "lang": "en", + "value": "Abstract Order" + } + ], + "persistence": { + "type": "property", + "column": "p_abstractorder" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_timestamp" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" - } - }, - { - "qualifier": "status", - "type": "DeliverySlotStatus", - "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.enums.DeliverySlotStatus", - "name": [ - { - "lang": "en", - "value": "Status" + { + "qualifier": "timestamp", + "type": "java.util.Date", + "name": [ + { + "lang": "en", + "value": "Timestamp" + } + ], + "persistence": { + "type": "property", + "column": "p_timestamp" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" } - ], - "persistence": { - "type": "property", - "column": "p_status" }, - "modifiers": { - "unique": "false", - "initial": "true", - "optional": "false", - "write": "true", - "partof": "false" + { + "qualifier": "status", + "type": "DeliverySlotStatus", + "typeClass": "com.sap.cx.boosters.easy.deliveryslotmanagement.enums.DeliverySlotStatus", + "name": [ + { + "lang": "en", + "value": "Status" + } + ], + "persistence": { + "type": "property", + "column": "p_status" + }, + "modifiers": { + "unique": "false", + "initial": "true", + "optional": "false", + "write": "true", + "partof": "false" + } } - } - ] - } -] + ] + } + ] +} ``` ### Generate the model classes @@ -403,10 +405,10 @@ This second step is required to use your own model class for the newly created i For Easy extensions, the model classes are generated through the gradle task `easy-class-gen` and then you need to register the model classes in the `easy.properties` file of the extension Here are the properties that you need to set up: ``` -easyextension.EasyTutorialStep2.easy.type.base.models.package=com.sap.cx.boosters.easy.deliveryslotmanagement -easytype.Vehicle.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.VehicleModel -easytype.DeliverySlot.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.models.DeliverySlotModel -easytype.DeliverySlotStatus.modelClass=com.sap.cx.boosters.easy.deliveryslotmanagement.enums.DeliverySlotStatus +easyextension.EasyTutorialStep2.easy.type.base.models.package=com.sap.cx.boosters.easy.easytutorialstep2 +easytype.Vehicle.modelClass=com.sap.cx.boosters.easy.easytutorialstep2.models.VehicleModel +easytype.DeliverySlot.modelClass=com.sap.cx.boosters.easy.easytutorialstep2.models.DeliverySlotModel +easytype.DeliverySlotStatus.modelClass=com.sap.cx.boosters.easy.easytutorialstep2.enums.DeliverySlotStatus ``` ## Importing data on Easy Extension Let's see how you can import data into Easy Extension. diff --git a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/enums/DeliverySlotStatus.groovy b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/enums/DeliverySlotStatus.groovy index a52e972..44538f3 100644 --- a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/enums/DeliverySlotStatus.groovy +++ b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/enums/DeliverySlotStatus.groovy @@ -1,9 +1,9 @@ /* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE * --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 18:08:24 GMT 2023 +* --- Generated at Tue Apr 16 23:19:31 BST 2024 * ---------------------------------------------------------------- */ diff --git a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotManagementModel.groovy b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotManagementModel.groovy index 5855ddd..f589f23 100644 --- a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotManagementModel.groovy +++ b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotManagementModel.groovy @@ -1,18 +1,18 @@ /* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE * --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 18:08:24 GMT 2023 +* --- Generated at Tue Apr 16 23:19:31 BST 2024 * ---------------------------------------------------------------- */ package com.sap.cx.boosters.easy.easytutorialstep2.models import de.hybris.platform.core.model.ItemModel +import de.hybris.platform.core.model.order.AbstractOrderModel import com.sap.cx.boosters.easy.easytutorialstep2.models.DeliverySlotModel import com.sap.cx.boosters.easy.easytutorialstep2.enums.DeliverySlotStatus -import de.hybris.platform.core.model.order.AbstractOrderModel import de.hybris.bootstrap.annotations.Accessor import de.hybris.platform.servicelayer.model.ItemModelContext @@ -24,8 +24,8 @@ class DeliverySlotManagementModel extends ItemModel { /**Generated model type code constant.*/ public static final String _TYPECODE = "DeliverySlotManagement" - /** Generated constant - Attribute key of DeliverySlotManagement.timestamp. */ - public static final String TIMESTAMP = "timestamp" + /** Generated constant - Attribute key of DeliverySlotManagement.abstractorder. */ + public static final String ABSTRACTORDER = "abstractorder" /** Generated constant - Attribute key of DeliverySlotManagement.deliveryslot. */ public static final String DELIVERYSLOT = "deliveryslot" @@ -33,12 +33,12 @@ class DeliverySlotManagementModel extends ItemModel { /** Generated constant - Attribute key of DeliverySlotManagement.status. */ public static final String STATUS = "status" + /** Generated constant - Attribute key of DeliverySlotManagement.timestamp. */ + public static final String TIMESTAMP = "timestamp" + /** Generated constant - Attribute key of DeliverySlotManagement.code. */ public static final String CODE = "code" - /** Generated constant - Attribute key of DeliverySlotManagement.abstractorder. */ - public static final String ABSTRACTORDER = "abstractorder" - /** * Generated constructor - Default constructor for generic creation. */ @@ -56,22 +56,22 @@ class DeliverySlotManagementModel extends ItemModel { /** - * Generated method - Getter of the DeliverySlotManagement.timestamp attribute. - * @return the timestamp + * Generated method - Getter of the DeliverySlotManagement.abstractorder attribute. + * @return the abstractorder */ - @Accessor(qualifier = TIMESTAMP, type = Accessor.Type.GETTER) - Date getTimestamp() { - return getPersistenceContext().getPropertyValue(TIMESTAMP) + @Accessor(qualifier = ABSTRACTORDER, type = Accessor.Type.GETTER) + AbstractOrderModel getAbstractorder() { + return getPersistenceContext().getPropertyValue(ABSTRACTORDER) } /** - * Generated method - Setter of DeliverySlotManagement.timestamp attribute. + * Generated method - Setter of DeliverySlotManagement.abstractorder attribute. * - * @param value the timestamp + * @param value the abstractorder */ - @Accessor(qualifier = TIMESTAMP, type = Accessor.Type.SETTER) - void setTimestamp(final Date value) { - getPersistenceContext().setPropertyValue(TIMESTAMP, value) + @Accessor(qualifier = ABSTRACTORDER, type = Accessor.Type.SETTER) + void setAbstractorder(final AbstractOrderModel value) { + getPersistenceContext().setPropertyValue(ABSTRACTORDER, value) } /** @@ -113,31 +113,40 @@ class DeliverySlotManagementModel extends ItemModel { } /** - * Generated method - Getter of the DeliverySlotManagement.code attribute. - * @return the code + * Generated method - Getter of the DeliverySlotManagement.timestamp attribute. + * @return the timestamp */ - @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) - String getCode() { - return getPersistenceContext().getPropertyValue(CODE) + @Accessor(qualifier = TIMESTAMP, type = Accessor.Type.GETTER) + Date getTimestamp() { + return getPersistenceContext().getPropertyValue(TIMESTAMP) } + /** + * Generated method - Setter of DeliverySlotManagement.timestamp attribute. + * + * @param value the timestamp + */ + @Accessor(qualifier = TIMESTAMP, type = Accessor.Type.SETTER) + void setTimestamp(final Date value) { + getPersistenceContext().setPropertyValue(TIMESTAMP, value) + } /** - * Generated method - Getter of the DeliverySlotManagement.abstractorder attribute. - * @return the abstractorder + * Generated method - Getter of the DeliverySlotManagement.code attribute. + * @return the code */ - @Accessor(qualifier = ABSTRACTORDER, type = Accessor.Type.GETTER) - AbstractOrderModel getAbstractorder() { - return getPersistenceContext().getPropertyValue(ABSTRACTORDER) + @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) + String getCode() { + return getPersistenceContext().getPropertyValue(CODE) } /** - * Generated method - Setter of DeliverySlotManagement.abstractorder attribute. + * Generated method - Setter of DeliverySlotManagement.code attribute. * - * @param value the abstractorder + * @param value the code */ - @Accessor(qualifier = ABSTRACTORDER, type = Accessor.Type.SETTER) - void setAbstractorder(final AbstractOrderModel value) { - getPersistenceContext().setPropertyValue(ABSTRACTORDER, value) + @Accessor(qualifier = CODE, type = Accessor.Type.SETTER) + void setCode(final String value) { + getPersistenceContext().setPropertyValue(CODE, value) } } diff --git a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotModel.groovy b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotModel.groovy index b20db58..029e613 100644 --- a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotModel.groovy +++ b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/DeliverySlotModel.groovy @@ -1,9 +1,9 @@ /* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE * --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 18:08:24 GMT 2023 +* --- Generated at Tue Apr 16 23:19:31 BST 2024 * ---------------------------------------------------------------- */ @@ -29,17 +29,17 @@ class DeliverySlotModel extends ItemModel { /** Generated constant - Attribute key of DeliverySlot.starttime. */ public static final String STARTTIME = "starttime" - /** Generated constant - Attribute key of DeliverySlot.vehicle. */ - public static final String VEHICLE = "vehicle" - /** Generated constant - Attribute key of DeliverySlot.code. */ public static final String CODE = "code" + /** Generated constant - Attribute key of DeliverySlot.available. */ + public static final String AVAILABLE = "available" + /** Generated constant - Attribute key of DeliverySlot.endtime. */ public static final String ENDTIME = "endtime" - /** Generated constant - Attribute key of DeliverySlot.available. */ - public static final String AVAILABLE = "available" + /** Generated constant - Attribute key of DeliverySlot.vehicle. */ + public static final String VEHICLE = "vehicle" /** * Generated constructor - Default constructor for generic creation. @@ -96,33 +96,42 @@ class DeliverySlotModel extends ItemModel { } /** - * Generated method - Getter of the DeliverySlot.vehicle attribute. - * @return the vehicle + * Generated method - Getter of the DeliverySlot.code attribute. + * @return the code */ - @Accessor(qualifier = VEHICLE, type = Accessor.Type.GETTER) - VehicleModel getVehicle() { - return getPersistenceContext().getPropertyValue(VEHICLE) + @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) + String getCode() { + return getPersistenceContext().getPropertyValue(CODE) } /** - * Generated method - Setter of DeliverySlot.vehicle attribute. + * Generated method - Setter of DeliverySlot.code attribute. * - * @param value the vehicle + * @param value the code */ - @Accessor(qualifier = VEHICLE, type = Accessor.Type.SETTER) - void setVehicle(final VehicleModel value) { - getPersistenceContext().setPropertyValue(VEHICLE, value) + @Accessor(qualifier = CODE, type = Accessor.Type.SETTER) + void setCode(final String value) { + getPersistenceContext().setPropertyValue(CODE, value) } /** - * Generated method - Getter of the DeliverySlot.code attribute. - * @return the code + * Generated method - Getter of the DeliverySlot.available attribute. + * @return the available */ - @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) - String getCode() { - return getPersistenceContext().getPropertyValue(CODE) + @Accessor(qualifier = AVAILABLE, type = Accessor.Type.GETTER) + Integer getAvailable() { + return getPersistenceContext().getPropertyValue(AVAILABLE) } + /** + * Generated method - Setter of DeliverySlot.available attribute. + * + * @param value the available + */ + @Accessor(qualifier = AVAILABLE, type = Accessor.Type.SETTER) + void setAvailable(final Integer value) { + getPersistenceContext().setPropertyValue(AVAILABLE, value) + } /** * Generated method - Getter of the DeliverySlot.endtime attribute. @@ -144,21 +153,21 @@ class DeliverySlotModel extends ItemModel { } /** - * Generated method - Getter of the DeliverySlot.available attribute. - * @return the available + * Generated method - Getter of the DeliverySlot.vehicle attribute. + * @return the vehicle */ - @Accessor(qualifier = AVAILABLE, type = Accessor.Type.GETTER) - Integer getAvailable() { - return getPersistenceContext().getPropertyValue(AVAILABLE) + @Accessor(qualifier = VEHICLE, type = Accessor.Type.GETTER) + VehicleModel getVehicle() { + return getPersistenceContext().getPropertyValue(VEHICLE) } /** - * Generated method - Setter of DeliverySlot.available attribute. + * Generated method - Setter of DeliverySlot.vehicle attribute. * - * @param value the available + * @param value the vehicle */ - @Accessor(qualifier = AVAILABLE, type = Accessor.Type.SETTER) - void setAvailable(final Integer value) { - getPersistenceContext().setPropertyValue(AVAILABLE, value) + @Accessor(qualifier = VEHICLE, type = Accessor.Type.SETTER) + void setVehicle(final VehicleModel value) { + getPersistenceContext().setPropertyValue(VEHICLE, value) } } diff --git a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/VehicleModel.groovy b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/VehicleModel.groovy index ac7c493..b9a6b7f 100644 --- a/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/VehicleModel.groovy +++ b/easy-tutorial-step2/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep2/models/VehicleModel.groovy @@ -1,9 +1,9 @@ /* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE * --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 18:08:24 GMT 2023 +* --- Generated at Tue Apr 16 23:19:31 BST 2024 * ---------------------------------------------------------------- */ @@ -21,12 +21,12 @@ class VehicleModel extends ItemModel { /**Generated model type code constant.*/ public static final String _TYPECODE = "Vehicle" - /** Generated constant - Attribute key of Vehicle.name. */ - public static final String NAME = "name" - /** Generated constant - Attribute key of Vehicle.code. */ public static final String CODE = "code" + /** Generated constant - Attribute key of Vehicle.name. */ + public static final String NAME = "name" + /** * Generated constructor - Default constructor for generic creation. */ @@ -43,6 +43,25 @@ class VehicleModel extends ItemModel { } + /** + * Generated method - Getter of the Vehicle.code attribute. + * @return the code + */ + @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) + String getCode() { + return getPersistenceContext().getPropertyValue(CODE) + } + + /** + * Generated method - Setter of Vehicle.code attribute. + * + * @param value the code + */ + @Accessor(qualifier = CODE, type = Accessor.Type.SETTER) + void setCode(final String value) { + getPersistenceContext().setPropertyValue(CODE, value) + } + /** * Generated method - Getter of the Vehicle.name attribute. * @return the name @@ -84,14 +103,4 @@ class VehicleModel extends ItemModel { void setName(final String value, final Locale loc) { getPersistenceContext().setLocalizedValue(NAME, loc, value) } - - /** - * Generated method - Getter of the Vehicle.code attribute. - * @return the code - */ - @Accessor(qualifier = CODE, type = Accessor.Type.GETTER) - String getCode() { - return getPersistenceContext().getPropertyValue(CODE) - } - } diff --git a/easy-tutorial-step3/src/main/resources/impex/install/02-deliveryslots.impex b/easy-tutorial-step3/src/main/resources/impex/install/02-deliveryslots.impex index c3c5dbd..ba93c61 100644 --- a/easy-tutorial-step3/src/main/resources/impex/install/02-deliveryslots.impex +++ b/easy-tutorial-step3/src/main/resources/impex/install/02-deliveryslots.impex @@ -1,4 +1,4 @@ -INSERT_UPDATE DeliverySlot; code[unique = true] ; warehouse(code); vehicle(code[unique = true]); starttime[dateformat = dd.MM.yyyy HH:mm:ss]; endtime[dateformat = dd.MM.yyyy HH:mm:ss]; available +INSERT_UPDATE DeliverySlot; code[unique = true] ; warehouse(code); vehicle(code); starttime[dateformat = dd.MM.yyyy HH:mm:ss]; endtime[dateformat = dd.MM.yyyy HH:mm:ss]; available ; slot20230519-10_20230519-12 ; warehouse_e ; Vehicle1 ; 19.05.2023 10:00:00 ; 19.05.2023 12:00:00 ; 3 ; slot20230519-12_20230519-14 ; warehouse_e ; Vehicle1 ; 19.05.2023 12:00:00 ; 19.05.2023 14:00:00 ; 3 ; slot20230519-14_20230519-16 ; warehouse_e ; Vehicle1 ; 19.05.2023 14:00:00 ; 19.05.2023 16:00:00 ; 3 @@ -2725,4 +2725,4 @@ INSERT_UPDATE DeliverySlot;code[unique=true];warehouse(code);vehicle(code[unique ;apparel_slot20231231-14_20231231-16;ap_warehouse_e;Vehicle1;31.12.2023 14:00:00;31.12.2023 16:00:00;3 ;apparel_slot20231231-16_20231231-18;ap_warehouse_e;Vehicle1;31.12.2023 16:00:00;31.12.2023 18:00:00;3 ;apparel_slot20231231-18_20231231-20;ap_warehouse_e;Vehicle1;31.12.2023 18:00:00;31.12.2023 20:00:00;3 - ;apparel_slot20231231-20_20231231-22;ap_warehouse_e;Vehicle1;31.12.2023 20:00:00;31.12.2023 22:00:00;3 \ No newline at end of file + ;apparel_slot20231231-20_20231231-22;ap_warehouse_e;Vehicle1;31.12.2023 20:00:00;31.12.2023 22:00:00;3 diff --git a/easy-tutorial-step4/README.md b/easy-tutorial-step4/README.md index cb38484..5cb50f1 100644 --- a/easy-tutorial-step4/README.md +++ b/easy-tutorial-step4/README.md @@ -67,11 +67,11 @@ To prepare some sample test data, you can leverage again the impex loading proce These are your tasks to complete this tutorial step: - Create the REST endpoints for the following actions: -| Rest Service | Http method | Path | Parameters | Response | Errors | Notes | -|:------------------:|:-----------:|:----------------------------------------------------------------------------:|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Book reservation | POST | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/bookDelivery | Path parameters:
- siteId
- userId
- cartId
Query parameters:
- Delivery Slot code | Json response with the detail of the newly created DeliverySlotManagement item | If the passed deliveryslot is no more available a 500 error will be returned | CartId will follow same rules of standard accelerator for users: will be the guid of the Cart for anonymous users, the Cart code for authenticated users.The DeliverySlotManagement row created will have the cart field populated and the order empty, status will be BOOKED | -| Get Reservation | GET | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/getBookedDelivery | Path parameters:
- siteId
- userId
- cartId
| Json response with the detail of the booked deliveryslotmanagement associate to the cart | 404 error status if no there's no deliveryslotmanagement associated to the cart | We assume that there can only be 1 deliverySlotManagement associated to a cart. | -| Change reservation | PUT | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/changeDelivery | Path parameters:
- siteId
- userId
- cartId
Query parameters:
- New Delivery Slot code | Json response with the detail of the updated DeliverySlotManagement item | 500 error status if the operation couldn't be completed | This operation is used when a customer change the delivery slot previously booked.
The service retrieves the deliverySlotManagement associated to the passed cart and if it exists and is still in the BOOKED status and if the passed delivery slot is still available, then it performs the update | +| Rest Service | Http method | Path | Parameters | Response | Errors | Notes | +|:------------------:|:-----------:|:----------------------------------------------------------------------------:|------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Book reservation | POST | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/bookDelivery | Path parameters:
  • siteId
  • userId
  • cartId

Query parameters:
  • Delivery Slot code
| Json response with the detail of the newly created DeliverySlotManagement item | If the passed deliveryslot is no more available a 500 error will be returned | CartId will follow same rules of standard accelerator for users: will be the guid of the Cart for anonymous users, the Cart code for authenticated users.The DeliverySlotManagement row created will have the cart field populated and the order empty, status will be BOOKED | +| Get Reservation | GET | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/getBookedDelivery | Path parameters:
  • siteId
  • userId
  • cartId
| Json response with the detail of the booked deliveryslotmanagement associate to the cart | 404 error status if no there's no deliveryslotmanagement associated to the cart | We assume that there can only be 1 deliverySlotManagement associated to a cart. | +| Change reservation | PUT | {baseSiteId}/users/{userId}/carts/{cartId}/slotsManagement/changeDelivery | Path parameters:
  • siteId
  • userId
  • cartId

Query parameters:
  • Delivery Slot code
| Json response with the detail of the updated DeliverySlotManagement item | 500 error status if the operation couldn't be completed | This operation is used when a customer change the delivery slot previously booked.
The service retrieves the deliverySlotManagement associated to the passed cart and if it exists and is still in the BOOKED status and if the passed delivery slot is still available, then it performs the update | - Create test cases for each implemented controllers diff --git a/easy-tutorial-step6/README.md b/easy-tutorial-step6/README.md index 1960851..1108b80 100644 --- a/easy-tutorial-step6/README.md +++ b/easy-tutorial-step6/README.md @@ -8,4 +8,4 @@ You can simply install this extension, test its REST endpoints and then use it a ## Next step You're now ready to take a look at the frontend part of the tutorial. -For this, clone the main branch of the `https://github.com/SAP-samples/easy-extension-samples-spa.git` repository on your local machine and then follow the instructions of the `README.md` file under `projects/easy/easy-tutorial-step7` +For this, clone the main branch of the [Samples SPA](https://github.com/SAP-samples/easy-extension-samples-spa.git) repository on your local machine and then follow the instructions of the `README.md` file under `projects/easy/easy-tutorial-step7` diff --git a/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementCartModel.groovy b/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementCartModel.groovy deleted file mode 100644 index 6d26653..0000000 --- a/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementCartModel.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. -* ---------------------------------------------------------------- -* --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE -* --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 19:41:13 GMT 2023 -* ---------------------------------------------------------------- -*/ - -package com.sap.cx.boosters.easy.easytutorialstep6.models - -import de.hybris.platform.core.model.order.CartModel -import com.sap.cx.boosters.easy.easytutorialstep6.models.DeliverySlotManagementModel -import de.hybris.bootstrap.annotations.Accessor -import de.hybris.platform.servicelayer.model.ItemModelContext - -/** -* Generated model class for easy type Cart. -*/ -class DeliverySlotManagementCartModel extends CartModel { - - /**Generated model type code constant.*/ - public static final String _TYPECODE = "Cart" - - /** Generated constant - Attribute key of Cart.deliveryslotmanagement. */ - public static final String DELIVERYSLOTMANAGEMENT = "deliveryslotmanagement" - - /** - * Generated constructor - Default constructor for generic creation. - */ - DeliverySlotManagementCartModel() { - super() - } - - /** - * Generated constructor - Default constructor for creation with existing context - * @param ctx the model context to be injected, must not be null - */ - DeliverySlotManagementCartModel(final ItemModelContext ctx) { - super(ctx) - } - - - /** - * Generated method - Getter of the Cart.deliveryslotmanagement attribute. - * @return the deliveryslotmanagement - */ - @Accessor(qualifier = DELIVERYSLOTMANAGEMENT, type = Accessor.Type.GETTER) - DeliverySlotManagementModel getDeliveryslotmanagement() { - return getPersistenceContext().getDynamicValue(this, DELIVERYSLOTMANAGEMENT) - } - -} diff --git a/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementOrderModel.groovy b/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementOrderModel.groovy deleted file mode 100644 index dec3e41..0000000 --- a/easy-tutorial-step6/gensrc/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/models/DeliverySlotManagementOrderModel.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. -* ---------------------------------------------------------------- -* --- WARNING: THIS FILE IS GENERATED BY EASY GRADLE PLUGIN AND WILL BE -* --- OVERWRITTEN IF REGENERATED AGAIN USING easy-class-gen GRADLE TASK! -* --- Generated at Wed Nov 29 19:41:13 GMT 2023 -* ---------------------------------------------------------------- -*/ - -package com.sap.cx.boosters.easy.easytutorialstep6.models - -import de.hybris.platform.core.model.order.OrderModel -import com.sap.cx.boosters.easy.easytutorialstep6.models.DeliverySlotManagementModel -import de.hybris.bootstrap.annotations.Accessor -import de.hybris.platform.servicelayer.model.ItemModelContext - -/** -* Generated model class for easy type Order. -*/ -class DeliverySlotManagementOrderModel extends OrderModel { - - /**Generated model type code constant.*/ - public static final String _TYPECODE = "Order" - - /** Generated constant - Attribute key of Order.deliveryslotmanagement. */ - public static final String DELIVERYSLOTMANAGEMENT = "deliveryslotmanagement" - - /** - * Generated constructor - Default constructor for generic creation. - */ - DeliverySlotManagementOrderModel() { - super() - } - - /** - * Generated constructor - Default constructor for creation with existing context - * @param ctx the model context to be injected, must not be null - */ - DeliverySlotManagementOrderModel(final ItemModelContext ctx) { - super(ctx) - } - - - /** - * Generated method - Getter of the Order.deliveryslotmanagement attribute. - * @return the deliveryslotmanagement - */ - @Accessor(qualifier = DELIVERYSLOTMANAGEMENT, type = Accessor.Type.GETTER) - DeliverySlotManagementModel getDeliveryslotmanagement() { - return getPersistenceContext().getDynamicValue(this, DELIVERYSLOTMANAGEMENT) - } - -} diff --git a/easy-tutorial-step6/src/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/populators/HomeDeliveryModeOrderPopulator.groovy b/easy-tutorial-step6/src/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/populators/HomeDeliveryModeOrderPopulator.groovy index 99f9003..07bb419 100644 --- a/easy-tutorial-step6/src/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/populators/HomeDeliveryModeOrderPopulator.groovy +++ b/easy-tutorial-step6/src/main/groovy/com/sap/cx/boosters/easy/easytutorialstep6/populators/HomeDeliveryModeOrderPopulator.groovy @@ -1,6 +1,6 @@ package com.sap.cx.boosters.easy.easytutorialstep6.populators -import com.sap.cx.boosters.easy.easytutorialstep6.models.DeliverySlotManagementOrderModel + import de.hybris.platform.commercefacades.order.data.OrderData import de.hybris.platform.converters.Populator import de.hybris.platform.core.model.order.OrderModel @@ -13,12 +13,9 @@ class HomeDeliveryModeOrderPopulator implements Populator @Override void populate(OrderModel source, OrderData orderData) throws ConversionException { - if (source instanceof DeliverySlotManagementOrderModel) { - def orderModel = source as DeliverySlotManagementOrderModel - if (orderModel.getDeliveryMode().getCode().startsWith("homedelivery")) { - def dsm = orderModel.getDeliveryslotmanagement() - orderData.getDeliveryMode().setDescription("You'll receive your items on: ${dsm.getDeliveryslot().getStarttime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}") - } + if (source.metaClass.deliveryMode.code.startsWith("homedelivery")) { + def dsm = source.metaClass.deliveryslotmanagement + orderData.deliveryMode.description = "You'll receive your items on: ${dsm.getDeliveryslot().getStarttime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}" } } } diff --git a/easy-tutorial-step6/src/main/resources/easytypes.json b/easy-tutorial-step6/src/main/resources/easytypes.json index a73288c..dc06c9c 100644 --- a/easy-tutorial-step6/src/main/resources/easytypes.json +++ b/easy-tutorial-step6/src/main/resources/easytypes.json @@ -374,8 +374,6 @@ "autocreate": "false", "generate": "false", "superType": "AbstractOrder", - "modelClassName" : "DeliverySlotManagementCartModel", - "superTypeModelClass": "de.hybris.platform.core.model.order.CartModel", "attributes": [ { "qualifier": "deliveryslotmanagement", @@ -403,8 +401,6 @@ "autocreate": "false", "generate": "false", "superType": "AbstractOrder", - "modelClassName" : "DeliverySlotManagementOrderModel", - "superTypeModelClass": "de.hybris.platform.core.model.order.OrderModel", "attributes": [ { "qualifier": "deliveryslotmanagement",