2016-10-03 16:22:42 +02:00
|
|
|
package org.gcube.common.authorizationservice.persistence.entities;
|
|
|
|
|
2019-10-04 18:44:55 +02:00
|
|
|
import java.io.Serializable;
|
|
|
|
|
2016-10-03 16:22:42 +02:00
|
|
|
import javax.persistence.Embeddable;
|
|
|
|
|
|
|
|
@Embeddable
|
2019-10-04 18:44:55 +02:00
|
|
|
public class AuthorizationId implements Serializable {
|
2016-10-03 16:22:42 +02:00
|
|
|
|
2019-10-04 18:44:55 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
2016-10-03 16:22:42 +02:00
|
|
|
String context;
|
|
|
|
String clientId;
|
|
|
|
String qualifier;
|
|
|
|
|
2019-10-04 18:44:55 +02:00
|
|
|
public AuthorizationId() {
|
2016-10-03 16:22:42 +02:00
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public AuthorizationId(String context, String clientId, String qualifier) {
|
|
|
|
super();
|
|
|
|
this.context = context;
|
|
|
|
this.clientId = clientId;
|
|
|
|
this.qualifier = qualifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2016-11-25 15:34:11 +01:00
|
|
|
return context+clientId+qualifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
final int prime = 31;
|
|
|
|
int result = 1;
|
|
|
|
result = prime * result
|
|
|
|
+ ((clientId == null) ? 0 : clientId.hashCode());
|
|
|
|
result = prime * result + ((context == null) ? 0 : context.hashCode());
|
|
|
|
result = prime * result
|
|
|
|
+ ((qualifier == null) ? 0 : qualifier.hashCode());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj)
|
|
|
|
return true;
|
|
|
|
if (obj == null)
|
|
|
|
return false;
|
|
|
|
if (getClass() != obj.getClass())
|
|
|
|
return false;
|
|
|
|
AuthorizationId other = (AuthorizationId) obj;
|
|
|
|
if (clientId == null) {
|
|
|
|
if (other.clientId != null)
|
|
|
|
return false;
|
|
|
|
} else if (!clientId.equals(other.clientId))
|
|
|
|
return false;
|
|
|
|
if (context == null) {
|
|
|
|
if (other.context != null)
|
|
|
|
return false;
|
|
|
|
} else if (!context.equals(other.context))
|
|
|
|
return false;
|
|
|
|
if (qualifier == null) {
|
|
|
|
if (other.qualifier != null)
|
|
|
|
return false;
|
|
|
|
} else if (!qualifier.equals(other.qualifier))
|
|
|
|
return false;
|
|
|
|
return true;
|
2016-10-03 16:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|