Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cds-feature-notifications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
<dependency>
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>
<artifactId>connectivity-destination-service</artifactId>
<version>5.32.0</version>
<version>5.33.0</version>
</dependency>

<dependency>
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>
<artifactId>cloudplatform-connectivity</artifactId>
<version>5.32.0</version>
<version>5.33.0</version>
</dependency>

<!-- TESTS -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
*/
package com.sap.cds.notifications.handlers;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sap.cds.CdsData;
import com.sap.cds.Result;
import com.sap.cds.Struct;
import com.sap.cds.impl.parser.ExpressionParser;
import com.sap.cds.notifications.assemblers.NotificationAssembler;
import com.sap.cds.ql.CQL;
import com.sap.cds.ql.cqn.CqnContainmentTest;
Expand Down Expand Up @@ -78,6 +81,7 @@
public class EntityNotificationHandler implements EventHandler {

private static final Logger logger = LoggerFactory.getLogger(EntityNotificationHandler.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

@After(event = "*")
public void onEntityChange(EventContext context) {
Expand Down Expand Up @@ -364,8 +368,22 @@ private Object resolveRecipients(Object recipientsConfig, Map<String, Object> en
private boolean evaluateWhereCondition(
Object whereCondition, Map<String, Object> entityData, EventContext context) {

// Complex CDS expression: CqnValue (e.g., $self.stock > 50)
if (!(whereCondition instanceof CqnValue cqnValue)) {
// CDS annotation expressions come back from the reflection API as a raw Map (CSN xpr format).
// In some SDK versions they may already be typed as CqnValue — accept both.
CqnValue cqnValue;
if (whereCondition instanceof CqnValue v) {
cqnValue = v;
} else if (whereCondition instanceof Map<?, ?>) {
try {
JsonNode jsonNode = OBJECT_MAPPER.valueToTree(whereCondition);
cqnValue = ExpressionParser.parsePredicate(jsonNode);
} catch (Exception e) {
throw new IllegalArgumentException(
"Where condition must be a boolean expression (e.g., '($self.stock > 50)'), got: "
+ whereCondition.getClass().getName(),
e);
}
} else {
throw new IllegalArgumentException(
"Where condition must be a boolean expression (e.g., '($self.stock > 50)'), got: "
+ whereCondition.getClass().getName());
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<!-- DEPENDENCIES VERSION -->
<jdk.version>21</jdk.version>
<cds.services.version>5.0.0</cds.services.version>
<cds.services.version>5.0.2</cds.services.version>
<spring.boot.version>4.1.0</spring.boot.version>

<cds.install-node.downloadUrl>https://nodejs.org/dist/</cds.install-node.downloadUrl>
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<!-- Versions of CAP Java and cds-dk used for build and integrations tests -->
<!-- https://central.sonatype.com/artifact/com.sap.cds/cds-services-api/versions -->
<cds.services.version>5.0.0</cds.services.version>
<cds.services.version>5.0.2</cds.services.version>
<!-- https://www.npmjs.com/package/@sap/cds-dk?activeTab=versions -->
<cds.cdsdk-version>10.0.4</cds.cdsdk-version>

Expand All @@ -84,15 +84,15 @@
<dependency>
<groupId>com.sap.cloud.sdk</groupId>
<artifactId>sdk-bom</artifactId>
<version>5.32.0</version>
<version>5.33.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>6.1.2</version>
<version>6.1.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -108,14 +108,14 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>runtime</scope>
</dependency>

Expand Down Expand Up @@ -275,7 +275,7 @@
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>3.8.0</version>
<version>3.9.0</version>
<configuration>
<java>
<googleJavaFormat>
Expand Down
Loading