Examples of TranslatableJsonException


Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

        JsonValue jsonImageId = jsonObject.get("dynamicImage");
        if (jsonImageId != null) {
            String id = jsonImageId.toString();
            dynamicImage = Common.getDynamicImage(id);
            if (dynamicImage == null)
                throw new TranslatableJsonException("emport.error.component.unknownDynamicImage", id,
                        Common.getDynamicImageIds());
        }
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        super.jsonRead(reader, jsonObject);

        String text = jsonObject.getString("durationType");
        if (text == null)
            throw new TranslatableJsonException("emport.error.chart.missing", "durationType",
                    Common.TIME_PERIOD_CODES.getCodeList());

        durationType = Common.TIME_PERIOD_CODES.getId(text);
        if (durationType == -1)
            throw new TranslatableJsonException("emport.error.chart.invalid", "durationType", text,
                    Common.TIME_PERIOD_CODES.getCodeList());
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        super.jsonRead(reader, jsonObject);

        String xid = jsonObject.getString("XID");
        if (xid == null)
            throw new TranslatableJsonException("emport.error.eventType.missing.reference", "XID");
        ScheduledEventVO se = new ScheduledEventDao().getScheduledEvent(xid);
        if (se == null)
            throw new TranslatableJsonException("emport.error.eventType.invalid.reference", "XID", xid);
        scheduleId = se.getId();
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    @Override
    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        String username = jsonObject.getString("user");
        if (StringUtils.isBlank(username))
            throw new TranslatableJsonException("emport.error.missingValue", "user");
        User user = new UserDao().getUser(username);
        if (user == null)
            throw new TranslatableJsonException("emport.error.missingUser", username);
        userId = user.getId();

        JsonArray jsonDataPoints = jsonObject.getJsonArray("dataPoints");
        if (jsonDataPoints != null) {
            pointList.clear();
            DataPointDao dataPointDao = new DataPointDao();
            for (JsonValue jv : jsonDataPoints) {
                String xid = jv.toString();
                DataPointVO dpVO = dataPointDao.getDataPoint(xid);
                if (dpVO == null)
                    throw new TranslatableJsonException("emport.error.missingPoint", xid);
                pointList.add(dpVO);
            }
        }

        JsonArray jsonSharers = jsonObject.getJsonArray("sharingUsers");
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    @Override
    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        String text = jsonObject.getString("attributeId");
        if (text == null)
            throw new TranslatableJsonException("emport.error.missing", "attributeId", ATTRIBUTE_CODES.getCodeList());
        attributeId = ATTRIBUTE_CODES.getId(text);
        if (!ATTRIBUTE_CODES.isValidId(attributeId))
            throw new TranslatableJsonException("emport.error.invalid", "attributeId", text,
                    ATTRIBUTE_CODES.getCodeList());
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        String text = jsonObject.getString("dataSourceXid");
        if (text != null) {
            DataSourceVO<?> ds = new DataSourceDao().getDataSource(text);
            if (ds == null)
                throw new TranslatableJsonException("emport.error.maintenanceEvent.invalid", "dataSourceXid", text);
            dataSourceId = ds.getId();
        }

        text = jsonObject.getString("alarmLevel");
        if (text != null) {
            alarmLevel = AlarmLevels.CODES.getId(text);
            if (!AlarmLevels.CODES.isValidId(alarmLevel))
                throw new TranslatableJsonException("emport.error.maintenanceEvent.invalid", "alarmLevel", text,
                        AlarmLevels.CODES.getCodeList());
        }

        text = jsonObject.getString("scheduleType");
        if (text != null) {
            scheduleType = TYPE_CODES.getId(text);
            if (!TYPE_CODES.isValidId(scheduleType))
                throw new TranslatableJsonException("emport.error.maintenanceEvent.invalid", "scheduleType", text,
                        TYPE_CODES.getCodeList());
        }
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

        String xid = jsonObject.getString("sourcePointId");
        if (xid != null) {
            DataPointVO vo = dataPointDao.getDataPoint(xid);
            if (vo == null)
                throw new TranslatableJsonException("emport.error.missingPoint", xid);
            sourcePointId = vo.getId();
        }

        xid = jsonObject.getString("targetPointId");
        if (xid != null) {
            DataPointVO vo = dataPointDao.getDataPoint(xid);
            if (vo == null)
                throw new TranslatableJsonException("emport.error.missingPoint", xid);
            targetPointId = vo.getId();
        }

        String text = jsonObject.getString("event");
        if (text != null) {
            event = EVENT_CODES.getId(text);
            if (!EVENT_CODES.isValidId(event))
                throw new TranslatableJsonException("emport.error.link.invalid", "event", text,
                        EVENT_CODES.getCodeList());
        }
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    @Override
    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        String text = jsonObject.getString("attributeId");
        if (text == null)
            throw new TranslatableJsonException("emport.error.missing", "attributeId", ATTRIBUTE_CODES.getCodeList());
        attributeId = ATTRIBUTE_CODES.getId(text);
        if (!ATTRIBUTE_CODES.isValidId(attributeId))
            throw new TranslatableJsonException("emport.error.invalid", "attributeId", text,
                    ATTRIBUTE_CODES.getCodeList());
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

    public void jsonRead(JsonReader reader, com.serotonin.json.type.JsonObject jsonObject) throws JsonException {
        super.jsonRead(reader, jsonObject);

        String xid = jsonObject.getString("XID");
        if (xid == null)
            throw new TranslatableJsonException("emport.error.eventType.missing.reference", "XID");
        MaintenanceEventVO me = new MaintenanceEventDao().getMaintenanceEvent(xid);
        if (me == null)
            throw new TranslatableJsonException("emport.error.eventType.invalid.reference", "XID", xid);
        maintenanceId = me.getId();
    }
View Full Code Here

Examples of com.serotonin.m2m2.i18n.TranslatableJsonException

            for (JsonValue jv : jsonStateList) {
                JsonObject jsonMapping = jv.toJsonObject();
                Integer state = jsonMapping.getInt("state");
                if (state == null)
                    throw new TranslatableJsonException("emport.error.missingValue", "state");

                Integer index = jsonMapping.getInt("imageIndex");
                if (index == null)
                    throw new TranslatableJsonException("emport.error.missingValue", "index");

                stateImageMap.put(state, index);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.