Package com.serotonin.db.spring

Examples of com.serotonin.db.spring.ExtendedJdbcTemplate


        AuditEventType.raiseChangedEvent(AuditEvent.TYPE_NAME, old, se);
    }

    public void deleteScheduledEvent(final int scheduledEventId) {
        ScheduledEventVO se = getScheduledEvent(scheduledEventId);
        final ExtendedJdbcTemplate ejt2 = ejt;
        if (se != null) {
            getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
                @Override
                protected void doInTransactionWithoutResult(TransactionStatus status) {
                    ejt2.update("delete from eventHandlers where eventTypeName=? and eventTypeRef1=?", new Object[] {
                            ScheduledEventType.TYPE_NAME, scheduledEventId });
                    ejt2.update("delete from scheduledEvents where id=?", new Object[] { scheduledEventId });
                }
            });

            AuditEventType.raiseDeletedEvent(AuditEvent.TYPE_NAME, se);
        }
View Full Code Here


                new Object[] { watchList.getXid(), userId, watchList.getName() }));
        return watchList;
    }

    public void saveWatchList(final WatchList watchList) {
        final ExtendedJdbcTemplate ejt2 = ejt;
        getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
            @SuppressWarnings("synthetic-access")
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                if (watchList.getId() == Common.NEW_ID)
                    watchList.setId(doInsert("insert into watchLists (xid, name, userId) values (?,?,?)", new Object[] {
                            watchList.getXid(), watchList.getName(), watchList.getUserId() }));
                else
                    ejt2.update("update watchLists set xid=?, name=? where id=?", new Object[] { watchList.getXid(),
                            watchList.getName(), watchList.getId() });
                ejt2.update("delete from watchListPoints where watchListId=?", new Object[] { watchList.getId() });
                ejt2.batchUpdate("insert into watchListPoints values (?,?,?)", new BatchPreparedStatementSetter() {
                    @Override
                    public int getBatchSize() {
                        return watchList.getPointList().size();
                    }
View Full Code Here

            }
        });
    }

    public void deleteWatchList(final int watchListId) {
        final ExtendedJdbcTemplate ejt2 = ejt;
        getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                ejt2.update("delete from watchListPoints where watchListId=?", new Object[] { watchListId });
                ejt2.update("delete from watchListUsers where watchListId=?", new Object[] { watchListId });
                ejt2.update("delete from selectedWatchList where watchListId=?", new Object[] { watchListId });
                ejt2.update("delete from watchLists where id=?", new Object[] { watchListId });
            }
        });
    }
View Full Code Here

            model.put("updateResult", -1);

            if (WebUtils.hasSubmitParameter(request, "query"))
                query(sqlString, serializedDataMsg, model);
            else if (WebUtils.hasSubmitParameter(request, "update")) {
                ExtendedJdbcTemplate ejt = new ExtendedJdbcTemplate();
                ejt.setDataSource(Common.databaseProxy.getDataSource());
                int result = ejt.update(sqlString);
                model.put("updateResult", result);
            }
            else if (WebUtils.hasSubmitParameter(request, "tables"))
                query(Common.databaseProxy.getTableListQuery(), serializedDataMsg, model);
        }
View Full Code Here

            deleteMaintenanceEvent(id);
    }

    public void deleteMaintenanceEvent(final int maintenanceEventId) {
        MaintenanceEventVO me = getMaintenanceEvent(maintenanceEventId);
        final ExtendedJdbcTemplate ejt2 = ejt;
        if (me != null) {
            getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
                @Override
                protected void doInTransactionWithoutResult(TransactionStatus status) {
                    ejt2.update("delete from eventHandlers where eventTypeName=? and eventTypeRef1=?", new Object[] {
                            MaintenanceEventType.TYPE_NAME, maintenanceEventId });
                    ejt2.update("delete from maintenanceEvents where id=?", new Object[] { maintenanceEventId });
                }
            });

            AuditEventType.raiseDeletedEvent(AuditEvent.TYPE_NAME, me);
        }
View Full Code Here

TOP

Related Classes of com.serotonin.db.spring.ExtendedJdbcTemplate

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.