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.renderer.vpp.util;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpointKey;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.location.providers.location.provider.ProviderAddressEndpointLocationKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.has.rule.group.with.renderer.endpoint.participation.RuleGroupWithRendererEndpointParticipationKey;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.endpoints.AddressEndpointWithLocationKey;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.renderer.endpoints.RendererEndpointKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.renderer.endpoints.renderer.endpoint.PeerEndpointKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.rule.groups.RuleGroupKey;
19 public class KeyFactory {
21 private KeyFactory() {}
23 public static AddressEndpointWithLocationKey addressEndpointWithLocationKey(RendererEndpointKey fromKey) {
24 return new AddressEndpointWithLocationKey(fromKey.getAddress(), fromKey.getAddressType(),
25 fromKey.getContextId(), fromKey.getContextType());
28 public static PeerEndpointKey peerEndpointKey(PeerEndpointKey fromKey) {
29 return new PeerEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(),
30 fromKey.getContextType());
33 public static RuleGroupKey ruleGroupKey(RuleGroupWithRendererEndpointParticipationKey fromKey) {
34 return new RuleGroupKey(fromKey.getContractId(), fromKey.getSubjectName(), fromKey.getTenantId());
37 public static AddressEndpointKey addressEndpointKey(RendererEndpointKey fromKey) {
38 return new AddressEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(),
39 fromKey.getContextType());
42 public static AddressEndpointKey addressEndpointKey(PeerEndpointKey fromKey) {
43 return new AddressEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(),
44 fromKey.getContextType());
47 public static ProviderAddressEndpointLocationKey providerAddressEndpointLocationKey(
48 AddressEndpointWithLocationKey fromKey) {
49 return new ProviderAddressEndpointLocationKey(fromKey.getAddress(), fromKey.getAddressType(),
50 fromKey.getContextId(), fromKey.getContextType());
53 public static RendererEndpointKey rendererEndpointKey(AddressEndpointWithLocationKey fromKey) {
54 return new RendererEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(),
55 fromKey.getContextType());
58 public static PeerEndpointKey peerEndpointKey(AddressEndpointWithLocationKey fromKey) {
59 return new PeerEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(),
60 fromKey.getContextType());