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