001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    
022    import java.io.Serializable;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     * @generated
027     */
028    @ProviderType
029    public class UserGroupGroupRolePK implements Comparable<UserGroupGroupRolePK>,
030            Serializable {
031            public long userGroupId;
032            public long groupId;
033            public long roleId;
034    
035            public UserGroupGroupRolePK() {
036            }
037    
038            public UserGroupGroupRolePK(long userGroupId, long groupId, long roleId) {
039                    this.userGroupId = userGroupId;
040                    this.groupId = groupId;
041                    this.roleId = roleId;
042            }
043    
044            public long getUserGroupId() {
045                    return userGroupId;
046            }
047    
048            public void setUserGroupId(long userGroupId) {
049                    this.userGroupId = userGroupId;
050            }
051    
052            public long getGroupId() {
053                    return groupId;
054            }
055    
056            public void setGroupId(long groupId) {
057                    this.groupId = groupId;
058            }
059    
060            public long getRoleId() {
061                    return roleId;
062            }
063    
064            public void setRoleId(long roleId) {
065                    this.roleId = roleId;
066            }
067    
068            @Override
069            public int compareTo(UserGroupGroupRolePK pk) {
070                    if (pk == null) {
071                            return -1;
072                    }
073    
074                    int value = 0;
075    
076                    if (userGroupId < pk.userGroupId) {
077                            value = -1;
078                    }
079                    else if (userGroupId > pk.userGroupId) {
080                            value = 1;
081                    }
082                    else {
083                            value = 0;
084                    }
085    
086                    if (value != 0) {
087                            return value;
088                    }
089    
090                    if (groupId < pk.groupId) {
091                            value = -1;
092                    }
093                    else if (groupId > pk.groupId) {
094                            value = 1;
095                    }
096                    else {
097                            value = 0;
098                    }
099    
100                    if (value != 0) {
101                            return value;
102                    }
103    
104                    if (roleId < pk.roleId) {
105                            value = -1;
106                    }
107                    else if (roleId > pk.roleId) {
108                            value = 1;
109                    }
110                    else {
111                            value = 0;
112                    }
113    
114                    if (value != 0) {
115                            return value;
116                    }
117    
118                    return 0;
119            }
120    
121            @Override
122            public boolean equals(Object obj) {
123                    if (this == obj) {
124                            return true;
125                    }
126    
127                    if (!(obj instanceof UserGroupGroupRolePK)) {
128                            return false;
129                    }
130    
131                    UserGroupGroupRolePK pk = (UserGroupGroupRolePK)obj;
132    
133                    if ((userGroupId == pk.userGroupId) && (groupId == pk.groupId) &&
134                                    (roleId == pk.roleId)) {
135                            return true;
136                    }
137                    else {
138                            return false;
139                    }
140            }
141    
142            @Override
143            public int hashCode() {
144                    return (String.valueOf(userGroupId) + String.valueOf(groupId) +
145                    String.valueOf(roleId)).hashCode();
146            }
147    
148            @Override
149            public String toString() {
150                    StringBundler sb = new StringBundler(15);
151    
152                    sb.append(StringPool.OPEN_CURLY_BRACE);
153    
154                    sb.append("userGroupId");
155                    sb.append(StringPool.EQUAL);
156                    sb.append(userGroupId);
157    
158                    sb.append(StringPool.COMMA);
159                    sb.append(StringPool.SPACE);
160                    sb.append("groupId");
161                    sb.append(StringPool.EQUAL);
162                    sb.append(groupId);
163    
164                    sb.append(StringPool.COMMA);
165                    sb.append(StringPool.SPACE);
166                    sb.append("roleId");
167                    sb.append(StringPool.EQUAL);
168                    sb.append(roleId);
169    
170                    sb.append(StringPool.CLOSE_CURLY_BRACE);
171    
172                    return sb.toString();
173            }
174    }