Search in sources :

Example 6 with DataPointModel

use of com.infiniteautomation.mango.rest.latest.model.dataPoint.DataPointModel in project ma-modules-public by infiniteautomation.

the class DataPointEventTypeModelMapping method map.

@Override
public DataPointEventTypeModel map(Object from, PermissionHolder user, RestModelMapper mapper) {
    DataPointEventType type = (DataPointEventType) from;
    DataPointVO dp = (DataPointVO) type.getReference1();
    DataPointModel dpModel;
    if (dp != null) {
        dpModel = mapper.map(dp, DataPointModel.class, user);
    } else {
        dpModel = null;
    }
    return new DataPointEventTypeModel(type, dpModel);
}
Also used : DataPointVO(com.serotonin.m2m2.vo.DataPointVO) DataPointModel(com.infiniteautomation.mango.rest.latest.model.dataPoint.DataPointModel) DataPointEventType(com.serotonin.m2m2.rt.event.type.DataPointEventType)

Aggregations

DataPointModel (com.infiniteautomation.mango.rest.latest.model.dataPoint.DataPointModel)6 BadRequestException (com.infiniteautomation.mango.rest.latest.exception.BadRequestException)4 TranslatableMessage (com.serotonin.m2m2.i18n.TranslatableMessage)4 VoAction (com.infiniteautomation.mango.rest.latest.bulk.VoAction)3 DataPointEventType (com.serotonin.m2m2.rt.event.type.DataPointEventType)3 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)3 AbstractRestException (com.infiniteautomation.mango.rest.latest.exception.AbstractRestException)2 AbstractDataSourceModel (com.infiniteautomation.mango.rest.latest.model.datasource.AbstractDataSourceModel)2 DataPointEventTypeModel (com.infiniteautomation.mango.rest.latest.model.event.DataPointEventTypeModel)2 DataSourceEventTypeModel (com.infiniteautomation.mango.rest.latest.model.event.DataSourceEventTypeModel)2 EventTypeVOModel (com.infiniteautomation.mango.rest.latest.model.event.EventTypeVOModel)2 PublisherEventTypeModel (com.infiniteautomation.mango.rest.latest.model.event.PublisherEventTypeModel)2 SystemEventTypeModel (com.infiniteautomation.mango.rest.latest.model.event.SystemEventTypeModel)2 AbstractPointEventDetectorModel (com.infiniteautomation.mango.rest.latest.model.event.detectors.AbstractPointEventDetectorModel)2 AbstractPublisherModel (com.infiniteautomation.mango.rest.latest.model.publisher.AbstractPublisherModel)2 NotFoundException (com.infiniteautomation.mango.util.exception.NotFoundException)2 EventTypeDefinition (com.serotonin.m2m2.module.EventTypeDefinition)2 SystemEventTypeDefinition (com.serotonin.m2m2.module.SystemEventTypeDefinition)2 AuditEventType (com.serotonin.m2m2.rt.event.type.AuditEventType)2 DataSourceEventType (com.serotonin.m2m2.rt.event.type.DataSourceEventType)2