View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.jdbc.model.event;
17  
18  import org.kuali.common.util.Assert;
19  
20  public final class SqlEvent {
21  
22  	private static final int DEFAULT_UPDATE_COUNT = -1;
23  
24  	private final String sql;
25  	private final long startTimeMillis;
26  	private final long stopTimeMillis;
27  	private final int updateCount;
28  
29  	public SqlEvent(String sql, long startTimeMillis) {
30  		this(sql, startTimeMillis, -1);
31  	}
32  
33  	public SqlEvent(String sql, long startTimeMillis, long stopTimeMillis) {
34  		this(sql, DEFAULT_UPDATE_COUNT, startTimeMillis, stopTimeMillis);
35  	}
36  
37  	public SqlEvent(String sql, int updateCount, long startTimeMillis, long stopTimeMillis) {
38  		Assert.notNull(sql);
39  		this.sql = sql;
40  		this.updateCount = updateCount;
41  		this.startTimeMillis = startTimeMillis;
42  		this.stopTimeMillis = stopTimeMillis;
43  	}
44  
45  	public String getSql() {
46  		return sql;
47  	}
48  
49  	public long getStartTimeMillis() {
50  		return startTimeMillis;
51  	}
52  
53  	public long getStopTimeMillis() {
54  		return stopTimeMillis;
55  	}
56  
57  	public int getUpdateCount() {
58  		return updateCount;
59  	}
60  
61  }