use of org.opencastproject.message.broker.api.assetmanager.AssetManagerItem.DeleteEpisode in project opencast by opencast.
the class AssetManagerUpdateHandler method execute.
@Override
protected void execute(MessageItem messageItem) {
AssetManagerItem item = (AssetManagerItem) messageItem;
String mpId = item.getId();
try {
logger.debug("Asset Manager message handler START for mp {} event type {} in thread {}", mpId, item.getType(), Thread.currentThread().getId());
switch(item.getType()) {
case Update:
if (item instanceof TakeSnapshot) {
// Check class just in case
TakeSnapshot snapshotItem = (TakeSnapshot) item;
// If no episopde dc, there's nothing to do.
if (snapshotItem.getEpisodeDublincore().isNone())
break;
// notifications, only when getting scheduler notifications
for (Publication pub : snapshotItem.getMediapackage().getPublications()) {
if (LiveScheduleService.CHANNEL_ID.equals(pub.getChannel()))
liveScheduleService.createOrUpdateLiveEvent(mpId, snapshotItem.getEpisodeDublincore().get());
}
}
break;
case Delete:
if (item instanceof DeleteEpisode)
// Episode is being deleted
liveScheduleService.deleteLiveEvent(mpId);
// No action needed when a snapshot is deleted
break;
default:
throw new IllegalArgumentException("Unhandled type of AssetManagerItem");
}
} catch (Exception e) {
logger.warn(String.format("Exception occurred for mp %s, event type %s", mpId, item.getType()), e);
} finally {
logger.debug("Asset Manager message handler END for mp {} event type {} in thread {}", mpId, item.getType(), Thread.currentThread().getId());
}
}
Aggregations