Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

Update versions and adapt instructions for trial #11

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

beckermarc
Copy link
Contributor

Updated CDS Services versions to 1.2.0 and performed necessary code changes.
Updated instructions to explain how to use CloudPlatform Trial accounts.
Therefore also removed reference to XXX or other instructor provided details.

Updated CDS Services versions to 1.2.0 and performed necessary code changes.
Updated instructions to explain how to use CloudPlatform Trial accounts.
Therefore also removed reference to XXX or other instructor provided details.
@beckermarc
Copy link
Contributor Author

@agoerler Can you also have a look please :)

Comment on lines 48 to 50
mvn -B archetype:generate -DarchetypeArtifactId=cds-services-archetype -DarchetypeGroupId=com.sap.cds \
-DarchetypeVersion=1.0.1 -DcdsVersion=3.17.4 \
-DarchetypeVersion=1.2.0 -DcdsVersion=3.21.2 \
-DgroupId=com.sap.teched.cap -DartifactId=products-service -Dpackage=com.sap.teched.cap.productsservice
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should replace this with a shorter call to cds init. I guess, you prefer to still have the fixed archetype and cds versions in it, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the other problem is that we want to use version 1.2.0, but the CDS-DK version available on AppStudio only provides 1.1.0. Also we don't want to initialize sample data, which was surprisingly added by cds init by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this means if we add the 3 parameters archetypeVersion, cdsVersion, and samples (or so) to cds init, it would work?
Would be something like

cds init products-service --add java --java:archetypeVersion=1.2.0 --java:cdsVersion=3.21.2

samples should default to false anyways, to align it with Node.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be great :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will align this with Joerg once I know his github user.

For the time being, we can leave the archetype call here.

@@ -85,7 +85,9 @@ You will now add a method to the `OrdersService` Java class to decrease the stoc
@Before(event = CdsService.EVENT_CREATE, entity = "OrdersService.Orders")
public void validateBookAndDecreaseStockViaOrders(List<Orders> orders) {
for(Orders order : orders) {
validateBookAndDecreaseStock(order.getItems());
if(order.getItems() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CDS4J does not automatically initialize collection-based types with empty lists anymore upon calling the getter, but returns null now.

@@ -247,7 +249,9 @@ Finally, add a method to the `OrdersService` Java class to calculate the `total`
public void calculateTotal(List<Orders> orders) {
for (Orders order : orders) {
// calculate net amount for expanded items
calculateNetAmount(order.getItems());
if(order.getItems() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

@beckermarc beckermarc merged commit 025d5eb into master Feb 14, 2020
@beckermarc beckermarc deleted the update-versions-and-trial branch February 14, 2020 14:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants