コード例 #1
0
 private void generateStatusOfTranscodings() {
   // FIXME:FK fetch using one single SQL query
   availableTranscodings = new HashMap<>();
   availableTranscodings.put(240, new HashSet<OLATResource>());
   availableTranscodings.put(360, new HashSet<OLATResource>());
   availableTranscodings.put(480, new HashSet<OLATResource>());
   availableTranscodings.put(720, new HashSet<OLATResource>());
   availableTranscodings.put(1080, new HashSet<OLATResource>());
   availableTranscodings.put(2160, new HashSet<OLATResource>());
   // determine resource type of interest
   List<String> types = new ArrayList<>();
   types.add("FileResource.VIDEO");
   // retrieve all resources of type video
   olatresources = olatresourceManager.findResourceByTypes(types);
   // go through all video resources
   for (OLATResource videoResource : olatresources) {
     // retrieve all transcodings for each video resource
     List<VideoTranscoding> transcodings = videoManager.getVideoTranscodings(videoResource);
     // map resource IDs to resolution
     for (VideoTranscoding videoTranscoding : transcodings) {
       if (videoTranscoding != null) {
         Set<OLATResource> oneResolution =
             availableTranscodings.get(videoTranscoding.getResolution());
         if (oneResolution != null) {
           oneResolution.add(videoTranscoding.getVideoResource());
         }
       }
     }
   }
 }
コード例 #2
0
  // go through all and delete selection
  private void queueDeleteTranscoding(TranscodingRow source) {
    for (OLATResource videoResource : olatresources) {
      if (availableTranscodings.get(source.getResolution()).contains(videoResource)) {
        List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodings(videoResource);

        for (VideoTranscoding videoTranscoding : videoTranscodings) {
          if (videoTranscoding.getResolution() == source.getResolution()) {
            videoManager.deleteVideoTranscoding(videoTranscoding);
          }
        }
      }
    }
  }