use of com.tencentcloudapi.vod.v20180717.models.EventContent in project cloud-sdk by mizhousoft.
the class QCloudVODServiceImpl method pullEvents.
/**
* {@inheritDoc}
*/
@Override
public List<VodEvent> pullEvents() throws CloudSDKException {
try {
PullEventsRequest req = new PullEventsRequest();
PullEventsResponse resp = vodClient.PullEvents(req);
EventContent[] list = resp.getEventSet();
if (null != list) {
List<VodEvent> events = new ArrayList<>(list.length);
for (EventContent item : list) {
VodEvent event = convertToEvent(item);
events.add(event);
}
return events;
}
return new ArrayList<>(0);
} catch (TencentCloudSDKException e) {
throw new CloudSDKException(e.getErrorCode(), e.getMessage(), e);
}
}
use of com.tencentcloudapi.vod.v20180717.models.EventContent in project cloud-sdk by mizhousoft.
the class QCloudVODServiceImpl method convertToEvent.
private VodEvent convertToEvent(EventContent content) {
String eventId = content.getEventHandle();
String eventType = content.getEventType();
if ("NewFileUpload".equals(eventType)) {
FileUploadTask uploadTask = content.getFileUploadEvent();
MediaMeta mediaMeta = buildMediaMeta(uploadTask.getFileId(), uploadTask.getMediaBasicInfo(), uploadTask.getMetaData(), null);
return new VodNewFileUploadEvent(eventId, mediaMeta);
} else if ("ProcedureStateChanged".equals(eventType)) {
ProcedureTask precTask = content.getProcedureStateChangeEvent();
boolean completed = "FINISH".equals(precTask.getStatus());
return new VodStateChangedEvent(eventId, precTask.getFileId(), completed);
} else if ("FileDeleted".equals(eventType)) {
FileDeleteTask deleteTask = content.getFileDeleteEvent();
return new VodFileDeletedEvent(eventId, deleteTask.getFileIdSet());
} else {
return new VodEvent(eventId);
}
}
Aggregations