VictorPavfurious commented on code in PR #4549:
URL: https://github.com/apache/fineract/pull/4549#discussion_r2034890993


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java:
##########
@@ -87,26 +83,23 @@ public class CalendarsApiResource {
     @Path("{calendarId}")
     @Consumes({ MediaType.APPLICATION_JSON })
     @Produces({ MediaType.APPLICATION_JSON })
-    public String retrieveCalendar(@PathParam("calendarId") final Long 
calendarId, @PathParam("entityType") final String entityType,
+    public CalendarData retrieveCalendar(@PathParam("calendarId") final Long 
calendarId, @PathParam("entityType") final String entityType,
             @PathParam("entityId") final Long entityId, @Context final UriInfo 
uriInfo) {
 
-        
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
+        
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
         final Integer entityTypeId = 
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue();
-        CalendarData calendarData = 
this.readPlatformService.retrieveCalendar(calendarId, entityId, entityTypeId);
+        final ApiRequestJsonSerializationSettings settings = 
apiRequestParameterHelper.process(uriInfo.getQueryParameters());
 
-        // Include recurring date details
-        final boolean withHistory = true;
-        final LocalDate tillDate = null;
-        final Collection<LocalDate> recurringDates = 
this.readPlatformService.generateRecurringDates(calendarData, withHistory, 
tillDate);
-        final Collection<LocalDate> nextTenRecurringDates = 
this.readPlatformService.generateNextTenRecurringDates(calendarData);
-        final LocalDate recentEligibleMeetingDate = null;
-        calendarData = CalendarData.withRecurringDates(calendarData, 
recurringDates, nextTenRecurringDates, recentEligibleMeetingDate);
+        final CalendarData calendarData = 
readPlatformService.retrieveCalendar(calendarId, entityId, entityTypeId);
+        final Collection<LocalDate> recurringDates = 
readPlatformService.generateRecurringDates(calendarData, true, null);
+        final Collection<LocalDate> nextTenRecurringDates = 
readPlatformService.generateNextTenRecurringDates(calendarData);
+        calendarData.setRecurringDates(recurringDates);
+        calendarData.setNextTenRecurringDates(nextTenRecurringDates);
 
-        final ApiRequestJsonSerializationSettings settings = 
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
         if (settings.isTemplate()) {
-            calendarData = handleTemplate(calendarData);
+            handleTemplate(calendarData);

Review Comment:
   I'm apologize, I'm not sure I understood that. Yes, handleTemplate returns 
new object, but i'm a little bit confuse for what it..?:) 
   If we'll have 1 million request here, so, we'll have 1 million object in 
memory which not use and jvm should be run GC to remove this object.. Is it ok 
? 
   I have investigated and realized that this is same object but in 
handleTemplate() has additional data and we have wrapped to new object... I 
don't get it for what..?:)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to