Examples of LoggableTransactionDatum


Examples of ke.go.moh.oec.oecsm.data.LoggableTransactionDatum

        Statement statement = connection.createStatement();
        ResultSet rs = statement.executeQuery("SELECT `transaction_data`.`ID`, `transaction_data`.`DATA`, `transaction_data`.`COLUMN_ID`, `transaction_data`.`TRANSACTION_ID` FROM `transaction_data` WHERE `transaction_data`.`TRANSACTION_ID` = " + loggableTransaction.getId() + ";");
        while (rs.next()) {
            Cell cell = new Cell(rs.getInt("ID"), rs.getString("DATA"));
            cell.setColumn(findColumn(rs.getInt("COLUMN_ID")));
            LoggableTransactionDatum loggableTransactionDatum = new LoggableTransactionDatum(cell, loggableTransaction);
            loggableTransactionDatumList.add(loggableTransactionDatum);
        }
        return loggableTransactionDatumList;
    }
View Full Code Here

Examples of ke.go.moh.oec.oecsm.data.LoggableTransactionDatum

                }
            } else if (transaction.getClass() == LoggableTransaction.class) {
                LoggableTransaction loggableTransaction = (LoggableTransaction) transaction;
                sql = "INSERT INTO `transaction`(`transaction`.`TYPE`, `transaction`.`TABLE_ID`, `transaction`.`CREATED_DATETIME`) VALUES('" + loggableTransaction.getType() + "', " + loggableTransaction.getTable().getId() + ", NOW());";
            } else if (transaction.getClass() == LoggableTransactionDatum.class) {
                LoggableTransactionDatum loggableTransactionDatum = (LoggableTransactionDatum) transaction;
                sql = "INSERT INTO `transaction_data`(`transaction_data`.`DATA`, `transaction_data`.`COLUMN_ID`, `transaction_data`.`TRANSACTION_ID`) VALUES('" + TransactionConverter.escapeSQL(loggableTransactionDatum.getCell().getData()) + "', " + loggableTransactionDatum.getCell().getColumn().getId() + ", " + loggableTransactionDatum.getLoggableTransaction().getId() + ");";
            }
        }
        return sql;
    }
View Full Code Here

Examples of ke.go.moh.oec.oecsm.data.LoggableTransactionDatum

//                pk = sourceRs.getString("PK");
//            }
            Cell cell = new Cell(sourcePk, sourceRs.getString(column));
            cell.setColumn(column);
            transactionList.add(new DataTransaction(cell, TransactionType.INSERT));
            loggableTransactionDatumList.add(new LoggableTransactionDatum(cell, loggableTransaction));
        }
        loggableTransaction.setLoggableTransactionDatumList(loggableTransactionDatumList);
        transactionList.add(loggableTransaction);
        processTransactions(transactionList);
        sourceRsHasRecords = sourceRs.next();
View Full Code Here

Examples of ke.go.moh.oec.oecsm.data.LoggableTransactionDatum

        List<LoggableTransactionDatum> loggableTransactionDatumList = new ArrayList<LoggableTransactionDatum>();
        for (Column column : table.getColumnList()) {
            Cell cell = shadowRs.getCell(column);
            cell.setColumn(column);
            transactionList.add(new DataTransaction(cell, TransactionType.DELETE));
            loggableTransactionDatumList.add(new LoggableTransactionDatum(cell, loggableTransaction));
        }
        loggableTransaction.setLoggableTransactionDatumList(loggableTransactionDatumList);
        transactionList.add(loggableTransaction);
        processTransactions(transactionList);
        shadowRsHasRecords = shadowRs.next();
View Full Code Here

Examples of ke.go.moh.oec.oecsm.data.LoggableTransactionDatum

            String sourceColumnValue = sourceRs.getString(column);
            if (shadowCell == null) {
                Cell cell = new Cell(shadowRs.getCell("PK").getData(), sourceColumnValue);
                cell.setColumn(column);
                transactionList.add(new DataTransaction(cell, TransactionType.INSERT));
                loggableTransactionDatumList.add(new LoggableTransactionDatum(cell, loggableTransaction));
                continue;
            }
            /*
             * Judge which columns we need to compare
             */
            String shadowColumnValue = shadowRs.getCell(column).getData();
            boolean pkColumn = table.getPk().contains(column.getName() + ",");
            boolean compare = (shadowColumnValue != null && sourceColumnValue != null)//compare only if both values are not null and this column is not (part of) the primary key
                    && !pkColumn;
            boolean ignore = (shadowColumnValue == null && sourceColumnValue == null);//if both values are null, no update has taken place
            boolean update = false;
            if (compare) {
                update = !shadowColumnValue.equals(sourceColumnValue);//if both values are not equal then an update has taken place
            } else {
                if (!pkColumn) {
                    update = !ignore;//if only one value is null then an update has taken place
                }
            }
            if (update) {
                Cell cell = shadowRs.getCell(column);
                cell.setData(sourceColumnValue);
                cell.setColumn(column);
                transactionList.add(new DataTransaction(cell, TransactionType.UPDATE));
                loggableTransactionDatumList.add(new LoggableTransactionDatum(cell, loggableTransaction));
            }
        }
        if (!loggableTransactionDatumList.isEmpty()) {
            // String pk = null;
            Cell cell = shadowRs.getCell("PK");
//            cell.setData(sourceRs.getString("PK"));
            cell.setData(sourcePk);

            //TODO: Accommodate cases where the pk is not the first column of the table
            cell.setColumn(table.getColumnList().get(0));
            loggableTransactionDatumList.add(new LoggableTransactionDatum(cell, loggableTransaction));

            loggableTransaction.setLoggableTransactionDatumList(loggableTransactionDatumList);
            transactionList.add(loggableTransaction);
        }
        processTransactions(transactionList);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.