Source:
public Response putCallTimeValues( @ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, List<CallTimeValueRest> callTimes, @Context HttpHeaders headers, @Context UriInfo uriInfo ) { if (callTimes.size() < 1) { return Response.ok().build(); } MediaType mediaType = headers.getAcceptableMediaTypes().get(0); MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.CALLTIME); MeasurementScheduleRequest req = new MeasurementScheduleRequest(schedule); CallTimeData ctd = new CallTimeData(req); long now = System.currentTimeMillis(); long startTime = System.currentTimeMillis(); long endTime = startTime - SEVEN_DAYS; for (CallTimeValueRest v : callTimes) { if (v.getCallDestination() == null) { throw new IllegalArgumentException("callDestination must not be null"); } if (v.getDuration()<0) { throw new IllegalArgumentException("duration must not be positive number"); } if (now - SEVEN_DAYS > v.getBeginTime()) { throw new IllegalArgumentException("beginTime is older than 7 days"); } if (v.getBeginTime() < startTime) { startTime = v.getBeginTime(); } if (v.getBeginTime()+v.getDuration() > endTime) { endTime = v.getBeginTime()+v.getDuration(); } ctd.addCallData(v.getCallDestination(), new Date(v.getBeginTime()), v.getDuration()); } Set<CallTimeData> data = new HashSet<CallTimeData>(); data.add(ctd); calltimeDataManager.addCallTimeData(data); UriBuilder uriBuilder = uriInfo.getBaseUriBuilder(); uriBuilder.path("/metric/data/{scheduleId}/callTime"); uriBuilder.queryParam("startTime",startTime); uriBuilder.queryParam("endTime",endTime); URI uri = uriBuilder.build(scheduleId); return Response.created(uri).type(mediaType).build(); }

Target:
public Response putCallTimeValues( @ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, List<CallTimeValueRest> callTimes, @Context HttpHeaders headers, @Context UriInfo uriInfo ) { if (callTimes.size() < 1) { return Response.ok().build(); } MediaType mediaType = headers.getAcceptableMediaTypes().get(0); MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.CALLTIME); MeasurementScheduleRequest req = new MeasurementScheduleRequest(schedule); CallTimeData ctd = new CallTimeData(req); long now = System.currentTimeMillis(); long startTime = System.currentTimeMillis(); long endTime = startTime - SEVEN_DAYS; int idx=0; for (CallTimeValueRest v : callTimes) { if (v.getCallDestination() == null) { throw new IllegalArgumentException("Invalid item["+idx+"] "+v+" : callDestination must not be null"); } if (v.getDuration()<0) { throw new IllegalArgumentException("Invalid item["+idx+"] "+v+" : duration must be a positive number"); } if (now - SEVEN_DAYS > v.getBeginTime()) { throw new IllegalArgumentException("Invalid item["+idx+"] "+v+" : beginTime is older than 7 days"); } if (v.getBeginTime() < startTime) { startTime = v.getBeginTime(); } if (v.getBeginTime()+v.getDuration() > endTime) { endTime = v.getBeginTime()+v.getDuration(); } ctd.addCallData(v.getCallDestination(), new Date(v.getBeginTime()), v.getDuration()); idx++; } Set<CallTimeData> data = new HashSet<CallTimeData>(); data.add(ctd); calltimeDataManager.addCallTimeData(data); UriBuilder uriBuilder = uriInfo.getBaseUriBuilder(); uriBuilder.path("/metric/data/{scheduleId}/callTime"); uriBuilder.queryParam("startTime",startTime); uriBuilder.queryParam("endTime",endTime); URI uri = uriBuilder.build(scheduleId); return Response.created(uri).type(mediaType).build(); }