001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2008-2011 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * Sonar is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.api.security; 021 022 import org.sonar.api.database.BaseIdentifiable; 023 024 import javax.persistence.Column; 025 import javax.persistence.Entity; 026 import javax.persistence.Table; 027 028 /** 029 * This JPA model maps the table user_roles 030 * 031 * @since 1.12 032 */ 033 @Entity 034 @Table(name = "user_roles") 035 public class UserRole extends BaseIdentifiable { 036 037 @Column(name = "user_id") 038 private Integer userId; 039 040 @Column(name = "role") 041 private String role; 042 043 @Column(name = "resource_id") 044 private Integer resourceId; 045 046 public UserRole(Integer userId, String role, Integer resourceId) { 047 this.userId = userId; 048 this.role = role; 049 this.resourceId = resourceId; 050 } 051 052 public UserRole() { 053 } 054 055 public Integer getUserId() { 056 return userId; 057 } 058 059 public UserRole setUserId(Integer userId) { 060 this.userId = userId; 061 return this; 062 } 063 064 public String getRole() { 065 return role; 066 } 067 068 public UserRole setRole(String role) { 069 this.role = role; 070 return this; 071 } 072 073 public Integer getResourceId() { 074 return resourceId; 075 } 076 077 public UserRole setResourceId(Integer resourceId) { 078 this.resourceId = resourceId; 079 return this; 080 } 081 }