Package org.opencastproject.adminui.util
Class BulkUpdateUtil
java.lang.Object
org.opencastproject.adminui.util.BulkUpdateUtil
This class holds utility functions which are related to the bulk update feature for events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classModel class for one group of update instructionsstatic classModel class for the bulk update instructions which are sent by the UI. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.json.simple.JSONObjectaddSchedulingDates(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.JSONObjectmergeMetadataFields(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.JSONObjecttoNonTechnicalMetadataJson(org.json.simple.JSONObject scheduling) Creates a json object containing meta data based on the given scheduling information.
-
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.
-