Coverage Report - net.admin4j.vo.ExceptionStatisticVO
 
Classes in this File Line Coverage Branch Coverage Complexity
ExceptionStatisticVO
83%
15/18
50%
4/8
2.4
 
 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 net.admin4j.deps.commons.lang3.builder.EqualsBuilder;
 17  
 import net.admin4j.deps.commons.lang3.builder.HashCodeBuilder;
 18  
 import net.admin4j.entity.ExceptionInfo;
 19  
 import net.admin4j.entity.ExceptionInfoBase;
 20  
 
 21  
 /**
 22  
  * Exception statistics
 23  
  * @author D. Ashmore
 24  
  * @since 1.0
 25  
  */
 26  
 public class ExceptionStatisticVO extends ExceptionInfoBase {
 27  
         
 28  
         private String id;
 29  
 
 30  33
         public ExceptionStatisticVO(ExceptionInfo eInfo) {
 31  33
                 this.stackTrace = eInfo.getStackTrace();
 32  33
                 this.id = eInfo.getAlternateId();
 33  33
                 this.setTroubleTicketUrl(eInfo.getTroubleTicketUrl());
 34  33
                 this.setExceptionClassName(eInfo.getExceptionClassName());
 35  33
                 this.setLastOccurrenceMessage(eInfo.getLastOccurrenceMessage());
 36  33
                 this.setFirstOccuranceDt(eInfo.getFirstOccuranceDt());
 37  33
                 this.setLastOccuranceDt(eInfo.getLastOccuranceDt());
 38  33
                 this.setTotalNbrExceptions(eInfo.getTotalNbrExceptions());
 39  
                 
 40  33
         }
 41  
 
 42  
     public String getExceptionPoint() {
 43  3
         if (this.getStackTrace() != null && this.getStackTrace().length > 0) {
 44  3
             return this.getStackTrace()[0].toString();
 45  
         }
 46  
         
 47  0
         return "";
 48  
     }
 49  
     
 50  
     public String getId() {
 51  3
         return this.id;
 52  
     }
 53  
 
 54  
     /* (non-Javadoc)
 55  
      * @see net.admin4j.exception.ExceptionInfoBase#equals(java.lang.Object)
 56  
      */
 57  
     @Override
 58  
     public boolean equals(Object obj) {
 59  9
         if (obj == null) {
 60  0
             return false;
 61  
         }
 62  9
         if ( !(obj instanceof ExceptionStatisticVO) ) {
 63  0
             return false;
 64  
         }
 65  
         
 66  
         return new EqualsBuilder()
 67  
             .appendSuper(super.equals(obj))
 68  
             .isEquals();
 69  
 
 70  
     }
 71  
     
 72  
     /* (non-Javadoc)
 73  
      * @see net.admin4j.exception.ExceptionInfoBase#hashCode()
 74  
      */
 75  
     @Override
 76  
     public int hashCode() {
 77  
         return new HashCodeBuilder(17,37)
 78  
             .appendSuper(super.hashCode())
 79  
             .toHashCode();
 80  
     }
 81  
 }