@@ -204,20 +204,20 @@ private HashMap<String, Object> getDataToHash(List<UriParameter> keyPredicates,
204204
205205 protected Entity getData (EdmEntitySet edmEntitySet , List <UriParameter > keyPredicates , ResourceInfo resource ,
206206 UriInfo uriInfo ) {
207- Entity product = null ;
207+ Entity entity = null ;
208208 String dbType = System .getenv ().getOrDefault ("DB_TYPE" , "mongodb" ).toLowerCase ();
209209
210210 try {
211211 if (dbType .equals ("mongodb" )) {
212- product = getDataFromMongo (resource , keyPredicates , uriInfo );
212+ entity = getDataFromMongo (resource , keyPredicates , uriInfo );
213213 } else {
214- product = getDataFromSQL (resource , keyPredicates , uriInfo );
214+ entity = getDataFromSQL (resource , keyPredicates , uriInfo );
215215 }
216216 } catch (Exception e ) {
217217 LOG .error ("Server Error occurred in reading " + resource .getResourceName (), e );
218218 }
219219
220- return product ;
220+ return entity ;
221221 }
222222
223223 private Entity getDataFromMongo (ResourceInfo resource , List <UriParameter > keyPredicates , UriInfo uriInfo ) {
@@ -243,7 +243,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
243243
244244 List <FieldInfo > enumFields = CommonDataProcessing .gatherEnumFields (resource );
245245 HashMap <String , Object > enumValues = new HashMap <>();
246- Entity product = null ;
246+ Entity entity = null ;
247247
248248 Document query = new Document ();
249249 if (keyPredicates != null ) {
@@ -270,7 +270,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
270270
271271 if (doc != null ) {
272272 LOG .info ("Found main document: {}" , doc .toJson ());
273- product = CommonDataProcessing .getEntityFromDocument (doc , resource );
273+ entity = CommonDataProcessing .getEntityFromDocument (doc , resource );
274274 String resourceRecordKey = doc .getString (primaryFieldName );
275275 LOG .info ("Resource Record Key: {}" , resourceRecordKey );
276276
@@ -288,7 +288,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
288288 Document lookupDoc = lookupCursor .next ();
289289 CommonDataProcessing .getEntityValues (lookupDoc , entities , enumFields );
290290 }
291- CommonDataProcessing .setEntityEnums (enumValues , product , enumFields );
291+ CommonDataProcessing .setEntityEnums (enumValues , entity , enumFields );
292292 }
293293 }
294294
@@ -318,7 +318,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
318318 expandCollection = database .getCollection ("media" );
319319 break ;
320320 case "ListAgent" :
321- Property listAgentKeyProp = product .getProperty ("ListAgentKey" );
321+ Property listAgentKeyProp = entity .getProperty ("ListAgentKey" );
322322 if (listAgentKeyProp != null && listAgentKeyProp .getValue () != null ) {
323323 String listAgentKey = listAgentKeyProp .getValue ().toString ();
324324 LOG .info ("Found ListAgentKey: {}" , listAgentKey );
@@ -341,7 +341,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
341341 link .setTitle ("ListAgent" );
342342 link .setType (Constants .ENTITY_NAVIGATION_LINK_TYPE );
343343 link .setInlineEntity (memberEntity );
344- product .getNavigationLinks ().add (link );
344+ entity .getNavigationLinks ().add (link );
345345 LOG .info ("Added ListAgent link to property" );
346346 } else {
347347 LOG .error ("Member resource definition not found in resourceLookup" );
@@ -383,7 +383,7 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
383383 } else {
384384 LOG .warn ("No {} entities found for property {}" , navigationName , resourceRecordKey );
385385 }
386- product .getNavigationLinks ().add (link );
386+ entity .getNavigationLinks ().add (link );
387387 }
388388 }
389389 } else {
@@ -394,11 +394,11 @@ private Entity getDataFromMongo(ResourceInfo resource, List<UriParameter> keyPre
394394 e .printStackTrace ();
395395 }
396396
397- return product ;
397+ return entity ;
398398 }
399399
400400 private Entity getDataFromSQL (ResourceInfo resource , List <UriParameter > keyPredicates , UriInfo uriInfo ) {
401- Entity product = null ;
401+ Entity entity = null ;
402402 try (Connection connection = getMySQLConnection ()) {
403403 String primaryFieldName = resource .getPrimaryKeyName ();
404404 List <FieldInfo > enumFields = CommonDataProcessing .gatherEnumFields (resource );
@@ -422,7 +422,7 @@ private Entity getDataFromSQL(ResourceInfo resource, List<UriParameter> keyPredi
422422 ResultSet resultSet = statement .executeQuery (queryBuilder .toString ())) {
423423
424424 if (resultSet .next ()) {
425- product = CommonDataProcessing .getEntityFromRow (resultSet , resource , null );
425+ entity = CommonDataProcessing .getEntityFromRow (resultSet , resource , null );
426426 String resourceRecordKey = resultSet .getString (primaryFieldName );
427427
428428 if (!enumFields .isEmpty ()) {
@@ -437,7 +437,7 @@ private Entity getDataFromSQL(ResourceInfo resource, List<UriParameter> keyPredi
437437 while (enumResultSet .next ()) {
438438 CommonDataProcessing .getEntityValues (enumResultSet , entities , enumFields );
439439 }
440- CommonDataProcessing .setEntityEnums (enumValues , product , enumFields );
440+ CommonDataProcessing .setEntityEnums (enumValues , entity , enumFields );
441441 }
442442 }
443443
@@ -449,13 +449,13 @@ private Entity getDataFromSQL(ResourceInfo resource, List<UriParameter> keyPredi
449449 UriResourceNavigation expandNavigation = (UriResourceNavigation ) expandPath ;
450450 EdmNavigationProperty edmNavigationProperty = expandNavigation .getProperty ();
451451 EntityCollection expandEntities = CommonDataProcessing .getExpandEntityCollection (
452- connection , edmNavigationProperty , product , resource , resourceRecordKey );
452+ connection , edmNavigationProperty , entity , resource , resourceRecordKey );
453453
454454 Link link = new Link ();
455455 link .setTitle (edmNavigationProperty .getName ());
456456 link .setType (Constants .ENTITY_NAVIGATION_LINK_TYPE );
457457 link .setInlineEntitySet (expandEntities );
458- product .getNavigationLinks ().add (link );
458+ entity .getNavigationLinks ().add (link );
459459 }
460460 }
461461 }
@@ -464,7 +464,7 @@ private Entity getDataFromSQL(ResourceInfo resource, List<UriParameter> keyPredi
464464 } catch (Exception e ) {
465465 LOG .error ("Error querying SQL database: " + e .getMessage (), e );
466466 }
467- return product ;
467+ return entity ;
468468 }
469469
470470 private URI createId (String entitySetName , Object id ) {
0 commit comments