Package com.serotonin.m2m2.rt.dataImage

Examples of com.serotonin.m2m2.rt.dataImage.DataPointRT


     * Convenience method for creating a populated view state.
     */
    private WatchListState createWatchListState(HttpServletRequest request, DataPointVO pointVO, RuntimeManager rtm,
            Map<String, Object> model, User user) {
        // Get the data point status from the data image.
        DataPointRT point = rtm.getDataPoint(pointVO.getId());

        WatchListState state = new WatchListState();
        state.setId(Integer.toString(pointVO.getId()));

        PointValueTime pointValue = prepareBasePointState(Integer.toString(pointVO.getId()), state, pointVO, point,
View Full Code Here


            HttpServletRequest request, GraphicalView view, User user, List<ViewComponentState> states, boolean edit,
            boolean add) {
        if (viewComponent.isPointComponent() && (edit || viewComponent.isVisible())) {
            PointComponent pointComponent = (PointComponent) viewComponent;

            DataPointRT dataPointRT = null;
            if (pointComponent.tgetDataPoint() != null)
                dataPointRT = rtm.getDataPoint(pointComponent.tgetDataPoint().getId());

            ViewComponentState state = preparePointComponentState(pointComponent, user, dataPointRT, model, request);
View Full Code Here

    @Override
    protected void createStateImpl(RuntimeManager rtm, HttpServletRequest request, JspComponentState state) {
        long maxTs = 0;
        for (JspViewChartPoint point : points) {
            DataPointRT dataPointRT = rtm.getDataPoint(point.getDataPointVO().getId());
            if (dataPointRT != null) {
                PointValueTime pvt = dataPointRT.getPointValue();
                if (pvt != null && maxTs < pvt.getTime())
                    maxTs = pvt.getTime();
            }
        }
View Full Code Here

    public ProcessResult validateScript(String script, int sourcePointId, int targetPointId) {
        ProcessResult response = new ProcessResult();
        TranslatableMessage message;
        ScriptExecutor scriptExecutor = new ScriptExecutor();

        DataPointRT point = Common.runtimeManager.getDataPoint(sourcePointId);
        if (point == null)
            message = new TranslatableMessage("event.pointLink.sourceUnavailable");
        else {
            Map<String, IDataPointValueSource> context = new HashMap<String, IDataPointValueSource>();
            context.put(PointLinkRT.CONTEXT_VAR_NAME, point);
View Full Code Here

    public int getId() {
        return vo.getId();
    }

    private void checkSource() {
        DataPointRT source = Common.runtimeManager.getDataPoint(vo.getSourcePointId());
        if (source == null)
            // The source has been terminated, was never enabled, or not longer exists.
            raiseFailureEvent(new TranslatableMessage("event.pointLink.sourceUnavailable"));
        else
            // Everything is good
View Full Code Here

        return;
      else
        ready = false; //Stop anyone else from using this
      }
        // Propagate the update to the target point. Validate that the target point is available.
        DataPointRT targetPoint = Common.runtimeManager.getDataPoint(vo.getTargetPointId());
        if (targetPoint == null) {
            raiseFailureEvent(newValue.getTime(), new TranslatableMessage("event.pointLink.targetUnavailable"));
            return;
        }

        if (!targetPoint.getPointLocator().isSettable()) {
            raiseFailureEvent(newValue.getTime(), new TranslatableMessage("event.pointLink.targetNotSettable"));
            return;
        }

        int targetDataType = targetPoint.getVO().getPointLocator().getDataTypeId();

        if (!StringUtils.isBlank(vo.getScript())) {
            ScriptExecutor scriptExecutor = new ScriptExecutor();
            Map<String, IDataPointValueSource> context = new HashMap<String, IDataPointValueSource>();
            DataPointRT source = Common.runtimeManager.getDataPoint(vo.getSourcePointId());
            context.put(CONTEXT_VAR_NAME, source);

            try {
                PointValueTime pvt = scriptExecutor.execute(vo.getScript(), context, newValue.getTime(),
                        targetDataType, newValue.getTime());
View Full Code Here

        MobileWatchListState state = new MobileWatchListState();
        state.setId(Integer.toString(pointVO.getId()));
        state.setName(pointVO.getExtendedName());

        // Get the data point status from the data image.
        DataPointRT pointRT = Common.runtimeManager.getDataPoint(pointVO.getId());
        if (pointRT == null)
            state.setDisabled(true);
        else {
            PointValueTime pvt = pointRT.getPointValue();
            state.setTime(Functions.getTime(pvt));

            if (pvt != null && pvt.getValue() instanceof ImageValue) {
                // Text renderers don't help here. Create a thumbnail.
                Map<String, Object> model = new HashMap<String, Object>();
View Full Code Here

                }
                else {
                    try {
                        String data = parts[position];
                        Double value = new Double(data);
                        dp.updatePointValue(new PointValueTime(value, time));
                    }
                    catch (NumberFormatException e) {
                        log.error("Weird. We couldn't parse the value " + parts[position]
                                + " into a double. attribute=" + locator.getAttributeId());
                    }
View Full Code Here

        String value;
        DataPointRT dataPointRT = rtm.getDataPoint(dataPointVO.getId());
        if (dataPointRT == null)
            value = disabledValue;
        else {
            PointValueTime pvt = dataPointRT.getPointValue();

            if (pvt != null && pvt.getValue() instanceof ImageValue) {
                // Text renderers don't help here. Create a thumbnail.
                Map<String, Object> model = new HashMap<String, Object>();
                model.put("point", dataPointVO);
                model.put("pointValue", pvt);
                value = BaseDwr.generateContent(request, "imageValueThumbnail.jsp", model);
            }
            else {
                int hint = raw ? TextRenderer.HINT_RAW : TextRenderer.HINT_FULL;
                value = dataPointVO.getTextRenderer().getText(pvt, hint);
                if (pvt != null && time)
                    state.setTime(pvt.getTime());
            }
        }
        state.setValue(value);
    }
View Full Code Here

        private boolean send(List<PublishQueueEntry<SquwkPointVO>> entries) {
            List<SampleAppendRequest> reqs = new ArrayList<SampleAppendRequest>();

            for (PublishQueueEntry<SquwkPointVO> entry : entries) {
                SquwkPointVO vo = entry.getVo();
                PointValueTime pvt = entry.getPvt();
                SampleAppendRequest req = new SampleAppendRequest(vo.getGuid(), pvt.getTime(), coerceDataValue(
                        pvt.getValue(), vo.getDataType()));
                reqs.add(req);
            }

            // Send the request. Set message non-null if there is a failure.
            ResultHandler resultHandler = new ResultHandler();
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.rt.dataImage.DataPointRT

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.