Class EventsEndpoint

java.lang.Object
org.opencastproject.external.endpoint.EventsEndpoint
All Implemented Interfaces:
org.osgi.service.cm.ManagedService

@Path("/api/events") @Produces({"application/json","application/v1.0.0+json","application/v1.1.0+json","application/v1.2.0+json","application/v1.3.0+json","application/v1.4.0+json","application/v1.5.0+json","application/v1.6.0+json","application/v1.7.0+json","application/v1.8.0+json","application/v1.9.0+json","application/v1.10.0+json","application/v1.11.0+json"}) public class EventsEndpoint extends Object implements org.osgi.service.cm.ManagedService
  • Field Details

    • URL_SIGNING_EXPIRES_DURATION_SECONDS_KEY

      protected static final String URL_SIGNING_EXPIRES_DURATION_SECONDS_KEY
      See Also:
    • DEFAULT_URL_SIGNING_EXPIRE_DURATION

      protected static final Long DEFAULT_URL_SIGNING_EXPIRE_DURATION
      The default time before a piece of signed content expires. 2 Hours.
    • endpointBaseUrl

      protected String endpointBaseUrl
      Base URL of this endpoint
  • Constructor Details

    • EventsEndpoint

      public EventsEndpoint()
  • Method Details

    • setAssetManager

      public void setAssetManager(org.opencastproject.assetmanager.api.AssetManager assetManager)
      OSGi DI
    • setIndexService

      public void setIndexService(org.opencastproject.index.service.api.IndexService indexService)
      OSGi DI
    • setIngestService

      public void setIngestService(org.opencastproject.ingest.api.IngestService ingestService)
      OSGi DI
    • setUrlSigningService

      public void setUrlSigningService(org.opencastproject.security.urlsigning.service.UrlSigningService urlSigningService)
      OSGi DI
    • getSecurityService

      public org.opencastproject.security.api.SecurityService getSecurityService()
    • getSchedulerService

      public org.opencastproject.scheduler.api.SchedulerService getSchedulerService()
    • setSchedulerService

      public void setSchedulerService(org.opencastproject.scheduler.api.SchedulerService schedulerService)
    • addCatalogUIAdapter

      public void addCatalogUIAdapter(org.opencastproject.metadata.dublincore.EventCatalogUIAdapter catalogUIAdapter)
      OSGi DI.
    • removeCatalogUIAdapter

      public void removeCatalogUIAdapter(org.opencastproject.metadata.dublincore.EventCatalogUIAdapter catalogUIAdapter)
      OSGi DI.
    • getAgentStateService

      public org.opencastproject.capture.admin.api.CaptureAgentStateService getAgentStateService()
      OSGi DI
    • setAgentStateService

      public void setAgentStateService(org.opencastproject.capture.admin.api.CaptureAgentStateService agentStateService)
      OSGi DI
    • setWorkflowService

      public void setWorkflowService(org.opencastproject.workflow.api.WorkflowService workflowService)
      OSGi DI
    • getEventCatalogUIAdapters

      public List<org.opencastproject.metadata.dublincore.EventCatalogUIAdapter> getEventCatalogUIAdapters(String organization)
    • updated

      public void updated(Dictionary<String,?> properties) throws org.osgi.service.cm.ConfigurationException
      OSGi callback if properties file is present
      Specified by:
      updated in interface org.osgi.service.cm.ManagedService
      Throws:
      org.osgi.service.cm.ConfigurationException
    • isNullOrEmpty

      public static <T> boolean isNullOrEmpty(List<String> list)
    • getEvent

      @GET @Path("{eventId}") public javax.ws.rs.core.Response getEvent(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @QueryParam("sign") boolean sign, @QueryParam("withacl") Boolean withAcl, @QueryParam("withmetadata") Boolean withMetadata, @QueryParam("withscheduling") Boolean withScheduling, @QueryParam("withpublications") Boolean withPublications, @QueryParam("includeInternalPublication") Boolean includeInternalPublication) throws Exception
      Throws:
      Exception
    • getEventMedia

      @GET @Path("{eventId}/media") public javax.ws.rs.core.Response getEventMedia(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id) throws Exception
      Throws:
      Exception
    • deleteEvent

      @DELETE @Path("{eventId}") public javax.ws.rs.core.Response deleteEvent(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id) throws org.opencastproject.elasticsearch.api.SearchIndexException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.elasticsearch.api.SearchIndexException
      org.opencastproject.security.api.UnauthorizedException
    • updateEventMetadata

      @POST @Path("{eventId}") public javax.ws.rs.core.Response updateEventMetadata(@HeaderParam("Accept") String acceptHeader, @Context javax.servlet.http.HttpServletRequest request, @PathParam("eventId") String eventId)
    • createNewEvent

      @POST @Path("/") @Consumes("multipart/form-data") public javax.ws.rs.core.Response createNewEvent(@HeaderParam("Accept") String acceptHeader, @Context javax.servlet.http.HttpServletRequest request)
    • getEvents

      @GET @Path("/") public javax.ws.rs.core.Response getEvents(@HeaderParam("Accept") String acceptHeader, @QueryParam("id") String id, @QueryParam("commentReason") String reasonFilter, @QueryParam("commentResolution") String resolutionFilter, @QueryParam("filter") List<String> filter, @QueryParam("sort") String sort, @QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit, @QueryParam("sign") boolean sign, @QueryParam("withacl") Boolean withAcl, @QueryParam("withmetadata") Boolean withMetadata, @QueryParam("withscheduling") Boolean withScheduling, @QueryParam("onlyWithWriteAccess") Boolean onlyWithWriteAccess, @QueryParam("withpublications") Boolean withPublications, @QueryParam("includeInternalPublication") Boolean includeInternalPublication)
    • getJsonEvents

      protected javax.ws.rs.core.Response getJsonEvents(String acceptHeader, List<org.opencastproject.elasticsearch.index.objects.IndexObject> events, Boolean withAcl, Boolean withMetadata, Boolean withScheduling, Boolean withPublications, Boolean includeInternalPublication, Boolean withSignedUrls, ApiVersion requestedVersion) throws org.opencastproject.index.service.exception.IndexServiceException, org.opencastproject.security.api.UnauthorizedException, org.opencastproject.scheduler.api.SchedulerException
      Render a collection of Events into a json array.
      Parameters:
      acceptHeader - The accept header to return to the client.
      events - The List of Events to render into json.
      withAcl - Whether to include the events' ACLs.
      withMetadata - Whether to include the events' metadata.
      withScheduling - Whether to include the events' scheduling information.
      withPublications - Whether to include the events' publications.
      withSignedUrls - Whether to sign the included urls.
      Returns:
      A Response with the accept header and body as the Json array of Events.
      Throws:
      org.opencastproject.index.service.exception.IndexServiceException
      org.opencastproject.scheduler.api.SchedulerException
      org.opencastproject.security.api.UnauthorizedException
    • eventToJSON

      protected com.google.gson.JsonObject eventToJSON(org.opencastproject.elasticsearch.index.objects.event.Event event, Boolean withAcl, Boolean withMetadata, Boolean withScheduling, Boolean withPublications, Boolean includeInternalPublication, Boolean withSignedUrls, ApiVersion requestedVersion) throws org.opencastproject.index.service.exception.IndexServiceException, org.opencastproject.scheduler.api.SchedulerException, org.opencastproject.security.api.UnauthorizedException
      Transform an Event to Json
      Parameters:
      event - The event to transform into json
      withAcl - Whether to add the acl information for the event
      withMetadata - Whether to add all the metadata for the event
      withScheduling - Whether to add the scheduling information for the event
      withPublications - Whether to add the publications
      withSignedUrls - Whether to sign the urls if they are protected by stream security.
      Returns:
      The event in json format.
      Throws:
      org.opencastproject.index.service.exception.IndexServiceException - Thrown if unable to get the metadata for the event.
      org.opencastproject.scheduler.api.SchedulerException
      org.opencastproject.security.api.UnauthorizedException
    • getEventAcl

      @GET @Path("{eventId}/acl") public javax.ws.rs.core.Response getEventAcl(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id) throws Exception
      Throws:
      Exception
    • updateEventAcl

      @PUT @Path("{eventId}/acl") public javax.ws.rs.core.Response updateEventAcl(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @FormParam("acl") String acl) throws Exception
      Throws:
      Exception
    • addEventAce

      @POST @Path("{eventId}/acl/{action}") public javax.ws.rs.core.Response addEventAce(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @PathParam("action") String action, @FormParam("role") String role) throws Exception
      Throws:
      Exception
    • deleteEventAce

      @DELETE @Path("{eventId}/acl/{action}/{role}") public javax.ws.rs.core.Response deleteEventAce(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @PathParam("action") String action, @PathParam("role") String role) throws Exception
      Throws:
      Exception
    • getAllEventMetadata

      @GET @Path("{eventId}/metadata") public javax.ws.rs.core.Response getAllEventMetadata(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @QueryParam("type") String type) throws Exception
      Throws:
      Exception
    • getEventMetadataById

      protected Optional<org.opencastproject.metadata.dublincore.MetadataList> getEventMetadataById(String id) throws org.opencastproject.index.service.exception.IndexServiceException, Exception
      Throws:
      org.opencastproject.index.service.exception.IndexServiceException
      Exception
    • getEventMetadata

      protected Optional<org.opencastproject.metadata.dublincore.MetadataList> getEventMetadata(org.opencastproject.elasticsearch.index.objects.event.Event event) throws org.opencastproject.index.service.exception.IndexServiceException, Exception
      Throws:
      org.opencastproject.index.service.exception.IndexServiceException
      Exception
    • updateEventMetadataByType

      @PUT @Path("{eventId}/metadata") public javax.ws.rs.core.Response updateEventMetadataByType(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @QueryParam("type") String type, @FormParam("metadata") String metadataJSON) throws Exception
      Throws:
      Exception
    • deleteEventMetadataByType

      @DELETE @Path("{eventId}/metadata") public javax.ws.rs.core.Response deleteEventMetadataByType(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @QueryParam("type") String type) throws org.opencastproject.elasticsearch.api.SearchIndexException
      Throws:
      org.opencastproject.elasticsearch.api.SearchIndexException
    • getEventPublications

      @GET @Path("{eventId}/publications") public javax.ws.rs.core.Response getEventPublications(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @QueryParam("sign") boolean sign, @QueryParam("includeInternalPublication") boolean includeInternalPublication) throws Exception
      Throws:
      Exception
    • getPublication

      public com.google.gson.JsonObject getPublication(org.opencastproject.mediapackage.Publication publication, Boolean sign, ApiVersion requestedVersion)
    • getEventPublication

      @GET @Path("{eventId}/publications/{publicationId}") public javax.ws.rs.core.Response getEventPublication(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String eventId, @PathParam("publicationId") String publicationId, @QueryParam("sign") boolean sign) throws Exception
      Throws:
      Exception
    • getAclFromEvent

      protected static org.opencastproject.security.api.AccessControlList getAclFromEvent(org.opencastproject.elasticsearch.index.objects.event.Event event)
      Get an AccessControlList from an Event.
      Parameters:
      event - The Event to get the ACL from.
      Returns:
      The AccessControlList stored in the Event
    • getEventScheduling

      @GET @Path("{eventId}/scheduling") @Produces({"application/json","application/v1.1.0+json","application/v1.2.0+json","application/v1.3.0+json","application/v1.4.0+json","application/v1.5.0+json","application/v1.6.0+json","application/v1.7.0+json","application/v1.8.0+json","application/v1.9.0+json","application/v1.10.0+json","application/v1.11.0+json"}) public javax.ws.rs.core.Response getEventScheduling(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id) throws Exception
      Throws:
      Exception
    • updateEventScheduling

      @PUT @Path("{eventId}/scheduling") @Produces({"application/json","application/v1.1.0+json","application/v1.2.0+json","application/v1.3.0+json","application/v1.4.0+json","application/v1.5.0+json","application/v1.6.0+json","application/v1.7.0+json","application/v1.8.0+json","application/v1.9.0+json","application/v1.10.0+json","application/v1.11.0+json"}) public javax.ws.rs.core.Response updateEventScheduling(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @FormParam("scheduling") String scheduling, @FormParam("allowConflict") @DefaultValue("false") boolean allowConflict) throws Exception
      Throws:
      Exception
    • updateFlavorWithTrack

      @POST @Path("{eventId}/track") @Consumes("multipart/form-data") public javax.ws.rs.core.Response updateFlavorWithTrack(@HeaderParam("Accept") String acceptHeader, @PathParam("eventId") String id, @Context javax.servlet.http.HttpServletRequest request)