bigbluebuttonbn-web: Implemented filter for recordIDs [id:eq:xxxx,yyyy,zzzz]
This commit is contained in:
parent
6b911820e0
commit
2c214cafac
@ -1711,11 +1711,10 @@ class ApiController {
|
|||||||
internalRecordIds = paramsProcessorUtil.decodeIds(params.recordID)
|
internalRecordIds = paramsProcessorUtil.decodeIds(params.recordID)
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> filters = new LinkedHashMap<String, Object>()
|
Map<String, Map<String, Object>> filters = new LinkedHashMap<String, Map<String, Object>>()
|
||||||
if (!StringUtils.isEmpty(params.filter)) {
|
if (!StringUtils.isEmpty(params.filter)) {
|
||||||
filters = paramsProcessorUtil.decodeFilters(params.filter)
|
filters = paramsProcessorUtil.decodeFilters(params.filter)
|
||||||
}
|
}
|
||||||
log.debug(new groovy.json.JsonBuilder( filters ).toPrettyString())
|
|
||||||
|
|
||||||
// Everything is good so far.
|
// Everything is good so far.
|
||||||
if ( internalRecordIds.size() == 0 ) {
|
if ( internalRecordIds.size() == 0 ) {
|
||||||
|
@ -339,7 +339,7 @@ public class MeetingService implements MessageListener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String,Recording> getRecordings(ArrayList<String> idList, Map<String, Object> filters) {
|
public HashMap<String,Recording> getRecordings(ArrayList<String> idList, Map<String, Map<String, Object>> filters) {
|
||||||
//TODO: this method shouldn't be used
|
//TODO: this method shouldn't be used
|
||||||
HashMap<String,Recording> recs= reorderRecordings(recordingService.getRecordings(idList, filters));
|
HashMap<String,Recording> recs= reorderRecordings(recordingService.getRecordings(idList, filters));
|
||||||
return recs;
|
return recs;
|
||||||
|
@ -740,8 +740,8 @@ public class ParamsProcessorUtil {
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> decodeFilters(String encodedFilters) {
|
public Map<String, Map<String, Object>> decodeFilters(String encodedFilters) {
|
||||||
Map<String, Object> filters = new LinkedHashMap<String, Object>();
|
Map<String, Map<String, Object>> filters = new LinkedHashMap<String, Map<String, Object>>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String[] sFilters = encodedFilters.split(URLDECODER_SEPARATOR);
|
String[] sFilters = encodedFilters.split(URLDECODER_SEPARATOR);
|
||||||
|
@ -57,7 +57,7 @@ public class RecordingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldIncludeDir( Map<String, Object> filters, String type ) {
|
private boolean shouldIncludeDir( Map<String, Map<String, Object>> filters, String type ) {
|
||||||
boolean r = false;
|
boolean r = false;
|
||||||
|
|
||||||
if( filters.containsKey("state") ) {
|
if( filters.containsKey("state") ) {
|
||||||
@ -83,7 +83,18 @@ public class RecordingService {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Recording> getRecordings(ArrayList<String> meetingIds, Map<String, Object> filters) {
|
private String[] recordingIdsFromFilters( Map<String, Map<String, Object>> filters ) {
|
||||||
|
String[] recordingIds = {};
|
||||||
|
|
||||||
|
if( filters.containsKey("id") ) {
|
||||||
|
Map<String, Object> filter = (Map<String, Object>)filters.get("id");
|
||||||
|
recordingIds = (String[])filter.get("values");
|
||||||
|
}
|
||||||
|
|
||||||
|
return recordingIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Recording> getRecordings(ArrayList<String> meetingIds, Map<String, Map<String, Object>> filters) {
|
||||||
ArrayList<Recording> recs = new ArrayList<Recording>();
|
ArrayList<Recording> recs = new ArrayList<Recording>();
|
||||||
|
|
||||||
if(meetingIds.isEmpty()){
|
if(meetingIds.isEmpty()){
|
||||||
@ -99,21 +110,21 @@ public class RecordingService {
|
|||||||
|
|
||||||
for(String meetingId : meetingIds){
|
for(String meetingId : meetingIds){
|
||||||
if ( shouldIncludeDir(filters, Recording.STATE_PUBLISHED) ) {
|
if ( shouldIncludeDir(filters, Recording.STATE_PUBLISHED) ) {
|
||||||
ArrayList<Recording> published = getRecordingsForPath(meetingId, publishedDir);
|
ArrayList<Recording> published = getRecordingsForPath(meetingId, recordingIdsFromFilters(filters), publishedDir);
|
||||||
if (!published.isEmpty()) {
|
if (!published.isEmpty()) {
|
||||||
recs.addAll(published);
|
recs.addAll(published);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shouldIncludeDir(filters, Recording.STATE_UNPUBLISHED) ) {
|
if ( shouldIncludeDir(filters, Recording.STATE_UNPUBLISHED) ) {
|
||||||
ArrayList<Recording> unpublished = getRecordingsForPath(meetingId, unpublishedDir);
|
ArrayList<Recording> unpublished = getRecordingsForPath(meetingId, recordingIdsFromFilters(filters), unpublishedDir);
|
||||||
if (!unpublished.isEmpty()) {
|
if (!unpublished.isEmpty()) {
|
||||||
recs.addAll(unpublished);
|
recs.addAll(unpublished);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shouldIncludeDir(filters, Recording.STATE_DELETED) ) {
|
if ( shouldIncludeDir(filters, Recording.STATE_DELETED) ) {
|
||||||
ArrayList<Recording> deleted = getRecordingsForPath(meetingId, deletedDir);
|
ArrayList<Recording> deleted = getRecordingsForPath(meetingId, recordingIdsFromFilters(filters), deletedDir);
|
||||||
if (!deleted.isEmpty()) {
|
if (!deleted.isEmpty()) {
|
||||||
recs.addAll(deleted);
|
recs.addAll(deleted);
|
||||||
}
|
}
|
||||||
@ -171,7 +182,7 @@ public class RecordingService {
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Recording> getRecordingsForPath(String meetingId, String path) {
|
private ArrayList<Recording> getRecordingsForPath(String meetingId, String[] recordingId, String path) {
|
||||||
ArrayList<Recording> recs = new ArrayList<Recording>();
|
ArrayList<Recording> recs = new ArrayList<Recording>();
|
||||||
|
|
||||||
String[] format = getPlaybackFormats(path);
|
String[] format = getPlaybackFormats(path);
|
||||||
@ -180,7 +191,9 @@ public class RecordingService {
|
|||||||
for (int f = 0; f < recordings.length; f++) {
|
for (int f = 0; f < recordings.length; f++) {
|
||||||
if (recordings[f].getName().startsWith(meetingId)) {
|
if (recordings[f].getName().startsWith(meetingId)) {
|
||||||
Recording r = getRecordingInfo(path, recordings[f].getName(), format[i]);
|
Recording r = getRecordingInfo(path, recordings[f].getName(), format[i]);
|
||||||
if (r != null) recs.add(r);
|
if (r != null && ( recordingId.length == 0 || Arrays.asList(recordingId).contains("any") || Arrays.asList(recordingId).contains(r.getId())) ) {
|
||||||
|
recs.add(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user