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) {
// validate
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");
}
// measure interval, so we can return proper location header
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);