Skip to content

Commit 875f607

Browse files
authored
Validate PURLs (#48)
Support for PURLs validation added
1 parent fb1d935 commit 875f607

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.2.1
2+
- Added support to pass validation properties.
3+
14
## 2.2.0
25
- Added a new abstract method to support new routing key template of Sepia.
36

pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
<parent>
77
<groupId>com.github.eiffel-community</groupId>
88
<artifactId>eiffel-remrem-parent</artifactId>
9-
<version>2.0.8</version>
9+
<version>2.0.18</version>
1010
</parent>
1111
<artifactId>eiffel-remrem-protocol-interface</artifactId>
12-
<version>2.2.0</version>
12+
<version>2.2.1</version>
13+
<properties>
14+
<maven.compiler.source>1.8</maven.compiler.source>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
</properties>
17+
1318
<repositories>
1419
<repository>
1520
<id>jitpack.io</id>

src/main/java/com/ericsson/eiffel/remrem/protocol/MsgService.java

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
package com.ericsson.eiffel.remrem.protocol;
1616

1717
import java.util.Collection;
18+
import java.util.HashMap;
1819

1920
import com.google.gson.JsonElement;
2021
import com.google.gson.JsonObject;
2122

2223
public interface MsgService {
24+
String LENIENT_VALIDATION = "lenientValidation";
2325

2426
/**
2527
* Generate takes a partial message in JSON format,
@@ -38,11 +40,23 @@ public interface MsgService {
3840
*
3941
* @param msgType
4042
* @param jsonMessage
41-
* @param lenientValidation
43+
* @param lenientValidation perform the only mandatory field validation and non-mandatory validation failures will
44+
* place in Eiffel message as a new property(remremGenerateFailures)
4245
* @return the generated and validate Eiffel messages as json String
4346
*/
4447
String generateMsg(String msgType, JsonObject jsonMessage, Boolean lenientValidation);
4548

49+
/**
50+
* Generate takes a partial message in JSON format,
51+
* validates it and adds mandatory fields before outputting a complete, valid Eiffel message.
52+
*
53+
* @param msgType
54+
* @param jsonMessage
55+
* @param validationProperties Available properties are implementation-specific.
56+
* @return the generated and validate Eiffel messages as json String
57+
*/
58+
String generateMsg(String msgType, JsonObject jsonMessage, HashMap<String, Object> validationProperties);
59+
4660
/**
4761
* Returns the Event Id from json formatted eiffel message.
4862
*
@@ -94,17 +108,28 @@ public interface MsgService {
94108
* @param jsonvalidateMessage
95109
* @return ValidationResult with true if validation is success, if validation fails ValidationResult has false and validation message property's.
96110
*/
97-
98111
ValidationResult validateMsg(String msgType, JsonObject jsonvalidateMessage);
112+
99113
/**
100114
* Method validates the jsonObject based on the event message type.
101115
* @param JsonObject bodyJson
102116
* @param jsonvalidateMessage
103117
* @param lenientValidation
104-
* @return ValidationResult with true if validation is success, if validation fails ValidationResult has false and validation message property's.
118+
* @return ValidationResult with true if validation is success, if validation fails ValidationResult has false
119+
* and validation message property's.
105120
*/
106121
ValidationResult validateMsg(String msgType, JsonObject jsonvalidateMessage, Boolean lenientValidation);
107122

123+
/**
124+
* Method validates the jsonObject based on the event message type.
125+
* @param JsonObject bodyJson
126+
* @param jsonvalidateMessage
127+
* @param validationProperties Available properties are implementation-specific.
128+
* @return ValidationResult with true if validation is success, if validation fails ValidationResult has false
129+
* and validation message property's.
130+
*/
131+
ValidationResult validateMsg(String msgType, JsonObject jsonvalidateMessage, HashMap<String, Object> validationProperties);
132+
108133
/**
109134
* Returns Routing key from the messaging library based on the eiffel message eventType.<br>
110135
* In general, Routing key of eiffel message is in the format<br>

0 commit comments

Comments
 (0)