Package com.serotonin.m2m2.view

Examples of com.serotonin.m2m2.view.ImplDefinition


            }
        }
    }

    private void readParts(String[] parts) {
        TranslatableMessage error = null;
        long time = System.currentTimeMillis();

        synchronized (pointListChangeLock) {
            for (DataPointRT dp : dataPoints) {
                VMStatPointLocatorVO locator = ((VMStatPointLocatorRT) dp.getPointLocator()).getPointLocatorVO();

                Integer position = attributePositions.get(locator.getAttributeId());
                if (position == null) {
                    if (error != null)
                        error = new TranslatableMessage("event.vmstat.attributeNotFound",
                                locator.getConfigurationDescription());
                }
                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());
                    }
                    catch (ArrayIndexOutOfBoundsException e) {
                        log.error("Weird. We need element " + position + " but the vmstat data is only " + parts.length
                                + " elements long. The statistic " + Common.translate(VMStatPointLocatorVO.ATTRIBUTE_CODES.getKey(locator.getAttributeId())) + " is missing from the vmstat output.");
                        raiseEvent(DATA_SOURCE_EXCEPTION_EVENT, System.currentTimeMillis(), true, new TranslatableMessage(
                                "event.vmstat.process", "The statistic " + Common.translate(VMStatPointLocatorVO.ATTRIBUTE_CODES.getKey(locator.getAttributeId())) + " is missing from the vmstat output."));
                    }
                }
            }
        }
View Full Code Here


    @DwrPermission(user = true)
    public ReportVO createReportFromWatchlist(String name, int[] dataPointIds) {
        ReportVO report = new ReportVO();
        User user = Common.getUser();

        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))
View Full Code Here

    @JsonProperty
    private int pointIdentifierIndex;
   
  @Override
  public TranslatableMessage getConnectionDescription() {
    return new TranslatableMessage("serial.connection",this.commPortId);
  }
View Full Code Here

    return EVENT_CODES;
  }

  @Override
  protected void addEventTypes(List<EventTypeVO> eventTypes) {
    eventTypes.add(createEventType(SerialDataSourceRT.DATA_SOURCE_EXCEPTION_EVENT, new TranslatableMessage(
                "event.ds.dataSource")));
    eventTypes.add(createEventType(SerialDataSourceRT.POINT_READ_EXCEPTION_EVENT, new TranslatableMessage(
                "event.ds.pointRead")));
    eventTypes.add(createEventType(SerialDataSourceRT.POINT_WRITE_EXCEPTION_EVENT, new TranslatableMessage(
                "event.ds.pointWrite")));
    eventTypes.add(createEventType(SerialDataSourceRT.POINT_READ_PATTERN_MISMATCH_EVENT, new TranslatableMessage(
                "event.serial.patternMismatch")));
   
  }
View Full Code Here

  }

  @Override
  public TranslatableMessage getConfigurationDescription() {
    //TODO add the properties to this
    return new TranslatableMessage("serial.point.configuration",pointIdentifier);
  }
View Full Code Here

        Common.eventManager.returnToNormal(eventType, time);
        eventActive = false;
    }

    public TranslatableMessage getMessage() {
        return new TranslatableMessage("event.schedule.active", vo.getDescription());
    }
View Full Code Here

    public ScheduledEventRT createRuntime() {
        return new ScheduledEventRT(this);
    }

    public TranslatableMessage getDescription() {
        TranslatableMessage message;

        if (!StringUtils.isBlank(alias))
            message = new TranslatableMessage("common.default", alias);
        else if (scheduleType == TYPE_ONCE) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.onceUntil", Functions.getTime(new DateTime(
                        activeYear, activeMonth, activeDay, activeHour, activeMinute, activeSecond, 0).getMillis()),
                        Functions.getTime(new DateTime(inactiveYear, inactiveMonth, inactiveDay, inactiveHour,
                                inactiveMinute, inactiveSecond, 0).getMillis()));
            else
                message = new TranslatableMessage("event.schedule.onceAt", Functions.getTime(new DateTime(activeYear,
                        activeMonth, activeDay, activeHour, activeMinute, activeSecond, 0).getMillis()));
        }
        else if (scheduleType == TYPE_HOURLY) {
            String activeTime = StringUtils.leftPad(Integer.toString(activeMinute), 2, '0') + ":"
                    + StringUtils.leftPad(Integer.toString(activeSecond), 2, '0');
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.hoursUntil", activeTime, StringUtils.leftPad(
                        Integer.toString(inactiveMinute), 2, '0')
                        + ":" + StringUtils.leftPad(Integer.toString(inactiveSecond), 2, '0'));
            else
                message = new TranslatableMessage("event.schedule.hoursAt", activeTime);
        }
        else if (scheduleType == TYPE_DAILY) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.dailyUntil", activeTime(), inactiveTime());
            else
                message = new TranslatableMessage("event.schedule.dailyAt", activeTime());
        }
        else if (scheduleType == TYPE_WEEKLY) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.weeklyUntil", weekday(true), activeTime(),
                        weekday(false), inactiveTime());
            else
                message = new TranslatableMessage("event.schedule.weeklyAt", weekday(true), activeTime());
        }
        else if (scheduleType == TYPE_MONTHLY) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.monthlyUntil", monthday(true), activeTime(),
                        monthday(false), inactiveTime());
            else
                message = new TranslatableMessage("event.schedule.monthlyAt", monthday(true), activeTime());
        }
        else if (scheduleType == TYPE_YEARLY) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.yearlyUntil", monthday(true), month(true),
                        activeTime(), monthday(false), month(false), inactiveTime());
            else
                message = new TranslatableMessage("event.schedule.yearlyAt", monthday(true), month(true), activeTime());
        }
        else if (scheduleType == TYPE_CRON) {
            if (returnToNormal)
                message = new TranslatableMessage("event.schedule.cronUntil", activeCron, inactiveCron);
            else
                message = new TranslatableMessage("event.schedule.cronAt", activeCron);
        }
        else
            throw new ShouldNeverHappenException("Unknown schedule type: " + scheduleType);

        return message;
View Full Code Here

    }

    private TranslatableMessage getTypeMessage() {
        switch (scheduleType) {
        case TYPE_HOURLY:
            return new TranslatableMessage("scheduledEvents.type.hour");
        case TYPE_DAILY:
            return new TranslatableMessage("scheduledEvents.type.day");
        case TYPE_WEEKLY:
            return new TranslatableMessage("scheduledEvents.type.week");
        case TYPE_MONTHLY:
            return new TranslatableMessage("scheduledEvents.type.month");
        case TYPE_YEARLY:
            return new TranslatableMessage("scheduledEvents.type.year");
        case TYPE_ONCE:
            return new TranslatableMessage("scheduledEvents.type.once");
        case TYPE_CRON:
            return new TranslatableMessage("scheduledEvents.type.cron");
        }
        return null;
    }
View Full Code Here

    private TranslatableMessage weekday(boolean active) {
        int day = activeDay;
        if (!active)
            day = inactiveDay;
        return new TranslatableMessage(weekdays[day]);
    }
View Full Code Here

        if (!active)
            day = inactiveDay;

        if (day == -3)
            return new TranslatableMessage("common.day.thirdLast");
        if (day == -2)
            return new TranslatableMessage("common.day.secondLastLast");
        if (day == -1)
            return new TranslatableMessage("common.day.last");
        if (day != 11 && day % 10 == 1)
            return new TranslatableMessage("common.counting.st", Integer.toString(day));
        if (day != 12 && day % 10 == 2)
            return new TranslatableMessage("common.counting.nd", Integer.toString(day));
        if (day != 13 && day % 10 == 3)
            return new TranslatableMessage("common.counting.rd", Integer.toString(day));
        return new TranslatableMessage("common.counting.th", Integer.toString(day));
    }
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.view.ImplDefinition

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.