diff options
author | Benjamin, Max <max.benjamin@att.com> | 2020-04-28 15:13:12 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-04-28 15:26:09 -0400 |
commit | 4f774eeef8c1797c7073754412535be47ea1a8d7 (patch) | |
tree | 567fd081f18e7dbbfc068f326d748cf0dc5844db /common/src/main/java | |
parent | ac42fe6ee5e461c3053d40f23cc62882b6a59fe5 (diff) |
move aai-client into its own project
move aai-client into its own project
Issue-ID: SO-2837
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I20b700d160efbdf81ff22c9ca0fab73b28d3649b
Diffstat (limited to 'common/src/main/java')
126 files changed, 0 insertions, 8458 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java deleted file mode 100644 index d376d85a83..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.net.URI; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.RestClient; -import org.onap.so.client.graphinventory.GraphInventoryClient; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIClient extends GraphInventoryClient { - - private static final String AAI_ROOT = "/aai"; - protected static Logger logger = LoggerFactory.getLogger(AAIClient.class); - protected AAIVersion version; - - protected AAIClient() { - super(AAIProperties.class); - } - - protected AAIClient(AAIVersion version) { - super(AAIProperties.class); - this.version = version; - } - - @Override - protected URI constructPath(URI uri) { - - return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build(); - } - - @Override - protected RestClient createClient(URI uri) { - try { - - return new AAIRestClient(getRestProperties(), constructPath(uri)); - } catch (GraphInventoryUriComputationException | NotFoundException e) { - logger.debug("failed to construct A&AI uri", e); - throw e; - } - } - - @Override - public AAIVersion getVersion() { - if (version == null) { - return this.<AAIProperties>getRestProperties().getDefaultVersion(); - } else { - return this.version; - } - } - - - @Override - public String getGraphDBName() { - return "A&AI"; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java deleted file mode 100644 index 66ea8f950e..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; -import java.util.Optional; -import javax.annotation.Priority; -import javax.ws.rs.ext.Provider; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.aai.entities.AAIError; -import org.slf4j.MDC; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Provider -@Priority(Integer.MIN_VALUE) -public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper { - - private final String requestId; - - public AAIClientResponseExceptionMapper() { - this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); - } - - @Override - public Optional<String> extractMessage(String entity) { - - String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " "; - try { - AAIError error = new ObjectMapper().readValue(entity, AAIError.class); - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - return Optional.of(errorString + formatter.getMessage()); - } catch (IOException e) { - return Optional.of(errorString + entity); - } - } - - protected String getRequestId() { - return this.requestId; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java deleted file mode 100644 index bb2b2eca19..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider; - -public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider { - - - public AAICommonObjectMapperPatchProvider() { - super(); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java deleted file mode 100644 index b75f40eb39..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; - -public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider { - - public AAICommonObjectMapperProvider() { - super(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java deleted file mode 100644 index 135341a2f4..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.aai.entities.Configuration; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.serviceinstancebeans.RequestDetails; - -public class AAIConfigurationClient { - - private AAIResourcesClient aaiClient; - - private static final String ORCHESTRATION_STATUS = "PreCreated"; - - public AAIConfigurationClient() { - aaiClient = new AAIResourcesClient(); - } - - public void createConfiguration(RequestDetails requestDetails, String configurationId, String configurationType, - String configurationSubType) { - - AAIResourceUri uri = getConfigurationURI(configurationId); - Configuration payload = - configurePayload(requestDetails, configurationId, configurationType, configurationSubType); - - aaiClient.create(uri, payload); - } - - public Configuration configurePayload(RequestDetails requestDetails, String configurationId, - String configurationType, String configurationSubType) { - - Configuration payload = new Configuration(); - payload.setConfigurationId(configurationId); - payload.setConfigurationType(configurationType); - payload.setConfigurationSubType(configurationSubType); - payload.setModelInvariantId(requestDetails.getModelInfo().getModelInvariantId()); - payload.setModelVersionId(requestDetails.getModelInfo().getModelVersionId()); - payload.setOrchestrationStatus(ORCHESTRATION_STATUS); - payload.setOperationalStatus(""); - payload.setConfigurationSelflink(getConfigurationURI(configurationId).build().getPath()); - payload.setModelCustomizationId(requestDetails.getModelInfo().getModelCustomizationId()); - - return payload; - } - - public void deleteConfiguration(String uuid) { - aaiClient.delete(getConfigurationURI(uuid)); - } - - public void updateOrchestrationStatus(String uuid, String payload) { - aaiClient.update(getConfigurationURI(uuid), payload); - } - - public Configuration getConfiguration(String uuid) { - return aaiClient.get(Configuration.class, getConfigurationURI(uuid)).orElse(null); - } - - public boolean configurationExists(String uuid) { - return aaiClient.exists(getConfigurationURI(uuid)); - } - - public AAIResourceUri getConfigurationURI(String uuid) { - return AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, uuid); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java deleted file mode 100644 index 1747d97633..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryQueryClient; -import org.onap.so.client.graphinventory.entities.DSLQuery; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public class AAIDSLQueryClient - extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> { - - public AAIDSLQueryClient() { - super(new AAIClient()); - } - - public AAIDSLQueryClient(AAIVersion version) { - super(new AAIClient(version)); - } - - @Override - protected GraphInventoryUri getQueryUri() { - return AAIUriFactory.createResourceUri(AAIObjectType.DSL); - } - - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIObjectType createType(String name) { - return AAIObjectType.fromTypeName(name); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java deleted file mode 100644 index e255b297ed..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.util.List; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.ServiceException; - -public class AAIErrorFormatter { - - private final AAIError error; - - public AAIErrorFormatter(AAIError error) { - this.error = error; - } - - public String getMessage() { - if (error.getRequestError() != null && error.getRequestError().getServiceException() != null) { - ServiceException serviceException = error.getRequestError().getServiceException(); - return this.fillInTemplate(serviceException.getText(), serviceException.getVariables()); - } - - return "no parsable error message found"; - } - - protected String fillInTemplate(String text, List<String> variables) { - for (int i = 0; i < variables.size(); i++) { - variables.set(i, this.format(variables.get(i), variables)); - } - - return format(text, variables); - } - - protected String format(String s, List<String> variables) { - s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s"); - s = s.replaceAll("%(\\d{2})", "%%$1"); - return String.format(s, variables.toArray()); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java b/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java deleted file mode 100644 index 1225bb3fd5..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -public class AAINamespaceConstants { - - public static final String CLOUD_INFRASTRUCTURE = "/cloud-infrastructure"; - public static final String NETWORK = "/network"; - public static final String BUSINESS = "/business"; - public static final String SERVICE_DESIGN_AND_CREATION = "/service-design-and-creation"; - public static final String EXTERNAL_SYSTEM = "/external-system"; - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java deleted file mode 100644 index dab3cda32b..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface AAIObjectBase extends GraphInventoryObjectBase { - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java deleted file mode 100644 index d14a4bedc3..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.Serializable; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.constants.Defaults; -import com.google.common.base.CaseFormat; - -public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable { - - private static final long serialVersionUID = 5312713297525740746L; - - public static final AAIObjectPlurals CUSTOMER = - new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers"); - public static final AAIObjectPlurals GENERIC_VNF = - new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs"); - public static final AAIObjectPlurals PORT_GROUP = - new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups"); - public static final AAIObjectPlurals PSERVER = - new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"); - public static final AAIObjectPlurals P_INTERFACE = - new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"); - public static final AAIObjectPlurals L3_NETWORK = - new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks"); - public static final AAIObjectPlurals NETWORK_POLICY = - new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies"); - public static final AAIObjectPlurals VPN_BINDING = - new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings"); - public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION, - AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"); - public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE, - AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"); - public static final AAIObjectPlurals OWNING_ENTITY = - new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities"); - public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP, - AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups"); - public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE, - AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones"); - public static final AAIObjectPlurals VF_MODULE = - new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules"); - public static final AAIObjectPlurals CONFIGURATION = - new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations"); - public static final AAIObjectPlurals DEFAULT_TENANT = - new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE - + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants"); - public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY, - AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies"); - public static final AAIObjectPlurals LOGICAL_LINK = - new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links"); - public static final AAIObjectPlurals L_INTERFACE = - new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces"); - public static final AAIObjectPlurals SUB_L_INTERFACE = - new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces"); - public static final AAIObjectPlurals INSTANCE_GROUP = - new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups"); - public static final AAIObjectPlurals PNF = - new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs"); - - private final String uriTemplate; - private final String partialUri; - private final AAIObjectType type; - - protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) { - this.uriTemplate = parentUri + partialUri; - this.partialUri = partialUri; - this.type = type; - } - - @Override - public String toString() { - return this.uriTemplate(); - } - - @Override - public String uriTemplate() { - return this.uriTemplate; - } - - @Override - public String partialUri() { - return this.partialUri; - } - - @Override - public AAIObjectType getType() { - return this.type; - } - - @Override - public String typeName() { - return this.getType().typeName(); - } - - @Override - public String typeName(CaseFormat format) { - return this.getType().typeName(format); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java deleted file mode 100644 index c9b69cd9e4..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ /dev/null @@ -1,322 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import com.google.common.base.CaseFormat; -import org.onap.aai.annotations.Metadata; -import org.onap.aai.domain.yang.AggregateRoute; -import org.onap.aai.domain.yang.AllottedResource; -import org.onap.aai.domain.yang.AvailabilityZone; -import org.onap.aai.domain.yang.CloudRegion; -import org.onap.aai.domain.yang.Collection; -import org.onap.aai.domain.yang.CommunicationServiceProfile; -import org.onap.aai.domain.yang.Complex; -import org.onap.aai.domain.yang.Configuration; -import org.onap.aai.domain.yang.Connector; -import org.onap.aai.domain.yang.Customer; -import org.onap.aai.domain.yang.Device; -import org.onap.aai.domain.yang.EsrVnfm; -import org.onap.aai.domain.yang.ExtAaiNetwork; -import org.onap.aai.domain.yang.Flavor; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Image; -import org.onap.aai.domain.yang.InstanceGroup; -import org.onap.aai.domain.yang.L3Network; -import org.onap.aai.domain.yang.LInterface; -import org.onap.aai.domain.yang.LineOfBusiness; -import org.onap.aai.domain.yang.LogicalLink; -import org.onap.aai.domain.yang.ModelVer; -import org.onap.aai.domain.yang.NetworkPolicy; -import org.onap.aai.domain.yang.NetworkTechnology; -import org.onap.aai.domain.yang.OperationalEnvironment; -import org.onap.aai.domain.yang.OwningEntity; -import org.onap.aai.domain.yang.PInterface; -import org.onap.aai.domain.yang.PhysicalLink; -import org.onap.aai.domain.yang.Platform; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.PortGroup; -import org.onap.aai.domain.yang.Project; -import org.onap.aai.domain.yang.Pserver; -import org.onap.aai.domain.yang.RouteTableReference; -import org.onap.aai.domain.yang.Service; -import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceProfile; -import org.onap.aai.domain.yang.ServiceSubscription; -import org.onap.aai.domain.yang.SliceProfile; -import org.onap.aai.domain.yang.SpPartner; -import org.onap.aai.domain.yang.SriovPf; -import org.onap.aai.domain.yang.Subnet; -import org.onap.aai.domain.yang.Tenant; -import org.onap.aai.domain.yang.TunnelXconnect; -import org.onap.aai.domain.yang.Vce; -import org.onap.aai.domain.yang.VfModule; -import org.onap.aai.domain.yang.VlanTag; -import org.onap.aai.domain.yang.Vnfc; -import org.onap.aai.domain.yang.VolumeGroup; -import org.onap.aai.domain.yang.VpnBinding; -import org.onap.aai.domain.yang.Vserver; -import org.onap.aai.domain.yang.Zone; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; -import org.onap.so.constants.Defaults; -import org.reflections.Reflections; -import org.reflections.scanners.SubTypesScanner; -import org.reflections.util.ClasspathHelper; -import org.reflections.util.ConfigurationBuilder; -import java.io.Serializable; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable { - - private static final long serialVersionUID = -2877184776691514600L; - private static Map<String, AAIObjectType> map = new HashMap<>(); - - public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType( - AAINamespaceConstants.CLOUD_INFRASTRUCTURE, - "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region"); - public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class); - public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query"); - public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess"); - public static final AAIObjectType SINGLE_TRANSACTION = - new AAIObjectType("/bulk/single-transaction", "", "single-transaction"); - public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class); - public static final AAIObjectType GENERIC_VNFS = - new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs"); - public static final AAIObjectType VF_MODULE = - new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class); - public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class); - public static final AAIObjectType NETWORK_POLICY = - new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class); - public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query"); - public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query"); - public static final AAIObjectType ROUTE_TABLE_REFERENCE = - new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class); - public static final AAIObjectType DEFAULT_TENANT = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" - + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant"); - public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class); - public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class); - public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class); - public static final AAIObjectType CONFIGURATION = - new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class); - public static final AAIObjectType PSERVER = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class); - public static final AAIObjectType SERVICE_SUBSCRIPTION = - new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class); - - public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType( - AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class); - - public static final AAIObjectType SERVICE = new AAIObjectType( - AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class); - public static final AAIObjectType SERVICE_INSTANCE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class); - public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class); - public static final AAIObjectType LINE_OF_BUSINESS = - new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class); - public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class); - public static final AAIObjectType OWNING_ENTITY = - new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class); - public static final AAIObjectType ALLOTTED_RESOURCE = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class); - public static final AAIObjectType ALLOTTED_RESOURCE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources"); - public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class); - public static final AAIObjectType OPERATIONAL_ENVIRONMENT = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class); - public static final AAIObjectType CLOUD_REGION = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class); - public static final AAIObjectType TENANT = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class); - public static final AAIObjectType VOLUME_GROUP = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class); - public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class); - public static final AAIObjectType MODEL_VER = new AAIObjectType( - AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class); - public static final AAIObjectType TUNNEL_XCONNECT = - new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class); - public static final AAIObjectType P_INTERFACE = - new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class); - public static final AAIObjectType SRIOV_PF = - new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class); - public static final AAIObjectType LOGICAL_LINK = - new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class); - public static final AAIObjectType PHYSICAL_LINK = - new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class); - public static final AAIObjectType INSTANCE_GROUP = - new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class); - public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class); - public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class); - public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class); - public static final AAIObjectType COMPLEX = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class); - public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class); - public static final AAIObjectType NETWORK_TECHNOLOGY = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class); - public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class); - public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class); - public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class); - public static final AAIObjectType EXT_AAI_NETWORK = - new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class); - public static final AAIObjectType AGGREGATE_ROUTE = - new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class); - public static final AAIObjectType L_INTERFACE = - new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class); - public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), - "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface"); - public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class); - public static final AAIObjectType FLAVOR = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class); - public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") { - - private static final long serialVersionUID = 9208984071038447607L; - - @Override - public boolean passThrough() { - return true; - } - }; - public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl"); - public static final AAIObjectType VNFM = new AAIObjectType( - AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class); - public static final AAIObjectType VNFM_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list"); - public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list", - "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list"); - public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType( - AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list"); - public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class); - public static final AAIObjectType AVAILIBILITY_ZONE = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class); - public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, - "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list"); - public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list", - "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list"); - public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class); - public static final AAIObjectType SERVICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class); - public static final AAIObjectType SERVICE_PROFILE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles"); - public static final AAIObjectType SLICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class); - public static final AAIObjectType SLICE_PROFILE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles"); - public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType( - AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles"); - public static final AAIObjectType QUERY_ALLOTTED_RESOURCE = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance"); - - private final String uriTemplate; - private final String parentUri; - private final String partialUri; - private final Class<?> aaiObjectClass; - private final String name; - - static { - /* Locate any AAIObjectTypes on the classpath and add them to our map */ - java.util.Collection<URL> packages = ClasspathHelper.forPackage(""); - Reflections r = - new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner())); - - Set<Class<? extends AAIObjectType>> resources = r.getSubTypesOf(AAIObjectType.class); - - for (Class<? extends AAIObjectType> customTypeClass : resources) { - AAIObjectType customType; - try { - customType = customTypeClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - } - } - } - - protected AAIObjectType() { - this.parentUri = null; - this.partialUri = null; - this.uriTemplate = null; - this.aaiObjectClass = null; - this.name = null; - } - - protected AAIObjectType(String parentUri, String partialUri, String name) { - this.parentUri = parentUri; - this.partialUri = partialUri; - this.uriTemplate = parentUri + partialUri; - this.aaiObjectClass = null; - this.name = name; - if (!AAIObjectType.map.containsKey(name)) { - AAIObjectType.map.put(name, this); - } - } - - protected AAIObjectType(String parentUri, Class<?> aaiObjectClass) { - this.parentUri = parentUri; - this.partialUri = removeParentUri(aaiObjectClass, parentUri); - this.uriTemplate = parentUri + partialUri; - this.aaiObjectClass = aaiObjectClass; - this.name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiObjectClass.getSimpleName()); - if (!AAIObjectType.map.containsKey(name)) { - AAIObjectType.map.put(name, this); - } - } - - @Override - public String toString() { - return this.uriTemplate(); - } - - public static AAIObjectType fromTypeName(String name) { - if (map.containsKey(name)) { - return map.get(name); - } else { - return AAIObjectType.UNKNOWN; - } - } - - @Override - public String typeName() { - return this.typeName(CaseFormat.LOWER_HYPHEN); - } - - @Override - public String typeName(CaseFormat format) { - return CaseFormat.LOWER_HYPHEN.to(format, this.name.replace("default-", "")); - } - - @Override - public String uriTemplate() { - return this.uriTemplate; - } - - @Override - public String partialUri() { - return this.partialUri; - } - - protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) { - return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replaceFirst(Pattern.quote(parentUri), ""); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIProperties.java b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java deleted file mode 100644 index 6505818758..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIProperties.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.RestProperties; - -public interface AAIProperties extends RestProperties { - - public AAIVersion getDefaultVersion(); - - public String getAuth(); - - public String getKey(); - - @Override - public default boolean mapNotFoundToEmpty() { - return true; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java deleted file mode 100644 index 634a65831f..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.CustomQuery; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryQueryClient; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public class AAIQueryClient - extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery, AAIResultWrapper, AAIObjectType> { - - public AAIQueryClient() { - super(new AAIClient()); - } - - public AAIQueryClient(AAIVersion version) { - super(new AAIClient(version)); - } - - @Override - protected GraphInventoryUri getQueryUri() { - return AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY); - } - - @Override - protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { - return super.setupQueryParams(uri); - } - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIObjectType createType(String name) { - return AAIObjectType.fromTypeName(name); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java deleted file mode 100644 index 8f16d815b6..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; - -public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIQueryObjectMapperProvider() { - super(); - AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); - // first Jaxb, second Jackson annotations - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); - - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java deleted file mode 100644 index 8e334de396..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.util.Optional; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.graphinventory.GraphInventoryResourcesClient; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; - -public class AAIResourcesClient extends - GraphInventoryResourcesClient<AAIResourcesClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> { - - private AAIClient aaiClient; - - public AAIResourcesClient() { - super(new AAIClient()); - aaiClient = (AAIClient) super.client; - } - - public AAIResourcesClient(AAIVersion version) { - super(new AAIClient(version)); - aaiClient = (AAIClient) super.client; - } - - public AAIResourcesClient(AAIClient client) { - super(client); - aaiClient = (AAIClient) super.client; - } - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIResultWrapper createWrapper(Object obj) { - return new AAIResultWrapper(obj); - } - - @Override - public AAITransactionalClient beginTransaction() { - return new AAITransactionalClient(this, aaiClient); - } - - @Override - public AAISingleTransactionClient beginSingleTransaction() { - return new AAISingleTransactionClient(this, aaiClient); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri) { - return super.buildRelationship(uri, Optional.empty()); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) { - return super.buildRelationship(uri, Optional.of(label)); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri, Optional<GraphInventoryEdgeLabel> label) { - return super.buildRelationship(uri, label); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java deleted file mode 100644 index 875571d71e..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIResourcesObjectMapperProvider() { - super(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java deleted file mode 100644 index 610ff728e9..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryRestClient; -import org.onap.logging.filter.base.ONAPComponents; - -public class AAIRestClient extends GraphInventoryRestClient { - - private final AAIProperties aaiProperties; - - protected AAIRestClient(AAIProperties props, URI uri) { - super(props, uri); - this.aaiProperties = props; - } - - @Override - public ONAPComponents getTargetEntity() { - return ONAPComponents.AAI; - } - - @Override - protected void initializeHeaderMap(Map<String, String> headerMap) { - headerMap.put("X-FromAppId", aaiProperties.getSystemName()); - headerMap.put("X-TransactionId", requestId); - String auth = aaiProperties.getAuth(); - String key = aaiProperties.getKey(); - - if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) { - addBasicAuthHeader(auth, key); - } - } - - @Override - protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() { - - return Optional.of(new AAIClientResponseExceptionMapper()); - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java deleted file mode 100644 index 2698bc347f..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; -import java.util.List; -import java.util.Optional; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.Pserver; - -public interface AAIRestClientI { - - List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException; - - void updateMaintenceFlagVnfId(String vnfId, boolean inMaint); - - GenericVnf getVnfByName(String vnfId); - - Optional<Pnf> getPnfByName(String pnfId); - - void createPnf(String pnfId, Pnf pnf); - - void updatePnf(String pnfId, Pnf pnf); -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java deleted file mode 100644 index f2f96ca905..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.Response; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.Pserver; -import org.onap.so.client.aai.entities.CustomQuery; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.Format; - -public class AAIRestClientImpl implements AAIRestClientI { - - private static final String PSERVER_VNF_QUERY = "pservers-fromVnf"; - - @Override - public List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException { - List<AAIResourceUri> startNodes = new ArrayList<>(); - startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); - String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY)); - - return this.getListOfPservers(jsonInput); - - } - - protected List<Pserver> getListOfPservers(String jsonInput) throws IOException { - ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - Results<Map<String, Pserver>> resultsFromJson = - mapper.readValue(jsonInput, new TypeReference<Results<Map<String, Pserver>>>() {}); - List<Pserver> results = new ArrayList<>(); - for (Map<String, Pserver> m : resultsFromJson.getResult()) { - results.add(m.get("pserver")); - } - return results; - } - - @Override - public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) { - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(inMaint); - new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf); - - } - - @Override - public GenericVnf getVnfByName(String vnfId) { - return new AAIResourcesClient() - .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null); - } - - @Override - public Optional<Pnf> getPnfByName(String pnfId) { - Response response = - new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId)); - if (response.getStatus() != 200) { - return Optional.empty(); - } else { - return Optional.of(response.readEntity(Pnf.class)); - } - } - - @Override - public void createPnf(String pnfId, Pnf pnf) { - new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), - Optional.of(pnf)); - } - - @Override - public void updatePnf(String pnfId, Pnf pnf) { - new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java deleted file mode 100644 index 687ff09c5a..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest; -import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; - -public class AAISingleTransactionClient extends - GraphInventoryTransactionClient<AAISingleTransactionClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> { - - private final SingleTransactionRequest request; - private AAIResourcesClient resourcesClient; - private AAIClient aaiClient; - - protected AAISingleTransactionClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { - super(); - this.resourcesClient = resourcesClient; - this.aaiClient = aaiClient; - this.request = new SingleTransactionRequest(); - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionClient#execute() - */ - @Override - public void execute() throws BulkProcessFailed { - try { - if (!this.request.getOperations().isEmpty()) { - RestClient client = - aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION)); - SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class); - if (response != null) { - final Optional<String> errorMessage = this.locateErrorMessages(response); - if (errorMessage.isPresent()) { - throw new BulkProcessFailed( - "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" - + errorMessage.get()); - } - } else { - throw new BulkProcessFailed( - "Transactions acccepted by A&AI, but there was no response. Unsure of result."); - } - } - } finally { - this.request.getOperations().clear(); - this.actionCount = 0; - } - } - - @Override - public void execute(boolean dryRun) throws BulkProcessFailed { - final ObjectMapper mapper = new ObjectMapper(); - if (dryRun) { - try { - if (logger.isDebugEnabled()) { - logger.debug("Would execute: {}", mapper.writeValueAsString(this.request)); - } - } catch (JsonProcessingException e) { - logger.debug("Could not format request to JSON", e); - } - } else { - this.execute(); - } - } - - protected Optional<String> locateErrorMessages(SingleTransactionResponse response) { - final List<String> errorMessages = new ArrayList<>(); - final ObjectMapper mapper = new ObjectMapper(); - - for (OperationBodyResponse body : response.getOperationResponses()) { - if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) { - AAIError error; - try { - error = mapper.readValue(mapper.writeValueAsString(body.getResponseBody()), AAIError.class); - } catch (IOException e) { - logger.error("could not parse error object from A&AI", e); - error = new AAIError(); - } - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - String outputMessage = formatter.getMessage(); - errorMessages.add(outputMessage); - } - } - - if (!errorMessages.isEmpty()) { - return Optional.of(Joiner.on("\n").join(errorMessages)); - } else { - return Optional.empty(); - } - } - - protected SingleTransactionRequest getRequest() { - return this.request; - } - - @Override - protected void put(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body)); - } - - @Override - protected void delete(String uri) { - request.getOperations() - .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object())); - } - - @Override - protected void delete(String uri, Object obj) { - request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj)); - } - - @Override - protected void patch(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body)); - } - - @Override - protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) { - return resourcesClient.get(genericType, clone); - } - - @Override - protected boolean exists(AAIBaseResourceUri<?, ?> uri) { - return resourcesClient.exists(uri); - } - - @Override - protected String getGraphDBName() { - return aaiClient.getGraphDBName(); - } - - @Override - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java deleted file mode 100644 index a8cd8bae39..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ /dev/null @@ -1,228 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.bulkprocess.OperationBody; -import org.onap.so.client.aai.entities.bulkprocess.Transaction; -import org.onap.so.client.aai.entities.bulkprocess.Transactions; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; - -public class AAITransactionalClient extends - GraphInventoryTransactionClient<AAITransactionalClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> { - - private final Transactions transactions; - private Transaction currentTransaction; - - private AAIResourcesClient resourcesClient; - private AAIClient aaiClient; - - protected AAITransactionalClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { - super(); - this.resourcesClient = resourcesClient; - this.aaiClient = aaiClient; - this.transactions = new Transactions(); - startTransaction(); - } - - private void startTransaction() { - Transaction transaction = new Transaction(); - transactions.getTransactions().add(transaction); - currentTransaction = transaction; - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#beginNewTransaction() - */ - public AAITransactionalClient beginNewTransaction() { - startTransaction(); - return this; - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#execute() - */ - @Override - public void execute() throws BulkProcessFailed { - try { - if (!this.transactions.getTransactions().isEmpty()) { - RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS)); - Response response = client.put(this.transactions); - if (response.hasEntity()) { - final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class)); - if (errorMessage.isPresent()) { - throw new BulkProcessFailed( - "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" - + errorMessage.get()); - } - } else { - throw new BulkProcessFailed( - "Transactions acccepted by A&AI, but there was no response. Unsure of result."); - } - } - } finally { - this.transactions.getTransactions().clear(); - this.currentTransaction = null; - this.actionCount = 0; - } - } - - @Override - public void execute(boolean dryRun) throws BulkProcessFailed { - final ObjectMapper mapper = new ObjectMapper(); - if (dryRun) { - try { - if (logger.isDebugEnabled()) { - logger.debug("Would execute: {}", mapper.writeValueAsString(this.transactions)); - } - } catch (JsonProcessingException e) { - logger.debug("Could not format request to JSON", e); - } - } else { - this.execute(); - } - } - - protected Optional<String> locateErrorMessages(String response) { - final List<String> errorMessages = new ArrayList<>(); - final List<String> results = JsonPathUtil.getInstance().locateResultList(response, "$..body"); - final ObjectMapper mapper = new ObjectMapper(); - if (!results.isEmpty()) { - List<Map<String, Object>> parsed = new ArrayList<>(); - try { - for (String result : results) { - parsed.add(mapper.readValue(result, new TypeReference<Map<String, Object>>() {})); - } - } catch (IOException e) { - logger.error("could not map json", e); - } - for (Map<String, Object> map : parsed) { - for (Entry<String, Object> entry : map.entrySet()) { - if (!entry.getKey().matches("2\\d\\d")) { - AAIError error; - try { - error = mapper.readValue(entry.getValue().toString(), AAIError.class); - } catch (IOException e) { - logger.error("could not parse error object from A&AI", e); - error = new AAIError(); - } - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - String outputMessage = formatter.getMessage(); - logger.error("part of a bulk action failed in A&AI: " + entry.getValue()); - errorMessages.add(outputMessage); - } - } - } - } - - if (!errorMessages.isEmpty()) { - return Optional.of(Joiner.on("\n").join(errorMessages)); - } else { - return Optional.empty(); - } - } - - private Relationship buildRelationship(AAIResourceUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) { - final Relationship result = new Relationship(); - result.setRelatedLink(uri.build().toString()); - if (label.isPresent()) { - result.setRelationshipLabel(label.toString()); - } - return result; - } - - protected Transactions getTransactions() { - return this.transactions; - } - - @Override - protected void put(String uri, Object body) { - currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body)); - } - - @Override - protected void delete(String uri) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null)); - } - - @Override - protected void delete(String uri, Object obj) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj)); - } - - @Override - protected void patch(String uri, Object body) { - currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body)); - } - - @Override - protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) { - return resourcesClient.get(genericType, clone); - } - - @Override - protected boolean exists(AAIBaseResourceUri<?, ?> uri) { - return resourcesClient.exists(uri); - } - - @Override - protected String getGraphDBName() { - return aaiClient.getGraphDBName(); - } - - @Override - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java deleted file mode 100644 index e8a2bc6c9c..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -public interface AAIUpdator { - - void updateVnfToLocked(String vnfName) throws Exception; - - void updateVnfToUnLocked(String vnfName) throws Exception; - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java deleted file mode 100644 index b2223be688..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.springframework.beans.factory.annotation.Autowired; - -public class AAIUpdatorImpl implements AAIUpdator { - - @Autowired - protected AAIRestClientI client; - - public AAIRestClientI getClient() { - return client; - } - - - public void setClient(AAIRestClientI client) { - this.client = client; - } - - @Override - public void updateVnfToLocked(String vnfId) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, true); - } - - @Override - public void updateVnfToUnLocked(String vnfId) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, false); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidator.java b/common/src/main/java/org/onap/so/client/aai/AAIValidator.java deleted file mode 100644 index f191311b2a..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; - -public interface AAIValidator { - - boolean isPhysicalServerLocked(String hostName) throws IOException; - - boolean isVNFLocked(String vnfId); - - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java deleted file mode 100644 index 96844ff1cb..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import java.io.IOException; -import java.util.List; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; -import org.springframework.beans.factory.annotation.Autowired; - - -public class AAIValidatorImpl implements AAIValidator { - - - @Autowired - protected AAIRestClientI client; - - public AAIRestClientI getClient() { - return client; - } - - - public void setClient(AAIRestClientI client) { - this.client = client; - } - - @Override - public boolean isPhysicalServerLocked(String vnfId) throws IOException { - List<Pserver> pservers; - boolean isLocked = false; - pservers = client.getPhysicalServerByVnfId(vnfId); - if (pservers != null) { - for (Pserver pserver : pservers) { - if (pserver.isInMaint()) { - isLocked = true; - return isLocked; - } - } - } - return isLocked; - } - - @Override - public boolean isVNFLocked(String vnfId) { - boolean isLocked = false; - GenericVnf genericVnf = client.getVnfByName(vnfId); - if (genericVnf.isInMaint()) - isLocked = true; - - return isLocked; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java deleted file mode 100644 index 42887884db..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryVersion; - -public enum AAIVersion implements GraphInventoryVersion { - V10("V10"), - V11("V11"), - V12("V12"), - V13("v13"), - V14("v14"), - V15("v15"), - V16("v16"), - V17("v17"), - V18("v18"), - V19("v19"); - - public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; - private final String value; - - private AAIVersion(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } -} - - diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java deleted file mode 100644 index 456f14e5ee..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; - -public enum AAIEdgeLabel implements GraphInventoryEdgeLabel { - - BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), - USES("org.onap.relationships.inventory.Uses"), - COMPOSED_OF("org.onap.relationships.inventory.ComposedOf"); - - private final String label; - - private AAIEdgeLabel(String label) { - this.label = label; - } - - - @Override - public String toString() { - return this.label; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java deleted file mode 100644 index ee3ffd9bbf..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -public class AAIEntity { - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java deleted file mode 100644 index 5989a6579d..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import org.onap.so.client.aai.entities.uri.AAIResourceUri; - -public interface AAIEntityObject { - - public AAIResourceUri getUri(); - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java deleted file mode 100644 index 10828acd96..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"requestError"}) -public class AAIError { - - @JsonProperty("requestError") - private RequestError requestError; - - @JsonProperty("requestError") - public RequestError getRequestError() { - return requestError; - } - - @JsonProperty("requestError") - public void setRequestError(RequestError requestError) { - this.requestError = requestError; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java deleted file mode 100644 index ab3284dd8f..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import java.io.Serializable; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIResultWrapper extends GraphInventoryResultWrapper<Relationships> implements Serializable { - - private static final long serialVersionUID = 5895841925807816737L; - private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class); - - public AAIResultWrapper(String json) { - super(json, logger); - } - - public AAIResultWrapper(Object aaiObject) { - super(aaiObject, logger); - } - - @Override - protected Relationships createRelationships(String json) { - return new Relationships(json); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java b/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java deleted file mode 100644 index 81c07b2cf4..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"configuration-id", "configuration-type", "configuration-sub-type", "model-invariant-id", - "model-version-id", "orchestration-status", "operational-status", "configuration-selflink", - "model-customization-id"}) -public class Configuration { - - @JsonProperty("configuration-id") - private String configurationId; - @JsonProperty("configuration-name") - private String configurationName; - @JsonProperty("configuration-type") - private String configurationType; - @JsonProperty("configuration-sub-type") - private String configurationSubType; - @JsonProperty("model-invariant-id") - private String modelInvariantId; - @JsonProperty("model-version-id") - private String modelVersionId; - @JsonProperty("orchestration-status") - private String orchestrationStatus; - @JsonProperty("operational-status") - private String operationalStatus; - @JsonProperty("configuration-selflink") - private String configurationSelflink; - @JsonProperty("model-customization-id") - private String modelCustomizationId; - - @JsonProperty("configuration-id") - public String getConfigurationId() { - return configurationId; - } - - @JsonProperty("configuration-id") - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - - @JsonProperty("configuration-name") - public String getConfigurationName() { - return configurationName; - } - - @JsonProperty("configuration-name") - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - - @JsonProperty("configuration-type") - public String getConfigurationType() { - return configurationType; - } - - @JsonProperty("configuration-type") - public void setConfigurationType(String configurationType) { - this.configurationType = configurationType; - } - - @JsonProperty("configuration-sub-type") - public String getConfigurationSubType() { - return configurationSubType; - } - - @JsonProperty("configuration-sub-type") - public void setConfigurationSubType(String configurationSubType) { - this.configurationSubType = configurationSubType; - } - - @JsonProperty("model-invariant-id") - public String getModelInvariantId() { - return modelInvariantId; - } - - @JsonProperty("model-invariant-id") - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - @JsonProperty("model-version-id") - public String getModelVersionId() { - return modelVersionId; - } - - @JsonProperty("model-version-id") - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - @JsonProperty("orchestration-status") - public String getOrchestrationStatus() { - return orchestrationStatus; - } - - @JsonProperty("orchestration-status") - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - @JsonProperty("operational-status") - public String getOperationalStatus() { - return operationalStatus; - } - - @JsonProperty("operational-status") - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - - @JsonProperty("model-customization-id") - public String getModelCustomizationId() { - return modelCustomizationId; - } - - @JsonProperty("model-customization-id") - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } - - @JsonProperty("configuration-selflink") - public String getConfigurationSelflink() { - return configurationSelflink; - } - - @JsonProperty("configuration-selflink") - public void setConfigurationSelflink(String configurationSelflink) { - this.configurationSelflink = configurationSelflink; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java deleted file mode 100644 index 3433e36151..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import com.fasterxml.jackson.annotation.JsonInclude; - - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class CustomQuery { - - private List<String> start; - private String query; - private String gremlin; - - public CustomQuery(List<AAIResourceUri> start) { - this.setStart(start); - } - - public CustomQuery(List<AAIResourceUri> start, String query) { - this.setStart(start); - this.query = "query/" + query; - } - - public CustomQuery(String gremlin) throws UnsupportedEncodingException { - this.gremlin = gremlin; - } - - public String getGremlin() { - return gremlin; - } - - public void setGremlin(String gremlin) { - this.gremlin = gremlin; - } - - public List<String> getStart() { - return start; - } - - public void setStart(List<AAIResourceUri> start) { - this.start = this.mapUris(start); - } - - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - private List<String> mapUris(List<AAIResourceUri> uris) { - final List<String> result = new ArrayList<>(); - uris.stream().map(item -> item.build().toString()).forEach(result::add); - return result; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java b/common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java deleted file mode 100644 index c662b4e465..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -@FunctionalInterface -public interface QueryStep { - - - public String build(); -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java deleted file mode 100644 index 91f2ee121e..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import java.util.List; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import org.onap.so.client.graphinventory.entities.GraphInventoryRelationships; - -public class Relationships extends GraphInventoryRelationships<AAIResultWrapper, AAIResourceUri, AAIObjectType> { - - public Relationships(String json) { - super(json); - } - - @Deprecated - /** - * Use getRelatedUris instead - * - * @return - */ - public List<AAIResourceUri> getRelatedAAIUris() { - return this.getRelatedUris(); - } - - @Deprecated - /** - * Use getRelatedUris instead - * - * @return - */ - public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) { - return this.getRelatedUris(type); - } - - - protected AAIResultWrapper get(AAIResourceUri uri) { - return new AAIResourcesClient().get(uri); - - } - - @Override - protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) { - - return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build()); - } - - @Override - protected AAIObjectType fromTypeName(String name) { - return AAIObjectType.fromTypeName(name); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java b/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java deleted file mode 100644 index 1a9001df11..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"serviceException"}) -public class RequestError { - - @JsonProperty("serviceException") - private ServiceException serviceException; - - @JsonProperty("serviceException") - public ServiceException getServiceException() { - return serviceException; - } - - @JsonProperty("serviceException") - public void setServiceException(ServiceException serviceException) { - this.serviceException = serviceException; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/Results.java b/common/src/main/java/org/onap/so/client/aai/entities/Results.java deleted file mode 100644 index a62c6adec1..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/Results.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - - - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"results"}) -public class Results<T> { - @JsonProperty("results") - protected List<T> results; - - @JsonProperty("results") - public List<T> getResult() { - if (results == null) { - results = new ArrayList<>(); - } - return this.results; - } - - @JsonProperty("results") - public void setResult(List<T> results) { - this.results = results; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java b/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java deleted file mode 100644 index de08dd9a81..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"messageId", "text", "variables"}) -public class ServiceException { - - @JsonProperty("messageId") - private String messageId; - @JsonProperty("text") - private String text; - @JsonProperty("variables") - private List<String> variables = new ArrayList<>(); - - @JsonProperty("messageId") - public String getMessageId() { - return messageId; - } - - @JsonProperty("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - @JsonProperty("text") - public String getText() { - return text; - } - - @JsonProperty("text") - public void setText(String text) { - this.text = text; - } - - @JsonProperty("variables") - public List<String> getVariables() { - return variables; - } - - @JsonProperty("variables") - public void setVariables(List<String> variables) { - this.variables = variables; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java deleted file mode 100644 index 45f2c965f9..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.bulkprocess; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"uri", "body"}) -public class OperationBody { - - @JsonProperty("uri") - private String uri; - @JsonProperty("body") - @JsonSerialize(using = OperationBodySerializer.class) - private Object body; - - @JsonProperty("uri") - public String getUri() { - return uri; - } - - @JsonProperty("uri") - public void setUri(String uri) { - this.uri = uri; - } - - public OperationBody withUri(String uri) { - this.uri = uri; - return this; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @JsonProperty("body") - public void setBody(Object body) { - this.body = body; - } - - public OperationBody withBody(Object body) { - this.body = body; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java deleted file mode 100644 index 7181e96aa4..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.bulkprocess; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class OperationBodySerializer extends StdSerializer<Object> { - - private static final long serialVersionUID = 5367385969270400106L; - - public OperationBodySerializer() { - this(null); - } - - public OperationBodySerializer(Class<Object> t) { - super(t); - } - - @Override - public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if (value instanceof String) { - gen.writeRawValue((String) value); - } else { - gen.writeObject(value); - } - - } - -} - diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java deleted file mode 100644 index 3b4351d768..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.bulkprocess; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"patch", "patch", "delete"}) -public class Transaction { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("put") - private List<OperationBody> put = new ArrayList<>(); - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("patch") - private List<OperationBody> patch = new ArrayList<>(); - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("delete") - private List<OperationBody> delete = new ArrayList<>(); - - @JsonProperty("put") - public List<OperationBody> getPut() { - return put; - } - - @JsonProperty("put") - public void setPut(List<OperationBody> put) { - this.put = put; - } - - public Transaction withPut(List<OperationBody> put) { - this.put = put; - return this; - } - - @JsonProperty("patch") - public List<OperationBody> getPatch() { - return patch; - } - - @JsonProperty("patch") - public void setPatch(List<OperationBody> patch) { - this.patch = patch; - } - - public Transaction withPatch(List<OperationBody> patch) { - this.patch = patch; - return this; - } - - @JsonProperty("delete") - public List<OperationBody> getDelete() { - return delete; - } - - @JsonProperty("delete") - public void setDelete(List<OperationBody> delete) { - this.delete = delete; - } - - public Transaction withDelete(List<OperationBody> delete) { - this.delete = delete; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java deleted file mode 100644 index 69e8a18a3e..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.bulkprocess; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"transactions"}) -public class Transactions { - - @JsonProperty("transactions") - private List<Transaction> transactions = new ArrayList<>(); - - @JsonProperty("transactions") - public List<Transaction> getTransactions() { - return transactions; - } - - @JsonProperty("transactions") - public void setTransactions(List<Transaction> transactions) { - this.transactions = transactions; - } - - public Transactions withTransactions(List<Transaction> transactions) { - this.transactions = transactions; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java deleted file mode 100644 index b2d67af156..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.singletransaction; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"action", "uri", "body"}) -public class OperationBodyRequest { - - @JsonProperty("action") - private String action; - @JsonProperty("uri") - private String uri; - @JsonProperty("body") - @JsonSerialize(using = OperationBodyRequestSerializer.class) - private Object body; - - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public OperationBodyRequest withAction(String action) { - this.action = action; - return this; - } - - @JsonProperty("uri") - public String getUri() { - return uri; - } - - @JsonProperty("uri") - public void setUri(String uri) { - this.uri = uri; - } - - public OperationBodyRequest withUri(String uri) { - this.uri = uri; - return this; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @JsonProperty("body") - public void setBody(Object body) { - this.body = body; - } - - public OperationBodyRequest withBody(Object body) { - this.body = body; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java deleted file mode 100644 index addc3f1364..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.singletransaction; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class OperationBodyRequestSerializer extends StdSerializer<Object> { - - private static final long serialVersionUID = 5367385969270400106L; - - public OperationBodyRequestSerializer() { - this(null); - } - - public OperationBodyRequestSerializer(Class<Object> t) { - super(t); - } - - @Override - public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if (value instanceof String) { - gen.writeRawValue((String) value); - } else { - gen.writeObject(value); - } - - } - -} - diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java deleted file mode 100644 index c5b11fe1f7..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.singletransaction; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonPropertyOrder({"action", "uri", "response-status-code", "response-body"}) -public class OperationBodyResponse { - - @JsonProperty("action") - public String action; - @JsonProperty("uri") - public String uri; - @JsonProperty("response-status-code") - public Integer responseStatusCode; - @JsonProperty("response-body") - public Object responseBody; - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JsonProperty("response-status-code") - public Integer getResponseStatusCode() { - return responseStatusCode; - } - - @JsonProperty("response-status-code") - public void setResponseStatusCode(Integer responseStatusCode) { - this.responseStatusCode = responseStatusCode; - } - - @JsonProperty("response-body") - public Object getResponseBody() { - return responseBody; - } - - @JsonProperty("response-body") - public void getResponseBody(Object responseBody) { - this.responseBody = responseBody; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java deleted file mode 100644 index af32ca9498..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.singletransaction; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class SingleTransactionRequest { - - @JsonProperty("operations") - public List<OperationBodyRequest> operations; - - public List<OperationBodyRequest> getOperations() { - - if (operations == null) { - operations = new ArrayList<>(); - } - - return operations; - } - - public void setOperations(List<OperationBodyRequest> operations) { - this.operations = operations; - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java deleted file mode 100644 index 525956c5a9..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.singletransaction; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class SingleTransactionResponse { - - @JsonProperty("operation-responses") - public List<OperationBodyResponse> operationResponses; - - @JsonProperty("operation-responses") - public List<OperationBodyResponse> getOperationResponses() { - if (operationResponses == null) { - operationResponses = new ArrayList<>(); - } - return operationResponses; - } - - @JsonProperty("operation-responses") - public void setOperationResponses(List<OperationBodyResponse> operationResponses) { - this.operationResponses = operationResponses; - } - - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java deleted file mode 100644 index 67f858a2bf..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectBase; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; - -public interface AAIBaseResourceUri<T extends AAIBaseResourceUri<?, ?>, OT extends AAIObjectBase> - extends AAIUri<T, OT>, GraphInventoryResourceUri<T, OT> { - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java deleted file mode 100644 index 2cec021c95..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; - -public interface AAIPluralResourceUri extends AAIBaseResourceUri<AAIPluralResourceUri, AAIObjectPlurals>, - GraphInventoryPluralResourceUri<AAIPluralResourceUri, AAIObjectPlurals> { - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java deleted file mode 100644 index e93d52889a..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; - -public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>, - GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> { - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java deleted file mode 100644 index 9ab45a8aa9..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.SimplePluralUri; - -public class AAISimplePluralUri - extends SimplePluralUri<AAIPluralResourceUri, AAIResourceUri, AAIObjectPlurals, AAIObjectType> - implements AAIPluralResourceUri { - - private static final long serialVersionUID = -6397024057188453229L; - - protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) { - super(type, builder, values); - } - - protected AAISimplePluralUri(AAIObjectPlurals type) { - super(type); - } - - protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) { - super(type, values); - } - - protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) { - super(type, uri); - } - - protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) { - super(parentUri, childType); - } - - protected AAISimplePluralUri(AAISimplePluralUri copy) { - super(copy); - } - - @Override - public AAISimplePluralUri clone() { - return new AAISimplePluralUri(this); - } - - @Override - public AAIObjectPlurals getObjectType() { - return this.pluralType; - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java deleted file mode 100644 index 49dab59fc1..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.net.URI; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.SimpleUri; - -public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> - implements AAIResourceUri { - - private static final long serialVersionUID = -6397024057188453229L; - - protected AAISimpleUri(AAIObjectType type, Object... values) { - super(type, values); - - } - - protected AAISimpleUri(AAIObjectType type, URI uri) { - super(type, uri); - } - - protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) { - super(type, builder, values); - } - - protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { - super(parentUri, childType, childValues); - } - - // copy constructor - protected AAISimpleUri(AAISimpleUri copy) { - super(copy); - } - - @Override - public AAISimpleUri clone() { - return new AAISimpleUri(this); - } - - @Override - public AAISimpleUri relatedTo(AAIObjectType type, String... values) { - this.internalURI = internalURI.path(relatedTo); - return new AAISimpleUri(this, type, values); - } - - @Override - public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) { - this.internalURI.path(relatedTo); - return new AAISimplePluralUri(this, plural); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java deleted file mode 100644 index 8101643b78..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.util.regex.Pattern; -import org.onap.so.client.aai.AAIObjectBase; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public interface AAIUri<T extends AAIUri<?, ?>, OP extends AAIObjectBase> extends GraphInventoryUri<T, OP> { - - public default Pattern getPrefixPattern() { - return Pattern.compile("/aai/v\\d+"); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java deleted file mode 100644 index bdd3921851..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.net.URI; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; - - -public class AAIUriFactory { - - /** - * values are filled into the URI template specified in {@link AAIObjectType} in order <br> - * There are two special lookups performed on certain types when a single value is specified: <br> - * Service Instance and AllottedResources <br> - * These can be retrieved without all their required keys but an HTTP call is required to do so - * - * @param type - * @param values - * @return - */ - public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) { - if (AAIObjectType.SERVICE_INSTANCE.equals(type)) { - return new ServiceInstanceUri(values); - } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) { - return new AllottedResourceLookupUri(values); - } else { - return new AAISimpleUri(type, values); - } - } - - public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) { - return new NodesSingleUri(type, values); - - } - - public static NodesPluralUri createNodesUri(AAIObjectPlurals type) { - return new NodesPluralUri(type); - - } - - /** - * This method should only be used to wrap a URI retrieved from A&AI contained within an object response - * - * @param type - * @param uri - * @return - */ - public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) { - return new AAISimpleUri(type, uri); - } - - - /** - * creates an AAIResourceUri from a parentUri - * - * @param parentUri - * @param childType - * @param childValues - * @return - */ - public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, - Object... childValues) { - - return new AAISimpleUri(parentUri, childType, childValues); - } - - public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) { - - return new AAISimplePluralUri(parentUri, childType); - } - - /** - * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers - * - * @param type - * @return - */ - public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) { - - return new AAISimplePluralUri(type); - - } - - /** - * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers - * - * @param type - * @return - */ - public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) { - - return new AAISimplePluralUri(type, values); - - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java deleted file mode 100644 index 30e60cdff2..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.net.URI; -import java.util.Optional; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; - -public class AllottedResourceLookupUri extends HttpLookupUri { - - private static final long serialVersionUID = -9212594383876793188L; - - protected AllottedResourceLookupUri(Object... values) { - super(AAIObjectType.ALLOTTED_RESOURCE, values); - } - - protected AllottedResourceLookupUri(UriBuilder builder, Optional<String> cachedValue, Object... values) { - super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values); - } - - @Override - public AllottedResourceLookupUri clone() { - return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values); - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - @Override - public URI buildNoNetwork() { - return super.build(new String[] {"NONE", "NONE", "NONE", (String) this.values[0]}); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java deleted file mode 100644 index a0f1962706..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java +++ /dev/null @@ -1,174 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.entities.Pathed; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; -import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri { - - private transient Optional<String> cachedValue = Optional.empty(); - private final AAIObjectType aaiType; - - protected HttpLookupUri(AAIObjectType type, Object... values) { - super(type, values); - this.aaiType = type; - } - - protected HttpLookupUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue, Object... values) { - super(type, builder, values); - this.cachedValue = cachedValue; - this.aaiType = type; - } - - protected String getObjectById(Object id) - throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - if (!this.getCachedValue().isPresent()) { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED); - String resultJson; - try { - resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson(); - } catch (BadRequestException e) { - throw new GraphInventoryUriNotFoundException( - aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); - - } - try { - cachedValue = extractRelatedLink(resultJson); - if (!cachedValue.isPresent()) { - throw new GraphInventoryUriNotFoundException( - aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); - } - } catch (IOException e) { - throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e); - } - } - return cachedValue.get(); - } - - protected Optional<String> extractRelatedLink(String jsonString) throws IOException { - Optional<String> result; - ObjectMapper mapper = new ObjectMapper(); - - Results<Pathed> results = mapper.readValue(jsonString, new TypeReference<Results<Pathed>>() {}); - if (results.getResult().size() == 1) { - String uriString = results.getResult().get(0).getResourceLink(); - URI uri = UriBuilder.fromUri(uriString).build(); - String rawPath = uri.getRawPath(); - result = Optional.of(rawPath.replaceAll("/aai/v\\d+", "")); - } else if (results.getResult().isEmpty()) { - result = Optional.empty(); - } else { - throw new IllegalStateException("more than one result returned"); - } - - return result; - } - - protected Optional<String> getCachedValue() { - return this.cachedValue; - } - - @Override - public URI build() { - try { - if (this.values.length == 1) { - String uri = getObjectById(this.values[0]); - Map<String, String> map = super.getURIKeys(uri); - this.values = map.values().toArray(values); - return super.build(values); - } - } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { - throw new GraphInventoryUriComputationException(e); - } - return super.build(); - } - - @Override - public URI locateAndBuild() { - try { - if (this.values.length == 1) { - String uri = getObjectById(this.values[0]); - Map<String, String> map = super.getURIKeys(uri); - this.values = map.values().toArray(values); - return super.build(values); - } - } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { - throw new GraphInventoryUriComputationException(e); - } - return super.build(); - } - - @Override - public abstract HttpLookupUri clone(); - - @Override - public void validateValuesSize(String template, Object... values) { - try { - super.validateValuesSize(template, values); - } catch (IncorrectNumberOfUriKeys e) { - if (values.length == 1) { - // Special case where we perform an http look up - } else { - throw e; - } - } - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - - oos.writeUTF(this.cachedValue.orElse("")); - } - - private void readObject(ObjectInputStream ois) throws IOException { - - String value = ois.readUTF(); - if ("".equals(value)) { - this.cachedValue = Optional.empty(); - } else { - this.cachedValue = Optional.ofNullable(value); - } - - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java deleted file mode 100644 index 8545fc96fb..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public class NodesPluralUri extends AAISimplePluralUri implements NodesUri { - - private static final long serialVersionUID = -6743170679667245998L; - - protected NodesPluralUri(AAIObjectPlurals type) { - super(type); - } - - @Override - public String getTemplate(GraphInventoryObjectBase type) { - return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); - } -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java deleted file mode 100644 index 7274b1f3b9..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public class NodesSingleUri extends AAISimpleUri implements NodesUri { - - private static final long serialVersionUID = 2721165364903444248L; - - protected NodesSingleUri(AAIObjectType type, Object... values) { - super(type, values); - } - - - @Override - public String getTemplate(GraphInventoryObjectBase type) { - return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java deleted file mode 100644 index 6e5fa77f76..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -public interface NodesUri { - - -} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java deleted file mode 100644 index 0b62d05c67..0000000000 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.aai.entities.uri; - -import java.net.URI; -import java.util.Optional; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; - -public class ServiceInstanceUri extends HttpLookupUri { - - private static final long serialVersionUID = 2248914170527514548L; - - protected ServiceInstanceUri(Object... values) { - super(AAIObjectType.SERVICE_INSTANCE, values); - } - - protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) { - super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values); - } - - @Override - public ServiceInstanceUri clone() { - return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values); - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - @Override - public URI buildNoNetwork() { - return super.build(new String[] {"NONE", "NONE", (String) this.values[0]}); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java b/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java deleted file mode 100644 index c483bd2caf..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class EmptyStringToNullSerializer extends StdSerializer<String> { - - private static final long serialVersionUID = 5367385969270400106L; - - public EmptyStringToNullSerializer() { - this(null); - } - - public EmptyStringToNullSerializer(Class<String> t) { - super(t); - } - - @Override - public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if ("".equals(value)) { - gen.writeNull(); - } else { - gen.writeString(value); - } - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java deleted file mode 100644 index 078b35aaf4..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public enum Format { - - RESOURCE("resource"), - RESOURCE_AND_URL("resource_and_url"), - SIMPLE("simple"), - RAW("raw"), - CONSOLE("console"), - PATHED("pathed"), - GRAPHSON("graphson"), - ID("id"), - COUNT("count"); - - private final String name; - - private Format(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java deleted file mode 100644 index 09efb5a48d..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.net.URI; -import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; -import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; - -public abstract class GraphInventoryClient { - - private RestProperties props; - - protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) { - - RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass); - this.props = props; - } - - protected abstract URI constructPath(URI uri); - - protected abstract RestClient createClient(URI uri); - - public RestClient createClient(GraphInventoryUri uri) { - final URI result; - if (uri instanceof HttpAwareUri) { - result = ((HttpAwareUri) uri).locateAndBuild(); - } else { - result = uri.build(); - } - - return createClient(result); - - } - - - public <T extends RestProperties> T getRestProperties() { - if (props == null) { - throw new IllegalStateException("No RestProperty implementation found on classpath"); - } - return (T) props; - } - - public abstract GraphInventoryVersion getVersion(); - - public abstract String getGraphDBName(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java deleted file mode 100644 index 2facdaa64e..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class GraphInventoryCommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperProvider { - - - public GraphInventoryCommonObjectMapperPatchProvider() { - super(); - EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer(); - SimpleModule emptyStringModule = new SimpleModule(); - emptyStringModule.addSerializer(String.class, sp); - mapper.registerModule(emptyStringModule); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java deleted file mode 100644 index a4f9496d17..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import org.onap.so.client.policy.CommonObjectMapperProvider; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; - -public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapperProvider { - - public GraphInventoryCommonObjectMapperProvider() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); - // first Jaxb, second Jackson annotations - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java deleted file mode 100644 index 72de833884..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectBase - extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial { - - public default boolean passThrough() { - return false; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java deleted file mode 100644 index bb547e30e8..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import com.google.common.base.CaseFormat; - -public interface GraphInventoryObjectName { - - public String typeName(); - - public String typeName(CaseFormat format); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java deleted file mode 100644 index 84604a76cf..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectPlurals extends GraphInventoryObjectBase { - - public GraphInventoryObjectType getType(); - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java deleted file mode 100644 index d09a83a644..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectType extends GraphInventoryObjectBase { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java deleted file mode 100644 index 0207595f7f..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectUriPartial { - - public String partialUri(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java deleted file mode 100644 index bcc26535ff..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectUriTemplate { - - public String uriTemplate(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java deleted file mode 100644 index d1bc6bc61e..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import org.onap.so.client.aai.AAICommonObjectMapperPatchProvider; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.JsonProcessingException; - -public class GraphInventoryPatchConverter { - - private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider(); - private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider(); - private static final Pattern LOCATE_COMPLEX_OBJECT = - Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$"); - - - public String convertPatchFormat(Object obj) { - return validatePatchObject(marshallObjectToPatchFormat(obj)); - } - - public String validatePatchObject(String payload) { - if (hasComplexObject(payload)) { - throw new GraphInventoryPatchDepthExceededException(payload); - } - - return payload; - } - - /** - * validates client side that json does not include any complex objects relationship-list is omitted from this - * validation - */ - protected boolean hasComplexObject(String json) { - if (json.isEmpty()) { - return false; - } - String complex = "$.*.*"; - String array = "$.*.*.*"; - List<String> result = JsonPathUtil.getInstance().getPathList(json, complex); - List<String> result2 = JsonPathUtil.getInstance().getPathList(json, array); - - result.addAll(result2); - return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find()); - } - - protected String marshallObjectToPatchFormat(Object obj) { - Object value = obj; - try { - if (!(obj instanceof Map || obj instanceof String)) { - value = patchProvider.getMapper().writeValueAsString(obj); - } else if (obj instanceof Map) { - value = standardProvider.getMapper().writeValueAsString(obj); - } - } catch (JsonProcessingException e) { - value = "{}"; - } - - return (String) value; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java deleted file mode 100644 index 3ff564fcb2..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.stream.Collectors; -import javax.ws.rs.core.GenericType; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.onap.so.client.graphinventory.entities.Pathed; -import org.onap.so.client.graphinventory.entities.ResourceAndUrl; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; -import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInventoryResultWrapper<?>, Type extends GraphInventoryObjectType> { - - private Optional<String> depth = Optional.empty(); - private boolean nodesOnly = false; - private Optional<GraphInventorySubgraphType> subgraph = Optional.empty(); - private GraphInventoryClient client; - private GraphInventoryCommonObjectMapperProvider mapperProvider = new GraphInventoryCommonObjectMapperProvider(); - - public GraphInventoryQueryClient(GraphInventoryClient client) { - this.client = client; - } - - protected abstract GraphInventoryUri getQueryUri(); - - public String query(Format format, I query) { - return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, - String.class); - } - - protected <R> List<R> querySingleType(Format format, I query, Class<R> clazz) { - return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))) - .put(query, new GenericType<Results<Object>>() {}).getResult().stream().map(item -> { - try { - return mapperProvider.getMapper().readValue(mapperProvider.getMapper().writeValueAsString(item), - clazz); - } catch (IOException e) { - throw new IllegalArgumentException("could not map values from json", e); - } - }).collect(Collectors.toList()); - } - - public List<Pathed> queryPathed(I query) { - return querySingleType(Format.PATHED, query, Pathed.class); - } - - public List<Id> queryId(I query) { - return querySingleType(Format.ID, query, Id.class); - } - - public <R> List<R> querySingleResource(I query, Class<R> clazz) { - try { - return getResourceAndUrl(query).stream().map(item -> item.getWrapper().asBean(clazz).get()) - .collect(Collectors.toList()); - } catch (IOException e) { - throw new IllegalArgumentException("could not map values from json", e); - } - } - - public List<ResourceAndUrl<Wrapper>> getResourceAndUrl(I query) throws IOException { - List<ResourceAndUrl<Wrapper>> result = new ArrayList<>(); - ObjectMapper mapper = mapperProvider.getMapper(); - Results<Map<String, Object>> resultsFromJson = mapper.readValue(query(Format.RESOURCE_AND_URL, query), - new TypeReference<Results<Map<String, Object>>>() {}); - for (Map<String, Object> m : resultsFromJson.getResult()) { - for (Entry<String, Object> entrySet : m.entrySet()) { - if (!entrySet.getKey().equals("url")) { - String url = (String) m.get("url"); - String stringJson = mapper.writeValueAsString(entrySet.getValue()); - result.add( - new ResourceAndUrl<Wrapper>(url, createType(entrySet.getKey()), createWrapper(stringJson))); - } - } - } - - return result; - } - - public abstract Wrapper createWrapper(String json); - - public abstract Type createType(String name); - - public S depth(String depth) { - this.depth = Optional.of(depth); - return (S) this; - } - - public S nodesOnly() { - this.nodesOnly = true; - return (S) this; - } - - public S subgraph(GraphInventorySubgraphType type) { - - subgraph = Optional.of(type); - - return (S) this; - } - - protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { - GraphInventoryUri clone = uri.clone(); - if (this.depth.isPresent()) { - clone.queryParam("depth", depth.get()); - } - if (this.nodesOnly) { - clone.queryParam("nodesOnly", ""); - } - if (this.subgraph.isPresent()) { - clone.queryParam("subgraph", this.subgraph.get().toString()); - } - return clone; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java deleted file mode 100644 index f446e5ac4c..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java +++ /dev/null @@ -1,418 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; - -public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { - - protected GraphInventoryClient client; - - protected GraphInventoryResourcesClient(GraphInventoryClient client) { - this.client = client; - } - - /** - * creates a new object in GraphInventory - * - * @param obj - can be any object which will marshal into a valid GraphInventory payload - * @param uri - * @return - */ - public void create(SingleUri uri, Object obj) { - RestClient giRC = client.createClient(uri); - giRC.put(obj); - } - - /** - * creates a new object in GraphInventory with no payload body - * - * @param uri - * @return - */ - public void createEmpty(SingleUri uri) { - RestClient giRC = client.createClient(uri); - giRC.put(""); - } - - /** - * returns false if the object does not exist in GraphInventory - * - * @param uri - * @return - */ - public boolean exists(Uri uri) { - GraphInventoryResourceUri<?, ?> forceMinimal = (Uri) uri.clone(); - forceMinimal.format(Format.COUNT); - forceMinimal.limit(1); - try { - RestClient giRC = client.createClient(forceMinimal); - - return giRC.get().getStatus() == Status.OK.getStatusCode(); - } catch (NotFoundException e) { - return false; - } - } - - /** - * Adds a relationship between two objects in GraphInventory - * - * @param uriA - * @param uriB - * @return - */ - public void connect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.put(this.buildRelationship(uriB)); - } - - /** - * Adds a relationship between two objects in GraphInventory with a given edge label - * - * @param uriA - * @param uriB - * @param edge label - * @return - */ - public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.put(this.buildRelationship(uriB, label)); - } - - /** - * Removes relationship from two objects in GraphInventory - * - * @param uriA - * @param uriB - * @return - */ - public void disconnect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.delete(this.buildRelationship(uriB)); - } - - /** - * Deletes object from GraphInventory. Automatically handles resource-version. - * - * @param uri - * @return - */ - public void delete(SingleUri uri) { - GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone(); - RestClient giRC = client.createClient(clone); - Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow( - () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName())); - String resourceVersion = (String) result.get("resource-version"); - giRC = client.createClient(clone.resourceVersion(resourceVersion)); - giRC.delete(); - } - - /** - * @param obj - can be any object which will marshal into a valid GraphInventory payload - * @param uri - * @return - */ - public void update(SingleUri uri, Object obj) { - RestClient giRC = client.createClient(uri); - giRC.patch(obj); - } - - /** - * Retrieves an object from GraphInventory and unmarshalls it into the Class specified - * - * @param clazz - * @param uri - * @return - */ - public <T> Optional<T> get(Class<T> clazz, Uri uri) { - try { - return client.createClient(uri).get(clazz); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory and returns complete response - * - * @param uri - * @return - */ - public Response getFullResponse(Uri uri) { - try { - return client.createClient(uri).get(); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return e.getResponse(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List - * - * @param resultClass - * @param uri - * @return - */ - public <T> Optional<T> get(GenericType<T> resultClass, Uri uri) { - try { - return client.createClient(uri).get(resultClass); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - public <T, R> Optional<R> getOne(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) { - Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri); - - if (result.isPresent()) { - if (result.get().size() == 1) { - return Optional.of(result.get().get(0)); - } else { - throw new GraphInventoryMultipleItemsException(result.get().size(), uri); - } - } - - return Optional.empty(); - } - - public <T, R> Optional<R> getFirst(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) { - Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri); - - if (result.isPresent() && !result.get().isEmpty()) { - return Optional.of(result.get().get(0)); - } - - return Optional.empty(); - } - - public <T, R> Optional<Wrapper> getFirstWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) { - - Optional<R> result = getFirst(pluralClass, resultClass, uri); - if (result.isPresent()) { - return Optional.of(this.createWrapper(result.get())); - } else { - return Optional.empty(); - } - } - - public <T, R> Optional<Wrapper> getOneWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) { - - Optional<R> result = getOne(pluralClass, resultClass, uri); - if (result.isPresent()) { - return Optional.of(this.createWrapper(result.get())); - } else { - return Optional.empty(); - } - } - - protected <T, R> Optional<List<R>> unwrapPlural(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) { - try { - PluralUri clone = (PluralUri) uri.clone().limit(1); - Optional<T> obj = client.createClient(clone).get(pluralClass); - if (obj.isPresent()) { - Optional<Method> listMethod = Arrays.stream(obj.get().getClass().getMethods()).filter(method -> { - - Type returnType = method.getGenericReturnType(); - if (returnType instanceof ParameterizedType) { - Type[] types = ((ParameterizedType) returnType).getActualTypeArguments(); - if (types != null && types[0] instanceof Class) { - Class<?> listClass = (Class<?>) types[0]; - return resultClass.equals(listClass); - } - } - - return false; - }).findFirst(); - if (listMethod.isPresent()) { - try { - return Optional.of((List<R>) listMethod.get().invoke(obj.get())); - - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - } - return Optional.empty(); - - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features - * - * @param uri - * @return - */ - public Wrapper get(Uri uri) { - String json; - try { - json = client.createClient(uri).get(String.class).orElse(null); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - json = null; - } else { - throw e; - } - } - return this.createWrapper(json); - } - - /** - * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features If the object - * cannot be found in GraphInventory the method will throw the runtime exception included as an argument - * - * @param uri - * @return - */ - public Wrapper get(Uri uri, Class<? extends RuntimeException> c) { - String json; - try { - json = client.createClient(uri).get(String.class).orElseThrow(() -> createException(c, - uri.build() + " not found in " + client.getGraphDBName(), Optional.empty())); - } catch (NotFoundException e) { - throw createException(c, "could not construct uri for use with " + client.getGraphDBName(), Optional.of(e)); - } - - return this.createWrapper(json); - } - - private RuntimeException createException(Class<? extends RuntimeException> c, String message, - Optional<Throwable> t) { - RuntimeException e; - try { - if (t.isPresent()) { - e = c.getConstructor(String.class, Throwable.class).newInstance(message, t.get()); - } else { - e = c.getConstructor(String.class).newInstance(message); - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e1) { - throw new IllegalArgumentException("could not create instance for " + c.getName()); - } - - return e; - } - - /** - * Will automatically create the object if it does not exist - * - * @param obj - Optional object which serializes to a valid GraphInventory payload - * @param uri - * @return - */ - public Self createIfNotExists(SingleUri uri, Optional<Object> obj) { - if (!this.exists((Uri) uri)) { - if (obj.isPresent()) { - this.create(uri, obj.get()); - } else { - this.createEmpty(uri); - } - - } - return (Self) this; - } - - protected Relationship buildRelationship(SingleUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - protected Relationship buildRelationship(SingleUri uri, GraphInventoryEdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - protected Relationship buildRelationship(SingleUri uri, Optional<GraphInventoryEdgeLabel> label) { - final Relationship result = new Relationship(); - if (uri instanceof HttpAwareUri) { - result.setRelatedLink(((HttpAwareUri) uri).locateAndBuild().toString()); - } else { - result.setRelatedLink(uri.build().toString()); - } - if (label.isPresent()) { - result.setRelationshipLabel(label.get().toString()); - } - return result; - } - - public abstract Wrapper createWrapper(String json); - - public abstract Wrapper createWrapper(Object json); - - /** - * Starts a transaction which encloses multiple GraphInventory mutations - * - * @return - */ - public abstract TransactionalClient beginTransaction(); - - /** - * Starts a transaction groups multiple GraphInventory mutations - * - * @return - */ - public abstract SingleTransactionClient beginSingleTransaction(); - - public <T extends RestProperties> T getRestProperties() { - return client.getRestProperties(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java deleted file mode 100644 index babfa14d71..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.Response; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.RestClientSSL; -import org.onap.so.client.RestProperties; -import org.onap.so.client.policy.CommonObjectMapperProvider; -import org.onap.logging.filter.base.ONAPComponents; -import org.onap.logging.filter.base.ONAPComponentsList; - -public abstract class GraphInventoryRestClient extends RestClientSSL { - - protected static final GraphInventoryCommonObjectMapperProvider standardProvider = - new GraphInventoryCommonObjectMapperProvider(); - - protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); - - protected GraphInventoryRestClient(RestProperties props, URI uri) { - super(props, Optional.of(uri)); - } - - @Override - public abstract ONAPComponentsList getTargetEntity(); - - @Override - protected abstract void initializeHeaderMap(Map<String, String> headerMap); - - @Override - protected abstract Optional<ResponseExceptionMapper> addResponseExceptionMapper(); - - @Override - protected CommonObjectMapperProvider getCommonObjectMapperProvider() { - return standardProvider; - } - - @Override - public Response patch(Object obj) { - return super.patch(convertToPatchFormat(obj)); - } - - @Override - public <T> T patch(Object obj, Class<T> resultClass) { - return super.patch(convertToPatchFormat(obj), resultClass); - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - - protected String convertToPatchFormat(Object obj) { - return getPatchConverter().convertPatchFormat(obj); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java deleted file mode 100644 index d30f481ac8..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - - -public enum GraphInventorySubgraphType { - STAR("star"), PRUNE("prune"); - - private final String name; - - private GraphInventorySubgraphType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java deleted file mode 100644 index 8ee5ca4e80..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.GenericType; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> { - - protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); - - protected int actionCount = 0; - - protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); - - protected GraphInventoryTransactionClient() {} - - /** - * creates a new object in A&AI - * - * @param obj - can be any object which will marshal into a valid A&AI payload - * @param uri - * @return - */ - public Self create(SingleUri uri, Object obj) { - this.put(uri.build().toString(), obj); - incrementActionAmount(); - return (Self) this; - } - - /** - * creates a new object in A&AI with no payload body - * - * @param uri - * @return - */ - public Self createEmpty(SingleUri uri) { - this.put(uri.build().toString(), new HashMap<String, String>()); - incrementActionAmount(); - return (Self) this; - } - - /** - * Will automatically create the object if it does not exist - * - * @param obj - Optional object which serializes to a valid GraphInventory payload - * @param uri - * @return - */ - public Self createIfNotExists(SingleUri uri, Optional<Object> obj) { - if (!this.exists((Uri) uri)) { - if (obj.isPresent()) { - this.create(uri, obj.get()); - } else { - this.createEmpty(uri); - } - - } - return (Self) this; - } - - /** - * Adds a relationship between two objects in A&AI - * - * @param uriA - * @param uriB - * @return - */ - public Self connect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); - incrementActionAmount(); - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, List<SingleUri> uris) { - for (SingleUri uri : uris) { - this.connect(uriA, uri); - } - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label)); - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, List<SingleUri> uris, EdgeLabel label) { - for (SingleUri uri : uris) { - this.connect(uriA, uri, label); - } - return (Self) this; - } - - /** - * Removes relationship from two objects in A&AI - * - * @param uriA - * @param uriB - * @return - */ - public Self disconnect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); - incrementActionAmount(); - return (Self) this; - } - - /** - * Removes relationship from multiple objects - disconnects A from all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self disconnect(SingleUri uriA, List<SingleUri> uris) { - for (SingleUri uri : uris) { - this.disconnect(uriA, uri); - } - return (Self) this; - } - - /** - * Deletes object from A&AI. Automatically handles resource-version. - * - * @param uri - * @return - */ - public Self delete(SingleUri uri) { - Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri) - .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName())); - String resourceVersion = (String) result.get("resource-version"); - this.delete(uri.resourceVersion(resourceVersion).build().toString()); - incrementActionAmount(); - return (Self) this; - } - - protected abstract <T> Optional<T> get(GenericType<T> genericType, Uri clone); - - protected abstract boolean exists(Uri uri); - - protected abstract String getGraphDBName(); - - protected abstract void put(String uri, Object body); - - protected abstract void delete(String uri); - - protected abstract void delete(String uri, Object obj); - - protected abstract void patch(String uri, Object body); - - /** - * @param obj - can be any object which will marshal into a valid A&AI payload - * @param uri - * @return - */ - public Self update(Uri uri, Object obj) { - - final String payload = getPatchConverter().convertPatchFormat(obj); - this.patch(uri.build().toString(), payload); - incrementActionAmount(); - return (Self) this; - } - - private void incrementActionAmount() { - actionCount++; - } - - /** - * Executes all created transactions in A&AI - * - * @throws BulkProcessFailed - */ - public abstract void execute() throws BulkProcessFailed; - - - /** - * Executes all created transactions in A&AI, with optional dry run flag - * - * @throws BulkProcessFailed - */ - public abstract void execute(boolean dryrun) throws BulkProcessFailed; - - private Relationship buildRelationship(SingleUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - private Relationship buildRelationship(SingleUri uri, EdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - private Relationship buildRelationship(SingleUri uri, Optional<EdgeLabel> label) { - final Relationship result = new Relationship(); - result.setRelatedLink(uri.build().toString()); - if (label.isPresent()) { - result.setRelationshipLabel(label.toString()); - } - return result; - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java deleted file mode 100644 index 3b7dba70f8..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface GraphInventoryVersion { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java deleted file mode 100644 index 3c69f70b11..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory; - -public interface TransactionBuilder { - - - void put(String uri, Object body); - - void delete(String uri, Object body); - - void patch(String uri, Object body); - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java deleted file mode 100644 index 5802e9c4e8..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.so.client.aai.entities.QueryStep; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep { - - protected final String nodeName; - protected final List<DSLNodeKey> nodeKeys; - protected final StringBuilder query; - protected boolean output = false; - - public DSLNodeBase() { - this.nodeName = ""; - this.nodeKeys = new ArrayList<>(); - this.query = new StringBuilder(); - - } - - public DSLNodeBase(GraphInventoryObjectName name) { - this.nodeName = name.typeName(); - this.nodeKeys = new ArrayList<>(); - this.query = new StringBuilder(); - query.append(nodeName); - } - - public DSLNodeBase(GraphInventoryObjectName name, DSLNodeKey... key) { - this.nodeName = name.typeName(); - this.nodeKeys = Arrays.asList(key); - this.query = new StringBuilder(); - query.append(nodeName); - } - - public DSLNodeBase(DSLNodeBase<?> copy) { - this.nodeName = copy.nodeName; - this.nodeKeys = copy.nodeKeys; - this.query = new StringBuilder(copy.query); - this.output = copy.output; - } - - public DSLOutputNode output() { - this.output = true; - - return new DSLOutputNode(this); - } - - public T and(DSLNodeKey... key) { - this.nodeKeys.addAll(Arrays.asList(key)); - - return (T) this; - } - - @Override - public String build() { - StringBuilder result = new StringBuilder(query); - if (output) { - result.append("*"); - } - for (DSLNodeKey key : nodeKeys) { - result.append(key.build()); - } - - return result.toString(); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java deleted file mode 100644 index e301edb0fd..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.so.client.aai.entities.QueryStep; -import com.google.common.base.Joiner; - - -public class DSLNodeKey implements QueryStep { - - private boolean not = false; - private final StringBuilder query = new StringBuilder(); - private final String keyName; - private final List<Object> values; - - public DSLNodeKey(String keyName, Object... value) { - - this.keyName = keyName; - this.values = Arrays.asList(value); - } - - public DSLNodeKey not() { - - this.not = true; - return this; - } - - @Override - public String build() { - StringBuilder result = new StringBuilder(query); - - if (not) { - result.append(" !"); - } - result.append("('").append(keyName).append("', "); - List<Object> temp = new ArrayList<>(); - for (Object item : values) { - if ("null".equals(item)) { - temp.add(String.format("' %s '", item)); - } else if ("".equals(item)) { - temp.add("' '"); - } else { - if (item instanceof String) { - temp.add(String.format("'%s'", item)); - } else { - temp.add(item); - } - } - } - result.append(Joiner.on(", ").join(temp)).append(")"); - - return result.toString(); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java deleted file mode 100644 index d799795650..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class DSLOutputNode extends DSLNodeBase<DSLOutputNode> implements Output { - - public DSLOutputNode(DSLNodeBase<?> copy) { - super(copy); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java deleted file mode 100644 index 1fa79a714c..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class DSLQuery { - - private String dsl; - - public DSLQuery() { - - } - - public DSLQuery(DSLTraversal<? extends Output> dsl) { - this.dsl = dsl.get(); - } - - public String getDsl() { - return dsl; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java deleted file mode 100644 index 7ff6e2ed22..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import org.onap.so.client.aai.entities.QueryStep; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import com.google.common.base.Joiner; - -public class DSLQueryBuilder<S, E> { - - private List<QueryStep> steps = new ArrayList<>(); - private String suffix = ""; - - protected DSLQueryBuilder() { - - } - - protected DSLQueryBuilder(QueryStep node) { - steps.add(node); - } - - public <T> DSLQueryBuilder<S, DSLNodeBase<?>> node(DSLNodeBase<?> node) { - steps.add(node); - - return (DSLQueryBuilder<S, DSLNodeBase<?>>) this; - } - - public DSLQueryBuilder<S, Node> output() { - Object obj = steps.get(steps.size() - 1); - if (obj instanceof DSLNodeBase) { - ((DSLNodeBase) steps.get(steps.size() - 1)).output(); - } else if (obj.getClass().getName().contains("$$Lambda$")) { - // process lambda expressions - for (Field f : obj.getClass().getDeclaredFields()) { - f.setAccessible(true); - Object o; - try { - o = f.get(obj); - if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) { - ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output(); - } - } catch (IllegalArgumentException | IllegalAccessException e) { - } - f.setAccessible(false); - break; - } - } - return (DSLQueryBuilder<S, Node>) this; - } - - @SafeVarargs - public final <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) { - - List<DSLQueryBuilder<?, ?>> unions = Arrays.asList(union); - steps.add(() -> { - StringBuilder query = new StringBuilder(); - - query.append("> [ ") - .append(Joiner.on(", ") - .join(unions.stream().map(item -> item.compile()).collect(Collectors.toList()))) - .append(" ]"); - return query.toString(); - }); - - return (DSLQueryBuilder<S, E2>) this; - } - - public DSLQueryBuilder<S, E> where(DSLQueryBuilder<?, ?> where) { - - steps.add(() -> { - StringBuilder query = new StringBuilder(); - query.append(where.compile()).append(")"); - String result = query.toString(); - if (!result.startsWith(">")) { - result = "> " + result; - } - return "(" + result; - }); - return this; - } - - public <E2> DSLQueryBuilder<S, E2> to(DSLQueryBuilder<?, E2> to) { - steps.add(() -> { - StringBuilder query = new StringBuilder(); - - query.append("> ").append(to.compile()); - return query.toString(); - }); - return (DSLQueryBuilder<S, E2>) this; - } - - public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) { - return (DSLQueryBuilder<S, E>) to(__.node(name)); - } - - public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) { - return (DSLQueryBuilder<S, E>) to(__.node(name, key)); - } - - public DSLQueryBuilder<S, E> limit(int limit) { - suffix = " LIMIT " + limit; - return this; - } - - public DSLTraversal<E> build() { - return new DSLTraversal<>(compile()); - } - - @Override - public String toString() { - return build().get(); - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return o.toString().equals(toString()); - } - return false; - } - - @Override - public int hashCode() { - - return compile().hashCode(); - } - - private String compile() { - return String.join(" ", steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix; - } - - protected QueryStep getFirst() { - return steps.get(0); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java deleted file mode 100644 index fb0772726f..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public class DSLStartNode extends DSLNodeBase<DSLStartNode> implements Start { - - - public DSLStartNode() { - super(); - } - - public DSLStartNode(GraphInventoryObjectName name) { - super(name); - } - - public DSLStartNode(GraphInventoryObjectName name, DSLNodeKey... key) { - super(name, key); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java deleted file mode 100644 index 40f80463b2..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class DSLTraversal<T> { - - private final String traversal; - - protected DSLTraversal(String traversal) { - this.traversal = traversal; - } - - public String get() { - return traversal; - } - - @Override - public String toString() { - return traversal; - } - - @Override - public int hashCode() { - return traversal.hashCode(); - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return this.toString().equals(o); - } - return false; - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java deleted file mode 100644 index e3542e863a..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -public interface GraphInventoryEdgeLabel { - - - @Override - public String toString(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java deleted file mode 100644 index 6e7b9c9f08..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Predicate; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> { - - protected final ObjectMapper mapper; - protected Map<String, Object> map; - protected final String jsonBody; - - public GraphInventoryRelationships(String json) { - this.jsonBody = json; - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - try { - this.map = mapper.readValue(json, new TypeReference<Map<String, Object>>() {}); - } catch (IOException e) { - this.map = new HashMap<>(); - } - } - - public List<Wrapper> getByType(GraphInventoryObjectName type) { - - return this.getAll(Optional.of(type)); - } - - public List<Wrapper> getAll() { - - return this.getAll(Optional.empty()); - } - - - public List<String> getRelatedLinks() { - return this.getRelatedLinks(Optional.empty()); - } - - public List<String> getRelatedLinks(GraphInventoryObjectName type) { - return this.getRelatedLinks(Optional.of(type)); - } - - public List<Uri> getRelatedUris() { - return this.getRelatedUris(x -> true); - } - - public List<Uri> getRelatedUris(GraphInventoryObjectName type) { - return this.getRelatedUris(x -> type.typeName().equals(x)); - } - - protected List<Uri> getRelatedUris(Predicate<String> p) { - List<Uri> result = new ArrayList<>(); - if (map.containsKey("relationship")) { - List<Map<String, Object>> relationships = (List<Map<String, Object>>) map.get("relationship"); - for (Map<String, Object> relationship : relationships) { - final String relatedTo = (String) relationship.get("related-to"); - if (p.test(relatedTo)) { - Type type; - type = fromTypeName(relatedTo); - final String relatedLink = (String) relationship.get("related-link"); - - result.add(createUri(type, relatedLink)); - } - } - } - return result; - } - - - - protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type) { - List<Uri> relatedLinks; - if (type.isPresent()) { - relatedLinks = this.getRelatedUris(type.get()); - } else { - relatedLinks = this.getRelatedUris(); - } - ArrayList<Wrapper> result = new ArrayList<>(); - for (Uri link : relatedLinks) { - result.add(this.get(link)); - } - return result; - } - - protected abstract Wrapper get(Uri uri); - - protected abstract Uri createUri(Type type, String relatedLink); - - protected abstract Type fromTypeName(String name); - - protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) { - String matcher = ""; - if (type.isPresent()) { - matcher = "[?(@.related-to=='" + type.get().typeName() + "')]"; - } - return JsonPathUtil.getInstance().locateResultList(this.jsonBody, - String.format("$.relationship%s.related-link", matcher)); - } - - public String getJson() { - return this.jsonBody; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java deleted file mode 100644 index 6a571038ee..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.jsonpath.JsonPathUtil; -import org.slf4j.Logger; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryResultWrapper<R extends GraphInventoryRelationships<?, ?, ?>> - implements Serializable { - - private static final long serialVersionUID = 5895841925807816727L; - protected final String jsonBody; - protected final ObjectMapper mapper; - private final transient Logger logger; - - protected GraphInventoryResultWrapper(String json, Logger logger) { - this.jsonBody = json; - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - this.logger = logger; - } - - protected GraphInventoryResultWrapper(Object aaiObject, Logger logger) { - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - this.jsonBody = mapObjectToString(aaiObject); - this.logger = logger; - } - - protected String mapObjectToString(Object aaiObject) { - try { - return mapper.writeValueAsString(aaiObject); - } catch (JsonProcessingException e) { - logger.warn("could not parse object into json - defaulting to empty object"); - return "{}"; - } - } - - public Optional<R> getRelationships() { - final String path = "$.relationship-list"; - if (isEmpty()) { - return Optional.empty(); - } - Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path); - if (result.isPresent()) { - return Optional.of(createRelationships(result.get())); - } else { - return Optional.empty(); - } - } - - protected abstract R createRelationships(String json); - - public String getJson() { - if (jsonBody == null) { - return "{}"; - } else { - return jsonBody; - } - } - - public Map<String, Object> asMap() { - - return asBean(new TypeReference<Map<String, Object>>() {}).orElse(new HashMap<>()); - } - - public <T> Optional<T> asBean(Class<T> clazz) { - if (isEmpty()) { - return Optional.empty(); - } - try { - return Optional.of(mapper.readValue(this.jsonBody, clazz)); - } catch (IOException e) { - return Optional.empty(); - } - } - - public <T> Optional<T> asBean(TypeReference<T> reference) { - if (isEmpty()) { - return Optional.empty(); - } - try { - return Optional.of(mapper.readValue(this.jsonBody, reference)); - } catch (IOException e) { - return Optional.empty(); - } - } - - public boolean isEmpty() { - return jsonBody == null; - } - - @Override - public String toString() { - return this.getJson(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java deleted file mode 100644 index 2951bc8d45..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -public class Id extends Resource { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java deleted file mode 100644 index cdaae7d91f..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public interface Node extends Output { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java deleted file mode 100644 index 06b8b65984..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.aai.entities.QueryStep; - -public interface Output extends QueryStep { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java deleted file mode 100644 index b848f1c597..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -public class Pathed extends Resource { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java deleted file mode 100644 index 1e7169d092..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"resource-type", "resource-link"}) -public class Resource { - - @JsonProperty("resource-type") - private String resourceType; - @JsonProperty("resource-link") - private String resourceLink; - - @JsonProperty("resource-type") - public String getResourceType() { - return resourceType; - } - - @JsonProperty("resource-type") - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @JsonProperty("resource-link") - public String getResourceLink() { - return resourceLink; - } - - @JsonProperty("resource-link") - public void setResourceLink(String resourceLink) { - this.resourceLink = resourceLink; - } - -} - diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java deleted file mode 100644 index 326bd06dfb..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public class ResourceAndUrl<Wrapper extends GraphInventoryResultWrapper> { - - private String url; - private GraphInventoryObjectType type; - private Wrapper wrapper; - - public ResourceAndUrl(String url, GraphInventoryObjectType type, Wrapper wrapper) { - this.url = url; - this.type = type; - this.wrapper = wrapper; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public Wrapper getWrapper() { - return wrapper; - } - - public void setWrapper(Wrapper wrapper) { - this.wrapper = wrapper; - } - - public GraphInventoryObjectType getType() { - return type; - } - - public void setType(GraphInventoryObjectType type) { - this.type = type; - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java deleted file mode 100644 index c649e36eca..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.aai.entities.QueryStep; - -public interface Start extends QueryStep { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java deleted file mode 100644 index 0af29f78e6..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class TraversalBuilder { - - - private TraversalBuilder() { - - } - - public static DSLQueryBuilder<Start, Start> fragment(Start node) { - return new DSLQueryBuilder<>(node); - } - - public static DSLQueryBuilder<Output, Output> traversal(Output node) { - return new DSLQueryBuilder<>(node); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java deleted file mode 100644 index ca0bd9e00d..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public class __ { - - protected __() { - - } - - public static <A> DSLQueryBuilder<A, A> identity() { - return new DSLQueryBuilder<>(); - } - - public static <A> DSLQueryBuilder<A, A> start(Start node) { - return new DSLQueryBuilder<>(node); - } - - public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name) { - - return __.<DSLStartNode>start(new DSLStartNode(name)); - } - - public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name, DSLNodeKey... key) { - return __.<DSLStartNode>start(new DSLStartNode(name, key)); - } - - public static DSLNodeKey key(String keyName, Object... value) { - return new DSLNodeKey(keyName, value); - } - - @SafeVarargs - public static final <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) { - - return __.<A>identity().union(traversal); - } - - public static <A> DSLQueryBuilder<A, A> where(DSLQueryBuilder<A, A> traversal) { - - return __.<A>identity().where(traversal); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java deleted file mode 100644 index d91f36c0c7..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -public enum Depth { - ZERO("0"), ONE("1"), TWO("2"), THREE("3"), FOUR("4"), FIVE("5"), SIX("6"), ALL("all"); - - private final String depth; - - private Depth(String s) { - - this.depth = s; - } - - - @Override - public String toString() { - return this.depth; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java deleted file mode 100644 index aa09702be8..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface GraphInventoryPluralResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase> - extends GraphInventoryResourceUri<T, OT> { - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java deleted file mode 100644 index 64933863d5..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface GraphInventoryResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase> - extends GraphInventoryUri<T, OT> { - - public T format(Format format); - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java deleted file mode 100644 index e45ff14a5e..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals> - extends GraphInventoryResourceUri<T, SingleObject> { - - public T resourceVersion(String version); - - public T relationshipAPI(); - - public P relatedTo(PluralObject plural); - - public T relatedTo(SingleObject type, String... values); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java deleted file mode 100644 index e3fda2fa23..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -import java.io.Serializable; -import java.net.URI; -import java.util.Map; -import java.util.regex.Pattern; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public interface GraphInventoryUri<T extends GraphInventoryUri<?, ?>, OT extends GraphInventoryObjectBase> - extends Serializable { - - public URI build(); - - /** - * By default GraphInventory enforces a depth of 1. Some objects can be told to retrieve objects nested beneath them - * by increasing this number. - * - * You can use 0 to restrict the returned information to only the object you requested You can use all to retrieve - * all nested objects (this should only be used if you really need a massive amount of information and are caching - * the retrieval) - * - * @param depth - * @return - */ - public T depth(Depth depth); - - /** - * Makes client only return object fields, no relationships - * - * @return - */ - public T nodesOnly(boolean nodesOnly); - - public T queryParam(String name, String... values); - - public T replaceQueryParam(String name, String... values); - - public T resultIndex(int index); - - public T resultSize(int size); - - public T limit(int size); - - public T clone(); - - /** - * returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType} - * - * @return - */ - public Map<String, String> getURIKeys(); - - public OT getObjectType(); - - public boolean equals(Object o); - - public int hashCode(); - - public Pattern getPrefixPattern(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java deleted file mode 100644 index 1ee3d57b6c..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -import java.net.URI; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; - -public interface HttpAwareUri extends AAIResourceUri { - - - public URI buildNoNetwork(); - - public URI locateAndBuild(); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java deleted file mode 100644 index fc1a008466..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.ws.rs.core.UriBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; -import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; -import org.springframework.web.util.UriUtils; - -public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase> - implements GraphInventoryResourceUri<T, S> { - - private static final long serialVersionUID = -1011069933894179423L; - protected transient UriBuilder internalURI; - protected static final String relationshipAPI = "/relationship-list/relationship"; - protected static final String relatedTo = "/related-to"; - protected Object[] values; - protected final S type; - protected final Parent parentUri; - protected final Map<String, Set<String>> queryParams = new HashMap<>(); - - protected SimpleBaseUri(S type, Object... values) { - this.type = type; - this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); - this.values = values; - this.parentUri = null; - validateValuesSize(this.getTemplate(type), values); - } - - protected SimpleBaseUri(S type, URI uri) { - if (!type.passThrough()) { - this.type = type; - this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); - this.values = - this.getURIKeys(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")).values().toArray(); - this.parentUri = null; - } else { - this.type = type; - this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")); - this.values = new Object[0]; - this.parentUri = null; - } - - } - - protected SimpleBaseUri(S type, UriBuilder builder, Object... values) { - this.internalURI = builder; - this.values = values; - this.type = type; - this.parentUri = null; - - } - - protected SimpleBaseUri(Parent parentUri, S childType, Object... childValues) { - this.type = childType; - this.internalURI = UriBuilder.fromUri(type.partialUri()); - this.values = childValues; - this.parentUri = parentUri; - - validateValuesSize(childType.partialUri(), values); - } - - protected SimpleBaseUri(SimpleBaseUri<T, Parent, S> copy) { - this.type = copy.type; - this.internalURI = copy.internalURI.clone(); - this.values = copy.values.clone(); - if (copy.parentUri != null) { - this.parentUri = (Parent) copy.parentUri.clone(); - } else { - this.parentUri = null; - } - } - - protected void setInternalURI(UriBuilder builder) { - this.internalURI = builder; - } - - @Override - public T queryParam(String name, String... values) { - this.internalURI = internalURI.queryParam(name, values); - if (queryParams.containsKey(name)) { - queryParams.get(name).addAll(Arrays.asList(values)); - } else { - queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); - } - return (T) this; - } - - @Override - public T replaceQueryParam(String name, String... values) { - this.internalURI = internalURI.replaceQueryParam(name, values); - queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); - return (T) this; - } - - @Override - public T resultIndex(int index) { - this.internalURI = internalURI.replaceQueryParam("resultIndex", index); - return (T) this; - } - - @Override - public T resultSize(int size) { - this.internalURI = internalURI.replaceQueryParam("resultSize", size); - return (T) this; - } - - @Override - public T limit(int size) { - this.resultIndex(0).resultSize(size); - return (T) this; - } - - @Override - public URI build() { - return build(this.values); - } - - protected URI build(Object... values) { - - // This is a workaround because resteasy does not encode URIs correctly - final String[] encoded = new String[values.length]; - for (int i = 0; i < values.length; i++) { - encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString()); - } - if (this.parentUri != null) { - return UriBuilder - .fromUri(this.parentUri.build().toString() + internalURI.buildFromEncoded(encoded).toString()) - .build(); - } else { - return internalURI.buildFromEncoded(encoded); - } - } - - @Override - public Map<String, String> getURIKeys() { - return this.getURIKeys(this.build().toString()); - } - - protected Map<String, String> getURIKeys(String uri) { - UriParser parser; - if (!("".equals(this.getTemplate(type)))) { - parser = new UriParserSpringImpl(this.getTemplate(type)); - } else { - return new HashMap<>(); - } - - - return parser.parse(uri); - } - - @Override - public abstract T clone(); - - @Override - public S getObjectType() { - return this.type; - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return this.toString().equals(o.toString()); - } - return false; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(this.toString()).toHashCode(); - } - - - @Override - public T depth(Depth depth) { - this.internalURI.replaceQueryParam("depth", depth.toString()); - return (T) this; - } - - @Override - public T nodesOnly(boolean nodesOnly) { - if (nodesOnly) { - this.internalURI.replaceQueryParam("nodes-only", ""); - } - return (T) this; - } - - @Override - public T format(Format format) { - this.internalURI.replaceQueryParam("format", format); - return (T) this; - } - - public void validateValuesSize(String template, Object... values) { - UriParser parser = new UriParserSpringImpl(template); - Set<String> variables = parser.getVariables(); - if (variables.size() != values.length) { - throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables)); - } - } - - protected String getTemplate(GraphInventoryObjectBase type) { - return type.uriTemplate(); - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } - - @Override - public String toString() { - return new ToStringBuilder(null, ToStringStyle.NO_CLASS_NAME_STYLE).append("type", type) - .append("parentUri", parentUri).append("values", values).append("queryParams", queryParams).toString(); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java deleted file mode 100644 index c0b6d573c1..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType> - extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable { - - private static final long serialVersionUID = -337701171277616439L; - - protected final PT pluralType; - - protected SimplePluralUri(PT type, UriBuilder builder, Object... values) { - super(type, builder, values); - this.pluralType = type; - } - - protected SimplePluralUri(PT type) { - super(type, new Object[0]); - this.pluralType = type; - } - - protected SimplePluralUri(PT type, Object... values) { - super(type, values); - this.pluralType = type; - } - - protected SimplePluralUri(Parent parentUri, PT childType) { - super(parentUri, childType, new Object[0]); - this.pluralType = childType; - } - - public SimplePluralUri(SimplePluralUri<T, Parent, PT, OT> copy) { - super(copy); - this.pluralType = copy.pluralType; - } - - protected void setInternalURI(UriBuilder builder) { - this.internalURI = builder; - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java deleted file mode 100644 index aff7392efe..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals> - extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> { - - private static final long serialVersionUID = -337701171277616439L; - protected static final String relationshipAPI = "/relationship-list/relationship"; - protected static final String relatedTo = "/related-to"; - - protected SimpleUri(S type, Object... values) { - super(type, values); - } - - protected SimpleUri(S type, URI uri) { - super(type, uri); - - } - - protected SimpleUri(S type, UriBuilder builder, Object... values) { - super(type, builder, values); - - } - - protected SimpleUri(T parentUri, S childType, Object... childValues) { - super(parentUri, childType, childValues); - } - - protected SimpleUri(SimpleBaseUri<T, T, S> copy) { - super(copy); - } - - @Override - public T resourceVersion(String version) { - this.internalURI = internalURI.replaceQueryParam("resource-version", version); - return (T) this; - } - - @Override - public T relationshipAPI() { - this.internalURI = internalURI.path(relationshipAPI); - return (T) this; - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java deleted file mode 100644 index 00000268a7..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri.parsers; - -import java.util.Map; -import java.util.Set; - -public interface UriParser { - public Set<String> getVariables(); - - public Map<String, String> parse(final String uri); -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java deleted file mode 100644 index 71afdb83d9..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.entities.uri.parsers; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import org.springframework.web.util.UriTemplate; -import org.springframework.web.util.UriUtils; - -public class UriParserSpringImpl implements UriParser { - - private final UriTemplate uriTemplate; - - public UriParserSpringImpl(final String template) { - this.uriTemplate = new UriTemplate(template); - } - - @Override - public Map<String, String> parse(final String uri) { - final boolean match = this.uriTemplate.matches(uri); - if (!match) { - return new LinkedHashMap<>(); - } - return Collections.unmodifiableMap(decodeParams(this.uriTemplate.match(uri))); - } - - @Override - public Set<String> getVariables() { - return Collections.unmodifiableSet(new LinkedHashSet<String>(this.uriTemplate.getVariableNames())); - } - - protected Map<String, String> decodeParams(Map<String, String> map) { - final Map<String, String> result = new LinkedHashMap<>(); - - for (Entry<String, String> entry : map.entrySet()) { - result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8")); - } - - return result; - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java deleted file mode 100644 index d69e83435b..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class BulkProcessFailed extends Exception { - - public BulkProcessFailed(String message) { - super(message); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java deleted file mode 100644 index d3c17ce9e9..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.onap.so.client.graphinventory.exceptions; - -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; - -public class GraphInventoryMultipleItemsException extends RuntimeException { - - private static final long serialVersionUID = -1596266941681036917L; - - public GraphInventoryMultipleItemsException(int size, GraphInventoryPluralResourceUri uri) { - super(String.format("Found %s objects at %s when we only expected to find one.", size, uri.build())); - } - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java deleted file mode 100644 index fe5f159291..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class GraphInventoryPatchDepthExceededException extends RuntimeException { - - private static final long serialVersionUID = -3740429832086738907L; - - - public GraphInventoryPatchDepthExceededException(String payload) { - super("Object exceeds allowed depth for update action: " + payload); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java deleted file mode 100644 index 45ebf9ee46..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class GraphInventoryPayloadException extends Exception { - - private static final long serialVersionUID = -5712783905947711065L; - - public GraphInventoryPayloadException(Throwable t) { - super(t); - } - - public GraphInventoryPayloadException(String s, Throwable t) { - super(s, t); - } - - public GraphInventoryPayloadException(String s) { - super(s); - } - - -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java deleted file mode 100644 index 380bce7165..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class GraphInventoryUriComputationException extends RuntimeException { - - private static final long serialVersionUID = 5187931752227522034L; - - public GraphInventoryUriComputationException(String s) { - super(s); - } - - public GraphInventoryUriComputationException(Throwable t) { - super(t); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java deleted file mode 100644 index 6637c89402..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class GraphInventoryUriNotFoundException extends Exception { - private static final long serialVersionUID = 2789643165122257833L; - - public GraphInventoryUriNotFoundException(String message) { - super(message); - } -} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java deleted file mode 100644 index ede8e481b2..0000000000 --- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.graphinventory.exceptions; - -public class IncorrectNumberOfUriKeys extends RuntimeException { - - private static final long serialVersionUID = 2189285428827817518L; - - public IncorrectNumberOfUriKeys(String message) { - super(message); - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java deleted file mode 100644 index 9b857dc08c..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java +++ /dev/null @@ -1,167 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import org.onap.so.client.dmaap.DmaapConsumer; -import org.onap.so.client.dmaap.DmaapPublisher; -import org.onap.so.client.sdno.beans.AAIParamList; -import org.onap.so.client.sdno.beans.Body; -import org.onap.so.client.sdno.beans.Input; -import org.onap.so.client.sdno.beans.RequestHdCustom; -import org.onap.so.client.sdno.beans.SDNO; -import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; -import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class SDNOHealthCheckClient { - - private static final String NODE_TYPE = "VROUTER"; - private static final String API_OPERATION_TYPE = "health-diagnostic-custom"; - private static final String MIRRORING_CHECK = "mirroring_check"; - private static final String CLIENT_NAME = "MSO"; - private static final String PRE_CHECK_CODE = "VROUTER000003"; - private static final String POST_CHECK_CODE = "VROUTER000004"; - private static final String LPORT_MIRRORING_CHECK = "lport_mirroring_check"; - private static final String CONFIGURATION_ID = "configuration-id"; - - - public boolean lPortMirrorHealthPreCheck(String userId, String requestId, Optional<String> clliCode, - String configurationId, String interfaceId) throws Exception { - String request = buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId); - return this.execute(requestId, request); - } - - public boolean lPortMirrorHealthPostCheck(String userId, String requestId, Optional<String> clliCode, - String configurationId, String interfaceId) throws Exception { - String request = buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId); - return this.execute(requestId, request); - } - - public boolean portMirrorHealthPreCheck(String userId, String requestId, Optional<String> clliCode, - String configurationId) throws Exception { - final String request = this.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId); - return this.execute(requestId, request); - } - - public boolean portMirrorHealthPostCheck(String userId, String requestId, Optional<String> clliCode, - String configurationId) throws Exception { - final String request = this.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId); - return this.execute(requestId, request); - } - - protected String buildLPortMirrorCheckPreRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId, String interfaceId) throws JsonProcessingException { - return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId, - PRE_CHECK_CODE); - } - - protected String buildLPortMirrorCheckPostRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId, String interfaceId) throws JsonProcessingException { - return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId, - POST_CHECK_CODE); - } - - protected String buildPortMirrorPreCheckRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId) throws JsonProcessingException { - return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, PRE_CHECK_CODE); - } - - protected String buildPortMirrorPostCheckRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId) throws JsonProcessingException { - return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, POST_CHECK_CODE); - } - - protected String buildPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId, String diagnosticCode) throws JsonProcessingException { - final AAIParamList list = new AAIParamList(); - list.setKey(CONFIGURATION_ID); - list.setValue(configurationId); - - return this.buildRequest(userId, requestId, clliCode, diagnosticCode, MIRRORING_CHECK, - Collections.singletonList(list)); - } - - protected String buildLPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode, - String configurationId, String interfaceId, String diagnosticCode) throws JsonProcessingException { - - final AAIParamList configurationIdParam = new AAIParamList(); - configurationIdParam.setKey(CONFIGURATION_ID); - configurationIdParam.setValue(configurationId); - final AAIParamList interfaceIdParam = new AAIParamList(); - interfaceIdParam.setKey("interface-id"); - interfaceIdParam.setValue(interfaceId); - final List<AAIParamList> list = new ArrayList<>(); - list.add(configurationIdParam); - list.add(interfaceIdParam); - return this.buildRequest(userId, requestId, clliCode, diagnosticCode, LPORT_MIRRORING_CHECK, list); - } - - - protected String buildRequest(String userId, String requestId, Optional<String> clliCode, String diagnosticCode, - String operationType, List<AAIParamList> paramList) throws JsonProcessingException { - - final RequestHdCustom hdCustom = new RequestHdCustom(); - hdCustom.withRequestUserId(userId).withRequestId(requestId).withRequestClientName(CLIENT_NAME) - .withHealthDiagnosticCode(diagnosticCode).withOperationType(operationType).withAaiParamList(paramList); - - final Input input = new Input(); - input.setRequestHdCustom(hdCustom); - final Body body = new Body(); - body.setInput(input); - final SDNO request = new SDNO(); - request.withBody(body).withOperation(API_OPERATION_TYPE).withNodeType(NODE_TYPE); - if (clliCode.isPresent()) { - request.setNodeLoc(clliCode.get()); - } - return this.getJson(request); - - } - - protected String getJson(SDNO obj) throws JsonProcessingException { - final ObjectMapper mapper = new ObjectMapper(); - return mapper.writeValueAsString(obj); - } - - protected DmaapPublisher getPublisher() throws FileNotFoundException, IOException { - return new SDNOHealthCheckDmaapPublisher(); - } - - protected DmaapConsumer getConsumer(String requestId) throws FileNotFoundException, IOException { - return new SDNOHealthCheckDmaapConsumer(requestId); - } - - protected boolean execute(String requestId, String request) throws Exception { - final DmaapPublisher publisher = this.getPublisher(); - publisher.send(request); - - final DmaapConsumer consumer = this.getConsumer(requestId); - - return consumer.consume(); - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java deleted file mode 100644 index 83624dec63..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno; - -import java.io.IOException; -import java.util.UUID; -import org.onap.aai.domain.yang.GenericVnf; - -public interface SDNOValidator { - - /** - * Issues a health diagnostic request for a given vnf to SDN-O - * - * @param vnfId - * @param uuid - * @param requestingUserId - * @return diagnostic result - * @throws IOException - * @throws Exception - */ - public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception; - - - /** - * Issues a health diagnostic request for a given GenericVnf to SDN-O - * - * @param genericVnf - * @param uuid - * @param requestingUserId - * @return diagnostic result - * @throws IOException - * @throws Exception - */ - public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) - throws IOException, Exception; - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java deleted file mode 100644 index 8e674fb77b..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Optional; -import java.util.UUID; -import javax.ws.rs.NotFoundException; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.dmaap.DmaapConsumer; -import org.onap.so.client.dmaap.DmaapPublisher; -import org.onap.so.client.sdno.beans.Body; -import org.onap.so.client.sdno.beans.Input; -import org.onap.so.client.sdno.beans.RequestHealthDiagnostic; -import org.onap.so.client.sdno.beans.SDNO; -import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; -import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class SDNOValidatorImpl implements SDNOValidator { - - private final static String clientName = "MSO"; - private final static String HEALTH_DIAGNOSTIC_CODE_DEFAULT = "default"; - - @Override - public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception { - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - AAIResourcesClient client = new AAIResourcesClient(); - GenericVnf vnf = client.get(GenericVnf.class, uri) - .orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI")); - - SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId); - ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(requestDiagnostic); - this.submitRequest(json); - boolean status = this.pollForResponse(uuid.toString()); - return status; - } - - @Override - public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) - throws IOException, Exception { - - SDNO requestDiagnostic = buildRequestDiagnostic(genericVnf, uuid, requestingUserId); - ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(requestDiagnostic); - this.submitRequest(json); - boolean status = this.pollForResponse(uuid.toString()); - return status; - } - - protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) { - - Optional<String> nfRole; - if (vnf.getNfRole() == null) { - nfRole = Optional.empty(); - } else { - nfRole = Optional.of(vnf.getNfRole()); - } - Input input = new Input(); - SDNO parentRequest = new SDNO(); - Body body = new Body(); - parentRequest.setBody(body); - parentRequest.setNodeType(nfRole.orElse("NONE").toUpperCase()); - parentRequest.setOperation("health-diagnostic"); - - body.setInput(input); - - RequestHealthDiagnostic request = new RequestHealthDiagnostic(); - - request.setRequestClientName(clientName); - request.setRequestNodeName(vnf.getVnfName()); - request.setRequestNodeUuid(vnf.getVnfId()); - request.setRequestNodeType(nfRole.orElse("NONE").toUpperCase()); - request.setRequestNodeIp(vnf.getIpv4OamAddress()); // generic-vnf oam ip - request.setRequestUserId(requestingUserId); // mech id? - request.setRequestId(uuid.toString()); // something to identify this request by for polling - request.setHealthDiagnosticCode(HEALTH_DIAGNOSTIC_CODE_DEFAULT); - - input.setRequestHealthDiagnostic(request); - - return parentRequest; - } - - protected void submitRequest(String json) throws FileNotFoundException, IOException, InterruptedException { - - DmaapPublisher publisher = new SDNOHealthCheckDmaapPublisher(); - publisher.send(json); - } - - protected boolean pollForResponse(String uuid) throws Exception { - DmaapConsumer consumer = this.getConsumer(uuid); - return consumer.consume(); - } - - - - protected DmaapConsumer getConsumer(String uuid) throws FileNotFoundException, IOException { - return new SDNOHealthCheckDmaapConsumer(uuid); - } - - - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java b/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java deleted file mode 100644 index 7e98355b4d..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"key", "value"}) -public class AAIParamList { - - @JsonProperty("key") - private String key; - @JsonProperty("value") - private String value; - - /** - * No args constructor for use in serialization - * - */ - public AAIParamList() {} - - /** - * - * @param value - * @param key - */ - public AAIParamList(String key, String value) { - super(); - this.key = key; - this.value = value; - } - - @JsonProperty("key") - public String getKey() { - return key; - } - - @JsonProperty("key") - public void setKey(String key) { - this.key = key; - } - - public AAIParamList withKey(String key) { - this.key = key; - return this; - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - public AAIParamList withValue(String value) { - this.value = value; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java deleted file mode 100644 index 8c40b749a6..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"input"}) -public class Body implements Serializable { - - @JsonProperty("input") - private Input input; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); - private static final long serialVersionUID = 9101706044452851559L; - - @JsonProperty("input") - public Input getInput() { - return input; - } - - @JsonProperty("input") - public void setInput(Input input) { - this.input = input; - } - - public Body withInput(Input input) { - this.input = input; - return this; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map<String, Object> map) { - this.additionalProperties = map; - } - - public Body withAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java deleted file mode 100644 index c8122c06f6..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"request-healthdiagnostic", "request-hd-custom"}) -public class Input implements Serializable { - - @JsonProperty("request-healthdiagnostic") - private RequestHealthDiagnostic RequestHealthDiagnostic; - @JsonProperty("request-hd-custom") - private RequestHdCustom requestHdCustom; - - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); - private final static long serialVersionUID = 7155546785389227528L; - - @JsonProperty("request-healthdiagnostic") - public RequestHealthDiagnostic getRequestHealthDiagnostic() { - return RequestHealthDiagnostic; - } - - @JsonProperty("request-healthdiagnostic") - public void setRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) { - this.RequestHealthDiagnostic = RequestHealthDiagnostic; - } - - @JsonProperty("request-hd-custom") - public RequestHdCustom getRequestHdCustom() { - return requestHdCustom; - } - - @JsonProperty("request-hd-custom") - public void setRequestHdCustom(RequestHdCustom requestHdCustom) { - this.requestHdCustom = requestHdCustom; - } - - public Input withRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) { - this.RequestHealthDiagnostic = RequestHealthDiagnostic; - return this; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map<String, Object> map) { - this.additionalProperties = map; - } - - public Input withAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java deleted file mode 100644 index 485f64673f..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"request-client-name", "request-user-id", "request-id", "health-diagnostic-code", "operation-type", - "send-detailed-cmd-response", "aai-param-list"}) -public class RequestHdCustom implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -206110458275127710L; - @JsonProperty("request-client-name") - private String requestClientName; - @JsonProperty("request-user-id") - private String requestUserId; - @JsonProperty("request-id") - private String requestId; - @JsonProperty("health-diagnostic-code") - private String healthDiagnosticCode; - @JsonProperty("operation-type") - private String operationType; - @JsonProperty("send-detailed-cmd-response") - private String sendDetailedCmdResponse = "false"; - @JsonProperty("aai-param-list") - private List<AAIParamList> aaiParamList = new ArrayList<>(); - - /** - * No args constructor for use in serialization - * - */ - public RequestHdCustom() {} - - /** - * - * @param requestClientName - * @param operationType - * @param requestId - * @param healthDiagnosticCode - * @param aaiParamList - * @param requestUserId - */ - public RequestHdCustom(String requestClientName, String requestUserId, String requestId, - String healthDiagnosticCode, String operationType, List<AAIParamList> aaiParamList) { - super(); - this.requestClientName = requestClientName; - this.requestUserId = requestUserId; - this.requestId = requestId; - this.healthDiagnosticCode = healthDiagnosticCode; - this.operationType = operationType; - this.aaiParamList = aaiParamList; - } - - @JsonProperty("request-client-name") - public String getRequestClientName() { - return requestClientName; - } - - @JsonProperty("request-client-name") - public void setRequestClientName(String requestClientName) { - this.requestClientName = requestClientName; - } - - public RequestHdCustom withRequestClientName(String requestClientName) { - this.requestClientName = requestClientName; - return this; - } - - @JsonProperty("request-user-id") - public String getRequestUserId() { - return requestUserId; - } - - @JsonProperty("request-user-id") - public void setRequestUserId(String requestUserId) { - this.requestUserId = requestUserId; - } - - public RequestHdCustom withRequestUserId(String requestUserId) { - this.requestUserId = requestUserId; - return this; - } - - @JsonProperty("request-id") - public String getRequestId() { - return requestId; - } - - @JsonProperty("request-id") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public RequestHdCustom withRequestId(String requestId) { - this.requestId = requestId; - return this; - } - - @JsonProperty("health-diagnostic-code") - public String getHealthDiagnosticCode() { - return healthDiagnosticCode; - } - - @JsonProperty("health-diagnostic-code") - public void setHealthDiagnosticCode(String healthDiagnosticCode) { - this.healthDiagnosticCode = healthDiagnosticCode; - } - - public RequestHdCustom withHealthDiagnosticCode(String healthDiagnosticCode) { - this.healthDiagnosticCode = healthDiagnosticCode; - return this; - } - - @JsonProperty("operation-type") - public String getOperationType() { - return operationType; - } - - @JsonProperty("operation-type") - public void setOperationType(String operationType) { - this.operationType = operationType; - } - - public RequestHdCustom withOperationType(String operationType) { - this.operationType = operationType; - return this; - } - - public void setSendDetailedCmdResponse(String sendDetailedCmdResponse) { - this.sendDetailedCmdResponse = sendDetailedCmdResponse; - } - - public String getSendDetailedCmdResponse() { - return sendDetailedCmdResponse; - } - - public RequestHdCustom withSendDetailedCmdResponse(String sendDetailedCmdResponse) { - this.sendDetailedCmdResponse = sendDetailedCmdResponse; - return this; - } - - @JsonProperty("aai-param-list") - public List<AAIParamList> getAaiParamList() { - return aaiParamList; - } - - @JsonProperty("aai-param-list") - public void setAaiParamList(List<AAIParamList> aaiParamList) { - this.aaiParamList = aaiParamList; - } - - public RequestHdCustom withAaiParamList(List<AAIParamList> aaiParamList) { - this.aaiParamList = aaiParamList; - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java deleted file mode 100644 index b1b75ab412..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java +++ /dev/null @@ -1,197 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"request-client-name", "request-node-name", "request-node-uuid", "request-node-ip", "request-id", - "request-user-id", "request-node-type", "health-diagnostic-code"}) -public class RequestHealthDiagnostic implements Serializable { - - @JsonProperty("request-client-name") - private String requestClientName; - @JsonProperty("request-node-name") - private String requestNodeName; - @JsonProperty("request-node-uuid") - private String requestNodeUuid; - @JsonProperty("request-node-ip") - private String requestNodeIp; - @JsonProperty("request-id") - private String requestId; - @JsonProperty("request-user-id") - private String requestUserId; - @JsonProperty("request-node-type") - private String requestNodeType; - @JsonProperty("health-diagnostic-code") - private String healthDiagnosticCode; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); - private static final long serialVersionUID = 1166788526178388021L; - - @JsonProperty("request-client-name") - public String getRequestClientName() { - return requestClientName; - } - - @JsonProperty("request-client-name") - public void setRequestClientName(String requestClientName) { - this.requestClientName = requestClientName; - } - - public RequestHealthDiagnostic withRequestClientName(String requestClientName) { - this.requestClientName = requestClientName; - return this; - } - - @JsonProperty("request-node-name") - public String getRequestNodeName() { - return requestNodeName; - } - - @JsonProperty("request-node-name") - public void setRequestNodeName(String requestNodeName) { - this.requestNodeName = requestNodeName; - } - - public RequestHealthDiagnostic withRequestNodeName(String requestNodeName) { - this.requestNodeName = requestNodeName; - return this; - } - - @JsonProperty("request-node-uuid") - public String getRequestNodeUuid() { - return requestNodeUuid; - } - - @JsonProperty("request-node-uuid") - public void setRequestNodeUuid(String requestNodeUuid) { - this.requestNodeUuid = requestNodeUuid; - } - - public RequestHealthDiagnostic withRequestNodeUuid(String requestNodeUuid) { - this.requestNodeUuid = requestNodeUuid; - return this; - } - - @JsonProperty("request-node-ip") - public String getRequestNodeIp() { - return requestNodeIp; - } - - @JsonProperty("request-node-ip") - public void setRequestNodeIp(String requestNodeIp) { - this.requestNodeIp = requestNodeIp; - } - - public RequestHealthDiagnostic withRequestNodeIp(String requestNodeIp) { - this.requestNodeIp = requestNodeIp; - return this; - } - - @JsonProperty("request-id") - public String getRequestId() { - return requestId; - } - - @JsonProperty("request-id") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public RequestHealthDiagnostic withRequestId(String requestId) { - this.requestId = requestId; - return this; - } - - @JsonProperty("request-user-id") - public String getRequestUserId() { - return requestUserId; - } - - @JsonProperty("request-user-id") - public void setRequestUserId(String requestUserId) { - this.requestUserId = requestUserId; - } - - public RequestHealthDiagnostic withRequestUserId(String requestUserId) { - this.requestUserId = requestUserId; - return this; - } - - @JsonProperty("request-node-type") - public String getRequestNodeType() { - return requestNodeType; - } - - @JsonProperty("request-node-type") - public void setRequestNodeType(String requestNodeType) { - this.requestNodeType = requestNodeType; - } - - public RequestHealthDiagnostic withRequestNodeType(String requestNodeType) { - this.requestNodeType = requestNodeType; - return this; - } - - @JsonProperty("health-diagnostic-code") - public String getHealthDiagnosticCode() { - return healthDiagnosticCode; - } - - @JsonProperty("health-diagnostic-code") - public void setHealthDiagnosticCode(String healthDiagnosticCode) { - this.healthDiagnosticCode = healthDiagnosticCode; - } - - public RequestHealthDiagnostic withHealthDiagnosticCode(String healthDiagnosticCode) { - this.healthDiagnosticCode = healthDiagnosticCode; - return this; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map<String, Object> map) { - this.additionalProperties = map; - } - - public RequestHealthDiagnostic withAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - return this; - } - -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java deleted file mode 100644 index 8b84cf6659..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"client-name", "code", "processing-host", "request-id", "status"}) -public class ResultInfo { - - @JsonProperty("client-name") - private String clientName; - @JsonProperty("code") - private String code; - @JsonProperty("processing-host") - private String processingHost; - @JsonProperty("request-id") - private String requestId; - @JsonProperty("status") - private String status; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); - - @JsonProperty("client-name") - public String getClientName() { - return clientName; - } - - @JsonProperty("client-name") - public void setClientName(String clientName) { - this.clientName = clientName; - } - - @JsonProperty("code") - public String getCode() { - return code; - } - - @JsonProperty("code") - public void setCode(String code) { - this.code = code; - } - - @JsonProperty("processing-host") - public String getProcessingHost() { - return processingHost; - } - - @JsonProperty("processing-host") - public void setProcessingHost(String processingHost) { - this.processingHost = processingHost; - } - - @JsonProperty("request-id") - public String getRequestId() { - return requestId; - } - - @JsonProperty("request-id") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - @JsonProperty("status") - public String getStatus() { - return status; - } - - @JsonProperty("status") - public void setStatus(String status) { - this.status = status; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map<String, Object> map) { - this.additionalProperties = map; - } -} diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java deleted file mode 100644 index 46e2c1d1fc..0000000000 --- a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdno.beans; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"operation", "nodeLoc", "nodeType", "body"}) -public class SDNO implements Serializable { - - @JsonProperty("operation") - private String operation; - @JsonProperty("nodeLoc") - private String nodeLoc; - @JsonProperty("nodeType") - private String nodeType; - @JsonProperty("body") - private Body body; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); - private static final long serialVersionUID = -5303297382564282650L; - - @JsonProperty("operation") - public String getOperation() { - return operation; - } - - @JsonProperty("operation") - public void setOperation(String operation) { - this.operation = operation; - } - - @JsonProperty("nodeLoc") - public String getNodeLoc() { - return nodeLoc; - } - - @JsonProperty("nodeLoc") - public void setNodeLoc(String nodeLoc) { - this.nodeLoc = nodeLoc; - } - - public SDNO withNodeLoc(String nodeLoc) { - this.nodeLoc = nodeLoc; - return this; - } - - public SDNO withOperation(String operation) { - this.operation = operation; - return this; - } - - @JsonProperty("nodeType") - public String getNodeType() { - return nodeType; - } - - @JsonProperty("nodeType") - public void setNodeType(String nodeType) { - this.nodeType = nodeType; - } - - public SDNO withNodeType(String nodeType) { - this.nodeType = nodeType; - return this; - } - - @JsonProperty("body") - public Body getBody() { - return body; - } - - @JsonProperty("body") - public void setBody(Body body) { - this.body = body; - } - - public SDNO withBody(Body body) { - this.body = body; - return this; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map<String, Object> map) { - this.additionalProperties = map; - } - - public SDNO SDNO(String name, Object value) { - this.additionalProperties.put(name, value); - return this; - } - -} |