Skip to content

Commit 740d967

Browse files
committed
Merge pull request #11 from aleksey-korolev/master
Add ZencoderNotification to ZencoderJob
2 parents fbdc46d + e3e6784 commit 740d967

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/main/java/de/bitzeche/video/transcoding/zencoder/job/ZencoderJob.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public class ZencoderJob {
4747

4848
private List<ZencoderOutput> outputs = new ArrayList<ZencoderOutput>();
4949

50-
public ZencoderJob(String inputPath) {
50+
private List<ZencoderNotification> notifications = new ArrayList<ZencoderNotification>();
51+
52+
53+
public ZencoderJob(String inputPath) {
5154
this.inputPath = inputPath;
5255
}
5356

@@ -97,6 +100,20 @@ public Document createXML() throws ParserConfigurationException {
97100
privateNode.setTextContent((this.isPrivate ? "1" : "0"));
98101
root.appendChild(privateNode);
99102

103+
// job notifications
104+
// API Note: Job-level notifications are supported only since API V2
105+
if (this.notifications.size() != 0) {
106+
Element notifis = document.createElement("notifications");
107+
notifis.setAttribute("type", "array");
108+
root.appendChild(notifis);
109+
for (ZencoderNotification item : this.notifications) {
110+
Element notif = item.createXML(document);
111+
if (notif != null) {
112+
notifis.appendChild(notif);
113+
}
114+
}
115+
}
116+
100117
if (outputs.size() == 0)
101118
return document;
102119

@@ -150,7 +167,7 @@ public boolean isTest() {
150167
return isTest;
151168
}
152169

153-
public void setJobId(int id) {
170+
public void setJobId(int id) {
154171
JobId = id;
155172
}
156173

@@ -173,4 +190,12 @@ public void setTest(boolean isTest) {
173190
public void setPrivate(boolean isPrivate) {
174191
this.isPrivate = isPrivate;
175192
}
193+
194+
public void addNotification(ZencoderNotification item) {
195+
this.notifications.add(item);
196+
}
197+
198+
public void deleteNotification(ZencoderNotification item) {
199+
this.notifications.remove(item);
200+
}
176201
}

0 commit comments

Comments
 (0)