Package it.freedomotic.model.charting

Examples of it.freedomotic.model.charting.UsageData


            return 6;
        }

        @Override
        public Object getValueAt(int rowIndex, int columnIndex) {
            UsageData item = points.getData().get(rowIndex);
            switch (columnIndex) {
                case 0:
                    return item.getDateTime();
                case 1:
                    return item.getObjName();
                case 2:
                    return item.getObjProtocol();
                case 3:
                    return item.getObjAddress();
                case 4:
                    return item.getObjBehavior();
                case 5:
                    return item.getObjValue();
            }
            return null;
        }
View Full Code Here


    protected void onShowGui() {
    }

    private void saveData(Command c) {
        try {
            UsageData item = new UsageData();

            Timestamp ts = new java.sql.Timestamp(
                    Integer.parseInt(c.getProperty("event.date.year")) - 1900,
                    Integer.parseInt(c.getProperty("event.date.month")) - 1,
                    Integer.parseInt(c.getProperty("event.date.day")),
                    Integer.parseInt(c.getProperty("event.time.hour")),
                    Integer.parseInt(c.getProperty("event.time.minute")),
                    Integer.parseInt(c.getProperty("event.time.second")),
                    0);

            item.setDateTime(ts);
            item.setObjName(c.getProperty("event.object.name"));
            item.setObjProtocol(c.getProperty("event.object.protocol"));
            item.setObjAddress(c.getProperty("event.object.address"));
            item.setUuid(c.getProperty("event.object.uuid"));

            //search for all objects behaviors changes   
            Pattern pat = Pattern.compile("^current\\.object\\.behavior\\.(.*)");
            for (Entry<Object, Object> entry : c.getProperties().entrySet()) {
                String key = (String) entry.getKey();
                Matcher fits = pat.matcher(key);
                if (fits.find() && !fits.group(1).equals("data")) { //exclude unwanted behaviors
                    UsageData item2 = item.clone();
                    item2.setObjBehavior(fits.group(1));
                    item2.setObjValue((String) entry.getValue());

                    if (isRunning() && em != null) {
                        if (!em.getTransaction().isActive()) {
                            em.getTransaction().begin();
                        }
View Full Code Here

TOP

Related Classes of it.freedomotic.model.charting.UsageData

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.