use of com.infiniteautomation.mango.rest.latest.model.datasource.EventTypeAlarmLevelModel in project ma-modules-public by infiniteautomation.
the class AbstractPublisherModel method fromVO.
@Override
public void fromVO(PUBLISHER vo) {
super.fromVO(vo);
this.connectionDescription = vo.getConfigDescription();
this.description = new TranslatableMessage(vo.getDefinition().getDescriptionKey());
this.enabled = vo.isEnabled();
this.eventAlarmLevels = new ArrayList<>();
ExportCodes eventCodes = vo.getEventCodes();
for (EventTypeVO evt : vo.getEventTypes()) {
PublisherEventType dsEvt = (PublisherEventType) evt.getEventType();
EventTypeAlarmLevelModel model = new EventTypeAlarmLevelModel(eventCodes.getCode(dsEvt.getReferenceId2()), dsEvt.getDuplicateHandling(), evt.getAlarmLevel(), evt.getDescription());
this.eventAlarmLevels.add(model);
}
this.publishType = PublisherVO.PUBLISH_TYPE_CODES.getCode(vo.getPublishType());
this.cacheWarningSize = vo.getCacheWarningSize();
this.cacheDiscardSize = vo.getCacheDiscardSize();
this.sendSnapshot = vo.isSendSnapshot();
this.snapshotSendPeriod = new TimePeriod(vo.getSnapshotSendPeriods(), TimePeriodType.convertTo(vo.getSnapshotSendPeriodType()));
this.publishAttributeChanges = vo.isPublishAttributeChanges();
}
use of com.infiniteautomation.mango.rest.latest.model.datasource.EventTypeAlarmLevelModel in project ma-modules-public by infiniteautomation.
the class AbstractPublisherModel method toVO.
@Override
public PUBLISHER toVO() {
PUBLISHER vo = super.toVO();
vo.setEnabled(enabled);
if (eventAlarmLevels != null) {
for (EventTypeAlarmLevelModel eval : eventAlarmLevels) {
vo.setAlarmLevel(eval.getEventType(), eval.getLevel());
}
}
vo.setPublishType(PublisherVO.PUBLISH_TYPE_CODES.getId(publishType));
vo.setCacheWarningSize(cacheWarningSize);
vo.setCacheDiscardSize(cacheDiscardSize);
vo.setSendSnapshot(sendSnapshot);
if (snapshotSendPeriod != null) {
vo.setSnapshotSendPeriods(snapshotSendPeriod.getPeriods());
vo.setSnapshotSendPeriodType(TimePeriodType.convertFrom(snapshotSendPeriod.getType()));
}
vo.setPublishAttributeChanges(publishAttributeChanges);
return vo;
}
Aggregations