Coverage Report - net.admin4j.vo.SqlStatementPerformanceSummaryVO
 
Classes in this File Line Coverage Branch Coverage Complexity
SqlStatementPerformanceSummaryVO
100%
29/29
80%
8/10
1.625
 
 1  
 /*
 2  
  * This software is licensed under the Apache License, Version 2.0
 3  
  * (the "License") agreement; you may not use this file except in compliance with
 4  
  * the License.  You may obtain a copy of the License at
 5  
  * 
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  * 
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package net.admin4j.vo;
 15  
 
 16  
 import java.util.StringTokenizer;
 17  
 
 18  
 import net.admin4j.deps.commons.lang3.Validate;
 19  
 
 20  
 /**
 21  
  * Summarizes the performance of a SQL statement
 22  
  * @author D. Ashmore
 23  
  *
 24  
  */
 25  
 public class SqlStatementPerformanceSummaryVO extends BaseVO {
 26  
 
 27  
     private static final long serialVersionUID = 447417429076494830L;
 28  
     
 29  
     private DataMeasurementSummaryVO summary;
 30  
     private String driverClass;
 31  
     private Integer majorVersion;
 32  
     private Integer minorVersion;
 33  
     private String poolName;
 34  
     private String sqlText;
 35  
     
 36  54
     public SqlStatementPerformanceSummaryVO(DataMeasurementSummaryVO summary) {
 37  
         Validate.notNull(summary, "Null summary not allowed.");
 38  54
         this.summary = summary;
 39  
         
 40  54
         StringTokenizer token1 = new StringTokenizer(summary.getLabel(), "-");
 41  54
         String context = token1.nextToken();
 42  
         
 43  54
         if (token1.hasMoreTokens()) {
 44  54
             this.sqlText = token1.nextToken();
 45  
         }
 46  
         
 47  54
         StringTokenizer token2 = new StringTokenizer(context, ":");
 48  54
         if (token2.hasMoreTokens()) {
 49  54
             this.driverClass = token2.nextToken();
 50  
         }
 51  54
         if (token2.hasMoreTokens()) {
 52  30
             this.majorVersion = Integer.valueOf(token2.nextToken());
 53  
         }
 54  54
         if (token2.hasMoreTokens()) {
 55  30
             this.minorVersion = Integer.valueOf(token2.nextToken());
 56  
         }
 57  
         
 58  54
         if (token2.hasMoreTokens()) {
 59  30
             this.poolName = token2.nextToken();
 60  
         }
 61  
         else {
 62  24
             this.poolName = "none";
 63  
         }
 64  54
     }
 65  
 
 66  
     public DataMeasurementSummaryVO getSummary() {
 67  45
         return summary;
 68  
     }
 69  
     
 70  
     public String getDriverClass() {
 71  3
         return driverClass;
 72  
     }
 73  
 
 74  
     public Integer getMajorVersion() {
 75  3
         return majorVersion;
 76  
     }
 77  
 
 78  
     public Integer getMinorVersion() {
 79  3
         return minorVersion;
 80  
     }
 81  
 
 82  
     public String getPoolName() {
 83  3
         return poolName;
 84  
     }
 85  
 
 86  
     public String getSqlText() {
 87  90
         return sqlText;
 88  
     }
 89  
 
 90  
     /* (non-Javadoc)
 91  
      * @see net.admin4j.vo.BaseVO#clone()
 92  
      */
 93  
     @Override
 94  
     public Object clone() throws CloneNotSupportedException {
 95  3
         SqlStatementPerformanceSummaryVO clone = new SqlStatementPerformanceSummaryVO( 
 96  
                 (DataMeasurementSummaryVO)this.summary.clone());
 97  3
         clone.driverClass = this.driverClass;
 98  3
         clone.majorVersion = this.majorVersion;
 99  3
         clone.minorVersion = this.minorVersion;
 100  3
         clone.poolName = this.poolName;
 101  3
         return clone;
 102  
     }
 103  
 
 104  
 }