041c02ff2d3ff6d393e0330d46596b12110fc425
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aaiclient.client.aai.entities.uri;
22
23 import java.net.URI;
24 import javax.ws.rs.core.UriBuilder;
25 import org.onap.aaiclient.client.aai.AAIObjectPlurals;
26 import org.onap.aaiclient.client.aai.AAIObjectType;
27 import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri;
28
29 public class AAISimpleUri extends
30         SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment>
31         implements AAIResourceUri {
32
33     private static final long serialVersionUID = -6397024057188453229L;
34
35     protected AAISimpleUri(AAIObjectType type, Object... values) {
36         super(type, values);
37
38     }
39
40     protected AAISimpleUri(AAIObjectType type, URI uri) {
41         super(type, uri);
42     }
43
44     protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
45         super(type, builder, values);
46     }
47
48     protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
49         super(parentUri, childType, childValues);
50     }
51
52     // copy constructor
53     protected AAISimpleUri(AAISimpleUri copy) {
54         super(copy);
55     }
56
57     @Override
58     public AAISimpleUri clone() {
59         return new AAISimpleUri(this);
60     }
61
62     @Override
63     public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
64         this.internalURI = internalURI.path(relatedTo);
65         return new AAISimpleUri(this, type, values);
66     }
67
68     @Override
69     public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) {
70         this.internalURI.path(relatedTo);
71         return new AAISimplePluralUri(this, plural);
72     }
73
74     @Override
75     public AAISimpleUri relatedTo(AAISingleFragment fragment) {
76         this.internalURI.path(relatedTo);
77         return new AAISimpleUri(this, fragment.get().build(), fragment.get().values());
78     }
79
80     @Override
81     public AAISimplePluralUri relatedTo(AAIPluralFragment fragment) {
82         this.internalURI.path(relatedTo);
83         return new AAISimplePluralUri(this, fragment.get().build());
84     }
85
86 }