Skip to content

Commit 328902b

Browse files
iamrishavkumarRishav Kumar B
andauthored
Implemented changes for shallow behavior in EIB (#495)
* Implemented changes for shallow behavior in EIB * Updated documentation related to shallow flag * Set the shallow flag value to true * Updated application.properties for integration test * Formatted application.properties files * Changed the type shallow value * updated shallowParameter * Made shallow parameter as optional Co-authored-by: Rishav Kumar B <rishav.b.kumar@ericsson.com>
1 parent 053a2f8 commit 328902b

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

src/integrationtests/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ spring.mail.properties.mail.smtp.auth: false
5959
spring.mail.properties.mail.smtp.starttls.enable: false
6060

6161
event.repository.url: http://localhost:8084/search/
62+
event.repository.shallow: true
6263

6364
ldap.enabled: false
6465
ldap.server.list: [{\

src/main/java/com/ericsson/ei/erqueryservice/ERQueryService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public class ERQueryService {
5353
@Value("${event.repository.url}")
5454
private String eventRepositoryUrl;
5555

56+
@Getter
57+
@Value("${event.repository.shallow:true}")
58+
private Boolean shallow;
59+
5660
public ERQueryService() {
5761
this.request = new HttpRequest();
5862
}
@@ -100,6 +104,13 @@ private ResponseEntity sendRequestToER(String eventId, SearchOption searchOption
100104

101105
private void prepareRequest(String eventId, SearchOption searchOption, int limit,
102106
int levels, boolean tree) throws IOException, URISyntaxException {
107+
Boolean shallowParameter;
108+
if (shallow == null ) {
109+
shallowParameter = true;
110+
}
111+
else {
112+
shallowParameter = shallow;
113+
}
103114
final SearchParameters searchParameters = getSearchParameters(searchOption);
104115
request
105116
.setHttpMethod(HttpMethod.POST)
@@ -108,6 +119,7 @@ private void prepareRequest(String eventId, SearchOption searchOption, int limit
108119
.addParam("limit", Integer.toString(limit))
109120
.addParam("levels", Integer.toString(levels))
110121
.addParam("tree", Boolean.toString(tree))
122+
.addParam("shallow", Boolean.toString(shallowParameter))
111123
.setBody(searchParameters.getAsJsonString(), ContentType.APPLICATION_JSON);
112124

113125
String uri = request.getURI().toString();

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ spring.mail.properties.mail.smtp.auth: false
5858
spring.mail.properties.mail.smtp.starttls.enable: false
5959

6060
event.repository.url:
61+
event.repository.shallow: true
6162

6263
ldap.enabled: false
6364
ldap.server.list: [{\

src/test/java/com/ericsson/ei/erqueryservice/test/ERQueryServiceTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class ERQueryServiceTest extends Mockito {
7171
private int limitParam = 85;
7272
private int levels = 2;
7373
private boolean isTree = true;
74+
private boolean shallow = true;
7475

7576
@Before
7677
public void setUp() throws Exception {
@@ -101,8 +102,8 @@ private Answer<ResponseEntity> validateRequest(HttpRequestBase httpRequestBase )
101102
}
102103

103104
public String buildUri() {
104-
String uri = String.format("%s%s?limit=%s&tree=%s&levels=%s",
105-
erQueryService.getEventRepositoryUrl().trim(), eventId, limitParam, isTree, levels);
105+
String uri = String.format("%s%s?limit=%s&tree=%s&shallow=%s&levels=%s",
106+
erQueryService.getEventRepositoryUrl().trim(), eventId, limitParam, isTree, shallow, levels) ;
106107
return uri;
107108
}
108109
}

wiki/configuration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ used. **event.repository.url** takes a full URL to such a repository.
159159

160160
* event.repository.url
161161

162+
A shallow property has been added , which is set to true. With property **event.repository.shallow** set to true,
163+
the ER query from Eiffel Intelligence will search the event id only in main ER. It will not look in external ER(s)
164+
for event ids. If this parameter set to false , search for event id will extended to External ER(s) as well.
165+
166+
The event id is of aggregated object. Using this event id , ER query will retrieve upstream/downstream events.
167+
168+
* event.repository.shallow
169+
162170
## MongoDB
163171

164172
You can set up connections to a single MongoDB instance or a Replica set of multiple MongoDB instances with or

0 commit comments

Comments
 (0)