1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.opencastproject.transcription.microsoft.azure.model;
23
24 import org.apache.commons.lang3.StringUtils;
25
26 import java.net.URI;
27 import java.util.List;
28 import java.util.Map;
29
30 public class MicrosoftAzureSpeechTranscription {
31
32
33
34
35
36 public class TranscriptionFiles {
37 public String files;
38 }
39 public class TranscriptionSelf {
40 public String self;
41 }
42 public String self;
43 public TranscriptionSelf model;
44 public TranscriptionFiles links;
45 public Map<String, Object> properties;
46 public TranscriptionSelf project;
47 public TranscriptionSelf dataset;
48 public List<String> contentUrls;
49 public String contentContainerUrl;
50 public String locale;
51 public String displayName;
52 public String description;
53 public Map<String, Object> customProperties;
54 public String lastActionDateTime;
55 public String status;
56 public String createdDateTime;
57
58
59
60
61 public MicrosoftAzureSpeechTranscription() { }
62
63 public String getID() {
64 if (StringUtils.isEmpty(self)) {
65 return null;
66 }
67 URI selfUriPath = URI.create(URI.create(self).getPath());
68 String speechServiceEndpointPath = "/speechtotext/v3.1/transcriptions/";
69 if (StringUtils.startsWithIgnoreCase(selfUriPath.getPath(), speechServiceEndpointPath)) {
70 String id = StringUtils.substringAfter(selfUriPath.getPath(), speechServiceEndpointPath);
71 if (!StringUtils.contains(id, "/")) {
72 return id;
73 }
74 return StringUtils.substringBefore(id, "/");
75 }
76 return null;
77 }
78
79 public boolean isFailed() {
80 return StringUtils.equalsIgnoreCase("Failed", status);
81 }
82
83 public boolean isRunning() {
84 return StringUtils.equalsIgnoreCase("Running", status);
85 }
86
87 public boolean isSucceeded() {
88 return StringUtils.equalsIgnoreCase("Succeeded", status);
89 }
90 }