Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit 3688701

Browse files
authored
Merge pull request #11 from dev-eng1/master
Provide generic getEntity method with flag value
2 parents 0db7ece + b45780d commit 3688701

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/java/com/senzing/listener/senzing/service/g2/G2Service.java

+22
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ public void cleanUp() {
6262
}
6363
}
6464

65+
/**
66+
* Gets an entity for an entity id.
67+
*
68+
* @param g2EntiyId The G2 id of the entity
69+
* @param flags bitmask
70+
*
71+
* @return Entity information in JSON format
72+
*
73+
* @throws ServiceExecutionException
74+
*/
75+
public String getEntity(long g2EntiyId, int flags) throws ServiceExecutionException {
76+
StringBuffer response = new StringBuffer();
77+
int result = g2Engine.getEntityByEntityIDV2(g2EntiyId, flags, response);
78+
if (result != G2ServiceDefinitions.G2_VALID_RESULT) {
79+
StringBuilder errorMessage = new StringBuilder("G2 engine failed to retrieve an entity with error: ");
80+
errorMessage.append(g2ErrorMessage(g2Engine));
81+
throw new ServiceExecutionException(errorMessage.toString());
82+
}
83+
return response.toString();
84+
}
85+
86+
6587
/**
6688
* Gets an entity for an entity id.
6789
*

0 commit comments

Comments
 (0)