Package com.serotonin.m2m2.vo

Examples of com.serotonin.m2m2.vo.DataPointVO


        report.setName(new TranslatableMessage("common.copyPrefix", name).translate(getTranslations()));
        report.setXid(Common.generateXid("REP_"));
        DataPointDao dataPointDao = new DataPointDao();
        for (int id : dataPointIds) {
            DataPointVO dp = dataPointDao.getDataPoint(id);
            if (dp == null || !Permissions.hasDataPointReadPermission(user, dp))
                continue;

            ReportPointVO rp = new ReportPointVO();
            rp.setPointId(dp.getId());
            rp.setPointKey("p" + dp.getId());
            rp.setColour(dp.getChartColour());
            rp.setConsolidatedChart(true);
            rp.setPlotType(dp.getPlotType());
            report.getPoints().add(rp);
        }

        return report;
    }
View Full Code Here


        return view;
    }

    protected DataPointVO getDataPointVO(JspView view, String xid) throws JspException {
        // Find the point.
        DataPointVO dataPointVO = new DataPointDao().getDataPoint(xid);
        if (dataPointVO == null)
            throw new JspException("Point with XID '" + xid + "' not found");

        // Check that the authorizing user has access to the point.
        Permissions.ensureDataPointReadPermission(view.getAuthorityUser(), dataPointVO);
View Full Code Here

        for (int i = 1; i < nextLine.length; i++) {
            if (StringUtils.isBlank(nextLine[i]))
                throw new TranslatableException(new TranslatableMessage("dataImport.import.badXid", i));

            DataPointVO vo = dataPointDao.getDataPoint(nextLine[i]);
            if (vo == null)
                throw new TranslatableException(new TranslatableMessage("dataImport.import.xidNotFound", nextLine[i]));

            vos[i - 1] = vo;
        }
View Full Code Here

      pointLocator.getRandomAnalogChange().setMax(100);
      pointLocator.getRandomAnalogChange().setStartValue("1");
      pointLocator.setSettable(true);
     
     
      DataPointVO dp = new DataPointVO();
      dp.setXid(dpDao.generateUniqueXid());
      dp.setName("Virtual Random " + i);
            dp.setDataSourceId(ds.getId());
            dp.setDataSourceTypeName(ds.getDefinition().getDataSourceTypeName());
            dp.setDeviceName(ds.getName());
            dp.setEventDetectors(new ArrayList<PointEventDetectorVO>(0));
            dp.defaultTextRenderer();
            //Setup the Chart Renderer
            ImageChartRenderer chartRenderer = new ImageChartRenderer(TimePeriods.DAYS,5);
            dp.setChartRenderer(chartRenderer);
     
            dp.setPointLocator(pointLocator);
      dp.setEnabled(true);
      dp.setSettable(true);
      dp.setDefaultCacheSize(0);     
     
      dp.validate(response);
      if(!response.getHasMessages())
        Common.runtimeManager.saveDataPoint(dp);
      else
        throw new RuntimeException("Invalid data!");
     
View Full Code Here

        if(!t.isFile())
          response.addContextualMessage("template", "reports.validate.template");
       
        DataPointDao dataPointDao = new DataPointDao();
        for (ReportPointVO point : points) {
          DataPointVO vo  = dataPointDao.getDataPoint(point.getPointId());
          String pointXid = "unknown";
          if(vo != null){
            pointXid = vo.getXid();
              try{
                Permissions.ensureDataPointReadPermission(user, dataPointDao.getDataPoint(point.getPointId()));
              }catch(PermissionException e){
               
                response.addContextualMessage("points", "reports.vaildate.pointDNE");
View Full Code Here

        // Create a list of DataPointVOs to which the user has permission.
        DataPointDao dataPointDao = new DataPointDao();
        List<ReportDao.PointInfo> points = new ArrayList<ReportDao.PointInfo>(reportConfig.getPoints().size());
        for (ReportPointVO reportPoint : reportConfig.getPoints()) {
            DataPointVO point = dataPointDao.getDataPoint(reportPoint.getPointId());
            if (point != null && Permissions.hasDataPointReadPermission(user, point)) {
                String colour = null;
                try {
                    if (!StringUtils.isBlank(reportPoint.getColour()))
                        colour = ColorUtils.toHexString(reportPoint.getColour()).substring(1);
View Full Code Here

        AuditEventType.maybeAddPropertyChangeMessage(list, "dsEdit.virtual.attractionPoint",
                from.getAttractionPointName(), getAttractionPointName());
    }

    private String getAttractionPointName() {
        DataPointVO dp = new DataPointDao().getDataPoint(attractionPointId);
        if (dp == null)
            return "";
        return dp.getName();
    }
View Full Code Here

    }

    @Override
    public void jsonWrite(ObjectWriter writer) throws IOException, JsonException {
        super.jsonWrite(writer);
        DataPointVO dp = new DataPointDao().getDataPoint(attractionPointId);
        if (dp == null)
            writer.writeEntry("attractionPointId", null);
        else
            writer.writeEntry("attractionPointId", dp.getXid());
    }
View Full Code Here

    @Override
    public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
        super.jsonRead(reader, jsonObject);
        String text = jsonObject.getString("attractionPointId");
        if (text != null) {
            DataPointVO dp = new DataPointDao().getDataPoint(text);
            if (dp == null)
                throw new TranslatableJsonException("virtual.error.attractor.missingPoint", "attractionPointId", text);
            attractionPointId = dp.getId();
        }
    }
View Full Code Here

   
    String text = jsonObject.getString("pointXid");
    if(text == null){
      throw new TranslatableJsonException("reports.emport.point.missingAttr", "pointXid");
    }else{
      DataPointVO vo = DataPointDao.instance.getByXid(text);
      if(vo == null){
        throw new TranslatableJsonException("reports.emport.pointDNE", text);
      }
      this.pointId = vo.getId();
    }
   
  }
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.vo.DataPointVO

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.