Coverage Report - br.com.arsmachina.accesslogger.hibernate.Access
 
Classes in this File Line Coverage Branch Coverage Complexity
Access
0%
0/35
0%
0/2
0
 
 1  
 // Copyright 2008 Thiago H. de Paula Figueiredo
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package br.com.arsmachina.accesslogger.hibernate;
 16  
 
 17  
 import java.util.Date;
 18  
 
 19  
 import javax.persistence.Column;
 20  
 import javax.persistence.Entity;
 21  
 import javax.persistence.GeneratedValue;
 22  
 import javax.persistence.GenerationType;
 23  
 import javax.persistence.Id;
 24  
 import javax.persistence.ManyToOne;
 25  
 import javax.persistence.Table;
 26  
 
 27  
 import org.hibernate.validator.Length;
 28  
 import org.hibernate.validator.NotNull;
 29  
 
 30  
 import br.com.arsmachina.authentication.entity.User;
 31  
 
 32  
 /**
 33  
  * Persistent {@link br.com.arsmachina.accesslogger.Access} subclass.
 34  
  * 
 35  
  * @author Thiago H. de Paula Figueiredo
 36  
  */
 37  
 @Entity
 38  
 @Table(name = "access")
 39  
 public class Access extends br.com.arsmachina.accesslogger.Access {
 40  
 
 41  
         private static final int MAXIMUM_IP_LENGTH = 20;
 42  
 
 43  
         private static final int MAXIMUM_VARCHAR_LENGTH = 255;
 44  
 
 45  
         private static final int MAXIMUM_JSESSIONID_LENGTH = 40;
 46  
 
 47  
         private static final int MAXIMUM_REMOTE_HOST_LENGTH = 50;
 48  
 
 49  
         private static final int MAXIMUM_LOCALE_LENGTH = 15;
 50  
 
 51  
         private Long id;
 52  
 
 53  
         /**
 54  
          * Default constructor.
 55  
          */
 56  0
         public Access() {
 57  0
         }
 58  
 
 59  
         /**
 60  
          * Constructor that receives an {@link br.com.arsmachina.accesslogger.Access} instance. All
 61  
          * property values are copied to the created object.
 62  
          * 
 63  
          * @param access an {@link br.com.arsmachina.accesslogger.Access}. It cannot be null.
 64  
          */
 65  0
         public Access(br.com.arsmachina.accesslogger.Access access) {
 66  
 
 67  0
                 if (access == null) {
 68  0
                         throw new IllegalArgumentException("Parameter access cannot be null");
 69  
                 }
 70  
 
 71  0
                 setActivationContext(access.getActivationContext());
 72  0
                 setContextPath(access.getContextPath());
 73  0
                 setIp(access.getIp());
 74  0
                 setLocale(access.getLocale());
 75  0
                 setPage(access.getPage());
 76  0
                 setQueryString(access.getQueryString());
 77  0
                 setReferer(access.getReferer());
 78  0
                 setRemoteHost(access.getRemoteHost());
 79  0
                 setSessionId(access.getSessionId());
 80  0
                 setTimestamp(access.getTimestamp());
 81  0
                 setUrl(access.getUrl());
 82  0
                 setUser(access.getUser());
 83  0
                 setUserAgent(access.getUserAgent());
 84  
 
 85  0
         }
 86  
 
 87  
         /**
 88  
          * @see br.com.arsmachina.accesslogger.Access#getContextPath()
 89  
          */
 90  
         @NotNull
 91  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 92  
         @Column(nullable = false, length = MAXIMUM_VARCHAR_LENGTH)
 93  
         @Override
 94  
         public String getContextPath() {
 95  0
                 return super.getContextPath();
 96  
         }
 97  
 
 98  
         /**
 99  
          * @see br.com.arsmachina.accesslogger.Access#getPage()
 100  
          */
 101  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 102  
         @Column(length = MAXIMUM_VARCHAR_LENGTH)
 103  
         @Override
 104  
         public String getPage() {
 105  0
                 return super.getPage();
 106  
         }
 107  
 
 108  
         /**
 109  
          * @see br.com.arsmachina.accesslogger.Access#getReferer()
 110  
          */
 111  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 112  
         @Column(length = MAXIMUM_VARCHAR_LENGTH)
 113  
         @Override
 114  
         public String getReferer() {
 115  0
                 return super.getReferer();
 116  
         }
 117  
 
 118  
         /**
 119  
          * @see br.com.arsmachina.accesslogger.Access#getTimestamp()
 120  
          */
 121  
         @NotNull
 122  
         @Override
 123  
         public Date getTimestamp() {
 124  0
                 return super.getTimestamp();
 125  
         }
 126  
 
 127  
         /**
 128  
          * @see br.com.arsmachina.accesslogger.Access#getUserAgent()
 129  
          */
 130  
         @NotNull
 131  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 132  
         @Column(nullable = false, length = MAXIMUM_VARCHAR_LENGTH)
 133  
         @Override
 134  
         public String getUserAgent() {
 135  0
                 return super.getUserAgent();
 136  
         }
 137  
 
 138  
         /**
 139  
          * Returns the value of the <code>id</code> property.
 140  
          * 
 141  
          * @return a {@link Long}.
 142  
          */
 143  
         @Id
 144  
         @GeneratedValue(strategy = GenerationType.IDENTITY)
 145  
         public Long getId() {
 146  0
                 return id;
 147  
         }
 148  
 
 149  
         /**
 150  
          * Changes the value of the <code>id</code> property.
 151  
          * 
 152  
          * @param id a {@link Long}.
 153  
          */
 154  
         public void setId(Long id) {
 155  0
                 this.id = id;
 156  0
         }
 157  
 
 158  
         /**
 159  
          * @see br.com.arsmachina.accesslogger.Access#getActivationContext()
 160  
          */
 161  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 162  
         @Column(length = MAXIMUM_VARCHAR_LENGTH)
 163  
         @Override
 164  
         public String getActivationContext() {
 165  0
                 return super.getActivationContext();
 166  
         }
 167  
 
 168  
         /**
 169  
          * @see br.com.arsmachina.accesslogger.Access#getIp()
 170  
          */
 171  
         @NotNull
 172  
         @Length(max = MAXIMUM_IP_LENGTH)
 173  
         @Column(nullable = false, length = MAXIMUM_IP_LENGTH)
 174  
         @Override
 175  
         public String getIp() {
 176  0
                 return super.getIp();
 177  
         }
 178  
 
 179  
         /**
 180  
          * @see br.com.arsmachina.accesslogger.Access#getQueryString()
 181  
          */
 182  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 183  
         @Column(length = MAXIMUM_VARCHAR_LENGTH)
 184  
         @Override
 185  
         public String getQueryString() {
 186  0
                 return super.getQueryString();
 187  
         }
 188  
 
 189  
         /**
 190  
          * @see br.com.arsmachina.accesslogger.Access#getSessionId()
 191  
          */
 192  
         @Length(max = MAXIMUM_JSESSIONID_LENGTH)
 193  
         @Column(length = MAXIMUM_JSESSIONID_LENGTH)
 194  
         @Override
 195  
         public String getSessionId() {
 196  0
                 return super.getSessionId();
 197  
         }
 198  
 
 199  
         /**
 200  
          * @see br.com.arsmachina.accesslogger.Access#getUrl()
 201  
          */
 202  
         @NotNull
 203  
         @Length(max = MAXIMUM_VARCHAR_LENGTH)
 204  
         @Column(nullable = false, length = MAXIMUM_VARCHAR_LENGTH)
 205  
         @Override
 206  
         public String getUrl() {
 207  0
                 return super.getUrl();
 208  
         }
 209  
 
 210  
         /**
 211  
          * @see br.com.arsmachina.accesslogger.Access#getUser()
 212  
          */
 213  
         @ManyToOne
 214  
         @Override
 215  
         public User getUser() {
 216  0
                 return super.getUser();
 217  
         }
 218  
 
 219  
         /**
 220  
          * @see br.com.arsmachina.accesslogger.Access#getLocale()
 221  
          */
 222  
         @Column(length = MAXIMUM_LOCALE_LENGTH)
 223  
         @Override
 224  
         public String getLocale() {
 225  0
                 return super.getLocale();
 226  
         }
 227  
 
 228  
         /**
 229  
          * @see br.com.arsmachina.accesslogger.Access#getRemoteHost()
 230  
          */
 231  
         @Column(nullable = false, length = MAXIMUM_REMOTE_HOST_LENGTH)
 232  
         @Override
 233  
         public String getRemoteHost() {
 234  0
                 return super.getRemoteHost();
 235  
         }
 236  
 
 237  
 }