import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.type.TypeFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
}
public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIResourceUri uri =
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
return uri.getURIKeys();
}
public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) {
return injectionHelper.getAaiClient()
- .get(ServiceInstance.class, AAIUriFactory
+ .get(ServiceInstance.class, AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)).depth(Depth.TWO))
.orElse(null);
}
public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName)
throws MultipleObjectsFoundException {
AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.L3_NETWORKS.getFragment()).queryParam("network-name", networkName);
Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
L3Network network = null;
public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) {
AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName);
return injectionHelper.getAaiClient().getOne(GenericVnfs.class, GenericVnf.class, uri);
public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId,
String configurationName) {
- AAIPluralResourceUri uri = AAIUriFactory
+ AAIPluralResourceUri uri = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.CONFIGURATIONS.getFragment()).queryParam("configuration-name", configurationName);
return injectionHelper.getAaiClient().getOne(Configurations.class, Configuration.class, uri);
import org.onap.so.serviceinstancebeans.RequestDetails;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
@RunWith(MockitoJUnitRunner.class)
public class BBInputSetupUtilsTest {
vnf.setVnfId(vnfId);
vnf.setVnfName(vnfName);
doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class,
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName));
Optional<GenericVnf> actual =
this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
configuration.setConfigurationId("id123");
doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class,
Configuration.class,
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123"))
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123"))
.relatedTo(Types.CONFIGURATIONS.getFragment())
.queryParam("configuration-name", "configuration-name123"));
Optional<Configuration> actual = this.bbInputSetupUtils
<artifactId>spring-boot-starter-data-jpa</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.onap.so</groupId>
<artifactId>aai-client</artifactId>
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
AAIResourceUri projectURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
}
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
Map<String, String> hashMap = new HashMap<>();
hashMap.put("owning-entity-name", owningEntityName);
getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI,
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
getAaiClient().connect(owningEntityURI, serviceInstanceURI);
}
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.slf4j.Logger;
try {
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
getAaiClient().delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
} catch (Exception ex) {
* 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.
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.slf4j.Logger;
AAIResourceUri projectURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
AAIResourcesClient aaiRC = new AAIResourcesClient();
aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
AAIResourcesClient aaiRC = new AAIResourcesClient();
aaiRC.connect(owningEntityURI, serviceInstanceURI);
}
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.slf4j.Logger;
try {
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
AAIResourcesClient aaiRC = new AAIResourcesClient();
aaiRC.delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
* 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.
import org.onap.aaiclient.client.aai.AAIRestClientImpl;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.springframework.stereotype.Component;
@Override
public void createRelation(String serviceInstanceId, String pnfName) {
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfName));
new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
}
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
/*
* This method is to create Relation between Parent & Child Services with Node as Composed Resource.
- *
+ *
*/
public void updateRelations(BuildingBlockExecution buildingBlockExecution) throws Exception {
client.create(composedResourceURI, composedResource);
AAIResourceUri childURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(childSvcInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(childSvcInstanceId));
client.connect(composedResourceURI, childURI);
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.logging.filter.base.ONAPComponents;
buildingBlockExecution.getLookupMap().get(ResourceKey.CHILD_SERVICE_INSTANCE_ID);
String parentServiceInstanceId = buildingBlockExecution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID);
ServiceInstance childInstanceAAI = aaiResourcesClient.get(ServiceInstance.class,
- AAIUriFactory
+ AAIClientUriFactory
.createResourceUri(
AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(childServiceInstanceId))
.depth(Depth.TWO))
.orElse(null);
ServiceInstance parentInstanceAAI =
aaiResourcesClient.get(ServiceInstance.class,
- AAIUriFactory.createResourceUri(
+ AAIClientUriFactory.createResourceUri(
AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(parentServiceInstanceId))
.depth(Depth.TWO))
.orElse(null);
ServiceInstance parentInstanceAAI =
aaiResourcesClient.get(ServiceInstance.class,
- AAIUriFactory.createResourceUri(
+ AAIClientUriFactory.createResourceUri(
AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(parentServiceInstanceId))
.depth(Depth.TWO))
.orElse(null);
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
AAIResourceUri configurationURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI);
}
AAIResourceUri configurationURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
AAIResourceUri configurationURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
}
* 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.
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
AAIResourceUri instanceGroupUri =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
.connect(instanceGroupUri, serviceInstanceURI);
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
AAIResourceUri networkURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI,
public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network,
ServiceInstance networkCollectionServiceInstance) {
- AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
+ AAIResourceUri networkCollectionServiceInstanceUri = AAIClientUriFactory.createResourceUri(
Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
AAIResourceUri networkURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionUri =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
- AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
+ AAIResourceUri networkCollectionServiceInstanceUri = AAIClientUriFactory.createResourceUri(
Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
}
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
public void createPnfAndConnectServiceInstance(Pnf pnf, ServiceInstance serviceInstance) {
AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()));
pnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf)))
.connect(pnfURI, serviceInstanceURI);
* 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.
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
private AAIObjectMapper aaiObjectMapper;
public boolean existsServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
return injectionHelper.getAaiClient().exists(serviceInstanceURI);
}
/**
* Create ServiceSubscription in A&AI
- *
+ *
* @param customer
*/
public void createServiceSubscription(Customer customer) {
}
public void deleteServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().delete(serviceInstanceURI);
}
public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
AAIResourceUri projectURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName()));
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI,
public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
AAIResourceUri owningEntityURI = AAIUriFactory
.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI);
}
ServiceInstance serviceInstance) {
AAIResourceUri owningEntityURI = AAIUriFactory
.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity))
}
public void updateServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
}
public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
- AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
+ AAIPluralResourceUri uriSI = AAIClientUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
return injectionHelper.getAaiClient().exists(uriSI);
}
* 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.
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
AAIResourceUri vnfURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI = AAIUriFactory
+ AAIResourceUri serviceInstanceURI = AAIClientUriFactory
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf)))
.connect(vnfURI, serviceInstanceURI);
/**
* Retrieve Generic VNF from AAI using vnf Id
- *
+ *
* @param vnfId - vnf-id required vnf
* @return AAI Generic Vnf
*/
/**
* Check inMaint flag value of Generic VNF from AAI using vnf Id
- *
+ *
* @param vnfId - vnf-id required vnf
* @return inMaint flag value
*/
<version>1.16.0-SNAPSHOT</version>
</parent>
<artifactId>aai-client</artifactId>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <versionRange>[1.0.0,)</versionRange>
- <goals>
- <goal>unpack</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute />
- </action>
- </pluginExecution>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.onap.so</groupId>
- <artifactId>fluent-builder-maven-plugin</artifactId>
- <goals>
- <goal>generate-builders</goal>
- </goals>
- <versionRange>[0.0,)</versionRange>
- </pluginExecutionFilter>
- <action>
- <execute />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.onap.aai.traversal</groupId>
- <artifactId>aai-traversal</artifactId>
- <version>1.7.2</version>
- <outputDirectory>${project.build.directory}/antlr</outputDirectory>
- <includes>**/*.g4</includes>
- </artifactItem>
- <artifactItem>
- <groupId>org.onap.aai.schema-service</groupId>
- <artifactId>aai-schema</artifactId>
- <outputDirectory>${project.build.directory}/swagger</outputDirectory>
- <includes>**/*.yaml</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.onap.so</groupId>
- <artifactId>fluent-builder-maven-plugin</artifactId>
- <version>${project.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>generate-builders</goal>
- </goals>
- <configuration>
- <destination>${project.build.directory}/generated-sources</destination>
- <destinationClasspath>org.onap.aaiclient.client.generated.fluentbuilders</destinationClasspath>
- <builderName>AAIFluentTypeBuilder</builderName>
- <swaggerLocation>${project.build.directory}/swagger/onap/aai_swagger_yaml/aai_swagger_LATEST.yaml</swaggerLocation>
- <singularBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentSingleType</singularBuilderClass>
- <pluralBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentPluralType</pluralBuilderClass>
- <topLevelBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentTopLevelType</topLevelBuilderClass>
- <baseBuilderClass>org.onap.aaiclient.client.graphinventory.GraphInventoryFluentTypeBase</baseBuilderClass>
- <singularClass>org.onap.aaiclient.client.aai.AAIObjectType</singularClass>
- <pluralClass>org.onap.aaiclient.client.aai.AAIObjectPlurals</pluralClass>
- <nameClass>org.onap.aaiclient.client.aai.AAIObjectName</nameClass>
- <singleFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAISingleFragment</singleFragmentClass>
- <pluralFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAIPluralFragment</pluralFragmentClass>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/generated-sources/fluent/</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
<dependencies>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>aai-fluent-uri-builder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor.modules</groupId>
+ <artifactId>blueprint-proto</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-lib</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@Override
public void onRemoved(Iterable<CacheEntryEvent<? extends Key, ? extends Entry>> events)
throws CacheEntryListenerException {
+
for (CacheEntryEvent<? extends Key, ? extends Entry> event : events) {
logger.debug("{} removed key: {}", event.getSource().getName(), event.getKey().getUri());
}
* 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.
* 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.
* 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.
package org.onap.aaiclient.client.aai.entities;
import java.io.Serializable;
-import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryResultWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* 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.
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
-import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryRelationships;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryRelationships;
+
public class Relationships extends GraphInventoryRelationships<AAIResultWrapper, AAIResourceUri, AAIObjectType> {
@Deprecated
/**
* Use getRelatedUris instead
- *
+ *
* @return
*/
public List<AAIResourceUri> getRelatedAAIUris() {
@Deprecated
/**
* Use getRelatedUris instead
- *
+ *
* @return
*/
public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) {
--- /dev/null
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+
+public class AAIClientUriFactory extends AAIUriFactory {
+ /**
+ * 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(AAISingleFragment fragment) {
+
+ if (Types.SERVICE_INSTANCE.typeName().equals(fragment.get().build().typeName())) {
+ return new ServiceInstanceUri(fragment);
+ } else if (Types.ALLOTTED_RESOURCE.typeName().equals(fragment.get().build().typeName())) {
+ return new AllottedResourceLookupUri(fragment);
+ } else {
+ return null;
+ }
+ }
+}
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
import java.util.stream.Collectors;
import javax.ws.rs.core.GenericType;
import org.onap.aaiclient.client.aai.entities.Results;
-import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
import org.onap.aaiclient.client.graphinventory.entities.Pathed;
-import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
* 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.aaiclient.client.graphinventory.entities;
+package org.onap.aaiclient.client.graphinventory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
import org.onap.so.jsonpath.JsonPathUtil;
+import com.ctc.wstx.shaded.msv_core.util.Uri;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
* 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.
import javax.ws.rs.core.Response.Status;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel;
-import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
/**
* creates a new object in GraphInventory
- *
+ *
* @param obj - can be any object which will marshal into a valid GraphInventory payload
* @param uri
* @return
/**
* creates a new object in GraphInventory with no payload body
- *
+ *
* @param uri
* @return
*/
/**
* returns false if the object does not exist in GraphInventory
- *
+ *
* @param uri
* @return
*/
/**
* Adds a relationship between two objects in GraphInventory
- *
+ *
* @param uriA
* @param uriB
* @return
/**
* Adds a relationship between two objects in GraphInventory with a given edge label
- *
+ *
* @param uriA
* @param uriB
* @param edge label
/**
* Removes relationship from two objects in GraphInventory
- *
+ *
* @param uriA
* @param uriB
* @return
/**
* Deletes object from GraphInventory. Automatically handles resource-version.
- *
+ *
* @param uri
* @return
*/
/**
* Deletes object from GraphInventory only if exists. Automatically handles resource-version.
- *
+ *
* @param uri
* @return
*/
/**
* Retrieves an object from GraphInventory and unmarshalls it into the Class specified
- *
+ *
* @param clazz
* @param uri
* @return
/**
* Retrieves an object from GraphInventory and returns complete response
- *
+ *
* @param uri
* @return
*/
/**
* Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List
- *
+ *
* @param resultClass
* @param uri
* @return
/**
* Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
- *
+ *
* @param uri
* @return
*/
/**
* 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
*/
/**
* Will automatically create the object if it does not exist
- *
+ *
* @param obj - Optional object which serializes to a valid GraphInventory payload
* @param uri
* @return
/**
* 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();
* 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.
* 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.aaiclient.client.graphinventory.entities;
+package org.onap.aaiclient.client.graphinventory;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.jsonpath.JsonPathUtil;
import org.slf4j.Logger;
import com.fasterxml.jackson.core.JsonProcessingException;
* 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.
/**
* 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
/**
* creates a new object in A&AI with no payload body
- *
+ *
* @param uri
* @return
*/
/**
* Will automatically create the object if it does not exist
- *
+ *
* @param obj - Optional object which serializes to a valid GraphInventory payload
* @param uri
* @return
/**
* Adds a relationship between two objects in A&AI
- *
+ *
* @param uriA
* @param uriB
* @return
/**
* relationship between multiple objects in A&AI - connects A to all objects specified in list
- *
+ *
* @param uriA
* @param uris
* @return
/**
* relationship between multiple objects in A&AI - connects A to all objects specified in list
- *
+ *
* @param uriA
* @param uris
* @return
/**
* relationship between multiple objects in A&AI - connects A to all objects specified in list
- *
+ *
* @param uriA
* @param uris
* @return
/**
* Removes relationship from two objects in A&AI
- *
+ *
* @param uriA
* @param uriB
* @return
/**
* Removes relationship from multiple objects - disconnects A from all objects specified in list
- *
+ *
* @param uriA
* @param uris
* @return
/**
* Deletes object from A&AI. Automatically handles resource-version.
- *
+ *
* @param uri
* @return
*/
/**
* 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;
* 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.aaiclient.client.graphinventory.entities;
-
-import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+package org.onap.aaiclient.client.graphinventory;
public class ResourceAndUrl<Wrapper extends GraphInventoryResultWrapper> {
* 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.
* 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.
import org.onap.aaiclient.client.graphinventory.Format;
import org.onap.aaiclient.client.graphinventory.GraphInventoryClient;
import org.onap.aaiclient.client.graphinventory.GraphInventorySubgraphType;
+import org.onap.aaiclient.client.graphinventory.ResourceAndUrl;
import org.onap.aaiclient.client.graphinventory.entities.Pathed;
-import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.RestClient;
import com.fasterxml.jackson.core.type.TypeReference;
* 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.
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri;
import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")).willReturn(
aResponse().withStatus(404).withHeader("Content-Type", "application/json").withHeader("Mock", "true")));
- uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("id")));
+ uri = spy((ServiceInstanceUri) AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("id")));
doReturn(aaiClient).when(uri).getResourcesClient();
}
* 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.
* 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.
* 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.
* 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.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>graph-inventory</artifactId>
+ <groupId>org.onap.so</groupId>
+ <version>1.16.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.onap.so</groupId>
+ <artifactId>aai-fluent-uri-builder</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>33.4.8-jre</version>
+ </dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.10.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai.schema-service</groupId>
+ <artifactId>aai-annotations</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.18.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.onap.so</groupId>
+ <artifactId>fluent-builder-maven-plugin</artifactId>
+ <goals>
+ <goal>generate-builders</goal>
+ </goals>
+ <versionRange>[0.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/generated/**/*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.onap.aai.traversal</groupId>
+ <artifactId>aai-traversal</artifactId>
+ <version>1.7.2</version>
+ <outputDirectory>${project.build.directory}/antlr</outputDirectory>
+ <includes>**/*.g4</includes>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.onap.aai.schema-service</groupId>
+ <artifactId>aai-schema</artifactId>
+ <version>1.9.2</version>
+ <outputDirectory>${project.build.directory}/swagger</outputDirectory>
+ <includes>**/*.yaml</includes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.onap.so</groupId>
+ <artifactId>fluent-builder-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-builders</goal>
+ </goals>
+ <configuration>
+ <destination>${project.build.directory}/generated-sources</destination>
+ <destinationClasspath>org.onap.aaiclient.client.generated.fluentbuilders</destinationClasspath>
+ <builderName>AAIFluentTypeBuilder</builderName>
+ <swaggerLocation>${project.build.directory}/swagger/onap/aai_swagger_yaml/aai_swagger_LATEST.yaml</swaggerLocation>
+ <singularBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentSingleType</singularBuilderClass>
+ <pluralBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentPluralType</pluralBuilderClass>
+ <topLevelBuilderClass>org.onap.aaiclient.client.aai.entities.uri.AAIFluentTopLevelType</topLevelBuilderClass>
+ <baseBuilderClass>org.onap.aaiclient.client.graphinventory.GraphInventoryFluentTypeBase</baseBuilderClass>
+ <singularClass>org.onap.aaiclient.client.aai.AAIObjectType</singularClass>
+ <pluralClass>org.onap.aaiclient.client.aai.AAIObjectPlurals</pluralClass>
+ <nameClass>org.onap.aaiclient.client.aai.AAIObjectName</nameClass>
+ <singleFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAISingleFragment</singleFragmentClass>
+ <pluralFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAIPluralFragment</pluralFragmentClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/fluent/</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
import java.util.Set;
import java.util.regex.Pattern;
import org.onap.aai.annotations.Metadata;
-import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup;
import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryFluentType;
import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryFluentType;
import com.google.common.base.CaseFormat;
public interface AAIFluentSingleType extends GraphInventoryFluentType<AAIObjectType> {
* 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.
* 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.
* 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.
* 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.
import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.AAIObjectPlurals;
import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
-
public class AAIUriFactory {
return new AAISimpleUri(type, values);
}
- /**
- * 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(AAISingleFragment fragment) {
-
- if (Types.SERVICE_INSTANCE.typeName().equals(fragment.get().build().typeName())) {
- return new ServiceInstanceUri(fragment);
- } else if (Types.ALLOTTED_RESOURCE.typeName().equals(fragment.get().build().typeName())) {
- return new AllottedResourceLookupUri(fragment);
- } else {
- return null;
- }
- }
-
public static AAIResourceUri createResourceUri(AAIFluentSingleType uri) {
return new AAISimpleUri(uri.build(), uri.values());
}
/**
* This method should only be used to wrap a URI retrieved from A&AI contained within an object response
- *
+ *
* @param type
* @param uri
* @return
/**
* creates an AAIResourceUri from a parentUri
- *
+ *
* @param parentUri
* @param childType
* @param childValues
/**
* Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
- *
+ *
* @param type
* @return
*/
/**
* Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
- *
+ *
* @param type
* @return
*/
package org.onap.aaiclient.client.aai.entities.uri;
import javax.ws.rs.core.UriBuilder;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase;
+import org.onap.aaiclient.client.aai.AAIObjectType;
public class NodesSingleUri extends AAISimpleUri implements NodesUri {
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;
-import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep {
* 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.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.onap.aaiclient.client.aai.entities.QueryStep;
import com.google.common.base.Joiner;
* 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.
* 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.
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
-import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import com.google.common.base.Joiner;
* 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.
* 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.
package org.onap.aaiclient.client.graphinventory.entities;
-import org.onap.aaiclient.client.aai.entities.QueryStep;
-
public interface Output extends QueryStep {
}
* 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.
* 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.aaiclient.client.aai.entities;
+package org.onap.aaiclient.client.graphinventory.entities;
@FunctionalInterface
public interface QueryStep {
* 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.
}
}
-
package org.onap.aaiclient.client.graphinventory.entities;
-import org.onap.aaiclient.client.aai.entities.QueryStep;
-
public interface Start extends QueryStep {
}
* 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.
* 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.
* 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.
import org.onap.aaiclient.client.graphinventory.Format;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase;
+
public interface GraphInventoryResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase>
extends GraphInventoryUri<T, OT> {
* 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.
/**
* 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
*/
/**
* Makes client only return object fields, no relationships
- *
+ *
* @return
*/
public T nodesOnly(boolean nodesOnly);
/**
* returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType}
- *
+ *
* @return
*/
public Map<String, String> getURIKeys();
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup;
public class AAIFluentTypeReverseLookupTest {
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
AAIResourceUri uri = new AAISimpleUri(parentUri, Types.ALLOTTED_RESOURCE.getFragment("").get().build(), "key4");
- assertEquals("path appended",
+ assertEquals(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4",
- uri.build().toString());
+ uri.build().toString(), "path appended");
}
}
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import javax.ws.rs.core.UriBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
.fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053")
.build());
- assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
- uri.build().toString());
+ assertEquals("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString(),
+ "root and version removed");
}
AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
- assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
+ assertEquals("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString(), "no change");
}
AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
- assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053",
- uri.build().toString());
+ assertEquals("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString(),
+ "encoding preserved");
}
AAIResourceUri uri2 = new AAISimpleUri(AAIFluentTypeBuilder.network().vce("").build(),
"a9f ec18e-1ea3-40e4-a6c0-a89b3de07053");
- assertEquals("are equal", uri2, uri);
+ assertEquals(uri2, uri, "are equal");
}
}
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAISimplePluralUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
* 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.
package org.onap.aaiclient.client.aai.entities.uri;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
--- /dev/null
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import org.onap.aaiclient.client.generated.fluentbuilders.Pserver;
+import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
+import org.onap.aaiclient.client.graphinventory.entities.DSLTraversal;
+import org.onap.aaiclient.client.graphinventory.entities.__;
+
+public class DslQueryBuilderTest {
+
+ @Test
+ void s() {
+ DSLTraversal<Object> traversal = __.start(new DSLStartNode(new Pserver.Info())).build();
+ assertEquals("pserver", traversal.get());
+ }
+}
<packaging>pom</packaging>
<modules>
<module>fluent-builder-maven-plugin</module>
+ <module>aai-fluent-uri-builder</module>
<module>aai-client</module>
</modules>
</project>
import org.onap.aaiclient.client.graphinventory.entities.__;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.aaiclient.client.aai.entities.uri.AAIClientUriFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
public ServiceInstance getServiceInstance(String serviceInstanceId) {
return this.getAaiResourcesClient()
.get(ServiceInstance.class,
- AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)))
+ AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)))
.orElseGet(() -> {
logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
return null;
public boolean isServiceRelatedToNetworks(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .exists(AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.L3_NETWORKS.getFragment()));
}
public boolean isServiceRelatedToGenericVnf(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .exists(AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.GENERIC_VNFS.getFragment()));
}
public boolean isServiceRelatedToConfiguration(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .exists(AAIClientUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
.relatedTo(Types.CONFIGURATIONS.getFragment()));
}