use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs in project VideoOptimzer by attdevsupport.
the class VideoPreferenceModel method updatePreferenceAndTable.
private boolean updatePreferenceAndTable(int row, VideoPreferenceInfo videoPref) {
mapper = new ObjectMapper();
prefs = PreferenceHandlerImpl.getInstance();
String temp = "";
if (videoUsagePrefs == null) {
temp = prefs.getPref(VideoUsagePrefs.VIDEO_PREFERENCE);
if (temp != null && !temp.equals("null")) {
try {
videoUsagePrefs = mapper.readValue(temp, VideoUsagePrefs.class);
} catch (IOException e) {
LOGGER.error("VideoUsagePrefs failed to de-serialize :" + e.getMessage());
}
} else {
try {
videoUsagePrefs = ContextAware.getAROConfigContext().getBean("videoUsagePrefs", VideoUsagePrefs.class);
temp = mapper.writeValueAsString(videoUsagePrefs);
prefs.setPref(VideoUsagePrefs.VIDEO_PREFERENCE, temp);
} catch (IOException e) {
LOGGER.error("VideoUsagePrefs failed to serialize :" + e.getMessage());
}
}
}
switch(row) {
case // StartUp DeSTARTUP_DELAY_ROWay
STARTUP_DELAY_ROW:
videoUsagePrefs.setStartUpDelayWarnVal(videoPref.getWarningCriteria());
break;
case // Stall Duration
STALL_DURATION_ROW:
videoUsagePrefs.setStallDurationWarnVal(videoPref.getWarningCriteria());
videoUsagePrefs.setStallDurationFailVal(videoPref.getFailCriteria());
break;
case // Segment Redundancy
SEGMENT_REDUNDANCY_ROW:
videoUsagePrefs.setSegmentRedundancyWarnVal(videoPref.getWarningCriteriaInt());
videoUsagePrefs.setSegmentRedundancyFailVal(videoPref.getFailCriteriaInt());
break;
}
// prefs.setPref(VideoUsagePrefs.VIDEO_PREFERENCE, temp);
videoPreferenceList.set(row, videoPref);
return true;
}
use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs in project VideoOptimzer by attdevsupport.
the class VideoUsagePrefsManagerImpl method getVideoUsagePreference.
public VideoUsagePrefs getVideoUsagePreference() {
PreferenceHandlerImpl prefs = PreferenceHandlerImpl.getInstance();
String videoPref = prefs.getPref(VideoUsagePrefs.VIDEO_PREFERENCE);
if (videoPref != null && !videoPref.equals("null")) {
ObjectMapper mapper = new ObjectMapper();
try {
videoUsagePrefs = mapper.readValue(videoPref, VideoUsagePrefs.class);
} catch (IOException e) {
LOG.error("VideoPreference Mapper Exception" + e.getMessage());
}
}
return videoUsagePrefs;
}
use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs in project VideoOptimzer by attdevsupport.
the class VideoPrefsController method loadPrefs.
/**
* Loads video preferences set in the config file onto VideoUsagePrefs
*/
public VideoUsagePrefs loadPrefs() {
ObjectMapper mapper = new ObjectMapper();
videoUsagePrefs = new VideoUsagePrefs();
String temp = prefs.getPref(VideoUsagePrefs.VIDEO_PREFERENCE);
if (temp != null && !temp.equals("null")) {
try {
videoUsagePrefs = mapper.readValue(temp, VideoUsagePrefs.class);
} catch (IOException e) {
LOG.error("VideoUsagePrefs failed to de-serialize :" + e.getMessage());
}
} else {
try {
temp = mapper.writeValueAsString(videoUsagePrefs);
prefs.setPref(VideoUsagePrefs.VIDEO_PREFERENCE, temp);
} catch (IOException e) {
LOG.error("VideoUsagePrefs failed to serialize :" + e.getMessage());
}
}
return videoUsagePrefs;
}
use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs in project VideoOptimzer by attdevsupport.
the class VideoAnalysisConfigHelperImpl method loadPrefs.
// TODO move this into AroPrefs, a new handler for preferences json serialization
void loadPrefs() {
Path filePath = Paths.get(folderPath + "prefs.json");
VideoUsagePrefs videoUsagePrefs = null;
try {
String temp = new String(Files.readAllBytes(filePath));
videoUsagePrefs = mapper.readValue(temp, VideoUsagePrefs.class);
LOG.debug("videoUsagePrefs :" + videoUsagePrefs);
} catch (JsonParseException e) {
LOG.error("VideoUsagePrefs failed to de-serialize :" + e.getMessage());
} catch (JsonMappingException e) {
LOG.error("VideoUsagePrefs failed to de-serialize :" + e.getMessage());
} catch (IOException e) {
LOG.error("VideoUsagePrefs failed to load :" + e.getMessage());
}
}
use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs in project VideoOptimzer by attdevsupport.
the class VideoPreferencesPanel method loadVideoUsagePreferences.
private void loadVideoUsagePreferences() {
mapper = new ObjectMapper();
prefs = PreferenceHandlerImpl.getInstance();
String temp = prefs.getPref(VideoUsagePrefs.VIDEO_PREFERENCE);
if (temp != null && !temp.equals("null")) {
try {
videoUsagePrefs = mapper.readValue(temp, VideoUsagePrefs.class);
videoPreferenceModel = new VideoPreferenceModel();
} catch (IOException e) {
LOG.error("VideoUsagePrefs failed to de-serialize :" + e.getMessage(), e);
}
} else {
try {
// new
videoUsagePrefs = ContextAware.getAROConfigContext().getBean("videoUsagePrefs", VideoUsagePrefs.class);
// VideoUsagePrefs();
temp = mapper.writeValueAsString(videoUsagePrefs);
prefs.setPref(VideoUsagePrefs.VIDEO_PREFERENCE, temp);
} catch (IOException e) {
LOG.error("VideoUsagePrefs failed to serialize :" + e.getMessage(), e);
}
}
}
Aggregations