blob: e8048f1f216d639b58c546dfd3f218358dcf4ba3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package org.traccar.reports;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
import org.traccar.Context;
public final class ReportUtils {
private ReportUtils() {
}
public static Collection<Long> getReportedDevices(Collection<Long> deviceIds, Collection<Long> groupIds) {
Collection<Long> result = new ArrayList<>();
result.addAll(deviceIds);
for (long groupId : groupIds) {
result.addAll(Context.getPermissionsManager().getGroupDevices(groupId));
}
return result;
}
public static StreamingOutput getOut(final byte[] csvBytes) {
return new StreamingOutput() {
@Override
public void write(OutputStream out) throws IOException, WebApplicationException {
out.write(csvBytes);
}
};
}
}
|