001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019
020 import java.io.Serializable;
021
022
025 public class UserGroupGroupRolePK implements Comparable<UserGroupGroupRolePK>,
026 Serializable {
027 public long userGroupId;
028 public long groupId;
029 public long roleId;
030
031 public UserGroupGroupRolePK() {
032 }
033
034 public UserGroupGroupRolePK(long userGroupId, long groupId, long roleId) {
035 this.userGroupId = userGroupId;
036 this.groupId = groupId;
037 this.roleId = roleId;
038 }
039
040 public long getUserGroupId() {
041 return userGroupId;
042 }
043
044 public void setUserGroupId(long userGroupId) {
045 this.userGroupId = userGroupId;
046 }
047
048 public long getGroupId() {
049 return groupId;
050 }
051
052 public void setGroupId(long groupId) {
053 this.groupId = groupId;
054 }
055
056 public long getRoleId() {
057 return roleId;
058 }
059
060 public void setRoleId(long roleId) {
061 this.roleId = roleId;
062 }
063
064 @Override
065 public int compareTo(UserGroupGroupRolePK pk) {
066 if (pk == null) {
067 return -1;
068 }
069
070 int value = 0;
071
072 if (userGroupId < pk.userGroupId) {
073 value = -1;
074 }
075 else if (userGroupId > pk.userGroupId) {
076 value = 1;
077 }
078 else {
079 value = 0;
080 }
081
082 if (value != 0) {
083 return value;
084 }
085
086 if (groupId < pk.groupId) {
087 value = -1;
088 }
089 else if (groupId > pk.groupId) {
090 value = 1;
091 }
092 else {
093 value = 0;
094 }
095
096 if (value != 0) {
097 return value;
098 }
099
100 if (roleId < pk.roleId) {
101 value = -1;
102 }
103 else if (roleId > pk.roleId) {
104 value = 1;
105 }
106 else {
107 value = 0;
108 }
109
110 if (value != 0) {
111 return value;
112 }
113
114 return 0;
115 }
116
117 @Override
118 public boolean equals(Object obj) {
119 if (this == obj) {
120 return true;
121 }
122
123 if (!(obj instanceof UserGroupGroupRolePK)) {
124 return false;
125 }
126
127 UserGroupGroupRolePK pk = (UserGroupGroupRolePK)obj;
128
129 if ((userGroupId == pk.userGroupId) && (groupId == pk.groupId) &&
130 (roleId == pk.roleId)) {
131 return true;
132 }
133 else {
134 return false;
135 }
136 }
137
138 @Override
139 public int hashCode() {
140 return (String.valueOf(userGroupId) + String.valueOf(groupId) +
141 String.valueOf(roleId)).hashCode();
142 }
143
144 @Override
145 public String toString() {
146 StringBundler sb = new StringBundler(15);
147
148 sb.append(StringPool.OPEN_CURLY_BRACE);
149
150 sb.append("userGroupId");
151 sb.append(StringPool.EQUAL);
152 sb.append(userGroupId);
153
154 sb.append(StringPool.COMMA);
155 sb.append(StringPool.SPACE);
156 sb.append("groupId");
157 sb.append(StringPool.EQUAL);
158 sb.append(groupId);
159
160 sb.append(StringPool.COMMA);
161 sb.append(StringPool.SPACE);
162 sb.append("roleId");
163 sb.append(StringPool.EQUAL);
164 sb.append(roleId);
165
166 sb.append(StringPool.CLOSE_CURLY_BRACE);
167
168 return sb.toString();
169 }
170 }