Class BulkUpdateUtil

java.lang.Object
org.opencastproject.adminui.util.BulkUpdateUtil

public final class BulkUpdateUtil extends Object
This class holds utility functions which are related to the bulk update feature for events.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Model class for one group of update instructions
    static class 
    Model class for the bulk update instructions which are sent by the UI.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.json.simple.JSONObject
    addSchedulingDates(org.opencastproject.elasticsearch.index.objects.event.Event event, org.json.simple.JSONObject scheduling)
    Takes the given scheduling information and completes the event start and end dates as well as the duration for the given event.
    static Optional<org.opencastproject.elasticsearch.index.objects.event.Event>
    getEvent(org.opencastproject.index.service.api.IndexService indexSvc, org.opencastproject.elasticsearch.index.ElasticsearchIndex index, String id)
    Wraps the IndexService.getEvent() method to convert SearchIndexExceptions into RuntimeExceptions.
    static org.json.simple.JSONObject
    mergeMetadataFields(org.json.simple.JSONObject first, org.json.simple.JSONObject second)
    Merges all fields of the given meta data json objects into one object.
    static org.json.simple.JSONObject
    toNonTechnicalMetadataJson(org.json.simple.JSONObject scheduling)
    Creates a json object containing meta data based on the given scheduling information.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getEvent

      public static Optional<org.opencastproject.elasticsearch.index.objects.event.Event> getEvent(org.opencastproject.index.service.api.IndexService indexSvc, org.opencastproject.elasticsearch.index.ElasticsearchIndex index, String id)
      Wraps the IndexService.getEvent() method to convert SearchIndexExceptions into RuntimeExceptions. Useful when using Java's functional programming features.
      Parameters:
      indexSvc - The IndexService instance.
      index - The index to get the event from.
      id - The id of the event to get.
      Returns:
      An optional holding the event or nothing, if not found.
    • addSchedulingDates

      public static org.json.simple.JSONObject addSchedulingDates(org.opencastproject.elasticsearch.index.objects.event.Event event, org.json.simple.JSONObject scheduling)
      Takes the given scheduling information and completes the event start and end dates as well as the duration for the given event. If the weekday shall be changed, the start and end dates are adjusted accordingly.
      Parameters:
      event - The event to complete the scheduling information for.
      scheduling - The (yet incomplete) scheduling information to complete.
      Returns:
      The completed scheduling information, adjusted for the given event.
    • toNonTechnicalMetadataJson

      public static org.json.simple.JSONObject toNonTechnicalMetadataJson(org.json.simple.JSONObject scheduling)
      Creates a json object containing meta data based on the given scheduling information.
      Parameters:
      scheduling - The scheduling information to extract meta data from.
      Returns:
      The meta data, consisting of location, startDate, and duration.
    • mergeMetadataFields

      public static org.json.simple.JSONObject mergeMetadataFields(org.json.simple.JSONObject first, org.json.simple.JSONObject second)
      Merges all fields of the given meta data json objects into one object.
      Parameters:
      first - The first meta data json object.
      second - The second meta data json object.
      Returns:
      A new json meta data object, containing the field of both input objects.