001    /**
002     * Copyright 2010-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.common.jdbc.model.event;
017    
018    import org.kuali.common.util.Assert;
019    
020    public final class SqlEvent {
021    
022            private static final int DEFAULT_UPDATE_COUNT = -1;
023    
024            private final String sql;
025            private final long startTimeMillis;
026            private final long stopTimeMillis;
027            private final int updateCount;
028    
029            public SqlEvent(String sql, long startTimeMillis) {
030                    this(sql, startTimeMillis, -1);
031            }
032    
033            public SqlEvent(String sql, long startTimeMillis, long stopTimeMillis) {
034                    this(sql, DEFAULT_UPDATE_COUNT, startTimeMillis, stopTimeMillis);
035            }
036    
037            public SqlEvent(String sql, int updateCount, long startTimeMillis, long stopTimeMillis) {
038                    Assert.notNull(sql);
039                    this.sql = sql;
040                    this.updateCount = updateCount;
041                    this.startTimeMillis = startTimeMillis;
042                    this.stopTimeMillis = stopTimeMillis;
043            }
044    
045            public String getSql() {
046                    return sql;
047            }
048    
049            public long getStartTimeMillis() {
050                    return startTimeMillis;
051            }
052    
053            public long getStopTimeMillis() {
054                    return stopTimeMillis;
055            }
056    
057            public int getUpdateCount() {
058                    return updateCount;
059            }
060    
061    }