1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21 package org.opencastproject.lti.service.api;
22
23 import org.opencastproject.security.api.UnauthorizedException;
24 import org.opencastproject.util.NotFoundException;
25
26 import java.util.List;
27
28 /**
29 * Interface for implementing functionality available in the LTI GUI
30 */
31 public interface LtiService {
32 String JOB_TYPE = "org.opencastproject.lti.service";
33
34 /**
35 * List currently running jobs for the series
36 * @param seriesId ID of the series
37 * @return A list of jobs
38 */
39 List<LtiJob> listJobs(String seriesId);
40
41 /**
42 * Upload a new event or update existing event's metadata
43 * @param file File to upload
44 * @param captions Subtitles file
45 * @param eventId ID of the event (can be <code>null</code> for new events)
46 * @param seriesId ID of the series
47 * @param metadataJson Metadata for the event as JSON string
48 */
49 void upsertEvent(
50 LtiFileUpload file,
51 String captions,
52 String captionFormat,
53 String captionLanguage,
54 String eventId,
55 String seriesId,
56 String metadataJson) throws UnauthorizedException, NotFoundException;
57
58 /**
59 * Copy an event to a different series
60 * @param eventId Event ID to copy
61 * @param seriesId Series ID to copy into
62 */
63 void copyEventToSeries(String eventId, String seriesId);
64
65 /**
66 * Returns the event metadata for a specific event
67 * @param eventId ID of the event
68 * @return The event metadata list
69 * @throws NotFoundException If the event doesn't exist
70 * @throws UnauthorizedException If the user cannot access the event
71 */
72 String getEventMetadata(String eventId) throws NotFoundException, UnauthorizedException;
73
74 /**
75 * Returns the event metadata for a new event
76 * @return The event metadata list
77 */
78 String getNewEventMetadata();
79
80 /**
81 * Set the event metadata
82 * @param eventId ID of the event
83 * @param metadataJson New metadata of the event as JSON
84 * @throws NotFoundException If the event doesn't exist
85 * @throws UnauthorizedException If the user cannot access the event
86 */
87 void setEventMetadataJson(String eventId, String metadataJson) throws NotFoundException, UnauthorizedException;
88
89 /**
90 * Deletes the specified event
91 * @param eventId ID of the event
92 */
93 void delete(String eventId);
94 }