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 getReportedDevices(Collection deviceIds, Collection groupIds) { Collection 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); } }; } }