X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Faaf%2FDmaapGrant.java;fp=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Faaf%2FDmaapGrant.java;h=bcee2a3f0d0cc642b2f02247330d08b9bd4debe1;hb=45ccf584c8574e9f96dd6fa3b8016accf24fc541;hp=90668bef4df80e9222419cd64be4a52e192b75b8;hpb=d3994fb85f92d429b626013a0bd9f2ff69418c95;p=dmaap%2Fdbcapi.git diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/DmaapGrant.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/DmaapGrant.java index 90668be..bcee2a3 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/aaf/DmaapGrant.java +++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/DmaapGrant.java @@ -7,9 +7,9 @@ * Licensed 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. @@ -22,46 +22,61 @@ package org.onap.dmaap.dbcapi.aaf; import org.apache.log4j.Logger; +import java.util.Objects; + public class DmaapGrant extends AafObject { - static final Logger logger = Logger.getLogger(DmaapGrant.class); - - private DmaapPerm perm; - private String role; - - public DmaapGrant(){ - - } - - public DmaapGrant( DmaapPerm p, String r ) { - this.perm = p; - this.role = r; - } - - public DmaapPerm getPerm() { - return perm; - } - - public void setPerm(DmaapPerm perm) { - this.perm = perm; - } - - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - public String toJSON() { - - String postJSON = String.format(" { \"perm\": %s, \"role\": \"%s\"}", - this.perm.toJSON(), - this.getRole() ); - logger.info( "returning JSON: " + postJSON); - - return postJSON; - } - - + static final Logger logger = Logger.getLogger(DmaapGrant.class); + + private DmaapPerm perm; + private String role; + + public DmaapGrant() { + + } + + public DmaapGrant(DmaapPerm p, String r) { + this.perm = p; + this.role = r; + } + + public DmaapPerm getPerm() { + return perm; + } + + public void setPerm(DmaapPerm perm) { + this.perm = perm; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String toJSON() { + + String postJSON = String.format(" { \"perm\": %s, \"role\": \"%s\"}", + this.perm.toJSON(), + this.getRole()); + logger.info("returning JSON: " + postJSON); + + return postJSON; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DmaapGrant that = (DmaapGrant) o; + return Objects.equals(perm, that.perm) && + Objects.equals(role, that.role); + } + + @Override + public int hashCode() { + + return Objects.hash(perm, role); + } }