Coverage Report - org.apache.shiro.samples.sprhib.model.Role
 
Classes in this File Line Coverage Branch Coverage Complexity
Role
0%
0/17
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.shiro.samples.sprhib.model;
 20  
 
 21  
 import org.hibernate.annotations.Cache;
 22  
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 23  
 import org.hibernate.annotations.CollectionOfElements;
 24  
 import org.hibernate.annotations.Index;
 25  
 
 26  
 import javax.persistence.*;
 27  
 import java.util.Set;
 28  
 
 29  
 /**
 30  
  * Model object that represents a security role.
 31  
  */
 32  
 @Entity
 33  
 @Table(name="roles")
 34  
 @Cache(usage= CacheConcurrencyStrategy.READ_WRITE)
 35  
 public class Role {
 36  
 
 37  
     private Long id;
 38  
 
 39  
     private String name;
 40  
 
 41  
     private String description;
 42  
 
 43  
     private Set<String> permissions;
 44  
 
 45  0
     protected Role() {
 46  0
     }
 47  
 
 48  0
     public Role(String name) {
 49  0
         this.name = name;
 50  0
     }
 51  
 
 52  
 
 53  
     @Id
 54  
     @GeneratedValue
 55  
     public Long getId() {
 56  0
         return id;
 57  
     }
 58  
 
 59  
     public void setId(Long id) {
 60  0
         this.id = id;
 61  0
     }
 62  
 
 63  
     @Basic(optional=false)
 64  
     @Column(length=100)
 65  
     @Index(name="idx_roles_name")
 66  
     public String getName() {
 67  0
         return name;
 68  
     }
 69  
 
 70  
     public void setName(String name) {
 71  0
         this.name = name;
 72  0
     }
 73  
 
 74  
     @Basic(optional=false)
 75  
     @Column(length=255)
 76  
     public String getDescription() {
 77  0
         return description;
 78  
     }
 79  
 
 80  
     public void setDescription(String description) {
 81  0
         this.description = description;
 82  0
     }
 83  
 
 84  
     @CollectionOfElements
 85  
     @JoinTable(name="roles_permissions")
 86  
     @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
 87  
     public Set<String> getPermissions() {
 88  0
         return permissions;
 89  
     }
 90  
 
 91  
     public void setPermissions(Set<String> permissions) {
 92  0
         this.permissions = permissions;
 93  0
     }
 94  
 
 95  
 }
 96  
 
 97