Search in sources :

Example 1 with JsonGetter

use of com.fasterxml.jackson.annotation.JsonGetter in project ma-modules-public by infiniteautomation.

the class EventInstanceModel method getComments.

@JsonGetter
public List<UserCommentModel> getComments() {
    List<UserCommentModel> commentModels = new ArrayList<UserCommentModel>();
    List<UserCommentVO> comments = this.data.getEventComments();
    if (comments == null)
        return null;
    for (UserCommentVO comment : comments) {
        commentModels.add(new UserCommentModel(comment));
    }
    return commentModels;
}
Also used : UserCommentModel(com.serotonin.m2m2.web.mvc.rest.v1.model.comment.UserCommentModel) ArrayList(java.util.ArrayList) UserCommentVO(com.serotonin.m2m2.vo.comment.UserCommentVO) JsonGetter(com.fasterxml.jackson.annotation.JsonGetter)

Example 2 with JsonGetter

use of com.fasterxml.jackson.annotation.JsonGetter in project ma-core-public by infiniteautomation.

the class AbstractDataSourceModel method getAlarmLevels.

@JsonGetter(value = "alarmLevels")
public Map<String, String> getAlarmLevels() {
    ExportCodes eventCodes = this.data.getEventCodes();
    Map<String, String> alarmCodeLevels = new HashMap<>();
    if (eventCodes != null && eventCodes.size() > 0) {
        for (int i = 0; i < eventCodes.size(); i++) {
            int eventId = eventCodes.getId(i);
            int level = this.data.getAlarmLevel(eventId, AlarmLevels.URGENT);
            alarmCodeLevels.put(eventCodes.getCode(eventId), AlarmLevels.CODES.getCode(level));
        }
    }
    return alarmCodeLevels;
}
Also used : ExportCodes(com.serotonin.m2m2.util.ExportCodes) HashMap(java.util.HashMap) JsonGetter(com.fasterxml.jackson.annotation.JsonGetter)

Aggregations

JsonGetter (com.fasterxml.jackson.annotation.JsonGetter)2 ExportCodes (com.serotonin.m2m2.util.ExportCodes)1 UserCommentVO (com.serotonin.m2m2.vo.comment.UserCommentVO)1 UserCommentModel (com.serotonin.m2m2.web.mvc.rest.v1.model.comment.UserCommentModel)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1