2 * ================================================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ================================================================================
\r
20 package org.openecomp.portalapp.portal.domain;
\r
23 @SuppressWarnings("rawtypes")
\r
24 public class EPUserApp implements java.io.Serializable, Comparable {
\r
26 private static final long serialVersionUID = 1L;
\r
28 private Long userId;
\r
30 private EPRole role;
\r
31 private Short priority;
\r
33 public EPUserApp() {
\r
36 public Long getAppId() {
\r
37 return this.getApp().getId();
\r
40 public Long getRoleId() {
\r
41 return (role == null) ? null : role.getId();
\r
44 public Long getAppRoleId() {
\r
45 return (role.getAppRoleId() == null) ? null : role.getAppRoleId();
\r
49 public String toString() {
\r
50 String str = "[u: "+getUserId()+"; a: "+getAppId()+", r: "+getRoleId()+"; appRoleId: "+getAppRoleId()+"]";
\r
54 public Long getUserId() {
\r
58 public void setUserId(Long id) {
\r
62 public EPApp getApp() {
\r
66 public void setApp(EPApp app) {
\r
70 public EPRole getRole() {
\r
74 public void setRole(EPRole role) {
\r
78 public Short getPriority() {
\r
79 return this.priority;
\r
82 public void setPriority(Short priority) {
\r
83 this.priority = priority;
\r
86 public boolean equals(Object other) {
\r
87 if ((this == other))
\r
89 if ((other == null))
\r
91 if (!(other instanceof EPUserApp))
\r
93 EPUserApp castOther = (EPUserApp) other;
\r
95 return (this.getUserId().equals(castOther.getUserId()))
\r
96 && (this.getApp().getId().equals(castOther.getApp().getId()))
\r
97 && (this.getRole().getId().equals(castOther.getRole().getId()))
\r
98 && ((this.priority==null && castOther.getPriority()==null) || this.getPriority().equals(castOther.getPriority()));
\r
101 public int hashCode() {
\r
104 result = 37 * result + (int) (this.getUserId()==null ? 0 : this.getUserId().intValue());
\r
105 result = 37 * result + (int) (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue());
\r
106 result = 37 * result + (int) (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue());
\r
107 result = 37 * result + (int) (this.priority==null ? 0 : this.priority);
\r
111 public int compareTo(Object other){
\r
112 EPUserApp castOther = (EPUserApp) other;
\r
114 Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.getApp()==null||this.getApp().getId()==null ? 0 : this.getApp().getId()) + (this.getRole()==null||this.getRole().getId()==null ? 0 : this.getRole().getId()) + (this.priority==null ? 0 : this.priority);
\r
115 Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.getRole()==null||castOther.getRole().getId()==null ? 0 : castOther.getRole().getId()) + (castOther.priority==null ? 0 : castOther.priority);
\r
117 return c1.compareTo(c2);
\r