X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps%2Fcps-ri%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fspi%2Fimpl%2FDataPersistencyServiceImpl.java;h=44d38f91d9a22bc66975a5181d115fa052e3c81f;hb=1d8e556c8cea9c0c8b78381e1e4ce3c36b965dc9;hp=93746e06ff8efd4ab586803d83acd8de265bb29c;hpb=75a05e296781f9427959355443bbebfc28ac804e;p=cps.git diff --git a/cps/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java b/cps/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java index 93746e06f..44d38f91d 100644 --- a/cps/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java +++ b/cps/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java @@ -36,11 +36,21 @@ public class DataPersistencyServiceImpl implements DataPersistencyService { * Method to store a JSON data structure in the database. * * @param jsonStructure the JSON data structure. - * @return + * @return the entity identifier. */ public final Integer storeJsonStructure(final String jsonStructure) { final JsonDataEntity jsonDataEntity = new JsonDataEntity(jsonStructure); dataRepository.save(jsonDataEntity); return jsonDataEntity.getId(); } + + /** + * Return the JSON structure from the database using the object identifier. + * + * @param jsonStructureId the JSON object identifier. + * @return the JSON structure from the database as a string. + */ + public final String getJsonById(final int jsonStructureId) { + return dataRepository.getOne(jsonStructureId).getJsonStructure(); + } }