| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| package org.apache.ranger.entity; |
| |
| import java.io.Serializable; |
| |
| import javax.persistence.Cacheable; |
| import javax.persistence.Column; |
| import javax.persistence.Entity; |
| import javax.persistence.GeneratedValue; |
| import javax.persistence.GenerationType; |
| import javax.persistence.Id; |
| import javax.persistence.SequenceGenerator; |
| import javax.persistence.Table; |
| import javax.persistence.Version; |
| import javax.xml.bind.annotation.XmlRootElement; |
| |
| import org.apache.ranger.common.AppConstants; |
| |
| @Entity |
| @Cacheable |
| @Table(name="x_service_resource") |
| @XmlRootElement |
| public class XXServiceResource extends XXDBBase implements Serializable { |
| private static final long serialVersionUID = 1L; |
| |
| @Id |
| @SequenceGenerator(name = "X_SERVICE_RESOURCE_SEQ", sequenceName = "X_SERVICE_RESOURCE_SEQ", allocationSize = 1) |
| @GeneratedValue(strategy = GenerationType.AUTO, generator = "X_SERVICE_RESOURCE_SEQ") |
| @Column(name = "id") |
| protected Long id; |
| |
| @Column(name = "guid", unique = true, nullable = false, length = 512) |
| protected String guid; |
| |
| @Version |
| @Column(name = "version") |
| protected Long version; |
| |
| @Column(name = "is_enabled") |
| protected Boolean isEnabled; |
| |
| @Column(name = "resource_signature") |
| protected String resourceSignature; |
| |
| @Column(name = "service_id") |
| protected Long serviceId; |
| |
| @Override |
| public void setId(Long id) { |
| this.id = id; |
| } |
| |
| @Override |
| public Long getId() { |
| return id; |
| } |
| |
| /** |
| * @return the guid |
| */ |
| public String getGuid() { |
| return guid; |
| } |
| |
| /** |
| * @param guid |
| * the guid to set |
| */ |
| public void setGuid(String guid) { |
| this.guid = guid; |
| } |
| |
| /** |
| * @return the serviceId |
| */ |
| public Long getServiceId() { |
| return serviceId; |
| } |
| |
| /** |
| * @param serviceId |
| * the serviceId to set |
| */ |
| public void setServiceId(Long serviceId) { |
| this.serviceId = serviceId; |
| } |
| |
| /** |
| * @return the resourceSignature |
| */ |
| public String getResourceSignature() { |
| return resourceSignature; |
| } |
| |
| /** |
| * @param resourceSignature |
| * the resourceSignature to set |
| */ |
| public void setResourceSignature(String resourceSignature) { |
| this.resourceSignature = resourceSignature; |
| } |
| |
| /** |
| * @return the version |
| */ |
| public Long getVersion() { |
| return version; |
| } |
| |
| /** |
| * @param version |
| * the version to set |
| */ |
| public void setVersion(Long version) { |
| this.version = version; |
| } |
| |
| /** |
| * @return the isEnabled |
| */ |
| public Boolean getIsEnabled() { |
| return isEnabled; |
| } |
| |
| /** |
| * @param isEnabled |
| * the isEnabled to set |
| */ |
| public void setIsEnabled(Boolean isEnabled) { |
| this.isEnabled = isEnabled; |
| } |
| |
| @Override |
| public int getMyClassType() { |
| return AppConstants.CLASS_TYPE_XA_SERVICE_RESOURCE; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see java.lang.Object#hashCode() |
| */ |
| @Override |
| public int hashCode() { |
| final int prime = 31; |
| int result = 1; |
| result = prime * result + ((id == null) ? 0 : id.hashCode()); |
| result = prime * result + ((guid == null) ? 0 : guid.hashCode()); |
| result = prime * result + ((version == null) ? 0 : version.hashCode()); |
| result = prime * result + ((isEnabled == null) ? 0 : isEnabled.hashCode()); |
| result = prime * result + ((resourceSignature == null) ? 0 : resourceSignature.hashCode()); |
| result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode()); |
| return result; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see java.lang.Object#equals(java.lang.Object) |
| */ |
| @Override |
| public boolean equals(Object obj) { |
| if (this == obj) |
| return true; |
| if (!super.equals(obj)) |
| return false; |
| if (getClass() != obj.getClass()) |
| return false; |
| XXServiceResource other = (XXServiceResource) obj; |
| if (resourceSignature == null) { |
| if (other.resourceSignature != null) |
| return false; |
| } else if (!resourceSignature.equals(other.resourceSignature)) |
| return false; |
| if (guid == null) { |
| if (other.guid != null) |
| return false; |
| } else if (!guid.equals(other.guid)) |
| return false; |
| if (id == null) { |
| if (other.id != null) |
| return false; |
| } else if (!id.equals(other.id)) |
| return false; |
| if (isEnabled == null) { |
| if (other.isEnabled != null) |
| return false; |
| } else if (!isEnabled.equals(other.isEnabled)) |
| return false; |
| if (serviceId == null) { |
| if (other.serviceId != null) |
| return false; |
| } else if (!serviceId.equals(other.serviceId)) |
| return false; |
| if (version == null) { |
| if (other.version != null) |
| return false; |
| } else if (!version.equals(other.version)) |
| return false; |
| return true; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see java.lang.Object#toString() |
| */ |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder(); |
| toString(sb); |
| return sb.toString(); |
| } |
| |
| public StringBuilder toString(StringBuilder sb) { |
| sb.append("{ "); |
| sb.append(super.toString() + "} "); |
| sb.append("id={").append(id).append("} "); |
| sb.append("guid={").append(guid).append("} "); |
| sb.append("version={").append(version).append("} "); |
| sb.append("isEnabled={").append(isEnabled).append("} "); |
| sb.append("resourceSignature={").append(resourceSignature).append("} "); |
| sb.append("serviceId={").append(serviceId).append("} "); |
| sb.append(" }"); |
| |
| return sb; |
| } |
| |
| } |