Package com.serotonin.m2m2.rt.script

Examples of com.serotonin.m2m2.rt.script.ScriptExecutor


                }
                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

            long time = dtf.parseDateTime(nextLine[0]).getMillis();

            // The rest of the values are point samples.
            for (int i = 1; i < nextLine.length; i++) {
                DataValue value = DataValue.stringToValue(nextLine[i], vos[i - 1].getPointLocator().getDataTypeId());
                PointValueTime pvt = new PointValueTime(value, time);

                if (rts[i - 1] != null)
                    rts[i - 1].savePointValueDirectToCache(pvt, null, true, true);
                else
                    // Save directly to the database
View Full Code Here

      } catch (NumberFormatException e) {
        startObject = new NumericValue(0);
      }
    } else {
      if (startValue == null)
        startObject = new AlphanumericValue("");
      else
        startObject = new AlphanumericValue(startValue);
    }
    return new VirtualPointLocatorRT(changeType, startObject, isSettable());
  }
View Full Code Here

import com.serotonin.m2m2.rt.dataImage.types.DataValue;

public class AlternateBooleanChangeRT extends ChangeTypeRT {
    @Override
    public DataValue change(DataValue currentValue) {
        return new BinaryValue(!currentValue.getBooleanValue());
    }
View Full Code Here

import com.serotonin.m2m2.rt.dataImage.types.DataValue;

public class RandomBooleanChangeRT extends ChangeTypeRT {
    @Override
    public DataValue change(DataValue currentValue) {
        return new BinaryValue(RANDOM.nextBoolean());
    }
View Full Code Here

  @Override
  public PointLocatorRT createRuntime() {
    ChangeTypeRT changeType = getChangeType().createRuntime();
    String startValue = getChangeType().getStartValue();
    DataValue startObject;
    if (dataTypeId == DataTypes.BINARY)
      startObject = BinaryValue.parseBinary(startValue);
    else if (dataTypeId == DataTypes.MULTISTATE) {
      try {
        startObject = MultistateValue.parseMultistate(startValue);
View Full Code Here

            // The first value is always a date.
            long time = dtf.parseDateTime(nextLine[0]).getMillis();

            // The rest of the values are point samples.
            for (int i = 1; i < nextLine.length; i++) {
                DataValue value = DataValue.stringToValue(nextLine[i], vos[i - 1].getPointLocator().getDataTypeId());
                PointValueTime pvt = new PointValueTime(value, time);

                if (rts[i - 1] != null)
                    rts[i - 1].savePointValueDirectToCache(pvt, null, true, true);
                else
View Full Code Here

      startObject = BinaryValue.parseBinary(startValue);
    else if (dataTypeId == DataTypes.MULTISTATE) {
      try {
        startObject = MultistateValue.parseMultistate(startValue);
      } catch (NumberFormatException e) {
        startObject = new MultistateValue(0);
      }
    } else if (dataTypeId == DataTypes.NUMERIC) {
      try {
        startObject = NumericValue.parseNumeric(startValue);
      } catch (NumberFormatException e) {
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.rt.script.ScriptExecutor

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.