2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.sxp.ep.provider.impl.dao;
11 import java.util.List;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ConditionName;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.EndpointGroupId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.endpoints.AddressEndpointWithLocation;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.integration.sxp.ep.provider.model.rev160302.sxp.ep.mapper.EndpointPolicyTemplateBySgt;
19 * Purpose: composite key holder for {@link EndpointPolicyTemplateBySgt}
21 public class EpPolicyTemplateValueKey {
23 private final TenantId tenantId;
24 private final List<EndpointGroupId> epgId;
25 private final List<ConditionName> conditionName;
27 public EpPolicyTemplateValueKey(final TenantId tenantId, final List<EndpointGroupId> epgId, final List<ConditionName> conditionName) {
28 this.tenantId = tenantId;
30 this.conditionName = conditionName;
33 public EpPolicyTemplateValueKey(AddressEndpointWithLocation endpoint) {
34 this(endpoint.getTenant(), endpoint.getEndpointGroup(), endpoint.getCondition());
37 public TenantId getTenantId() {
41 public List<EndpointGroupId> getEpgId() {
45 public List<ConditionName> getConditionName() {
50 public boolean equals(final Object o) {
51 if (this == o) return true;
52 if (o == null || getClass() != o.getClass()) return false;
54 final EpPolicyTemplateValueKey that = (EpPolicyTemplateValueKey) o;
56 if (tenantId != null ? !tenantId.equals(that.tenantId) : that.tenantId != null) return false;
57 if (epgId != null ? !epgId.equals(that.epgId) : that.epgId != null) return false;
58 return conditionName != null ? conditionName.equals(that.conditionName) : that.conditionName == null;
63 public int hashCode() {
64 return tenantId != null ? tenantId.hashCode() : 0;