com.alogient.cameleon.sdk.content.service.impl.MediaServiceImpl Maven / Gradle / Ivy
package com.alogient.cameleon.sdk.content.service.impl;
import com.alogient.cameleon.sdk.content.dao.MediaDao;
import com.alogient.cameleon.sdk.content.dao.model.Video;
import com.alogient.cameleon.sdk.content.dao.model.VideoCulture;
import com.alogient.cameleon.sdk.content.service.MediaService;
import com.alogient.cameleon.sdk.content.vo.media.VideoVo;
public class MediaServiceImpl implements MediaService {
/**
* Media data access object
*/
private MediaDao mediaDao;
/**
* @param mediaDao the mediaDao to set
*/
public void setMediaDao(MediaDao mediaDao) {
this.mediaDao = mediaDao;
}
/**
* {@inheritDoc}
*/
@Override
public VideoVo getVideo(Integer videoId, Integer cultureId,
Boolean isLiveMode) {
Video video = mediaDao.getVideo(videoId);
if (video == null || video.getVideos() == null) {
return null;
}
VideoCulture target = null;
for (VideoCulture videoCulture : video.getVideos()) {
if (videoCulture.getCulture().getCultureId().intValue() == cultureId
.intValue()) {
target = videoCulture;
break;
}
}
if (target == null) {
return null;
}
VideoVo vo = new VideoVo();
vo.setVideoCultureId(target.getVideoCultureId());
vo.setCultureCode(target.getCulture().getCultureCode());
vo.setIsExternal(video.getIsExternal());
vo.setTitle(target.getTitle());
vo.setDescription(target.getDescription());
vo.setVideoFile(isLiveMode ? target.getVideoFile() : target
.getVideoFilePreview());
vo.setImageFile(isLiveMode ? target.getImageFile() : target
.getImageFilePreview());
vo.setIsVisible(isLiveMode ? target.getIsVisible() : target
.getIsVisiblePreview());
vo.setDuration(target.getDuration());
return vo;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy