Package com.serotonin.json.type

Examples of com.serotonin.json.type.JsonObject


      throws JsonException {
    Integer value = readDataType(jsonObject, DataTypes.IMAGE);
    if (value != null)
      dataTypeId = value;

    JsonObject ctjson = jsonObject.getJsonObject("changeType");
    if (ctjson == null)
      throw new TranslatableJsonException("emport.error.missingObject",
          "changeType");

    String text = ctjson.getString("type");
    if (text == null)
      throw new TranslatableJsonException("emport.error.missing", "type",
          ChangeTypeVO.CHANGE_TYPE_CODES.getCodeList());

    changeTypeId = ChangeTypeVO.CHANGE_TYPE_CODES.getId(text);
View Full Code Here


    }

    public static class Resolver implements TypeResolver {
        @Override
        public Type resolve(JsonValue jsonValue) throws JsonException {
            JsonObject json = jsonValue.toJsonObject();

            String type = json.getString("type");
            if (type == null)
                throw new TranslatableJsonException("emport.error.component.missing", "type", getExportTypes());

            ImplDefinition def = ImplDefinition.findByExportName(getImplementations(), type);
View Full Code Here

        return graphicalViewDao.getViews();
    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        JsonObject viewJson = jsonValue.toJsonObject();

        String xid = viewJson.getString("xid");
        if (StringUtils.isBlank(xid))
            xid = graphicalViewDao.generateUniqueXid();

        ensureDao();
        GraphicalView view = graphicalViewDao.getViewByXid(xid);
View Full Code Here

        return scheduledEventDao.getScheduledEvents();
    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        JsonObject scheduledEvent = jsonValue.toJsonObject();

        String xid = scheduledEvent.getString("xid");
        if (StringUtils.isBlank(xid))
            xid = scheduledEventDao.generateUniqueXid();

        ScheduledEventVO vo = scheduledEventDao.getScheduledEvent(xid);
        if (vo == null) {
View Full Code Here

        return wls;
    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        JsonObject watchListJson = jsonValue.toJsonObject();

        String xid = watchListJson.getString("xid");
        if (StringUtils.isBlank(xid))
            xid = watchListDao.generateUniqueXid();

        WatchList watchList = watchListDao.getWatchList(xid);
        if (watchList == null) {
View Full Code Here

        return wls;
    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        JsonObject reportJson = jsonValue.toJsonObject();

        String xid = reportJson.getString("xid");
        if (StringUtils.isBlank(xid))
            xid = reportDao.generateUniqueXid();

        ReportVO report = reportDao.getReport(xid);
        if (report == null) {
View Full Code Here

        return new PointLinkDao().getPointLinks();
    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        JsonObject pointLink = jsonValue.toJsonObject();
        PointLinkDao pointLinkDao = new PointLinkDao();

        String xid = pointLink.getString("xid");
        if (StringUtils.isBlank(xid))
            pointLinkDao.generateUniqueXid();

        PointLinkVO vo = pointLinkDao.getPointLink(xid);
        if (vo == null) {
View Full Code Here

    }

    @Override
    public void doImport(JsonValue jsonValue, ImportContext importContext) throws JsonException {
        MaintenanceEventDao maintenanceEventDao = new MaintenanceEventDao();
        JsonObject maintenanceEvent = jsonValue.toJsonObject();

        String xid = maintenanceEvent.getString("xid");
        if (StringUtils.isBlank(xid))
            xid = maintenanceEventDao.generateUniqueXid();

        MaintenanceEventVO vo = maintenanceEventDao.getMaintenanceEvent(xid);
        if (vo == null) {
View Full Code Here

        JsonArray jsonStateList = jsonObject.getJsonArray("stateImageMappings");
        if (jsonStateList != null) {
            stateImageMap.clear();

            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

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

        JsonObject jsonChildren = jsonObject.getJsonObject("children");
        if (jsonChildren != null) {
            for (Map.Entry<String, JsonValue> jsonChild : jsonChildren.entrySet()) {
                CompoundChild child = getChild(jsonChild.getKey());
                if (child == null || !child.getViewComponent().isPointComponent())
                    throw new TranslatableJsonException("emport.error.compound.invalidChildId", jsonChild.getKey(),
                            definition().getId(), getPointComponentChildIds());
                jsonReadDataPoint(jsonChild.getValue(), (PointComponent) child.getViewComponent());
View Full Code Here

TOP

Related Classes of com.serotonin.json.type.JsonObject

Copyright © 2018 www.massapicom. 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.