summaryrefslogtreecommitdiffstats
path: root/common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java')
-rw-r--r--common/src/main/java/org/onap/so/client/DefaultProperties.java28
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java83
-rw-r--r--common/src/main/java/org/onap/so/client/PreconditionFailedException.java10
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java127
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java13
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java467
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java98
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java26
-rw-r--r--common/src/main/java/org/onap/so/client/RestPropertiesLoader.java104
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java101
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java82
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java46
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java107
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java53
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java53
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java125
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java340
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIProperties.java17
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java61
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java84
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java54
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java14
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java19
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java213
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java308
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdator.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java44
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidator.java12
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java61
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java26
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java28
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIError.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java29
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Configuration.java70
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java100
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Relationships.java78
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/RequestError.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Results.java24
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java63
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java42
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java119
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java33
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java89
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java42
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java88
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java31
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java35
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java54
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java212
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java75
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java174
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java45
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java193
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java41
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java45
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java72
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java5
-rw-r--r--common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java9
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java34
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java4
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProperties.java17
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java31
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java87
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Consumer.java2
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java75
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java189
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java11
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java87
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java42
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Publisher.java4
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java18
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java20
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java41
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java230
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java49
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java41
-rw-r--r--common/src/main/java/org/onap/so/client/exceptions/SDNOException.java22
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java40
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/Format.java30
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java43
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java16
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java21
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java3
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java3
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java96
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java198
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java575
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java67
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java19
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java404
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java12
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java91
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java75
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java38
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java223
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java186
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java172
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java53
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java63
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java66
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java34
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java54
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java81
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java4
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java464
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java52
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java12
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java28
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java16
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMAction.java19
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMClient.java99
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMProperties.java11
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java41
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java31
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java59
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java93
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Property.java63
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java419
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java19
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java45
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java50
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java50
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Status.java91
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Version.java73
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java27
-rw-r--r--common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java10
-rw-r--r--common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java26
-rw-r--r--common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java122
-rw-r--r--common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java23
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClient.java12
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java167
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java28
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java10
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java147
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Bbid.java90
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Config.java18
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java11
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Content.java4
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java124
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java143
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java50
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java33
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java5
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Id.java61
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java15
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java50
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java50
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java41
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Treatments.java90
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Workstep.java90
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/RubyClient.java105
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Event.java59
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java344
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java59
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java51
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java239
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java48
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java165
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java92
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Body.java11
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Input.java23
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java306
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java22
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java161
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java39
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java261
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java49
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java4
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java1
-rw-r--r--common/src/main/java/org/onap/so/constants/Defaults.java49
-rw-r--r--common/src/main/java/org/onap/so/entity/MsoRequest.java66
-rw-r--r--common/src/main/java/org/onap/so/exceptions/MSOException.java32
-rw-r--r--common/src/main/java/org/onap/so/exceptions/MarshallerException.java2
-rw-r--r--common/src/main/java/org/onap/so/exceptions/ValidationException.java18
-rw-r--r--common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java107
-rw-r--r--common/src/main/java/org/onap/so/logger/ErrorCode.java2
-rw-r--r--common/src/main/java/org/onap/so/logger/LogConstants.java8
-rw-r--r--common/src/main/java/org/onap/so/logger/LoggerStartupListener.java65
-rw-r--r--common/src/main/java/org/onap/so/logger/MessageEnum.java209
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java36
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java73
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java51
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java33
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java220
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java89
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java91
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java47
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java177
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java63
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java85
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java84
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java75
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java42
-rw-r--r--common/src/main/java/org/onap/so/properties/MsoDatabaseException.java14
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java16
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java21
-rw-r--r--common/src/main/java/org/onap/so/security/MSOSpringFirewall.java14
-rw-r--r--common/src/main/java/org/onap/so/security/UserCredentials.java42
-rw-r--r--common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java34
-rw-r--r--common/src/main/java/org/onap/so/security/WebSecurityConfig.java64
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java68
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java80
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java25
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java24
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java3
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java239
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java33
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java257
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java13
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java125
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java55
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java33
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java18
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Project.java31
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java93
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java27
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java147
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java254
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java54
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java177
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java24
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java248
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java91
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java63
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java76
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java55
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Service.java102
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java19
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java191
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java32
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java32
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java128
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java191
-rw-r--r--common/src/main/java/org/onap/so/spring/SpringContextHelper.java16
-rw-r--r--common/src/main/java/org/onap/so/test/categories/SlowTests.java2
-rw-r--r--common/src/main/java/org/onap/so/utils/CheckResults.java57
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java60
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java9
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java8
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java10
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java27
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java25
258 files changed, 9234 insertions, 9488 deletions
diff --git a/common/src/main/java/org/onap/so/client/DefaultProperties.java b/common/src/main/java/org/onap/so/client/DefaultProperties.java
index 84509ead05..7d70cff50f 100644
--- a/common/src/main/java/org/onap/so/client/DefaultProperties.java
+++ b/common/src/main/java/org/onap/so/client/DefaultProperties.java
@@ -25,18 +25,20 @@ import java.net.URL;
public class DefaultProperties implements RestProperties {
- private final URL url;
- public DefaultProperties(URL url) {
- this.url = url;
- }
- @Override
- public URL getEndpoint() throws MalformedURLException {
- return this.url;
- }
-
- @Override
- public String getSystemName() {
- return RestClient.ECOMP_COMPONENT_NAME;
- }
+ private final URL url;
+
+ public DefaultProperties(URL url) {
+ this.url = url;
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return this.url;
+ }
+
+ @Override
+ public String getSystemName() {
+ return RestClient.ECOMP_COMPONENT_NAME;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
index 6f13a86237..3fb09433e1 100644
--- a/common/src/main/java/org/onap/so/client/HttpClient.java
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -23,65 +23,64 @@ package org.onap.so.client;
import java.net.URL;
import java.util.Map;
import java.util.Optional;
-
import static org.apache.commons.lang3.StringUtils.*;
-
import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpClient extends RestClient {
- protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
+ protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
private TargetEntity targetEntity;
HttpClient(URL host, String contentType, TargetEntity targetEntity) {
- super(host, contentType);
- this.targetEntity = targetEntity;
- }
+ super(host, contentType);
+ this.targetEntity = targetEntity;
+ }
@Override
- public TargetEntity getTargetEntity(){
+ public TargetEntity getTargetEntity() {
return targetEntity;
}
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- }
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {}
- @Override
- protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
- return Optional.empty();
- }
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.empty();
+ }
- /**
- * Adds a basic authentication header to the request.
- * @param auth the encrypted credentials
- * @param key the key for decrypting the credentials
- */
- @Override
- public void addBasicAuthHeader(String auth, String key) {
- if(isNotBlank(auth) && isNotBlank(key)){
- super.addBasicAuthHeader(auth, key);
- }else{
- log.warn("Not adding basic auth to headers.");
- }
- }
+ /**
+ * Adds a basic authentication header to the request.
+ *
+ * @param auth the encrypted credentials
+ * @param key the key for decrypting the credentials
+ */
+ @Override
+ public void addBasicAuthHeader(String auth, String key) {
+ if (isNotBlank(auth) && isNotBlank(key)) {
+ super.addBasicAuthHeader(auth, key);
+ } else {
+ log.warn("Not adding basic auth to headers.");
+ }
+ }
- /**
- * Adds an additional header to the header map
- * @param encoded basic auth value
- */
- public void addAdditionalHeader(String name, String value) {
- try {
- if(isNotBlank(name) && isNotBlank(value)){
- headerMap.put(name, value);
- }else{
- log.warn("Not adding " + name + " to headers.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
+ /**
+ * Adds an additional header to the header map
+ *
+ * @param encoded basic auth value
+ */
+ public void addAdditionalHeader(String name, String value) {
+ try {
+ if (isNotBlank(name) && isNotBlank(value)) {
+ headerMap.put(name, value);
+ } else {
+ log.warn("Not adding " + name + " to headers.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/PreconditionFailedException.java b/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
index 4ff07a616d..29f4c4d9b9 100644
--- a/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
+++ b/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
@@ -24,12 +24,12 @@ import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
public class PreconditionFailedException extends WebApplicationException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
- public PreconditionFailedException(String message) {
+ public PreconditionFailedException(String message) {
super(message, Response.Status.PRECONDITION_FAILED);
}
}
diff --git a/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
index bcc60b6915..2517ebe2d5 100644
--- a/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
@@ -21,7 +21,6 @@
package org.onap.so.client;
import java.util.Optional;
-
import javax.ws.rs.BadRequestException;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.InternalServerErrorException;
@@ -33,71 +32,71 @@ import javax.ws.rs.NotSupportedException;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class ResponseExceptionMapper {
- private static final Logger logger = LoggerFactory.getLogger(ResponseExceptionMapper.class);
- public void map(Response response) {
- if (response.getStatus() >= 300) {
- String body = "";
- String message = "empty message";
- try {
- response.bufferEntity();
- if (response.hasEntity()) {
- body = response.readEntity(String.class);
- }
- } catch (IllegalStateException e) {
- body = "failed to read entity stream";
- logger.error(body, e);
- } catch (ProcessingException e) {
- body = "could not buffer stream";
- logger.error(body, e);
- }
- Optional<String> result = this.extractMessage(body);
- if (result.isPresent()) {
- message = result.get();
- }
- Response.Status status = Response.Status.fromStatusCode(response.getStatus());
- WebApplicationException webAppException;
- switch (status) {
- case BAD_REQUEST:
- webAppException = new BadRequestException(message);
- break;
- case UNAUTHORIZED:
- webAppException = new NotAuthorizedException(message);
- break;
- case FORBIDDEN:
- webAppException = new ForbiddenException(message);
- break;
- case NOT_FOUND:
- webAppException = new NotFoundException(message);
- break;
- case METHOD_NOT_ALLOWED:
- webAppException = new NotAllowedException(message);
- break;
- case NOT_ACCEPTABLE:
- webAppException = new NotAcceptableException(message);
- break;
- case PRECONDITION_FAILED:
- webAppException = new PreconditionFailedException(message);
- break;
- case UNSUPPORTED_MEDIA_TYPE:
- webAppException = new NotSupportedException(message);
- break;
- case INTERNAL_SERVER_ERROR:
- webAppException = new InternalServerErrorException(message);
- break;
- case SERVICE_UNAVAILABLE:
- webAppException = new WebApplicationException(message);
- break;
- default:
- webAppException = new WebApplicationException(message);
- }
- throw webAppException;
- }
- }
-
- public abstract Optional<String> extractMessage(String entity);
+ private static final Logger logger = LoggerFactory.getLogger(ResponseExceptionMapper.class);
+
+ public void map(Response response) {
+ if (response.getStatus() >= 300) {
+ String body = "";
+ String message = "empty message";
+ try {
+ response.bufferEntity();
+ if (response.hasEntity()) {
+ body = response.readEntity(String.class);
+ }
+ } catch (IllegalStateException e) {
+ body = "failed to read entity stream";
+ logger.error(body, e);
+ } catch (ProcessingException e) {
+ body = "could not buffer stream";
+ logger.error(body, e);
+ }
+ Optional<String> result = this.extractMessage(body);
+ if (result.isPresent()) {
+ message = result.get();
+ }
+ Response.Status status = Response.Status.fromStatusCode(response.getStatus());
+ WebApplicationException webAppException;
+ switch (status) {
+ case BAD_REQUEST:
+ webAppException = new BadRequestException(message);
+ break;
+ case UNAUTHORIZED:
+ webAppException = new NotAuthorizedException(message);
+ break;
+ case FORBIDDEN:
+ webAppException = new ForbiddenException(message);
+ break;
+ case NOT_FOUND:
+ webAppException = new NotFoundException(message);
+ break;
+ case METHOD_NOT_ALLOWED:
+ webAppException = new NotAllowedException(message);
+ break;
+ case NOT_ACCEPTABLE:
+ webAppException = new NotAcceptableException(message);
+ break;
+ case PRECONDITION_FAILED:
+ webAppException = new PreconditionFailedException(message);
+ break;
+ case UNSUPPORTED_MEDIA_TYPE:
+ webAppException = new NotSupportedException(message);
+ break;
+ case INTERNAL_SERVER_ERROR:
+ webAppException = new InternalServerErrorException(message);
+ break;
+ case SERVICE_UNAVAILABLE:
+ webAppException = new WebApplicationException(message);
+ break;
+ default:
+ webAppException = new WebApplicationException(message);
+ }
+ throw webAppException;
+ }
+ }
+
+ public abstract Optional<String> extractMessage(String entity);
}
diff --git a/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
index 0392b49629..5927d4d99d 100644
--- a/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
@@ -17,11 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client;
import java.util.Optional;
-
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
@@ -29,10 +28,10 @@ import javax.ws.rs.ext.Provider;
@Priority(Integer.MIN_VALUE)
public class ResponseExceptionMapperImpl extends ResponseExceptionMapper {
- @Override
- public Optional<String> extractMessage(String entity) {
- return Optional.of(entity);
- }
-
+ @Override
+ public Optional<String> extractMessage(String entity) {
+ return Optional.of(entity);
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 4284cea847..0b10d85bbf 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -58,252 +58,253 @@ import net.jodah.failsafe.RetryPolicy;
public abstract class RestClient {
- private static final String APPLICATION_MERGE_PATCH_JSON = "application/merge-patch+json";
+ private static final String APPLICATION_MERGE_PATCH_JSON = "application/merge-patch+json";
public static final String ECOMP_COMPONENT_NAME = "MSO";
- private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
- private WebTarget webTarget;
+ private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
+ private WebTarget webTarget;
- protected final Map<String, String> headerMap;
- protected final Logger logger = LoggerFactory.getLogger(RestClient.class);
- protected URL host;
- protected Optional<URI> path;
- protected String accept;
- protected String contentType;
- protected String requestId = "";
+ protected final Map<String, String> headerMap;
+ protected final Logger logger = LoggerFactory.getLogger(RestClient.class);
+ protected URL host;
+ protected Optional<URI> path;
+ protected String accept;
+ protected String contentType;
+ protected String requestId = "";
protected JaxRsClientLogging jaxRsClientLogging;
protected RestProperties props;
protected RestClient(RestProperties props, Optional<URI> path) {
- headerMap = new HashMap<>();
- try {
- host = props.getEndpoint();
- } catch (MalformedURLException e) {
-
- throw new RuntimeException(e);
- }
- this.props = props;
- this.path = path;
- }
-
- protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
- this(props, path);
- this.accept = accept;
- this.contentType = contentType;
- this.props = props;
- }
-
- protected RestClient(URL host, String contentType) {
- headerMap = new HashMap<>();
- this.path = Optional.empty();
- this.host = host;
- this.contentType = contentType;
- this.props = new DefaultProperties(host);
- }
-
- /**
- * Override method to return false to disable logging.
- *
- * @return true - to enable logging, false otherwise
- */
- protected boolean enableLogging() {
- return true;
- }
-
- /**
- * Override method to return custom value for max payload size.
- *
- * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
- */
- protected int getMaxPayloadSize()
- {
- return MAX_PAYLOAD_SIZE;
- }
-
- protected Builder getBuilder() {
-
- if (webTarget == null) {
- initializeClient(getClient());
- }
- Builder builder = webTarget.request();
- initializeHeaderMap(headerMap);
- for (Entry<String, String> entry : headerMap.entrySet()) {
- builder.header(entry.getKey(), entry.getValue());
- }
- return builder;
- }
-
- protected WebTarget getWebTarget() {
- return this.webTarget;
- }
-
- protected abstract void initializeHeaderMap(Map<String, String> headerMap);
-
- protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
- return Optional.of(new ResponseExceptionMapperImpl());
- }
-
- protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
- return new CommonObjectMapperProvider();
- }
-
- /**
- * Adds a basic authentication header to the request.
- * @param auth the encrypted credentials
- * @param key the key for decrypting the credentials
- */
- protected void addBasicAuthHeader(String auth, String key) {
- try {
- byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
- String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth);
- headerMap.put("Authorization", authHeaderValue);
- } catch (GeneralSecurityException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- protected String getAccept() {
- return accept;
- }
-
- protected String getContentType() {
- return contentType;
- }
-
- protected String getMergeContentType() {
- return APPLICATION_MERGE_PATCH_JSON;
- }
-
- protected Client getClient() {
- return ClientBuilder.newBuilder().build();
- }
-
- protected abstract TargetEntity getTargetEntity();
-
- protected void initializeClient(Client client) {
- if (this.enableLogging()) {
- client.register(new PayloadLoggingFilter(this.getMaxPayloadSize()));
- }
- CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
- client.register(new JacksonJsonProvider(provider.getMapper()));
+ headerMap = new HashMap<>();
+ try {
+ host = props.getEndpoint();
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ this.props = props;
+ this.path = path;
+ }
+
+ protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ this(props, path);
+ this.accept = accept;
+ this.contentType = contentType;
+ this.props = props;
+ }
+
+ protected RestClient(URL host, String contentType) {
+ headerMap = new HashMap<>();
+ this.path = Optional.empty();
+ this.host = host;
+ this.contentType = contentType;
+ this.props = new DefaultProperties(host);
+ }
+
+ /**
+ * Override method to return false to disable logging.
+ *
+ * @return true - to enable logging, false otherwise
+ */
+ protected boolean enableLogging() {
+ return true;
+ }
+
+ /**
+ * Override method to return custom value for max payload size.
+ *
+ * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
+ */
+ protected int getMaxPayloadSize() {
+ return MAX_PAYLOAD_SIZE;
+ }
+
+ protected Builder getBuilder() {
+
+ if (webTarget == null) {
+ initializeClient(getClient());
+ }
+ Builder builder = webTarget.request();
+ initializeHeaderMap(headerMap);
+ for (Entry<String, String> entry : headerMap.entrySet()) {
+ builder.header(entry.getKey(), entry.getValue());
+ }
+ return builder;
+ }
+
+ protected WebTarget getWebTarget() {
+ return this.webTarget;
+ }
+
+ protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new CommonObjectMapperProvider();
+ }
+
+ /**
+ * Adds a basic authentication header to the request.
+ *
+ * @param auth the encrypted credentials
+ * @param key the key for decrypting the credentials
+ */
+ protected void addBasicAuthHeader(String auth, String key) {
+ try {
+ byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
+ String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth);
+ headerMap.put("Authorization", authHeaderValue);
+ } catch (GeneralSecurityException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ protected String getAccept() {
+ return accept;
+ }
+
+ protected String getContentType() {
+ return contentType;
+ }
+
+ protected String getMergeContentType() {
+ return APPLICATION_MERGE_PATCH_JSON;
+ }
+
+ protected Client getClient() {
+ return ClientBuilder.newBuilder().build();
+ }
+
+ protected abstract TargetEntity getTargetEntity();
+
+ protected void initializeClient(Client client) {
+ if (this.enableLogging()) {
+ client.register(new PayloadLoggingFilter(this.getMaxPayloadSize()));
+ }
+ CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
+ client.register(new JacksonJsonProvider(provider.getMapper()));
jaxRsClientLogging = new JaxRsClientLogging();
jaxRsClientLogging.setTargetService(getTargetEntity());
client.register(jaxRsClientLogging);
if (!path.isPresent()) {
- webTarget = client.target(host.toString());
- } else {
- webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
- }
- if (getAccept() == null || getAccept().isEmpty()) {
- this.accept = MediaType.APPLICATION_JSON;
- }
- if (getContentType() == null || getContentType().isEmpty()) {
- this.contentType = MediaType.APPLICATION_JSON;
- }
- }
-
- protected List<Predicate<Throwable>> retryOn() {
-
- List<Predicate<Throwable>> result = new ArrayList<>();
-
- result.add(e -> {
- return e.getCause() instanceof SocketTimeoutException;
- });
- result.add(e -> {
- return e.getCause() instanceof ConnectException;
- });
- return result;
- }
-
- public Response get() {
- return method("GET", null);
- }
-
- public Response post(Object obj) {
- return method("POST", obj);
- }
-
- public Response patch(Object obj) {
- return method("PATCH", obj);
- }
-
- public Response put(Object obj) {
- return method("PUT", obj);
- }
-
- public Response delete() {
- return method("DELETE", null);
- }
-
- public Response delete(Object obj) {
- return method("DELETE", obj);
- }
-
- public <T> Optional<T> get(Class<T> resultClass) {
- return format(method("GET", null), resultClass);
- }
-
- public <T> Optional<T> get(GenericType<T> resultClass) {
- return format(method("GET", null), resultClass);
- }
-
- public <T> T post(Object obj, Class<T> resultClass) {
- return format(method("POST", obj), resultClass).orElse(null);
- }
-
- public <T> T patch(Object obj, Class<T> resultClass) {
- return format(method("PATCH", obj), resultClass).orElse(null);
- }
-
- public <T> T put(Object obj, Class<T> resultClass) {
- return format(method("PUT", obj), resultClass).orElse(null);
- }
-
- public <T> T put(Object obj, GenericType<T> resultClass) {
- return format(method("PUT", obj), resultClass).orElse(null);
- }
-
- public <T> T delete(Class<T> resultClass) {
- return format(method("DELETE", null), resultClass).orElse(null);
- }
-
- public <T> T delete(Object obj, Class<T> resultClass) {
- return format(method("DELETE", obj), resultClass).orElse(null);
- }
-
- public Response method(String method, Object entity) {
- RetryPolicy policy = new RetryPolicy();
-
- List<Predicate<Throwable>> items = retryOn();
-
- Predicate<Throwable> pred = items.stream().reduce(Predicate::or).orElse(x -> false);
-
- policy.retryOn(error -> pred.test(error));
-
- policy.withDelay(this.props.getDelayBetweenRetries(), TimeUnit.MILLISECONDS)
- .withMaxRetries(this.props.getRetries());
-
- return Failsafe.with(policy).get(buildRequest(method, entity));
- }
-
- protected RestRequest buildRequest(String method, Object entity) {
- return new RestRequest(this, method, entity);
- }
- private <T> Optional<T> format(Response response, Class<T> resultClass) {
- if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
- return Optional.empty();
- }
- return Optional.of(response.readEntity(resultClass));
- }
-
- private <T> Optional<T> format(Response response, GenericType<T> resultClass) {
- if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
- return Optional.empty();
- }
- return Optional.of(response.readEntity(resultClass));
- }
+ webTarget = client.target(host.toString());
+ } else {
+ webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
+ }
+ if (getAccept() == null || getAccept().isEmpty()) {
+ this.accept = MediaType.APPLICATION_JSON;
+ }
+ if (getContentType() == null || getContentType().isEmpty()) {
+ this.contentType = MediaType.APPLICATION_JSON;
+ }
+ }
+
+ protected List<Predicate<Throwable>> retryOn() {
+
+ List<Predicate<Throwable>> result = new ArrayList<>();
+
+ result.add(e -> {
+ return e.getCause() instanceof SocketTimeoutException;
+ });
+ result.add(e -> {
+ return e.getCause() instanceof ConnectException;
+ });
+ return result;
+ }
+
+ public Response get() {
+ return method("GET", null);
+ }
+
+ public Response post(Object obj) {
+ return method("POST", obj);
+ }
+
+ public Response patch(Object obj) {
+ return method("PATCH", obj);
+ }
+
+ public Response put(Object obj) {
+ return method("PUT", obj);
+ }
+
+ public Response delete() {
+ return method("DELETE", null);
+ }
+
+ public Response delete(Object obj) {
+ return method("DELETE", obj);
+ }
+
+ public <T> Optional<T> get(Class<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> Optional<T> get(GenericType<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return format(method("POST", obj), resultClass).orElse(null);
+ }
+
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return format(method("PATCH", obj), resultClass).orElse(null);
+ }
+
+ public <T> T put(Object obj, Class<T> resultClass) {
+ return format(method("PUT", obj), resultClass).orElse(null);
+ }
+
+ public <T> T put(Object obj, GenericType<T> resultClass) {
+ return format(method("PUT", obj), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Class<T> resultClass) {
+ return format(method("DELETE", null), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Object obj, Class<T> resultClass) {
+ return format(method("DELETE", obj), resultClass).orElse(null);
+ }
+
+ public Response method(String method, Object entity) {
+ RetryPolicy policy = new RetryPolicy();
+
+ List<Predicate<Throwable>> items = retryOn();
+
+ Predicate<Throwable> pred = items.stream().reduce(Predicate::or).orElse(x -> false);
+
+ policy.retryOn(error -> pred.test(error));
+
+ policy.withDelay(this.props.getDelayBetweenRetries(), TimeUnit.MILLISECONDS)
+ .withMaxRetries(this.props.getRetries());
+
+ return Failsafe.with(policy).get(buildRequest(method, entity));
+ }
+
+ protected RestRequest buildRequest(String method, Object entity) {
+ return new RestRequest(this, method, entity);
+ }
+
+ private <T> Optional<T> format(Response response, Class<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
+
+ private <T> Optional<T> format(Response response, GenericType<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 8369eba859..abef417325 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -26,62 +26,62 @@ import java.nio.file.Paths;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.util.Optional;
-
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
public abstract class RestClientSSL extends RestClient {
-
- private static final String TRUE = "true";
+
+ private static final String TRUE = "true";
public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
- public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
- public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
-
+ public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
+ public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
+
+
+ protected RestClientSSL(RestProperties props, Optional<URI> path) {
+ super(props, path);
+ }
+
+ protected RestClientSSL(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ super(props, path, accept, contentType);
+ }
+
+ @Override
+ protected Client getClient() {
+
+ Client client = null;
+ try {
+ String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
+ if (loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) {
+ KeyStore ks = getKeyStore();
+ if (ks != null) {
+ client = ClientBuilder.newBuilder()
+ .keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build();
+ logger.info("RestClientSSL not using default SSL context - setting keystore here.");
+ return client;
+ }
+ }
+ // Use default SSL context
+ client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
+ logger.info("RestClientSSL using default SSL context!");
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException(e);
+ }
+ return client;
+ }
- protected RestClientSSL(RestProperties props, Optional<URI> path) {
- super(props, path);
- }
+ private KeyStore getKeyStore() {
+ KeyStore ks = null;
+ char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
+ try (FileInputStream fis = new FileInputStream(
+ Paths.get(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)).normalize().toString())) {
+ ks = KeyStore.getInstance(KeyStore.getDefaultType());
- protected RestClientSSL(RestProperties props, Optional<URI> path, String accept, String contentType) {
- super(props, path, accept, contentType);
- }
+ ks.load(fis, password);
+ } catch (Exception e) {
+ return null;
+ }
- @Override
- protected Client getClient() {
-
- Client client = null;
- try {
- String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
- if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) {
- KeyStore ks = getKeyStore();
- if(ks != null) {
- client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build();
- logger.info("RestClientSSL not using default SSL context - setting keystore here.");
- return client;
- }
- }
- //Use default SSL context
- client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
- logger.info("RestClientSSL using default SSL context!");
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException(e);
- }
- return client;
- }
-
- private KeyStore getKeyStore() {
- KeyStore ks = null;
- char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
- try(FileInputStream fis = new FileInputStream(Paths.get(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)).normalize().toString())) {
- ks = KeyStore.getInstance(KeyStore.getDefaultType());
-
- ks.load(fis, password);
- }
- catch(Exception e) {
- return null;
- }
-
- return ks;
- }
+ return ks;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java
index 7043e89b1e..9e4e99cb4e 100644
--- a/common/src/main/java/org/onap/so/client/RestProperties.java
+++ b/common/src/main/java/org/onap/so/client/RestProperties.java
@@ -25,15 +25,19 @@ import java.net.URL;
public interface RestProperties {
- public URL getEndpoint() throws MalformedURLException;
- public String getSystemName();
- public default Integer getRetries() {
- return Integer.valueOf(2);
- }
- public default Long getDelayBetweenRetries() {
- return Long.valueOf(500);
- }
- public default boolean mapNotFoundToEmpty() {
- return false;
- }
+ public URL getEndpoint() throws MalformedURLException;
+
+ public String getSystemName();
+
+ public default Integer getRetries() {
+ return Integer.valueOf(2);
+ }
+
+ public default Long getDelayBetweenRetries() {
+ return Long.valueOf(500);
+ }
+
+ public default boolean mapNotFoundToEmpty() {
+ return false;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
index 570b48ecb8..efb50cf04b 100644
--- a/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
@@ -25,55 +25,57 @@ import java.util.ServiceLoader;
public class RestPropertiesLoader {
- /* required to make ServiceLoader thread safe */
- private static final ThreadLocal<ServiceLoader<RestProperties>> services = new ThreadLocal<ServiceLoader<RestProperties>>() {
- @Override
- protected ServiceLoader<RestProperties> initialValue() {
- return ServiceLoader.load(RestProperties.class);
- }
- };
- private RestPropertiesLoader() {
- }
-
- private static class Helper {
- private static final RestPropertiesLoader INSTANCE = new RestPropertiesLoader();
- }
-
- public static RestPropertiesLoader getInstance() {
- return Helper.INSTANCE;
- }
-
- public <T> T getNewImpl(Class<? extends RestProperties> clazz) {
- return this.getImpl(clazz, true);
- }
- public <T> T getImpl(Class<? extends RestProperties> clazz) {
- return this.getImpl(clazz, false);
- }
-
- private <T> T getImpl(Class<? extends RestProperties> clazz, boolean forceNewInstance) {
- T result = null;
- ServiceLoader<RestProperties> loader = this.services.get();
- Iterator<RestProperties> propertyImpls = loader.iterator();
- RestProperties item;
- while (propertyImpls.hasNext()) {
- item = propertyImpls.next();
- if (clazz.isAssignableFrom(item.getClass())) {
- try {
- if (forceNewInstance) {
- result = (T)item.getClass().newInstance();
- } else {
- result = (T)item;
- }
- } catch (InstantiationException | IllegalAccessException e) {
- /* all spi implementations must provide a public
- * no argument constructor
- */
-
- }
- //break;
- }
- }
-
- return result;
- }
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<RestProperties>> services =
+ new ThreadLocal<ServiceLoader<RestProperties>>() {
+ @Override
+ protected ServiceLoader<RestProperties> initialValue() {
+ return ServiceLoader.load(RestProperties.class);
+ }
+ };
+
+ private RestPropertiesLoader() {}
+
+ private static class Helper {
+ private static final RestPropertiesLoader INSTANCE = new RestPropertiesLoader();
+ }
+
+ public static RestPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public <T> T getNewImpl(Class<? extends RestProperties> clazz) {
+ return this.getImpl(clazz, true);
+ }
+
+ public <T> T getImpl(Class<? extends RestProperties> clazz) {
+ return this.getImpl(clazz, false);
+ }
+
+ private <T> T getImpl(Class<? extends RestProperties> clazz, boolean forceNewInstance) {
+ T result = null;
+ ServiceLoader<RestProperties> loader = this.services.get();
+ Iterator<RestProperties> propertyImpls = loader.iterator();
+ RestProperties item;
+ while (propertyImpls.hasNext()) {
+ item = propertyImpls.next();
+ if (clazz.isAssignableFrom(item.getClass())) {
+ try {
+ if (forceNewInstance) {
+ result = (T) item.getClass().newInstance();
+ } else {
+ result = (T) item;
+ }
+ } catch (InstantiationException | IllegalAccessException e) {
+ /*
+ * all spi implementations must provide a public no argument constructor
+ */
+
+ }
+ // break;
+ }
+ }
+
+ return result;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
index 3864f2e5cc..9d2fa42d00 100644
--- a/common/src/main/java/org/onap/so/client/RestRequest.java
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -24,67 +24,68 @@ package org.onap.so.client;
import java.util.Optional;
import java.util.concurrent.Callable;
-
import javax.ws.rs.HttpMethod;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestRequest implements Callable<Response> {
- private static final Logger logger = LoggerFactory.getLogger(RestRequest.class);
+ private static final Logger logger = LoggerFactory.getLogger(RestRequest.class);
+
+ private final RestClient client;
+ private final String method;
+ private final Object entity;
+
+ public RestRequest(RestClient client, String method, Object entity) {
+ this.client = client;
+ this.method = method;
+ this.entity = entity;
+ }
+
+ @Override
+ public Response call() throws Exception {
+ final Response response;
+ if ("GET".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).get();
+ } else if ("POST".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept())
+ .post(Entity.entity(entity, this.client.getContentType()));
+ } else if ("PATCH".equals(method)) {
+ response = this.client.getBuilder().header("X-HTTP-Method-Override", "PATCH")
+ .accept(this.client.getAccept()).post(Entity.entity(entity, this.client.getMergeContentType()));
+ } else if ("DELETE".equals(method)) {
+ if (entity == null) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).delete();
- private final RestClient client;
- private final String method;
- private final Object entity;
-
- public RestRequest(RestClient client, String method, Object entity) {
- this.client = client;
- this.method = method;
- this.entity = entity;
- }
- @Override
- public Response call() throws Exception {
- final Response response;
- if ("GET".equals(method)) {
- response = this.client.getBuilder().accept(this.client.getAccept()).get();
- } else if ("POST".equals(method)) {
- response = this.client.getBuilder().accept(this.client.getAccept()).post(Entity.entity(entity, this.client.getContentType()));
- } else if ("PATCH".equals(method)) {
- response = this.client.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.client.getAccept())
- .post(Entity.entity(entity, this.client.getMergeContentType()));
- } else if ("DELETE".equals(method)) {
- if (entity == null) {
- response = this.client.getBuilder().accept(this.client.getAccept()).delete();
+ } else {
+ response = this.client.getBuilder().accept(this.client.getAccept())
+ .build(HttpMethod.DELETE, Entity.entity(entity, this.client.getContentType())).invoke();
+ }
+ } else if ("PUT".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept())
+ .put(Entity.entity(entity, this.client.getContentType()));
+ } else {
+ response = Response.serverError().entity(method + " not valid").build();
+ }
- } else {
- response = this.client.getBuilder().accept(this.client.getAccept())
- .build(HttpMethod.DELETE, Entity.entity(entity, this.client.getContentType())).invoke();
- }
- } else if ("PUT".equals(method)) {
- response = this.client.getBuilder().accept(this.client.getAccept()).put(Entity.entity(entity, this.client.getContentType()));
- } else {
- response = Response.serverError().entity(method + " not valid").build();
- }
-
- Optional<ResponseExceptionMapper> mapper = this.client.addResponseExceptionMapper();
- if (mapper.isPresent()) {
- try {
- mapper.get().map(response);
- } catch (NotFoundException e) {
- if (this.client.props.mapNotFoundToEmpty() && "GET".equals(method)) {
- logger.debug("RestClient recieved not found on URL: {}", this.client.getWebTarget().getUri());
- return response;
- } else {
- throw e;
- }
- }
- }
+ Optional<ResponseExceptionMapper> mapper = this.client.addResponseExceptionMapper();
+ if (mapper.isPresent()) {
+ try {
+ mapper.get().map(response);
+ } catch (NotFoundException e) {
+ if (this.client.props.mapNotFoundToEmpty() && "GET".equals(method)) {
+ logger.debug("RestClient recieved not found on URL: {}", this.client.getWebTarget().getUri());
+ return response;
+ } else {
+ throw e;
+ }
+ }
+ }
- return response;
- }
+ return response;
+ }
}
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
index 72a381a048..131bc27783 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -21,10 +21,8 @@
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.GraphInventoryVersion;
@@ -35,45 +33,47 @@ 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(GraphInventoryUri uri) {
-
- return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
- }
+ 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(GraphInventoryUri uri) {
+
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ }
+
+ @Override
+ public RestClient createClient(GraphInventoryUri 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 RestClient createClient(GraphInventoryUri 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";
- }
+ @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
index 6c6cf9024d..7029ffe5e4 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
@@ -22,42 +22,40 @@ 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 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;
- }
+ 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
index 9c8345d4b6..bb2b2eca19 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
@@ -24,8 +24,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperPatchPr
public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider {
-
- public AAICommonObjectMapperPatchProvider() {
- super();
- }
+
+ 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
index 15bc2ea8ef..b75f40eb39 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
@@ -24,8 +24,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide
public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider {
- public AAICommonObjectMapperProvider() {
- super();
- }
+ 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
index b29c8070c8..135341a2f4 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java
@@ -27,57 +27,58 @@ 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);
- }
+ 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
index 5f2c623d57..1747d97633 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
@@ -26,30 +26,31 @@ 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);
- }
-
+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
index 6b3bb545de..2fe3910486 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
@@ -21,36 +21,35 @@
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) {
- return String.format(s.replaceAll("%(\\d+)", "%$1\\$s"), variables.toArray());
- }
+ 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) {
+ return String.format(s.replaceAll("%(\\d+)", "%$1\\$s"), variables.toArray());
+ }
}
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
index 7eadea00ff..923a6805aa 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
@@ -21,67 +21,88 @@
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 GraphInventoryObjectPlurals, Serializable {
- private static final long serialVersionUID = 5312713297525740746L;
-
- public static final AAIObjectPlurals CUSTOMER = new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/customers", "customer");
- public static final AAIObjectPlurals GENERIC_VNF = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnf");
- public static final AAIObjectPlurals PORT_GROUP = new AAIObjectPlurals(AAIObjectType.VCE.uriTemplate(), "/port-groups", "port-group");
- public static final AAIObjectPlurals PSERVER = new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers", "pserver");
- public static final AAIObjectPlurals P_INTERFACE = new AAIObjectPlurals(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces", "p-interface");
- public static final AAIObjectPlurals L3_NETWORK = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/l3-networks", "l3-network");
- public static final AAIObjectPlurals NETWORK_POLICY = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/network-policies", "network-policy");
- public static final AAIObjectPlurals VPN_BINDING = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/vpn-bindings", "vpn-binding");
- public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions", "service-subscription");
- public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances", "service-instance");
- public static final AAIObjectPlurals OWNING_ENTITY = new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/owning-entities", "owning-entity");
- public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups", "volume-group");
- public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones", "availability-zone");
- public static final AAIObjectPlurals VF_MODULE = new AAIObjectPlurals(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules", "vf-module");
- public static final AAIObjectPlurals CONFIGURATION = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/configurations", "configuration");
- public static final AAIObjectPlurals DEFAULT_TENANT = new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants", "default-tenant");
- public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies", "network-technology");
- public static final AAIObjectPlurals LOGICAL_LINK = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/logical-links", "logical-link");
- public static final AAIObjectPlurals L_INTERFACE = new AAIObjectPlurals(AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces", "l-interface");
- public static final AAIObjectPlurals SUB_L_INTERFACE = new AAIObjectPlurals(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces", "l-interface");
+ private static final long serialVersionUID = 5312713297525740746L;
+
+ public static final AAIObjectPlurals CUSTOMER =
+ new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/customers", "customer");
+ public static final AAIObjectPlurals GENERIC_VNF =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnf");
+ public static final AAIObjectPlurals PORT_GROUP =
+ new AAIObjectPlurals(AAIObjectType.VCE.uriTemplate(), "/port-groups", "port-group");
+ public static final AAIObjectPlurals PSERVER =
+ new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers", "pserver");
+ public static final AAIObjectPlurals P_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces", "p-interface");
+ public static final AAIObjectPlurals L3_NETWORK =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/l3-networks", "l3-network");
+ public static final AAIObjectPlurals NETWORK_POLICY =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/network-policies", "network-policy");
+ public static final AAIObjectPlurals VPN_BINDING =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/vpn-bindings", "vpn-binding");
+ public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(
+ AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions", "service-subscription");
+ public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(
+ AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances", "service-instance");
+ public static final AAIObjectPlurals OWNING_ENTITY =
+ new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/owning-entities", "owning-entity");
+ public static final AAIObjectPlurals VOLUME_GROUP =
+ new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups", "volume-group");
+ public static final AAIObjectPlurals AVAILIBILITY_ZONE =
+ new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones", "availability-zone");
+ public static final AAIObjectPlurals VF_MODULE =
+ new AAIObjectPlurals(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules", "vf-module");
+ public static final AAIObjectPlurals CONFIGURATION =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/configurations", "configuration");
+ public static final AAIObjectPlurals DEFAULT_TENANT =
+ new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
+ + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants", "default-tenant");
+ public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(
+ AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies", "network-technology");
+ public static final AAIObjectPlurals LOGICAL_LINK =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/logical-links", "logical-link");
+ public static final AAIObjectPlurals L_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces", "l-interface");
+ public static final AAIObjectPlurals SUB_L_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces", "l-interface");
+
+ private final String uriTemplate;
+ private final String partialUri;
+ private final String name;
+
+ protected AAIObjectPlurals(String parentUri, String partialUri, String name) {
+ this.uriTemplate = parentUri + partialUri;
+ this.partialUri = partialUri;
+ this.name = name;
+ }
- private final String uriTemplate;
- private final String partialUri;
- private final String name;
- protected AAIObjectPlurals(String parentUri, String partialUri, String name) {
- this.uriTemplate = parentUri + partialUri;
- this.partialUri = partialUri;
- this.name = name;
- }
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
- @Override
- public String toString() {
- return this.uriTemplate();
- }
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
- @Override
- public String uriTemplate() {
- return this.uriTemplate;
- }
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
- @Override
- public String partialUri() {
- return this.partialUri;
- }
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
- @Override
- public String typeName() {
- return this.typeName(CaseFormat.LOWER_HYPHEN);
- }
- @Override
- public String typeName(CaseFormat format) {
- return CaseFormat.LOWER_HYPHEN.to(format, this.name);
- }
+ @Override
+ public String typeName(CaseFormat format) {
+ return CaseFormat.LOWER_HYPHEN.to(format, this.name);
+ }
}
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
index 29485f2de8..2ce4d8c6bf 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
-
import org.onap.aai.annotations.Metadata;
import org.onap.aai.domain.yang.AggregateRoute;
import org.onap.aai.domain.yang.AllottedResource;
@@ -81,157 +80,198 @@ import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
-
import com.google.common.base.CaseFormat;
public class AAIObjectType implements 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 = 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 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 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");
- 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");
-
-
- 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);
- try {
- for (Class<? extends AAIObjectType> customTypeClass : resources) {
- AAIObjectType customType;
- 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), "");
- }
+ 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 =
+ 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 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 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");
+ 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");
+
+
+ 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);
+ try {
+ for (Class<? extends AAIObjectType> customTypeClass : resources) {
+ AAIObjectType customType;
+ 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
index 9f6708200c..6505818758 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
@@ -24,11 +24,14 @@ 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;
- }
+ 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
index cc855e444a..634a65831f 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
@@ -26,34 +26,35 @@ 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);
- }
-
+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
index d5eeb83041..8f16d815b6 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
@@ -27,13 +27,13 @@ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider {
- public AAIQueryObjectMapperProvider() {
- super();
- AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ 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
index ee1736feeb..5b302f663e 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -21,7 +21,6 @@
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;
@@ -30,48 +29,49 @@ import org.onap.so.client.graphinventory.GraphInventoryResourcesClient;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-public class AAIResourcesClient extends GraphInventoryResourcesClient<AAIResourcesClient, AAIResourceUri, 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 class AAIResourcesClient extends
+ GraphInventoryResourcesClient<AAIResourcesClient, AAIResourceUri, 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;
+ }
+
+ @Override
+ public AAIResultWrapper createWrapper(String json) {
+ return new AAIResultWrapper(json);
+ }
+
+ @Override
+ public AAITransactionalClient beginTransaction() {
+ return new AAITransactionalClient(this, aaiClient);
+ }
+
+ @Override
+ public AAISingleTransactionClient beginSingleTransaction() {
+ return new AAISingleTransactionClient(this, aaiClient);
+ }
+
+ @Override
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ return super.buildRelationship(uri, Optional.empty());
+ }
- @Override
- public AAIResultWrapper createWrapper(String json) {
- return new AAIResultWrapper(json);
- }
+ @Override
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ return super.buildRelationship(uri, Optional.of(label));
+ }
- @Override
- public AAITransactionalClient beginTransaction() {
- return new AAITransactionalClient(this, aaiClient);
- }
+ @Override
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ return super.buildRelationship(uri, label);
+ }
- @Override
- public AAISingleTransactionClient beginSingleTransaction() {
- return new AAISingleTransactionClient(this, aaiClient);
- }
-
- @Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
- return super.buildRelationship(uri, Optional.empty());
- }
-
- @Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
- return super.buildRelationship(uri, Optional.of(label));
- }
-
- @Override
- protected Relationship buildRelationship(GraphInventoryResourceUri 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
index 15f2ed2fa2..875571d71e 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
@@ -22,8 +22,8 @@ package org.onap.so.client.aai;
public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider {
- public AAIResourcesObjectMapperProvider() {
- super();
- }
+ 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
index 30d1b040e2..6eafb965a2 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -23,9 +23,7 @@ package org.onap.so.client.aai;
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.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.GraphInventoryRestClient;
@@ -34,38 +32,38 @@ import org.onap.so.utils.TargetEntity;
public class AAIRestClient extends GraphInventoryRestClient {
- private final AAIProperties aaiProperties;
+ private final AAIProperties aaiProperties;
- protected AAIRestClient(AAIProperties props, URI uri) {
- super(props, uri);
- this.aaiProperties = props;
- }
+ protected AAIRestClient(AAIProperties props, URI uri) {
+ super(props, uri);
+ this.aaiProperties = props;
+ }
- @Override
- public TargetEntity getTargetEntity(){
- return TargetEntity.AAI;
+ @Override
+ public TargetEntity getTargetEntity() {
+ return TargetEntity.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();
+ @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);
- }
- }
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
+ }
- @Override
- protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
- return Optional.of(new AAIClientResponseExceptionMapper());
- }
-
- protected GraphInventoryPatchConverter getPatchConverter() {
- return this.patchConverter;
- }
+ 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
index 62d7d565ac..8bc709b276 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
@@ -29,13 +29,13 @@ 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);
+ List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException;
- Optional<Pnf> getPnfByName(String pnfId);
+ void updateMaintenceFlagVnfId(String vnfId, boolean inMaint);
- void createPnf(String pnfId, Pnf pnf);
+ GenericVnf getVnfByName(String vnfId);
+
+ Optional<Pnf> getPnfByName(String pnfId);
+
+ void createPnf(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
index b2c7fcc062..03e2eaea1f 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
@@ -45,8 +45,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
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));
+ String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
return this.getListOfPservers(jsonInput);
@@ -54,9 +53,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
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>>>() {
- });
+ 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"));
@@ -68,8 +66,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setInMaint(inMaint);
- new AAIResourcesClient()
- .update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
}
@@ -81,8 +78,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
@Override
public Optional<Pnf> getPnfByName(String pnfId) {
- Response response = new AAIResourcesClient()
- .getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
+ Response response =
+ new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
if (response.getStatus() != 200) {
return Optional.empty();
} else {
@@ -92,7 +89,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
@Override
public void createPnf(String pnfId, Pnf pnf) {
- new AAIResourcesClient()
- .createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), Optional.of(pnf));
+ new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId),
+ Optional.of(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
index fecbf59c36..1370bb3fa3 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -24,9 +24,7 @@ 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;
@@ -39,109 +37,116 @@ 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.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAISingleTransactionClient extends GraphInventoryTransactionClient<AAISingleTransactionClient, 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;
- }
- }
-
- 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
- public void put(String uri, Object body) {
- request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
- }
-
- @Override
- public void delete(String uri, Object body) {
- request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body));
- }
-
- @Override
- public 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, AAIResourceUri clone) {
- return resourcesClient.get(genericType, clone);
- }
-
- @Override
- protected boolean exists(AAIResourceUri uri) {
- return resourcesClient.exists(uri);
- }
-
- @Override
- protected String getGraphDBName() {
- return aaiClient.getGraphDBName();
- }
-
- @Override
- protected GraphInventoryPatchConverter getPatchConverter() {
- return this.patchConverter;
- }
+public class AAISingleTransactionClient
+ extends GraphInventoryTransactionClient<AAISingleTransactionClient, 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;
+ }
+ }
+
+ 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
+ public void put(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
+ }
+
+ @Override
+ public void delete(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body));
+ }
+
+ @Override
+ public 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, AAIResourceUri clone) {
+ return resourcesClient.get(genericType, clone);
+ }
+
+ @Override
+ protected boolean exists(AAIResourceUri 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
index 9fb6cd7706..11e458a3da 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -26,10 +26,8 @@ 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;
@@ -43,156 +41,166 @@ 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.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAITransactionalClient extends GraphInventoryTransactionClient<AAITransactionalClient, 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;
- }
- }
-
- 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
- public void put(String uri, Object body) {
- currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
- }
-
- @Override
- public void delete(String uri, Object body) {
- currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body));
-
- }
-
- @Override
- public void patch(String uri, Object body) {
- currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
- }
-
- @Override
- protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
- return resourcesClient.get(genericType, clone);
- }
-
- @Override
- protected boolean exists(AAIResourceUri uri) {
- return resourcesClient.exists(uri);
- }
-
- @Override
- protected String getGraphDBName() {
- return aaiClient.getGraphDBName();
- }
-
- @Override
- protected GraphInventoryPatchConverter getPatchConverter() {
- return this.patchConverter;
- }
+public class AAITransactionalClient
+ extends GraphInventoryTransactionClient<AAITransactionalClient, 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;
+ }
+ }
+
+ 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
+ public void put(String uri, Object body) {
+ currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
+ }
+
+ @Override
+ public void delete(String uri, Object body) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body));
+
+ }
+
+ @Override
+ public void patch(String uri, Object body) {
+ currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ return resourcesClient.get(genericType, clone);
+ }
+
+ @Override
+ protected boolean exists(AAIResourceUri 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
index f7c9fe8362..e8a2bc6c9c 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java
@@ -21,9 +21,9 @@
package org.onap.so.client.aai;
public interface AAIUpdator {
-
- void updateVnfToLocked(String vnfName) throws Exception;
-
- void updateVnfToUnLocked(String vnfName) throws Exception;
+
+ 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
index 2697e4a9e8..0d400339f9 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
@@ -24,27 +24,27 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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);
- }
+
+ @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
index 18252d548b..f191311b2a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidator.java
@@ -23,10 +23,10 @@ package org.onap.so.client.aai;
import java.io.IOException;
public interface AAIValidator {
-
- boolean isPhysicalServerLocked(String hostName) throws IOException;
-
- boolean isVNFLocked(String vnfId);
-
-} \ No newline at end of file
+ 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
index 1bd7720e55..3987d7375a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -22,7 +22,6 @@ 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;
@@ -32,40 +31,40 @@ import org.springframework.stereotype.Component;
public class AAIValidatorImpl implements AAIValidator {
- @Autowired
- protected AAIRestClientI client;
-
- public AAIRestClientI getClient() {
- return client;
- }
+ @Autowired
+ protected AAIRestClientI client;
+
+ public AAIRestClientI getClient() {
+ return client;
+ }
- public void setClient(AAIRestClientI client) {
- this.client = 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);
- for (Pserver pserver : pservers) {
- if (pserver.isInMaint()) {
- isLocked = true;
- return isLocked;
- }
- }
- return isLocked;
- }
+ @Override
+ public boolean isPhysicalServerLocked(String vnfId) throws IOException {
+ List<Pserver> pservers;
+ boolean isLocked = false;
+ pservers = client.getPhysicalServerByVnfId(vnfId);
+ 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;
+ @Override
+ public boolean isVNFLocked(String vnfId) {
+ boolean isLocked = false;
+ GenericVnf genericVnf = client.getVnfByName(vnfId);
+ if (genericVnf.isInMaint())
+ isLocked = true;
- return isLocked;
- }
+ 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
index d93d656403..499246d7d1 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
@@ -23,19 +23,19 @@ package org.onap.so.client.aai;
import org.onap.so.client.graphinventory.GraphInventoryVersion;
public enum AAIVersion implements GraphInventoryVersion {
- V13("v13"),
- V14("v14"),
- V15("v15");
-
- public final static 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;
- }
+ V13("v13"), V14("v14"), V15("v15");
+
+ public final static 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
index eb6d0d0b43..2e70c4925a 100644
--- 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
@@ -24,18 +24,18 @@ 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;
- }
+ 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
index c2aceeeeba..ee3ffd9bbf 100644
--- 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
@@ -20,6 +20,6 @@
package org.onap.so.client.aai.entities;
-public class AAIEntity{
-
+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
index dc91c8a034..5989a6579d 100644
--- 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
@@ -23,7 +23,7 @@ package org.onap.so.client.aai.entities;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
public interface AAIEntityObject {
-
- public AAIResourceUri getUri();
+
+ 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
index 4261f4f3c0..10828acd96 100644
--- 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
@@ -25,9 +25,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "requestError"
-})
+@JsonPropertyOrder({"requestError"})
public class AAIError {
@JsonProperty("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
index 5ce81ce879..ab3284dd8f 100644
--- 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
@@ -21,26 +21,25 @@
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);
- }
+ 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);
- }
+ @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
index e1ce3a8adc..81c07b2cf4 100644
--- 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
@@ -25,24 +25,16 @@ 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"
-})
+@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")
+ @JsonProperty("configuration-type")
private String configurationType;
@JsonProperty("configuration-sub-type")
private String configurationSubType;
@@ -52,13 +44,13 @@ public class Configuration {
private String modelVersionId;
@JsonProperty("orchestration-status")
private String orchestrationStatus;
- @JsonProperty("operational-status")
+ @JsonProperty("operational-status")
private String operationalStatus;
- @JsonProperty("configuration-selflink")
+ @JsonProperty("configuration-selflink")
private String configurationSelflink;
@JsonProperty("model-customization-id")
private String modelCustomizationId;
-
+
@JsonProperty("configuration-id")
public String getConfigurationId() {
return configurationId;
@@ -68,16 +60,16 @@ public class Configuration {
public void setConfigurationId(String configurationId) {
this.configurationId = configurationId;
}
-
+
@JsonProperty("configuration-name")
public String getConfigurationName() {
- return configurationName;
- }
+ return configurationName;
+ }
@JsonProperty("configuration-name")
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
- }
+ public void setConfigurationName(String configurationName) {
+ this.configurationName = configurationName;
+ }
@JsonProperty("configuration-type")
public String getConfigurationType() {
@@ -118,36 +110,36 @@ public class Configuration {
public void setModelVersionId(String modelVersionId) {
this.modelVersionId = modelVersionId;
}
-
+
@JsonProperty("orchestration-status")
public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
+ return orchestrationStatus;
+ }
@JsonProperty("orchestration-status")
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
@JsonProperty("operational-status")
- public String getOperationalStatus() {
- return operationalStatus;
- }
+ public String getOperationalStatus() {
+ return operationalStatus;
+ }
@JsonProperty("operational-status")
- public void setOperationalStatus(String operationalStatus) {
- this.operationalStatus = operationalStatus;
- }
-
+ public void setOperationalStatus(String operationalStatus) {
+ this.operationalStatus = operationalStatus;
+ }
+
@JsonProperty("model-customization-id")
public String getModelCustomizationId() {
- return modelCustomizationId;
- }
+ return modelCustomizationId;
+ }
@JsonProperty("model-customization-id")
- public void setModelCustomizationId(String modelCustomizationId) {
- this.modelCustomizationId = modelCustomizationId;
- }
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
@JsonProperty("configuration-selflink")
public String getConfigurationSelflink() {
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
index 8203476c82..af7ccf661e 100644
--- 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
@@ -23,60 +23,58 @@ 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)
+@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomQuery {
-
- private List<String> start;
- private String query;
- private String gremlin;
-
- public String getGremlin() {
- return gremlin;
- }
-
- public void setGremlin(String gremlin) {
- this.gremlin = 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 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;
- }
+
+ private List<String> start;
+ private String query;
+ private String gremlin;
+
+ public String getGremlin() {
+ return gremlin;
+ }
+
+ public void setGremlin(String gremlin) {
+ this.gremlin = 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 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
index b056fd0e40..c662b4e465 100644
--- 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
@@ -23,6 +23,6 @@ package org.onap.so.client.aai.entities;
@FunctionalInterface
public interface QueryStep {
-
- public String build();
+
+ 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
index 61a2f4b8fa..91f2ee121e 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -31,44 +29,46 @@ 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 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);
+
+ }
- 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) {
- @Override
- protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) {
-
- return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build());
- }
+ return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build());
+ }
- @Override
- protected AAIObjectType fromTypeName(String name) {
- return AAIObjectType.fromTypeName(name);
- }
+ @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
index bc8c283e34..1a9001df11 100644
--- 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
@@ -25,9 +25,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "serviceException"
-})
+@JsonPropertyOrder({"serviceException"})
public class RequestError {
@JsonProperty("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
index c3f0ad1fa1..a62c6adec1 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,22 +29,21 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"results"
-})
+@JsonPropertyOrder({"results"})
public class Results<T> {
- @JsonProperty("results")
- protected List<T> results;
-
- @JsonProperty("results")
+ @JsonProperty("results")
+ protected List<T> results;
+
+ @JsonProperty("results")
public List<T> getResult() {
if (results == null) {
- results = new ArrayList<>();
+ results = new ArrayList<>();
}
return this.results;
}
- @JsonProperty("results")
- public void setResult(List<T> results) {
- this.results=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
index 9d9723c514..de08dd9a81 100644
--- 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
@@ -22,17 +22,12 @@ 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"
-})
+@JsonPropertyOrder({"messageId", "text", "variables"})
public class ServiceException {
@JsonProperty("messageId")
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
index 4b2aac1364..16a4c178e5 100644
--- 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
@@ -27,46 +27,43 @@ import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"uri",
-"body"
-})
+@JsonPropertyOrder({"uri", "body"})
public class OperationBody {
-@JsonProperty("uri")
-private String uri;
-@JsonProperty("body")
-@JsonSerialize(using = OperationBodySerializer.class)
-private Object body;
+ @JsonProperty("uri")
+ private String uri;
+ @JsonProperty("body")
+ @JsonSerialize(using = OperationBodySerializer.class)
+ private Object body;
-@JsonProperty("uri")
-public String getUri() {
-return uri;
-}
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
-@JsonProperty("uri")
-public void setUri(String uri) {
-this.uri = uri;
-}
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
-public OperationBody withUri(String uri) {
-this.uri = uri;
-return this;
-}
+ public OperationBody withUri(String uri) {
+ this.uri = uri;
+ return this;
+ }
-@JsonProperty("body")
-public Object getBody() {
-return body;
-}
+ @JsonProperty("body")
+ public Object getBody() {
+ return body;
+ }
-@JsonProperty("body")
-public void setBody(Object body) {
-this.body = body;
-}
+ @JsonProperty("body")
+ public void setBody(Object body) {
+ this.body = body;
+ }
-public OperationBody withBody(Object body) {
-this.body = body;
-return this;
-}
+ 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
index 2981e0deef..7181e96aa4 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -29,26 +28,27 @@ 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);
- }
-
- }
+ 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
index 1c405753c3..3b4351d768 100644
--- 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
@@ -22,74 +22,69 @@ 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"
-})
+@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;
-}
+ @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
index 51d56d371a..69e8a18a3e 100644
--- 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
@@ -22,33 +22,30 @@ 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"
-})
+@JsonPropertyOrder({"transactions"})
public class Transactions {
-@JsonProperty("transactions")
-private List<Transaction> transactions = new ArrayList<>();
+ @JsonProperty("transactions")
+ private List<Transaction> transactions = new ArrayList<>();
-@JsonProperty("transactions")
-public List<Transaction> getTransactions() {
-return transactions;
-}
+ @JsonProperty("transactions")
+ public List<Transaction> getTransactions() {
+ return transactions;
+ }
-@JsonProperty("transactions")
-public void setTransactions(List<Transaction> transactions) {
-this.transactions = transactions;
-}
+ @JsonProperty("transactions")
+ public void setTransactions(List<Transaction> transactions) {
+ this.transactions = transactions;
+ }
-public Transactions withTransactions(List<Transaction> transactions) {
-this.transactions = transactions;
-return this;
-}
+ 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
index f2626e9e43..5d28013c85 100644
--- 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
@@ -27,62 +27,59 @@ import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"action",
-"uri",
-"body"
-})
+@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;
+ @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 String getAction() {
+ return action;
+ }
-public void setAction(String action) {
- this.action = 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;
-}
+ public OperationBodyRequest withAction(String action) {
+ this.action = action;
+ return this;
+ }
-@JsonProperty("uri")
-public void setUri(String uri) {
-this.uri = uri;
-}
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
-public OperationBodyRequest withUri(String uri) {
-this.uri = uri;
-return this;
-}
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
-@JsonProperty("body")
-public Object getBody() {
-return body;
-}
+ public OperationBodyRequest withUri(String uri) {
+ this.uri = uri;
+ return this;
+ }
-@JsonProperty("body")
-public void setBody(Object body) {
-this.body = body;
-}
+ @JsonProperty("body")
+ public Object getBody() {
+ return body;
+ }
-public OperationBodyRequest withBody(Object body) {
-this.body = body;
-return this;
-}
+ @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
index 170719962e..addc3f1364 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -29,26 +28,27 @@ 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);
- }
-
- }
+ 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
index 71f65b50db..c5b11fe1f7 100644
--- 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
@@ -23,49 +23,51 @@ 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"
-})
+@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;
- }
+ @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
index 0d392c453f..af32ca9498 100644
--- 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
@@ -22,24 +22,23 @@ 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;
- }
+ @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
index db251b5b3b..525956c5a9 100644
--- 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
@@ -22,26 +22,25 @@ 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;
- }
-
-
+ @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/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
index 8775a6a687..70dfd581e8 100644
--- 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
@@ -28,25 +28,37 @@ import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri {
- public AAIResourceUri relationshipAPI();
- public AAIResourceUri relatedTo(AAIObjectPlurals plural);
- public AAIResourceUri relatedTo(AAIObjectType type, String... values);
- public AAIResourceUri resourceVersion(String version);
- public AAIResourceUri format(Format format);
- @Override
- public AAIResourceUri depth(Depth depth);
- @Override
- public AAIResourceUri nodesOnly(boolean nodesOnly);
- @Override
- public AAIResourceUri queryParam(String name, String... values);
- @Override
- public AAIResourceUri replaceQueryParam(String name, String... values);
- @Override
- public AAIResourceUri resultIndex(int index);
- @Override
- public AAIResourceUri resultSize(int size);
- @Override
- public AAIResourceUri limit(int size);
- @Override
- public AAIResourceUri clone();
+ public AAIResourceUri relationshipAPI();
+
+ public AAIResourceUri relatedTo(AAIObjectPlurals plural);
+
+ public AAIResourceUri relatedTo(AAIObjectType type, String... values);
+
+ public AAIResourceUri resourceVersion(String version);
+
+ public AAIResourceUri format(Format format);
+
+ @Override
+ public AAIResourceUri depth(Depth depth);
+
+ @Override
+ public AAIResourceUri nodesOnly(boolean nodesOnly);
+
+ @Override
+ public AAIResourceUri queryParam(String name, String... values);
+
+ @Override
+ public AAIResourceUri replaceQueryParam(String name, String... values);
+
+ @Override
+ public AAIResourceUri resultIndex(int index);
+
+ @Override
+ public AAIResourceUri resultSize(int size);
+
+ @Override
+ public AAIResourceUri limit(int size);
+
+ @Override
+ public AAIResourceUri clone();
}
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
index 7cb37d9c3a..7572541206 100644
--- 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
@@ -21,9 +21,7 @@
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.Format;
@@ -33,105 +31,113 @@ import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUri extends SimpleUri 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(AAIObjectPlurals type, UriBuilder builder, Object... values) {
- super(type, builder, values);
- }
- protected AAISimpleUri(AAIObjectPlurals type) {
- super(type);
- }
- protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
- super(type, values);
- }
- protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
- super(parentUri, childType, childValues);
- }
-
- protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
- super(parentUri, childType);
- }
-
- @Override
- public AAISimpleUri relationshipAPI() {
- return (AAISimpleUri) super.relationshipAPI();
- }
-
- @Override
- public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
- return (AAISimpleUri) super.relatedTo(plural);
- }
- @Override
- public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
- return (AAISimpleUri) super.relatedTo(type, values);
- }
-
- @Override
- public AAISimpleUri resourceVersion(String version) {
- return (AAISimpleUri) super.resourceVersion(version);
- }
-
- @Override
- public AAISimpleUri queryParam(String name, String... values) {
- return (AAISimpleUri) super.queryParam(name, values);
- }
-
- @Override
- public AAISimpleUri replaceQueryParam(String name, String... values) {
- return (AAISimpleUri) super.replaceQueryParam(name, values);
- }
-
- @Override
- public AAISimpleUri resultIndex(int index) {
- return (AAISimpleUri) super.resultIndex(index);
- }
-
- @Override
- public AAISimpleUri resultSize(int size) {
- return (AAISimpleUri) super.resultSize(size);
- }
-
- @Override
- public AAISimpleUri limit(int size) {
- return (AAISimpleUri) super.limit(size);
- }
-
- @Override
- public AAISimpleUri clone() {
- if (this.type != null) {
- return new AAISimpleUri((AAIObjectType)this.type, this.internalURI.clone(), values);
- } else {
- return new AAISimpleUri((AAIObjectPlurals)this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public AAIObjectType getObjectType() {
- return (AAIObjectType)this.type;
- }
-
- @Override
- public AAISimpleUri depth(Depth depth) {
- return (AAISimpleUri) super.depth(depth);
- }
- @Override
- public AAISimpleUri nodesOnly(boolean nodesOnly) {
- return (AAISimpleUri)super.nodesOnly(nodesOnly);
- }
-
- @Override
- public AAISimpleUri format(Format format) {
- return (AAISimpleUri)super.format(format);
- }
+
+ 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(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+
+ protected AAISimpleUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
+ super(parentUri, childType, childValues);
+ }
+
+ protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ super(parentUri, childType);
+ }
+
+ @Override
+ public AAISimpleUri relationshipAPI() {
+ return (AAISimpleUri) super.relationshipAPI();
+ }
+
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
+ return (AAISimpleUri) super.relatedTo(plural);
+ }
+
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ return (AAISimpleUri) super.relatedTo(type, values);
+ }
+
+ @Override
+ public AAISimpleUri resourceVersion(String version) {
+ return (AAISimpleUri) super.resourceVersion(version);
+ }
+
+ @Override
+ public AAISimpleUri queryParam(String name, String... values) {
+ return (AAISimpleUri) super.queryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri replaceQueryParam(String name, String... values) {
+ return (AAISimpleUri) super.replaceQueryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri resultIndex(int index) {
+ return (AAISimpleUri) super.resultIndex(index);
+ }
+
+ @Override
+ public AAISimpleUri resultSize(int size) {
+ return (AAISimpleUri) super.resultSize(size);
+ }
+
+ @Override
+ public AAISimpleUri limit(int size) {
+ return (AAISimpleUri) super.limit(size);
+ }
+
+ @Override
+ public AAISimpleUri clone() {
+ if (this.type != null) {
+ return new AAISimpleUri((AAIObjectType) this.type, this.internalURI.clone(), values);
+ } else {
+ return new AAISimpleUri((AAIObjectPlurals) this.pluralType, this.internalURI.clone(), values);
+ }
+ }
+
+ @Override
+ public AAIObjectType getObjectType() {
+ return (AAIObjectType) this.type;
+ }
+
+ @Override
+ public AAISimpleUri depth(Depth depth) {
+ return (AAISimpleUri) super.depth(depth);
+ }
+
+ @Override
+ public AAISimpleUri nodesOnly(boolean nodesOnly) {
+ return (AAISimpleUri) super.nodesOnly(nodesOnly);
+ }
+
+ @Override
+ public AAISimpleUri format(Format format) {
+ return (AAISimpleUri) super.format(format);
+ }
}
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
index fb43cda7a4..6a4c90a6ee 100644
--- 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
@@ -26,37 +26,46 @@ import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
public interface AAIUri extends GraphInventoryUri {
- /**
- * By default A&AI 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
- */
- @Override
- public AAIUri depth(Depth depth);
- /**
- * Makes client only return object fields, no relationships
- *
- * @return
- */
- @Override
- public AAIUri nodesOnly(boolean nodesOnly);
- @Override
- public AAIUri queryParam(String name, String... values);
- @Override
- public AAIUri replaceQueryParam(String name, String... values);
- @Override
- public AAIUri resultIndex(int index);
- @Override
- public AAIUri resultSize(int size);
- @Override
- public AAIUri limit(int size);
- @Override
- public AAIUri clone();
-
- @Override
- public AAIObjectType getObjectType();
+ /**
+ * By default A&AI 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
+ */
+ @Override
+ public AAIUri depth(Depth depth);
+
+ /**
+ * Makes client only return object fields, no relationships
+ *
+ * @return
+ */
+ @Override
+ public AAIUri nodesOnly(boolean nodesOnly);
+
+ @Override
+ public AAIUri queryParam(String name, String... values);
+
+ @Override
+ public AAIUri replaceQueryParam(String name, String... values);
+
+ @Override
+ public AAIUri resultIndex(int index);
+
+ @Override
+ public AAIUri resultSize(int size);
+
+ @Override
+ public AAIUri limit(int size);
+
+ @Override
+ public AAIUri clone();
+
+ @Override
+ public AAIObjectType getObjectType();
}
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
index ac0aba3c36..406ff09952 100644
--- 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
@@ -21,96 +21,94 @@
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 AAIResourceUri createNodesUri(AAIObjectType type, Object... values) {
- return new NodesUri(type, values);
-
- }
-
- public static AAIResourceUri createNodesUri(AAIObjectPlurals type) {
- return new NodesUri(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 AAIResourceUri 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 AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
-
- return new AAISimpleUri(parentUri, childType, childValues);
- }
-
- public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
-
- return new AAISimpleUri(parentUri, childType);
- }
-
- /**
- * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
- *
- * @param type
- * @return
- */
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
-
- return new AAISimpleUri(type);
-
- }
-
- /**
- * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
- *
- * @param type
- * @return
- */
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
-
- return new AAISimpleUri(type, values);
-
- }
-} \ No newline at end of file
+
+ /**
+ * 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 AAIResourceUri createNodesUri(AAIObjectType type, Object... values) {
+ return new NodesUri(type, values);
+
+ }
+
+ public static AAIResourceUri createNodesUri(AAIObjectPlurals type) {
+ return new NodesUri(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 AAIResourceUri 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 AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
+ Object... childValues) {
+
+ return new AAISimpleUri(parentUri, childType, childValues);
+ }
+
+ public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+
+ return new AAISimpleUri(parentUri, childType);
+ }
+
+ /**
+ * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
+
+ return new AAISimpleUri(type);
+
+ }
+
+ /**
+ * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
+
+ return new AAISimpleUri(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
index 329471243b..30e60cdff2 100644
--- 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
@@ -22,32 +22,33 @@ 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]});
- }
+ 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
index a627480d5d..f086a6abcf 100644
--- 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
@@ -24,11 +24,9 @@ import java.io.IOException;
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;
@@ -39,101 +37,108 @@ import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadExcepti
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 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);
- }
- }
- Optional<String> cachedValueOpt = this.getCachedValue();
- return cachedValueOpt.isPresent() ? cachedValueOpt.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 = getURIKeys(uri);
- return super.build(map.values().toArray(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();
- }
- @Override
- public abstract URI buildNoNetwork();
+ private 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);
+ }
+ }
+ Optional<String> cachedValueOpt = this.getCachedValue();
+ return cachedValueOpt.isPresent() ? cachedValueOpt.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 = getURIKeys(uri);
+ return super.build(map.values().toArray(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();
+ }
+
+ @Override
+ public abstract URI buildNoNetwork();
}
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
index 6ffc6ecd9b..4b4b5d92a2 100644
--- 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
@@ -21,7 +21,6 @@
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.GraphInventoryObjectPlurals;
@@ -29,24 +28,24 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectType;
public class NodesUri extends AAISimpleUri {
- private static final long serialVersionUID = 8818689895730182042L;
-
- protected NodesUri(AAIObjectType type, Object... values) {
- super(type, values);
- }
-
- protected NodesUri(AAIObjectPlurals type) {
- super(type);
- }
-
-
- @Override
- protected String getTemplate(GraphInventoryObjectType type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
-
- @Override
- protected String getTemplate(GraphInventoryObjectPlurals type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
+ private static final long serialVersionUID = 8818689895730182042L;
+
+ protected NodesUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ }
+
+ protected NodesUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+
+ @Override
+ protected String getTemplate(GraphInventoryObjectType type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+
+ @Override
+ protected String getTemplate(GraphInventoryObjectPlurals type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
}
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
index 324193dc84..0b62d05c67 100644
--- 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
@@ -22,32 +22,33 @@ 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]});
- }
+ 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/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
index 9d72fdf85b..d6c7072c14 100644
--- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
@@ -24,7 +24,6 @@ import java.net.URI;
import java.security.GeneralSecurityException;
import java.util.Map;
import java.util.Optional;
-
import org.apache.commons.codec.binary.Base64;
import org.onap.so.client.RestClient;
import org.onap.so.client.policy.CommonObjectMapperProvider;
@@ -34,46 +33,47 @@ import org.onap.so.utils.TargetEntity;
public class AdapterRestClient extends RestClient {
- private final AdapterRestProperties adapterRestProperties;
- public AdapterRestClient(AdapterRestProperties props, URI uri) {
- super(props, Optional.of(uri));
- this.adapterRestProperties = props;
- }
+ private final AdapterRestProperties adapterRestProperties;
- public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) {
- super(props, Optional.of(uri), accept, contentType);
- this.adapterRestProperties = props;
- }
+ public AdapterRestClient(AdapterRestProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ this.adapterRestProperties = props;
+ }
+
+ public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) {
+ super(props, Optional.of(uri), accept, contentType);
+ this.adapterRestProperties = props;
+ }
@Override
- public TargetEntity getTargetEntity(){
+ public TargetEntity getTargetEntity() {
return TargetEntity.OPENSTACK_ADAPTER;
}
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("Authorization",
- this.getBasicAuth(adapterRestProperties.getAuth(), adapterRestProperties.getKey()));
- }
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization",
+ this.getBasicAuth(adapterRestProperties.getAuth(), adapterRestProperties.getKey()));
+ }
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new JettisonStyleMapperProvider();
+ }
- @Override
- protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
- return new JettisonStyleMapperProvider();
- }
-
- private String getBasicAuth(String encryptedAuth, String msoKey) {
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
- return null;
- }
- try {
- String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
- byte[] encoded = Base64.encodeBase64(auth.getBytes());
- String encodedString = new String(encoded);
- encodedString = "Basic " + encodedString;
- return encodedString;
- } catch (GeneralSecurityException e) {
- logger.error(e.getMessage(),e);
- return null;
- }
- }
+ private String getBasicAuth(String encryptedAuth, String msoKey) {
+ if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
+ return null;
+ }
+ try {
+ String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
+ byte[] encoded = Base64.encodeBase64(auth.getBytes());
+ String encodedString = new String(encoded);
+ encodedString = "Basic " + encodedString;
+ return encodedString;
+ } catch (GeneralSecurityException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
index 18e0bd8996..5dcc6d52d7 100644
--- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
@@ -24,6 +24,7 @@ import org.onap.so.client.RestProperties;
public interface AdapterRestProperties extends RestProperties {
- public String getAuth();
- public String getKey();
+ public String getAuth();
+
+ public String getKey();
}
diff --git a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
index edd4e6dfa4..66beec0d48 100644
--- a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
+++ b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
@@ -39,15 +39,12 @@ public class BasicAuthClientInterceptor implements ClientInterceptor {
}
@Override
- public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
- MethodDescriptor<ReqT, RespT> method,
- CallOptions callOptions,
- Channel channel) {
+ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method,
+ CallOptions callOptions, Channel channel) {
Key<String> authHeader = Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER);
- return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
- channel.newCall(method, callOptions)) {
+ return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(channel.newCall(method, callOptions)) {
@Override
public void start(Listener<RespT> responseListener, Metadata headers) {
headers.put(authHeader, props.getBasicAuth());
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
index 9b2fd3fdb0..7ef158996d 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
@@ -33,18 +33,17 @@ import org.slf4j.LoggerFactory;
/**
* <p>
- * The CDS processing client is using gRPC for communication between SO and CDS.
- * That communication is configured to use a streaming approach, meaning that
- * client can send an event to which server can reply will multiple sub-responses,
+ * The CDS processing client is using gRPC for communication between SO and CDS. That communication is configured to use
+ * a streaming approach, meaning that client can send an event to which server can reply will multiple sub-responses,
* until full completion of the processing.
* </p>
* <p>
- * In order for the caller to manage the callback, it is the responsibility of the
- * caller to implement and provide a {@link CDSProcessingListener} so received messages
- * can be handled appropriately.
+ * In order for the caller to manage the callback, it is the responsibility of the caller to implement and provide a
+ * {@link CDSProcessingListener} so received messages can be handled appropriately.
* </p>
*
* Here is an example of implementation of such listener:
+ *
* <pre>
* new CDSProcessingListener {
*
@@ -72,15 +71,12 @@ public class CDSProcessingClient implements AutoCloseable {
CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
if (props == null) {
throw new PreconditionFailedException(
- "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
+ "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
}
- this.channel = NettyChannelBuilder
- .forAddress(props.getHost(), props.getPort())
- .nameResolverFactory(new DnsNameResolverProvider())
- .loadBalancerFactory(new PickFirstLoadBalancerProvider())
- .intercept(new BasicAuthClientInterceptor(props))
- .usePlaintext()
- .build();
+ this.channel = NettyChannelBuilder.forAddress(props.getHost(), props.getPort())
+ .nameResolverFactory(new DnsNameResolverProvider())
+ .loadBalancerFactory(new PickFirstLoadBalancerProvider())
+ .intercept(new BasicAuthClientInterceptor(props)).usePlaintext().build();
this.handler = new CDSProcessingHandler(listener);
log.info("CDSProcessingClient started");
}
@@ -93,16 +89,14 @@ public class CDSProcessingClient implements AutoCloseable {
/**
* Sends a request to the CDS backend micro-service.
*
- * The caller will be returned a CountDownLatch that can be used
- * to define how long the processing can wait. The CountDownLatch is
- * initiated with just 1 count. When the client receives an #onCompleted callback,
- * the counter will decrement.
+ * The caller will be returned a CountDownLatch that can be used to define how long the processing can wait. The
+ * CountDownLatch is initiated with just 1 count. When the client receives an #onCompleted callback, the counter
+ * will decrement.
*
* It is the user responsibility to close the client.
*
* @param input request to send
- * @return CountDownLatch instance that can be use to #await for
- * completeness of processing
+ * @return CountDownLatch instance that can be use to #await for completeness of processing
*/
public CountDownLatch sendRequest(ExecutionServiceInput input) {
return handler.process(input, channel);
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
index 4b86493f79..9fdcb8e13e 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
@@ -46,7 +46,7 @@ class CDSProcessingHandler {
ActionIdentifiers header = request.getActionIdentifiers();
log.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(),
- header.getBlueprintVersion());
+ header.getBlueprintVersion());
final CountDownLatch finishLatch = new CountDownLatch(1);
@@ -67,7 +67,7 @@ class CDSProcessingHandler {
@Override
public void onCompleted() {
log.info("Completed blueprint({}:{}) for action({})", header.getBlueprintVersion(),
- header.getBlueprintName(), header.getBlueprintVersion());
+ header.getBlueprintName(), header.getBlueprintVersion());
finishLatch.countDown();
}
};
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index 59c64e0459..a1e58c6a08 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -1,17 +1,14 @@
/*
* Copyright (C) 2019 Bell Canada.
*
- * 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
+ * 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
+ * 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.
+ * 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.
*/
package org.onap.so.client.cds;
@@ -25,6 +22,6 @@ public interface CDSProperties extends RestProperties {
int getPort();
String getBasicAuth();
-
+
int getTimeout();
}
diff --git a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
index ffebe77620..4ca5690188 100644
--- a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.defaultproperties;
import java.io.File;
@@ -27,23 +27,24 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-
import org.onap.so.client.dmaap.DmaapProperties;
public class DefaultDmaapPropertiesImpl implements DmaapProperties {
- private final Map<String, String> properties;
- public DefaultDmaapPropertiesImpl() throws IOException {
- File initialFile = new File("src/test/resources/dmaap.properties");
- InputStream targetStream = new FileInputStream(initialFile);
- Properties properties = new Properties();
- properties.load(targetStream);
- this.properties = new HashMap<>();
- properties.forEach((key, value) -> this.properties.put((String)key, (String)value));
- }
- @Override
- public Map<String, String> getProperties() {
- return this.properties;
- }
+ private final Map<String, String> properties;
+
+ public DefaultDmaapPropertiesImpl() throws IOException {
+ File initialFile = new File("src/test/resources/dmaap.properties");
+ InputStream targetStream = new FileInputStream(initialFile);
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ this.properties = new HashMap<>();
+ properties.forEach((key, value) -> this.properties.put((String) key, (String) value));
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return this.properties;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
index 9e4574df4c..06aaf6de3c 100644
--- a/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
@@ -29,53 +29,54 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-
import org.onap.so.client.policy.PolicyRestProperties;
public class PolicyRestPropertiesImpl implements PolicyRestProperties {
-
- final Map<Object, Object> props;
- public PolicyRestPropertiesImpl() {
- File initialFile = new File("src/test/resources/policy.properties");
- Map<Object, Object> temp;
- try (InputStream targetStream = new FileInputStream(initialFile)) {
- Properties properties = new Properties();
- properties.load(targetStream);
- temp = properties;
- } catch (IOException e) {
- temp = new HashMap<>();
- }
- this.props = temp;
-
- }
- @Override
- public URL getEndpoint() {
- try {
- return new URL((String)props.getOrDefault("policy.endpoint", ""));
- } catch (MalformedURLException e) {
- return null;
- }
- }
- @Override
- public String getSystemName() {
- return "MSO";
- }
-
- @Override
- public String getClientAuth() {
- return (String)props.get("policy.client.auth");
- }
-
- @Override
- public String getAuth() {
- return (String)props.get("policy.auth");
- }
-
- @Override
- public String getEnvironment() {
- return (String)props.get("policy.environment");
- }
+ final Map<Object, Object> props;
+
+ public PolicyRestPropertiesImpl() {
+ File initialFile = new File("src/test/resources/policy.properties");
+ Map<Object, Object> temp;
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ temp = properties;
+ } catch (IOException e) {
+ temp = new HashMap<>();
+ }
+ this.props = temp;
+
+ }
+
+ @Override
+ public URL getEndpoint() {
+ try {
+ return new URL((String) props.getOrDefault("policy.endpoint", ""));
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public String getClientAuth() {
+ return (String) props.get("policy.client.auth");
+ }
+
+ @Override
+ public String getAuth() {
+ return (String) props.get("policy.auth");
+ }
+
+ @Override
+ public String getEnvironment() {
+ return (String) props.get("policy.environment");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/Consumer.java b/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
index 7b1310f252..1985f6478a 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
@@ -22,5 +22,5 @@ package org.onap.so.client.dmaap;
public interface Consumer {
- public Iterable<String> fetch();
+ public Iterable<String> fetch();
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
index dea00dd08f..86d4aa7413 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
@@ -26,7 +26,6 @@ import java.util.Base64;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
-
import org.onap.so.client.defaultproperties.DefaultDmaapPropertiesImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,48 +35,48 @@ import org.onap.so.utils.CryptoUtils;
public abstract class DmaapClient {
- protected static Logger logger = LoggerFactory.getLogger(DmaapClient.class);
- protected final Map<String, String> msoProperties;
- protected final Properties properties;
+ protected static Logger logger = LoggerFactory.getLogger(DmaapClient.class);
+ protected final Map<String, String> msoProperties;
+ protected final Properties properties;
- public DmaapClient(String filepath) throws IOException {
- Resource resource = new ClassPathResource(filepath);
- DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
- if (dmaapProperties == null) {
- logger.error("No RestProperty implementation found on classpath, loading default");
- dmaapProperties = new DefaultDmaapPropertiesImpl();
- }
- this.msoProperties = dmaapProperties.getProperties();
- this.properties = new Properties();
- this.properties.load(resource.getInputStream());
- try {
- this.properties.put("auth", CryptoUtils.decrypt(this.getAuth(), this.getKey()).getBytes());
- } catch (GeneralSecurityException e) {
- logger.error(e.getMessage(), e);
- }
- this.properties.put("key", this.getKey());
- this.properties.put("topic", this.getTopic());
- Optional<String> host = this.getHost();
- if (host.isPresent()) {
- this.properties.put("host", host.get());
- }
- }
+ public DmaapClient(String filepath) throws IOException {
+ Resource resource = new ClassPathResource(filepath);
+ DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
+ if (dmaapProperties == null) {
+ logger.error("No RestProperty implementation found on classpath, loading default");
+ dmaapProperties = new DefaultDmaapPropertiesImpl();
+ }
+ this.msoProperties = dmaapProperties.getProperties();
+ this.properties = new Properties();
+ this.properties.load(resource.getInputStream());
+ try {
+ this.properties.put("auth", CryptoUtils.decrypt(this.getAuth(), this.getKey()).getBytes());
+ } catch (GeneralSecurityException e) {
+ logger.error(e.getMessage(), e);
+ }
+ this.properties.put("key", this.getKey());
+ this.properties.put("topic", this.getTopic());
+ Optional<String> host = this.getHost();
+ if (host.isPresent()) {
+ this.properties.put("host", host.get());
+ }
+ }
- protected String deobfuscatePassword(String decrypted_key) {
+ protected String deobfuscatePassword(String decrypted_key) {
- try {
- return new String(Base64.getDecoder().decode(decrypted_key.getBytes()));
- } catch (IllegalArgumentException iae) {
- logger.error("llegal Arguments", iae);
- return decrypted_key;
- }
- }
+ try {
+ return new String(Base64.getDecoder().decode(decrypted_key.getBytes()));
+ } catch (IllegalArgumentException iae) {
+ logger.error("llegal Arguments", iae);
+ return decrypted_key;
+ }
+ }
- public abstract String getKey();
+ public abstract String getKey();
- public abstract String getAuth();
+ public abstract String getAuth();
- public abstract String getTopic();
+ public abstract String getTopic();
- public abstract Optional<String> getHost();
+ public abstract Optional<String> getHost();
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index c9acdd7e89..3dd0c751e3 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -29,97 +29,104 @@ import org.onap.so.client.dmaap.rest.RestConsumer;
public abstract class DmaapConsumer extends DmaapClient {
- public DmaapConsumer() throws IOException {
- super("dmaap/default-consumer.properties");
- }
-
- public Consumer getConsumer() {
- return new RestConsumer(this.properties);
- }
-
- public boolean consume() throws Exception {
- Consumer mrConsumer = this.getConsumer();
- boolean accepted = false;
- Stopwatch stopwatch = Stopwatch.createUnstarted();
- try {
- while (this.continuePolling()) {
- if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
- final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
- logger.error(message);
- throw new ExceededMaximumPollingTime(message);
- }
- stopwatch.start();
- Iterable<String> itr = mrConsumer.fetch();
- stopwatch.stop();
- for (String message : itr) {
- if (!accepted && this.isAccepted(message)) {
- logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
- accepted = true;
- }
- if (accepted) {
- logger.info("received dmaap message: " + message);
- if (this.isFailure(message)) {
- this.stopProcessingMessages();
- final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- logger.error(errorMsg);
- throw new DMaaPConsumerFailure(errorMsg);
- } else {
- this.processMessage(message);
- }
- }
- }
- }
- return true;
- } finally {
- if (stopwatch.isRunning()) {
- stopwatch.stop();
- }
- }
- }
-
- /**
- * Should this consumer continue to consume messages from the topic?
- * @return
- */
- public abstract boolean continuePolling();
- /**
- * Process a message from a DMaaP topic
- *
- * @param message
- * @throws Exception
- */
- public abstract void processMessage(String message) throws Exception;
- /**
- * Has the request been accepted by the receiving system?
- * Should the consumer move to processing messages?
- *
- * @param message
- * @return
- */
- public abstract boolean isAccepted(String message);
- /**
- * has the request failed?
- *
- * @param message
- * @return
- */
- public abstract boolean isFailure(String message);
- /**
- * The request id to filter messages on
- * @return
- */
- public abstract String getRequestId();
- /**
- * Logic that defines when the consumer should stop processing messages
- */
- public abstract void stopProcessingMessages();
-
- /**
- * time in milliseconds
- */
- public int getMaximumElapsedTime() {
- return 180000;
- }
+ public DmaapConsumer() throws IOException {
+ super("dmaap/default-consumer.properties");
+ }
+
+ public Consumer getConsumer() {
+ return new RestConsumer(this.properties);
+ }
+
+ public boolean consume() throws Exception {
+ Consumer mrConsumer = this.getConsumer();
+ boolean accepted = false;
+ Stopwatch stopwatch = Stopwatch.createUnstarted();
+ try {
+ while (this.continuePolling()) {
+ if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
+ final String message =
+ "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
+ logger.error(message);
+ throw new ExceededMaximumPollingTime(message);
+ }
+ stopwatch.start();
+ Iterable<String> itr = mrConsumer.fetch();
+ stopwatch.stop();
+ for (String message : itr) {
+ if (!accepted && this.isAccepted(message)) {
+ logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
+ accepted = true;
+ }
+ if (accepted) {
+ logger.info("received dmaap message: " + message);
+ if (this.isFailure(message)) {
+ this.stopProcessingMessages();
+ final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+ logger.error(errorMsg);
+ throw new DMaaPConsumerFailure(errorMsg);
+ } else {
+ this.processMessage(message);
+ }
+ }
+ }
+ }
+ return true;
+ } finally {
+ if (stopwatch.isRunning()) {
+ stopwatch.stop();
+ }
+ }
+ }
+
+ /**
+ * Should this consumer continue to consume messages from the topic?
+ *
+ * @return
+ */
+ public abstract boolean continuePolling();
+
+ /**
+ * Process a message from a DMaaP topic
+ *
+ * @param message
+ * @throws Exception
+ */
+ public abstract void processMessage(String message) throws Exception;
+
+ /**
+ * Has the request been accepted by the receiving system? Should the consumer move to processing messages?
+ *
+ * @param message
+ * @return
+ */
+ public abstract boolean isAccepted(String message);
+
+ /**
+ * has the request failed?
+ *
+ * @param message
+ * @return
+ */
+ public abstract boolean isFailure(String message);
+
+ /**
+ * The request id to filter messages on
+ *
+ * @return
+ */
+ public abstract String getRequestId();
+
+ /**
+ * Logic that defines when the consumer should stop processing messages
+ */
+ public abstract void stopProcessingMessages();
+
+ /**
+ * time in milliseconds
+ */
+ public int getMaximumElapsedTime() {
+ return 180000;
+ }
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
index 161608dc77..604f2b3e89 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
@@ -24,9 +24,10 @@ import java.util.Map;
public interface DmaapProperties {
- /**
- * A map of strings which contains the properties for a dmaap client
- * @return
- */
- public Map<String, String> getProperties();
+ /**
+ * A map of strings which contains the properties for a dmaap client
+ *
+ * @return
+ */
+ public Map<String, String> getProperties();
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
index 3064f6142f..f2b3d5d643 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
@@ -23,47 +23,50 @@ package org.onap.so.client.dmaap;
import java.util.ServiceLoader;
public class DmaapPropertiesLoader {
- /* required to make ServiceLoader thread safe */
- private static final ThreadLocal<ServiceLoader<DmaapProperties>> services = new ThreadLocal<ServiceLoader<DmaapProperties>>() {
- @Override
- protected ServiceLoader<DmaapProperties> initialValue() {
- return ServiceLoader.load(DmaapProperties.class);
- }
- };
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<DmaapProperties>> services =
+ new ThreadLocal<ServiceLoader<DmaapProperties>>() {
+ @Override
+ protected ServiceLoader<DmaapProperties> initialValue() {
+ return ServiceLoader.load(DmaapProperties.class);
+ }
+ };
- private DmaapPropertiesLoader() {
- }
-
- private static class Helper {
- private static final DmaapPropertiesLoader INSTANCE = new DmaapPropertiesLoader();
- }
-
- public static DmaapPropertiesLoader getInstance() {
- return Helper.INSTANCE;
- }
- public DmaapProperties getImpl() {
- return this.getImpl(false);
- }
- public DmaapProperties getNewImpl() {
- return this.getImpl(true);
- }
- private DmaapProperties getImpl(boolean forceNewInstance) {
-
- ServiceLoader<DmaapProperties> loader = this.services.get();
- for (DmaapProperties service : loader) {
- if (forceNewInstance) {
- try {
- return service.getClass().newInstance();
- } catch (InstantiationException | IllegalAccessException e) {
- /* all spi implementations must provide a public
- * no argument constructor
- */
- }
- } else {
- return service;
- }
- }
-
- return null;
- }
+ private DmaapPropertiesLoader() {}
+
+ private static class Helper {
+ private static final DmaapPropertiesLoader INSTANCE = new DmaapPropertiesLoader();
+ }
+
+ public static DmaapPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public DmaapProperties getImpl() {
+ return this.getImpl(false);
+ }
+
+ public DmaapProperties getNewImpl() {
+ return this.getImpl(true);
+ }
+
+ private DmaapProperties getImpl(boolean forceNewInstance) {
+
+ ServiceLoader<DmaapProperties> loader = this.services.get();
+ for (DmaapProperties service : loader) {
+ if (forceNewInstance) {
+ try {
+ return service.getClass().newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ /*
+ * all spi implementations must provide a public no argument constructor
+ */
+ }
+ } else {
+ return service;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
index 48691dcd84..158bc6e264 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
@@ -22,30 +22,30 @@ package org.onap.so.client.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
-
import org.onap.so.client.dmaap.rest.RestPublisher;
public abstract class DmaapPublisher extends DmaapClient {
-
- private long seconds;
- private final Publisher publisher;
- public DmaapPublisher() throws FileNotFoundException, IOException {
- super("dmaap/default-consumer.properties");
- this.publisher = new RestPublisher(properties);
- this.seconds = 20;
-
- }
-
- public DmaapPublisher(long seconds) throws FileNotFoundException, IOException {
- this();
- this.seconds = seconds;
- }
-
- public void send(String json){
- logger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
- publisher.send(json);
- //publisher.close(seconds, TimeUnit.SECONDS);
- }
+
+ private long seconds;
+ private final Publisher publisher;
+
+ public DmaapPublisher() throws FileNotFoundException, IOException {
+ super("dmaap/default-consumer.properties");
+ this.publisher = new RestPublisher(properties);
+ this.seconds = 20;
+
+ }
+
+ public DmaapPublisher(long seconds) throws FileNotFoundException, IOException {
+ this();
+ this.seconds = seconds;
+ }
+
+ public void send(String json) {
+ logger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
+ publisher.send(json);
+ // publisher.close(seconds, TimeUnit.SECONDS);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/Publisher.java b/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
index ba6ce16418..8d5974cdfc 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
@@ -17,10 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap;
public interface Publisher {
- public void send(String json);
+ public void send(String json);
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
index f845f7e6ef..70c27532b6 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
@@ -17,18 +17,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap.exceptions;
public class DMaaPConsumerFailure extends Exception {
- private static final long serialVersionUID = 2499229901897110362L;
+ private static final long serialVersionUID = 2499229901897110362L;
+
+ public DMaaPConsumerFailure() {
+ super();
+ }
- public DMaaPConsumerFailure() {
- super();
- }
-
- public DMaaPConsumerFailure(String message) {
- super(message);
- }
+ public DMaaPConsumerFailure(String message) {
+ super(message);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
index 0002f878d8..e6d27aac80 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
@@ -17,18 +17,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap.exceptions;
-public class ExceededMaximumPollingTime extends RuntimeException {
+public class ExceededMaximumPollingTime extends RuntimeException {
+
+ private static final long serialVersionUID = 2331207691092906423L;
- private static final long serialVersionUID = 2331207691092906423L;
+ public ExceededMaximumPollingTime() {
+ super();
+ }
- public ExceededMaximumPollingTime() {
- super();
- }
-
- public ExceededMaximumPollingTime(String message) {
- super(message);
- }
+ public ExceededMaximumPollingTime(String message) {
+ super(message);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index 9fd8c05cb5..1d85dac7dc 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -22,32 +22,31 @@ package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Map;
-
import org.onap.so.client.RestClient;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
public class DMaaPRestClient extends RestClient {
- private final String auth;
- private final String key;
-
- public DMaaPRestClient(URL url, String contentType, String auth, String key) {
- super(url, contentType);
- this.auth = auth;
- this.key = key;
- }
-
- @Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.DMAAP;
- }
-
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
- addBasicAuthHeader(auth, key);
- }
- }
+ private final String auth;
+ private final String key;
+
+ public DMaaPRestClient(URL url, String contentType, String auth, String key) {
+ super(url, contentType);
+ this.auth = auth;
+ this.key = key;
+ }
+
+ @Override
+ public TargetEntity getTargetEntity() {
+ return TargetEntity.DMAAP;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
index 18849217f8..52ea452e07 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
@@ -17,115 +17,135 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap.rest;
import java.util.Properties;
public class PropertiesBean {
- private String auth;
- private String key;
- private String environment;
- private String partition;
- private String contentType;
- private String host;
- private String topic;
- private String timeout;
-
-
- public PropertiesBean(Properties properties) {
- this.withAuth(properties.getProperty("auth"))
- .withKey(properties.getProperty("key"))
- .withTopic(properties.getProperty("topic"))
- .withEnvironment(properties.getProperty("environment"))
- .withHost(properties.getProperty("host"))
- .withTimeout(properties.getProperty("timeout", "20000"))
- .withPartition(properties.getProperty("partition"))
- .withContentType(properties.getProperty("contentType", "application/json"));
- }
- public String getAuth() {
- return auth;
- }
- public void setAuth(String auth) {
- this.auth = auth;
- }
- public PropertiesBean withAuth(String auth) {
- this.auth = auth;
- return this;
- }
- public String getKey() {
- return key;
- }
- public void setKey(String key) {
- this.key = key;
- }
- public PropertiesBean withKey(String key) {
- this.key = key;
- return this;
- }
- public String getEnvironment() {
- return environment;
- }
- public void setEnvironment(String environment) {
- this.environment = environment;
- }
- public PropertiesBean withEnvironment(String environment) {
- this.environment = environment;
- return this;
- }
- public String getPartition() {
- return partition;
- }
- public void setPartition(String partition) {
- this.partition = partition;
- }
- public PropertiesBean withPartition(String partition) {
- this.partition = partition;
- return this;
- }
- public String getContentType() {
- return contentType;
- }
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
- public PropertiesBean withContentType(String contentType) {
- this.contentType = contentType;
- return this;
- }
- public String getHost() {
- return host;
- }
- public void setHost(String host) {
- this.host = host;
- }
- public PropertiesBean withHost(String host) {
- this.host = host;
- return this;
- }
- public String getTopic() {
- return topic;
- }
- public void setTopic(String topic) {
- this.topic = topic;
- }
- public PropertiesBean withTopic(String topic) {
- this.topic = topic;
- return this;
- }
- public String getTimeout() {
- return timeout;
- }
- public void setTimeout(String timeout) {
- this.timeout = timeout;
- }
- public PropertiesBean withTimeout(String timeout) {
- this.timeout = timeout;
- return this;
- }
-
-
-
-
+ private String auth;
+ private String key;
+ private String environment;
+ private String partition;
+ private String contentType;
+ private String host;
+ private String topic;
+ private String timeout;
+
+
+ public PropertiesBean(Properties properties) {
+ this.withAuth(properties.getProperty("auth")).withKey(properties.getProperty("key"))
+ .withTopic(properties.getProperty("topic")).withEnvironment(properties.getProperty("environment"))
+ .withHost(properties.getProperty("host")).withTimeout(properties.getProperty("timeout", "20000"))
+ .withPartition(properties.getProperty("partition"))
+ .withContentType(properties.getProperty("contentType", "application/json"));
+ }
+
+ public String getAuth() {
+ return auth;
+ }
+
+ public void setAuth(String auth) {
+ this.auth = auth;
+ }
+
+ public PropertiesBean withAuth(String auth) {
+ this.auth = auth;
+ return this;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public PropertiesBean withKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ public String getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+ public PropertiesBean withEnvironment(String environment) {
+ this.environment = environment;
+ return this;
+ }
+
+ public String getPartition() {
+ return partition;
+ }
+
+ public void setPartition(String partition) {
+ this.partition = partition;
+ }
+
+ public PropertiesBean withPartition(String partition) {
+ this.partition = partition;
+ return this;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public PropertiesBean withContentType(String contentType) {
+ this.contentType = contentType;
+ return this;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public PropertiesBean withHost(String host) {
+ this.host = host;
+ return this;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ public PropertiesBean withTopic(String topic) {
+ this.topic = topic;
+ return this;
+ }
+
+ public String getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(String timeout) {
+ this.timeout = timeout;
+ }
+
+ public PropertiesBean withTimeout(String timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+
+
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
index bee5a0c2ca..a3ebf3c56c 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
@@ -25,37 +25,34 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.client.RestClient;
import org.onap.so.client.dmaap.Consumer;
public class RestConsumer implements Consumer {
- private final RestClient client;
- public RestConsumer(Properties properties) {
- PropertiesBean bean = new PropertiesBean(properties);
- client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
- }
-
- private URL createURL(PropertiesBean properties) {
- try {
- return UriBuilder.fromUri(properties.getHost())
- .path("events").path(properties.getTopic())
- .path(properties.getPartition())
- .path("consumer1")
- .queryParam("timeout", properties.getTimeout()).build().toURL();
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public Iterable<String> fetch() {
-
- return client.get(new GenericType<List<String>>() {}).orElse(new ArrayList<>());
- }
+ private final RestClient client;
+
+ public RestConsumer(Properties properties) {
+ PropertiesBean bean = new PropertiesBean(properties);
+ client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
+ }
+
+ private URL createURL(PropertiesBean properties) {
+ try {
+ return UriBuilder.fromUri(properties.getHost()).path("events").path(properties.getTopic())
+ .path(properties.getPartition()).path("consumer1").queryParam("timeout", properties.getTimeout())
+ .build().toURL();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public Iterable<String> fetch() {
+
+ return client.get(new GenericType<List<String>>() {}).orElse(new ArrayList<>());
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
index af660c2aa4..7926141f3b 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
@@ -23,33 +23,30 @@ package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
-
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.client.RestClient;
import org.onap.so.client.dmaap.Publisher;
public class RestPublisher implements Publisher {
- private final RestClient client;
+ private final RestClient client;
+
+ public RestPublisher(Properties properties) {
+ PropertiesBean bean = new PropertiesBean(properties);
+ client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
+ }
+
+ private URL createURL(PropertiesBean properties) {
+ try {
+ return UriBuilder.fromUri(properties.getHost()).path("events").path(properties.getTopic())
+ .queryParam("timeout", properties.getTimeout()).build().toURL();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
- public RestPublisher(Properties properties) {
- PropertiesBean bean = new PropertiesBean(properties);
- client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
- }
-
- private URL createURL(PropertiesBean properties) {
- try {
- return UriBuilder.fromUri(properties.getHost())
- .path("events").path(properties.getTopic())
- .queryParam("timeout", properties.getTimeout()).build().toURL();
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void send(String json) {
- client.post(json);
- }
+ @Override
+ public void send(String json) {
+ client.post(json);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
index 1e14308ad5..a83657ad8c 100644
--- a/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
+++ b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
@@ -23,17 +23,17 @@ package org.onap.so.client.exceptions;
public class SDNOException extends Exception {
- private static final long serialVersionUID = 6189163383568887383L;
+ private static final long serialVersionUID = 6189163383568887383L;
- public SDNOException() {
- super();
- }
-
- public SDNOException(String string) {
- super("SDN-O exception: " + string);
- }
+ public SDNOException() {
+ super();
+ }
- public SDNOException(Exception e) {
- super(e);
- }
+ public SDNOException(String string) {
+ super("SDN-O exception: " + string);
+ }
+
+ public SDNOException(Exception e) {
+ super(e);
+ }
}
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
index e21386f809..c483bd2caf 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java
@@ -21,7 +21,6 @@
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;
@@ -29,24 +28,25 @@ 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);
- }
- }
+ 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
index 0a3e0b498c..b422516e63 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
@@ -22,23 +22,17 @@ 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");
+ RESOURCE("resource"), RESOURCE_AND_URL("resource_and_url"), SIMPLE("simple"), RAW("raw"), CONSOLE(
+ "console"), PATHED("pathed"), GRAPHSON("graphson"), ID("id");
- private final String name;
-
- private Format(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
+ 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
index 30e91dce03..98d48ec3a8 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -21,7 +21,6 @@
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;
@@ -29,24 +28,26 @@ import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
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(GraphInventoryUri uri);
-
- public abstract RestClient createClient(GraphInventoryUri uri);
-
- 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();
+ private RestProperties props;
+
+ protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) {
+
+ RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass);
+ this.props = props;
+ }
+
+ protected abstract URI constructPath(GraphInventoryUri uri);
+
+ public abstract RestClient createClient(GraphInventoryUri uri);
+
+ 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
index 47c9e77b84..2facdaa64e 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java
@@ -24,12 +24,12 @@ 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);
- }
+
+ 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
index f9857424a2..72b01c268e 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
@@ -21,7 +21,6 @@
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;
@@ -35,18 +34,18 @@ 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(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ 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(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/GraphInventoryObjectName.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
index 4543d8523b..bb547e30e8 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
@@ -24,6 +24,7 @@ import com.google.common.base.CaseFormat;
public interface GraphInventoryObjectName {
- public String typeName();
- public String typeName(CaseFormat format);
+ 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
index ba48eb279f..42f4733e47 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
@@ -20,6 +20,7 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectPlurals extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectPlurals
+ extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
}
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
index 453becb75a..c11a08e867 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
@@ -20,6 +20,7 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectType extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectType
+ extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
}
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
index 0987221b0d..0207595f7f 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java
@@ -22,5 +22,5 @@ package org.onap.so.client.graphinventory;
public interface GraphInventoryObjectUriPartial {
- public String partialUri();
+ 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
index e231ddb811..bcc26535ff 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java
@@ -22,5 +22,5 @@ package org.onap.so.client.graphinventory;
public interface GraphInventoryObjectUriTemplate {
- public String uriTemplate();
+ 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
index 00e597b189..d1bc6bc61e 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java
@@ -23,61 +23,61 @@ 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).)+?\\['[^\\[\\]]+?'\\]$");
+ 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 = "{}";
+ }
-
- 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;
- }
+ 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
index 152e9d7a36..3ff564fcb2 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
@@ -27,115 +27,115 @@ 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;
- }
+ 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
index e1519d61a2..2a76dab107 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
@@ -23,12 +23,10 @@ package org.onap.so.client.graphinventory;
import java.lang.reflect.InvocationTargetException;
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;
@@ -40,287 +38,296 @@ import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, 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(Uri 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(Uri 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) {
- GraphInventoryUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
- 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(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = 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(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri uriAClone = 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(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = 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(Uri uri) {
- GraphInventoryResourceUri clone = 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(Uri 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;
- }
- }
- }
- /**
- * 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(Uri uri, Optional<Object> obj) {
- if(!this.exists(uri)){
- if (obj.isPresent()) {
- this.create(uri, obj.get());
- } else {
- this.createEmpty(uri);
- }
-
- }
- return (Self)this;
- }
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
- return buildRelationship(uri, Optional.empty());
- }
-
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
- return buildRelationship(uri, Optional.of(label));
- }
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
- final Relationship result = new Relationship();
- result.setRelatedLink(uri.build().toString());
- if (label.isPresent()) {
- result.setRelationshipLabel(label.get().toString());
- }
- return result;
- }
-
- public abstract Wrapper createWrapper(String 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();
-
- private GraphInventoryUri addParams(Optional<Depth> depth, boolean nodesOnly, GraphInventoryUri uri) {
- GraphInventoryUri clone = uri.clone();
- if (depth.isPresent()) {
- clone.depth(depth.get());
- }
- if (nodesOnly) {
- clone.nodesOnly(nodesOnly);
- }
-
- return clone;
- }
-
- public <T extends RestProperties> T getRestProperties() {
- return client.getRestProperties();
- }
+ 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(Uri 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(Uri 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) {
+ GraphInventoryUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
+ 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(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = 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(Uri uriA, Uri uriB, EdgeLabel label) {
+ GraphInventoryResourceUri uriAClone = 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(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = 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(Uri uri) {
+ GraphInventoryResourceUri clone = 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(Uri 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;
+ }
+ }
+ }
+
+ /**
+ * 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(Uri uri, Optional<Object> obj) {
+ if (!this.exists(uri)) {
+ if (obj.isPresent()) {
+ this.create(uri, obj.get());
+ } else {
+ this.createEmpty(uri);
+ }
+
+ }
+ return (Self) this;
+ }
+
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ return buildRelationship(uri, Optional.empty());
+ }
+
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ return buildRelationship(uri, Optional.of(label));
+ }
+
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().toString());
+ if (label.isPresent()) {
+ result.setRelationshipLabel(label.get().toString());
+ }
+ return result;
+ }
+
+ public abstract Wrapper createWrapper(String 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();
+
+ private GraphInventoryUri addParams(Optional<Depth> depth, boolean nodesOnly, GraphInventoryUri uri) {
+ GraphInventoryUri clone = uri.clone();
+ if (depth.isPresent()) {
+ clone.depth(depth.get());
+ }
+ if (nodesOnly) {
+ clone.nodesOnly(nodesOnly);
+ }
+
+ return clone;
+ }
+
+ 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
index 10c06634dc..434c65da46 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
@@ -23,9 +23,7 @@ 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;
@@ -34,44 +32,45 @@ import org.onap.so.utils.TargetEntity;
public abstract class GraphInventoryRestClient extends RestClientSSL {
- protected static final GraphInventoryCommonObjectMapperProvider standardProvider = new GraphInventoryCommonObjectMapperProvider();
+ protected static final GraphInventoryCommonObjectMapperProvider standardProvider =
+ new GraphInventoryCommonObjectMapperProvider();
+
+ protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
- protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
-
- protected GraphInventoryRestClient(RestProperties props, URI uri) {
- super(props, Optional.of(uri));
- }
+ protected GraphInventoryRestClient(RestProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ }
- @Override
+ @Override
public abstract TargetEntity getTargetEntity();
- @Override
- protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+ @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
- protected abstract Optional<ResponseExceptionMapper> addResponseExceptionMapper();
-
- @Override
- protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
- return standardProvider;
- }
+ @Override
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return super.patch(convertToPatchFormat(obj), resultClass);
+ }
- @Override
- public Response patch(Object obj) {
- return super.patch(convertToPatchFormat(obj));
- }
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
- @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);
- }
+ 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
index 4bbbe202cc..d30f481ac8 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java
@@ -22,17 +22,16 @@ package org.onap.so.client.graphinventory;
public enum GraphInventorySubgraphType {
- STAR("star"),
- PRUNE("prune");
+ STAR("star"), PRUNE("prune");
- private final String name;
+ private final String name;
- private GraphInventorySubgraphType(String name) {
- this.name = name;
- }
+ private GraphInventorySubgraphType(String name) {
+ this.name = name;
+ }
- @Override
- public String toString() {
- return 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
index 4c228b2ea3..992d1f017b 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -24,10 +24,8 @@ 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.aai.AAIVersion;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
@@ -37,202 +35,208 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> implements TransactionBuilder {
-
- 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(Uri 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(Uri 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(Uri uri, Optional<Object> obj) {
- if(!this.exists(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(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris) {
- for (Uri 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(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris, EdgeLabel label) {
- for (Uri 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(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris) {
- for (Uri uri : uris) {
- this.disconnect(uriA, uri);
- }
- return (Self)this;
- }
- /**
- * Deletes object from A&AI. Automatically handles resource-version.
- *
- * @param uri
- * @return
- */
- public Self delete(Uri uri) {
- Map<String, Object> result = this.get(new GenericType<Map<String, Object>>(){}, (Uri)uri.clone())
- .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();
-
- /**
- * @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;
-
- private Relationship buildRelationship(Uri uri) {
- return buildRelationship(uri, Optional.empty());
- }
-
- private Relationship buildRelationship(Uri uri, EdgeLabel label) {
- return buildRelationship(uri, Optional.of(label));
- }
- private Relationship buildRelationship(Uri 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;
- }
-
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel>
+ implements TransactionBuilder {
+
+ 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(Uri 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(Uri 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(Uri uri, Optional<Object> obj) {
+ if (!this.exists(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(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris) {
+ for (Uri 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(Uri uriA, Uri uriB, EdgeLabel label) {
+ GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris, EdgeLabel label) {
+ for (Uri 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(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri 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(Uri uriA, List<Uri> uris) {
+ for (Uri uri : uris) {
+ this.disconnect(uriA, uri);
+ }
+ return (Self) this;
+ }
+
+ /**
+ * Deletes object from A&AI. Automatically handles resource-version.
+ *
+ * @param uri
+ * @return
+ */
+ public Self delete(Uri uri) {
+ Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone())
+ .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();
+
+ /**
+ * @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;
+
+ private Relationship buildRelationship(Uri uri) {
+ return buildRelationship(uri, Optional.empty());
+ }
+
+ private Relationship buildRelationship(Uri uri, EdgeLabel label) {
+ return buildRelationship(uri, Optional.of(label));
+ }
+
+ private Relationship buildRelationship(Uri 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/TransactionBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
index 88a6228d2b..3c69f70b11 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
@@ -22,9 +22,11 @@ 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);
-
+
+ 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/DSLNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
index 1e4750d2cf..7ee5bd328e 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
@@ -23,55 +23,56 @@ 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 class DSLNode implements QueryStep {
- private final String nodeName;
- private final List<DSLNodeKey> nodeKeys;
- private final StringBuilder query = new StringBuilder();
- private boolean output = false;
-
- public DSLNode() {
- this.nodeName = "";
- this.nodeKeys = new ArrayList<>();
-
- }
- public DSLNode(GraphInventoryObjectName name) {
- this.nodeName = name.typeName();
- this.nodeKeys = new ArrayList<>();
- query.append(nodeName);
- }
- public DSLNode(GraphInventoryObjectName name, DSLNodeKey... key) {
- this.nodeName = name.typeName();
- this.nodeKeys = Arrays.asList(key);
- query.append(nodeName);
- }
-
- public DSLNode output() {
- this.output = true;
-
- return this;
- }
+ private final String nodeName;
+ private final List<DSLNodeKey> nodeKeys;
+ private final StringBuilder query = new StringBuilder();
+ private boolean output = false;
+
+ public DSLNode() {
+ this.nodeName = "";
+ this.nodeKeys = new ArrayList<>();
+
+ }
+
+ public DSLNode(GraphInventoryObjectName name) {
+ this.nodeName = name.typeName();
+ this.nodeKeys = new ArrayList<>();
+ query.append(nodeName);
+ }
+
+ public DSLNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ this.nodeName = name.typeName();
+ this.nodeKeys = Arrays.asList(key);
+ query.append(nodeName);
+ }
+
+ public DSLNode output() {
+ this.output = true;
+
+ return this;
+ }
+
+ public DSLNode and(DSLNodeKey... key) {
+ this.nodeKeys.addAll(Arrays.asList(key));
+
+ return this;
+ }
+
+ @Override
+ public String build() {
+ StringBuilder result = new StringBuilder(query);
+ if (output) {
+ result.append("*");
+ }
+ for (DSLNodeKey key : nodeKeys) {
+ result.append(key.build());
+ }
- public DSLNode and(DSLNodeKey... key) {
- this.nodeKeys.addAll(Arrays.asList(key));
-
- return 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();
- }
+ 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
index c40a3e6f96..bf33e8f8d3 100644
--- 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
@@ -23,50 +23,49 @@ 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<String> values;
- public DSLNodeKey(String keyName, String... value) {
+ private boolean not = false;
+ private final StringBuilder query = new StringBuilder();
+ private final String keyName;
+ private final List<String> values;
+
+ public DSLNodeKey(String keyName, String... 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);
- 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<String> temp = new ArrayList<>();
+ for (String item : values) {
+ if (item.equals("null")) {
+ temp.add(String.format("' %s '", item));
+ } else if (item.equals("")) {
+ temp.add("' '");
+ } else {
+ temp.add(String.format("'%s'", item));
+ }
+ }
+ result.append(Joiner.on(", ").join(temp)).append(")");
- if (not) {
- result.append(" !");
- }
- result.append("('").append(keyName).append("', ");
- List<String> temp = new ArrayList<>();
- for (String item : values) {
- if (item.equals("null")) {
- temp.add(String.format("' %s '", item));
- } else if (item.equals("")){
- temp.add("' '");
- } else {
- temp.add(String.format("'%s'", item));
- }
- }
- result.append(Joiner.on(", ").join(temp)).append(")");
-
- return result.toString();
- }
+ return result.toString();
+ }
}
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
index c8ab015b26..3056c9ca80 100644
--- 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
@@ -25,23 +25,23 @@ import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DSLQuery {
- private String dsl;
-
- public DSLQuery() {
-
- }
-
- public DSLQuery(String dsl) {
- this.dsl = dsl;
- }
-
- public String getDsl() {
- return dsl;
- }
-
- public void setDsl(String dsl) {
- this.dsl = dsl;
- }
-
-
+ private String dsl;
+
+ public DSLQuery() {
+
+ }
+
+ public DSLQuery(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getDsl() {
+ return dsl;
+ }
+
+ public void setDsl(String dsl) {
+ this.dsl = 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
index 3a47c38444..ffbb86f023 100644
--- 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
@@ -24,123 +24,122 @@ 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> implements QueryStep {
- private List<QueryStep> steps = new ArrayList<>();
- private String suffix = "";
-
- public DSLQueryBuilder() {
-
- }
- public DSLQueryBuilder(DSLNode node) {
- steps.add(node);
- }
-
- public DSLQueryBuilder<S, DSLNode> node(DSLNode node) {
- steps.add(node);
-
- return (DSLQueryBuilder<S, DSLNode>) this;
- }
- public DSLQueryBuilder<S, E> output() {
- if (steps.get(steps.size() -1) instanceof DSLNode) {
- ((DSLNode)steps.get(steps.size() -1)).output();
- }
- return this;
- }
-
- public <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.build()).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.build()).append(")");
- String result = query.toString();
- if (!result.startsWith(">")) {
- result = "> " + result;
- }
- return "(" + result;
- });
- return this;
- }
-
- public DSLQueryBuilder<S, E> to(DSLQueryBuilder<?, ?> to) {
- steps.add(() -> {
- StringBuilder query = new StringBuilder();
-
- query.append("> ").append(to.build());
- return query.toString();
- });
- return this;
- }
-
- public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
- return to(__.node(name));
- }
-
- public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
- return to(__.node(name, key));
- }
-
- public DSLQueryBuilder<S, E> limit(int limit) {
- suffix = " LIMIT " + limit;
- return this;
- }
-
- @Override
- public String build() {
- return compile();
- }
-
- @Override
- public String toString() {
- return build();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o != null) {
- if (o instanceof QueryStep) {
- return ((QueryStep)o).build().equals(this.build());
- } else if (o instanceof String) {
- return o.equals(this.build());
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
-
- return build().hashCode();
- }
-
- private String compile() {
- return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
- }
-
- protected QueryStep getFirst() {
- return steps.get(0);
- }
+ private List<QueryStep> steps = new ArrayList<>();
+ private String suffix = "";
+
+ public DSLQueryBuilder() {
+
+ }
+
+ public DSLQueryBuilder(DSLNode node) {
+ steps.add(node);
+ }
+
+ public DSLQueryBuilder<S, DSLNode> node(DSLNode node) {
+ steps.add(node);
+
+ return (DSLQueryBuilder<S, DSLNode>) this;
+ }
+
+ public DSLQueryBuilder<S, E> output() {
+ if (steps.get(steps.size() - 1) instanceof DSLNode) {
+ ((DSLNode) steps.get(steps.size() - 1)).output();
+ }
+ return this;
+ }
+
+ public <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.build()).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.build()).append(")");
+ String result = query.toString();
+ if (!result.startsWith(">")) {
+ result = "> " + result;
+ }
+ return "(" + result;
+ });
+ return this;
+ }
+
+ public DSLQueryBuilder<S, E> to(DSLQueryBuilder<?, ?> to) {
+ steps.add(() -> {
+ StringBuilder query = new StringBuilder();
+
+ query.append("> ").append(to.build());
+ return query.toString();
+ });
+ return this;
+ }
+
+ public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
+ return to(__.node(name));
+ }
+
+ public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return to(__.node(name, key));
+ }
+
+ public DSLQueryBuilder<S, E> limit(int limit) {
+ suffix = " LIMIT " + limit;
+ return this;
+ }
+
+ @Override
+ public String build() {
+ return compile();
+ }
+
+ @Override
+ public String toString() {
+ return build();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ if (o instanceof QueryStep) {
+ return ((QueryStep) o).build().equals(this.build());
+ } else if (o instanceof String) {
+ return o.equals(this.build());
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+
+ return build().hashCode();
+ }
+
+ private String compile() {
+ return Joiner.on(" ").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/GraphInventoryEdgeLabel.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java
index 461920fe7f..e3542e863a 100644
--- 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
@@ -22,7 +22,7 @@ package org.onap.so.client.graphinventory.entities;
public interface GraphInventoryEdgeLabel {
-
- @Override
- public String toString();
+
+ @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
index 752a743247..892951f950 100644
--- 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
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
-
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -37,101 +36,102 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
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 GraphInventoryResourceUri, 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;
- }
+ 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
index c0b29e46c2..6a571038ee 100644
--- 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
@@ -27,97 +27,99 @@ 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();
- }
+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/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
index 8d49fb5640..1e7169d092 100644
--- 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
@@ -25,36 +25,33 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "resource-type",
- "resource-link"
-})
+@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;
- }
+ @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
index 6e7312c1f3..326bd06dfb 100644
--- 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
@@ -24,33 +24,38 @@ 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;
- }
-
+ 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/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
index 184f412adb..2fdd6574e5 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
@@ -24,36 +24,38 @@ 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(DSLNode node) {
- return new DSLQueryBuilder<>(node);
- }
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name) {
-
- return __.<DSLNode>start(new DSLNode(name));
- }
-
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
- return __.<DSLNode>start(new DSLNode(name, key));
- }
-
- public static DSLNodeKey key(String keyName, String... value) {
- return new DSLNodeKey(keyName, value);
- }
-
- public static <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);
- }
+ protected __() {
+
+ }
+
+ public static <A> DSLQueryBuilder<A, A> identity() {
+ return new DSLQueryBuilder<>();
+ }
+
+ public static <A> DSLQueryBuilder<A, A> start(DSLNode node) {
+ return new DSLQueryBuilder<>(node);
+ }
+
+ public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name) {
+
+ return __.<DSLNode>start(new DSLNode(name));
+ }
+
+ public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return __.<DSLNode>start(new DSLNode(name, key));
+ }
+
+ public static DSLNodeKey key(String keyName, String... value) {
+ return new DSLNodeKey(keyName, value);
+ }
+
+ public static <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
index 1205511d11..d91f36c0c7 100644
--- 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
@@ -21,24 +21,18 @@
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;
- }
+ 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/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
index 2357d07fd4..c579a285d2 100644
--- 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
@@ -26,25 +26,37 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
public interface GraphInventoryResourceUri extends GraphInventoryUri {
- public GraphInventoryResourceUri relationshipAPI();
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
- public GraphInventoryResourceUri resourceVersion(String version);
- public GraphInventoryResourceUri format(Format format);
- @Override
- public GraphInventoryResourceUri depth(Depth depth);
- @Override
- public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
- @Override
- public GraphInventoryResourceUri queryParam(String name, String... values);
- @Override
- public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
- @Override
- public GraphInventoryResourceUri resultIndex(int index);
- @Override
- public GraphInventoryResourceUri resultSize(int size);
- @Override
- public GraphInventoryResourceUri limit(int size);
- @Override
- public GraphInventoryResourceUri clone();
+ public GraphInventoryResourceUri relationshipAPI();
+
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
+
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
+
+ public GraphInventoryResourceUri resourceVersion(String version);
+
+ public GraphInventoryResourceUri format(Format format);
+
+ @Override
+ public GraphInventoryResourceUri depth(Depth depth);
+
+ @Override
+ public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
+
+ @Override
+ public GraphInventoryResourceUri queryParam(String name, String... values);
+
+ @Override
+ public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
+
+ @Override
+ public GraphInventoryResourceUri resultIndex(int index);
+
+ @Override
+ public GraphInventoryResourceUri resultSize(int size);
+
+ @Override
+ public GraphInventoryResourceUri limit(int size);
+
+ @Override
+ public GraphInventoryResourceUri clone();
}
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
index 42c478eff7..d6d3e5eaa2 100644
--- 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
@@ -22,42 +22,55 @@ package org.onap.so.client.graphinventory.entities.uri;
import java.net.URI;
import java.util.Map;
-
import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
public interface GraphInventoryUri {
-
- 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 GraphInventoryUri depth(Depth depth);
- /**
- * Makes client only return object fields, no relationships
- *
- * @return
- */
- public GraphInventoryUri nodesOnly(boolean nodesOnly);
- public GraphInventoryUri queryParam(String name, String... values);
- public GraphInventoryUri replaceQueryParam(String name, String... values);
- public GraphInventoryUri resultIndex(int index);
- public GraphInventoryUri resultSize(int size);
- public GraphInventoryUri limit(int size);
- public GraphInventoryUri 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 GraphInventoryObjectType getObjectType();
- public boolean equals(Object o);
- public int hashCode();
+
+ 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 GraphInventoryUri depth(Depth depth);
+
+ /**
+ * Makes client only return object fields, no relationships
+ *
+ * @return
+ */
+ public GraphInventoryUri nodesOnly(boolean nodesOnly);
+
+ public GraphInventoryUri queryParam(String name, String... values);
+
+ public GraphInventoryUri replaceQueryParam(String name, String... values);
+
+ public GraphInventoryUri resultIndex(int index);
+
+ public GraphInventoryUri resultSize(int size);
+
+ public GraphInventoryUri limit(int size);
+
+ public GraphInventoryUri 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 GraphInventoryObjectType getObjectType();
+
+ public boolean equals(Object o);
+
+ public int hashCode();
}
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
index 3d08c8d40c..fcfde74b33 100644
--- 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
@@ -24,6 +24,6 @@ import java.net.URI;
public interface HttpAwareUri {
-
- public URI buildNoNetwork();
+
+ public URI buildNoNetwork();
}
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
index 1b8844116a..5d0a33909a 100644
--- 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
@@ -29,9 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-
import javax.ws.rs.core.UriBuilder;
-
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
@@ -43,229 +41,241 @@ import org.springframework.web.util.UriUtils;
public class SimpleUri implements GraphInventoryResourceUri, Serializable {
- private static final long serialVersionUID = -337701171277616439L;
-
- protected transient UriBuilder internalURI;
- protected final static String relationshipAPI = "/relationship-list/relationship";
- protected final static String relatedTo = "/related-to";
- protected final Object[] values;
- protected final GraphInventoryObjectType type;
- protected final GraphInventoryObjectPlurals pluralType;
- protected SimpleUri(GraphInventoryObjectType type, Object... values) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
- protected SimpleUri(GraphInventoryObjectType type, URI uri) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
- this.values = new Object[0];
- }
- protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = type;
- this.pluralType = null;
- }
- protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = null;
- this.pluralType = type;
- }
- protected SimpleUri(GraphInventoryObjectPlurals type) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = new Object[0];
- }
- protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectType childType, Object... childValues) {
- this.type = childType;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = childValues;
- validateValuesSize(childType.partialUri(), values);
- }
-
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectPlurals childType) {
- this.type = null;
- this.pluralType = childType;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = new Object[0];
- }
-
- protected void setInternalURI(UriBuilder builder) {
- this.internalURI = builder;
- }
- @Override
- public SimpleUri relationshipAPI() {
- this.internalURI = internalURI.path(relationshipAPI);
- return this;
- }
-
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
-
- this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
- return this;
- }
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
- this.internalURI = internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
- return this;
- }
-
- @Override
- public SimpleUri resourceVersion(String version) {
- this.internalURI = internalURI.replaceQueryParam("resource-version", version);
- return this;
- }
-
- @Override
- public SimpleUri queryParam(String name, String... values) {
- this.internalURI = internalURI.queryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri replaceQueryParam(String name, String... values) {
- this.internalURI = internalURI.replaceQueryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri resultIndex(int index) {
- this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
- return this;
- }
-
- @Override
- public SimpleUri resultSize(int size) {
- this.internalURI = internalURI.replaceQueryParam("resultSize", size);
- return this;
- }
-
- @Override
- public SimpleUri limit(int size) {
- return this.resultIndex(0).resultSize(size);
- }
-
- @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());
- }
- 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 (this.type != null) {
- if (!("".equals(this.getTemplate(type)))) {
- parser = new UriParserSpringImpl(this.getTemplate(type));
- } else {
- return new HashMap<>();
- }
- } else {
- parser = new UriParserSpringImpl(this.getTemplate(pluralType));
- }
-
-
- return parser.parse(uri);
- }
-
- @Override
- public SimpleUri clone() {
- if (this.type != null) {
- return new SimpleUri(this.type, this.internalURI.clone(), values);
- } else {
- return new SimpleUri(this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public GraphInventoryObjectType getObjectType() {
- return this.type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof GraphInventoryUri) {
- return this.build().equals(((GraphInventoryUri)o).build());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(this.build()).toHashCode();
- }
-
-
- @Override
- public SimpleUri depth(Depth depth) {
- this.internalURI.replaceQueryParam("depth", depth.toString());
- return this;
- }
- @Override
- public SimpleUri nodesOnly(boolean nodesOnly) {
- if (nodesOnly) {
- this.internalURI.replaceQueryParam("nodes-only", "");
- }
- return this;
- }
-
- @Override
- public SimpleUri format(Format format) {
- this.internalURI.replaceQueryParam("format", format);
- return 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(GraphInventoryObjectType type) {
- return type.uriTemplate();
- }
-
- protected String getTemplate(GraphInventoryObjectPlurals 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));
- }
+ private static final long serialVersionUID = -337701171277616439L;
+
+ protected transient UriBuilder internalURI;
+ protected final static String relationshipAPI = "/relationship-list/relationship";
+ protected final static String relatedTo = "/related-to";
+ protected final Object[] values;
+ protected final GraphInventoryObjectType type;
+ protected final GraphInventoryObjectPlurals pluralType;
+
+ protected SimpleUri(GraphInventoryObjectType type, Object... values) {
+ this.type = type;
+ this.pluralType = null;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ validateValuesSize(this.getTemplate(type), values);
+ }
+
+ protected SimpleUri(GraphInventoryObjectType type, URI uri) {
+ this.type = type;
+ this.pluralType = null;
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
+ this.values = new Object[0];
+ }
+
+ protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = type;
+ this.pluralType = null;
+ }
+
+ protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = null;
+ this.pluralType = type;
+ }
+
+ protected SimpleUri(GraphInventoryObjectPlurals type) {
+ this.type = null;
+ this.pluralType = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = new Object[0];
+ }
+
+ protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
+ this.type = null;
+ this.pluralType = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ validateValuesSize(this.getTemplate(type), values);
+ }
+
+ protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectType childType,
+ Object... childValues) {
+ this.type = childType;
+ this.pluralType = null;
+ this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
+ this.values = childValues;
+ validateValuesSize(childType.partialUri(), values);
+ }
+
+ protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectPlurals childType) {
+ this.type = null;
+ this.pluralType = childType;
+ this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
+ this.values = new Object[0];
+ }
+
+ protected void setInternalURI(UriBuilder builder) {
+ this.internalURI = builder;
+ }
+
+ @Override
+ public SimpleUri relationshipAPI() {
+ this.internalURI = internalURI.path(relationshipAPI);
+ return this;
+ }
+
+ @Override
+ public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
+
+ this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
+ return this;
+ }
+
+ @Override
+ public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
+ this.internalURI =
+ internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
+ return this;
+ }
+
+ @Override
+ public SimpleUri resourceVersion(String version) {
+ this.internalURI = internalURI.replaceQueryParam("resource-version", version);
+ return this;
+ }
+
+ @Override
+ public SimpleUri queryParam(String name, String... values) {
+ this.internalURI = internalURI.queryParam(name, values);
+ return this;
+ }
+
+ @Override
+ public SimpleUri replaceQueryParam(String name, String... values) {
+ this.internalURI = internalURI.replaceQueryParam(name, values);
+ return this;
+ }
+
+ @Override
+ public SimpleUri resultIndex(int index) {
+ this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
+ return this;
+ }
+
+ @Override
+ public SimpleUri resultSize(int size) {
+ this.internalURI = internalURI.replaceQueryParam("resultSize", size);
+ return this;
+ }
+
+ @Override
+ public SimpleUri limit(int size) {
+ return this.resultIndex(0).resultSize(size);
+ }
+
+ @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());
+ }
+ 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 (this.type != null) {
+ if (!("".equals(this.getTemplate(type)))) {
+ parser = new UriParserSpringImpl(this.getTemplate(type));
+ } else {
+ return new HashMap<>();
+ }
+ } else {
+ parser = new UriParserSpringImpl(this.getTemplate(pluralType));
+ }
+
+
+ return parser.parse(uri);
+ }
+
+ @Override
+ public SimpleUri clone() {
+ if (this.type != null) {
+ return new SimpleUri(this.type, this.internalURI.clone(), values);
+ } else {
+ return new SimpleUri(this.pluralType, this.internalURI.clone(), values);
+ }
+ }
+
+ @Override
+ public GraphInventoryObjectType getObjectType() {
+ return this.type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof GraphInventoryUri) {
+ return this.build().equals(((GraphInventoryUri) o).build());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.build()).toHashCode();
+ }
+
+
+ @Override
+ public SimpleUri depth(Depth depth) {
+ this.internalURI.replaceQueryParam("depth", depth.toString());
+ return this;
+ }
+
+ @Override
+ public SimpleUri nodesOnly(boolean nodesOnly) {
+ if (nodesOnly) {
+ this.internalURI.replaceQueryParam("nodes-only", "");
+ }
+ return this;
+ }
+
+ @Override
+ public SimpleUri format(Format format) {
+ this.internalURI.replaceQueryParam("format", format);
+ return 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(GraphInventoryObjectType type) {
+ return type.uriTemplate();
+ }
+
+ protected String getTemplate(GraphInventoryObjectPlurals 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));
+ }
}
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
index 03d83ebfb6..00000268a7 100644
--- 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
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Set;
public interface UriParser {
- public Set<String> getVariables();
- public Map<String, String> parse(final String uri);
+ 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
index b4cf8eb949..14a46c243b 100644
--- 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
@@ -19,6 +19,7 @@
*/
package org.onap.so.client.graphinventory.entities.uri.parsers;
+
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -26,39 +27,38 @@ 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;
+ private final UriTemplate uriTemplate;
+
+ public UriParserSpringImpl(final String template) {
+ this.uriTemplate = new UriTemplate(template);
+ }
- 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 Map<String, String> parse(final String uri) {
- final boolean match = this.uriTemplate.matches(uri);
- if (!match) {
- return new LinkedHashMap<>();
+ @Override
+ public Set<String> getVariables() {
+ return Collections.unmodifiableSet(new LinkedHashSet<String>(this.uriTemplate.getVariableNames()));
}
- 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;
- }
+ 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
index 0c973a8457..d69e83435b 100644
--- 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
@@ -22,7 +22,7 @@ package org.onap.so.client.graphinventory.exceptions;
public class BulkProcessFailed extends Exception {
- public BulkProcessFailed(String message) {
- super(message);
- }
+ public BulkProcessFailed(String message) {
+ super(message);
+ }
}
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
index 07af13049c..fe5f159291 100644
--- 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
@@ -22,10 +22,10 @@ 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);
- }
+ 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
index 24a6e5ccf9..45ebf9ee46 100644
--- 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
@@ -22,19 +22,19 @@ 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);
- }
-
+ 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
index 51747d495a..380bce7165 100644
--- 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
@@ -22,13 +22,13 @@ package org.onap.so.client.graphinventory.exceptions;
public class GraphInventoryUriComputationException extends RuntimeException {
- private static final long serialVersionUID = 5187931752227522034L;
+ private static final long serialVersionUID = 5187931752227522034L;
- public GraphInventoryUriComputationException(String s) {
- super(s);
- }
-
- public GraphInventoryUriComputationException(Throwable t) {
- super(t);
- }
+ 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
index d2f47a5b00..6637c89402 100644
--- 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
@@ -21,9 +21,9 @@
package org.onap.so.client.graphinventory.exceptions;
public class GraphInventoryUriNotFoundException extends Exception {
- private static final long serialVersionUID = 2789643165122257833L;
+ private static final long serialVersionUID = 2789643165122257833L;
- public GraphInventoryUriNotFoundException(String message) {
- super(message);
- }
+ 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
index 121708fc46..ede8e481b2 100644
--- 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
@@ -22,10 +22,10 @@ package org.onap.so.client.graphinventory.exceptions;
public class IncorrectNumberOfUriKeys extends RuntimeException {
- private static final long serialVersionUID = 2189285428827817518L;
-
- public IncorrectNumberOfUriKeys(String message) {
- super(message);
- }
+ private static final long serialVersionUID = 2189285428827817518L;
+
+ public IncorrectNumberOfUriKeys(String message) {
+ super(message);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMAction.java b/common/src/main/java/org/onap/so/client/grm/GRMAction.java
index 376c736037..4236c04741 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMAction.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMAction.java
@@ -21,17 +21,16 @@
package org.onap.so.client.grm;
public enum GRMAction {
-
- FIND_RUNNING("findRunning"),
- ADD("add");
- private final String action;
+ FIND_RUNNING("findRunning"), ADD("add");
- GRMAction(String action) {
- this.action = action;
- }
+ private final String action;
- public String getAction() {
- return action;
- }
+ GRMAction(String action) {
+ this.action = action;
+ }
+
+ public String getAction() {
+ return action;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMClient.java b/common/src/main/java/org/onap/so/client/grm/GRMClient.java
index 653e1cc7b3..4c221d1a8e 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMClient.java
@@ -29,55 +29,52 @@ import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
public class GRMClient {
- public String findRunningServicesAsString(String name, int majorVersion, String env) throws Exception {
-
- ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
- try {
- GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
- return invoker.post(request, String.class);
- }
- catch(Exception e) {
- throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
- }
- }
-
- public ServiceEndPointList findRunningServices(String name, int majorVersion, String env) throws Exception {
-
- ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
- try {
- GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
- return invoker.post(request, ServiceEndPointList.class);
- }
- catch(Exception e) {
- throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
- }
- }
-
- public ServiceEndPointLookupRequest buildServiceEndPointlookupRequest(String name, int majorVersion, String env) {
- VersionLookup version = new VersionLookup();
- version.setMajor(majorVersion);
-
- ServiceEndPointLookup endpoint = new ServiceEndPointLookup();
- endpoint.setName(name);
- endpoint.setVersion(version);
-
- ServiceEndPointLookupRequest request = new ServiceEndPointLookupRequest();
- request.setServiceEndPoint(endpoint);
- request.setEnv(env);
- return request;
- }
-
- public void addServiceEndPoint(ServiceEndPointRequest request) throws Exception {
- try {
- GRMRestInvoker invoker = this.getInvoker(GRMAction.ADD);
- invoker.post(request);
- }
- catch(Exception e) {
- throw new GRMClientCallFailed("Call to GRM addServiceEndPoint failed: " + e.getMessage(), e);
- }
- }
-
- protected GRMRestInvoker getInvoker(GRMAction action) {
- return new GRMRestInvoker(action);
- }
+ public String findRunningServicesAsString(String name, int majorVersion, String env) throws Exception {
+
+ ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
+ return invoker.post(request, String.class);
+ } catch (Exception e) {
+ throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
+ }
+ }
+
+ public ServiceEndPointList findRunningServices(String name, int majorVersion, String env) throws Exception {
+
+ ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
+ return invoker.post(request, ServiceEndPointList.class);
+ } catch (Exception e) {
+ throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
+ }
+ }
+
+ public ServiceEndPointLookupRequest buildServiceEndPointlookupRequest(String name, int majorVersion, String env) {
+ VersionLookup version = new VersionLookup();
+ version.setMajor(majorVersion);
+
+ ServiceEndPointLookup endpoint = new ServiceEndPointLookup();
+ endpoint.setName(name);
+ endpoint.setVersion(version);
+
+ ServiceEndPointLookupRequest request = new ServiceEndPointLookupRequest();
+ request.setServiceEndPoint(endpoint);
+ request.setEnv(env);
+ return request;
+ }
+
+ public void addServiceEndPoint(ServiceEndPointRequest request) throws Exception {
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.ADD);
+ invoker.post(request);
+ } catch (Exception e) {
+ throw new GRMClientCallFailed("Call to GRM addServiceEndPoint failed: " + e.getMessage(), e);
+ }
+ }
+
+ protected GRMRestInvoker getInvoker(GRMAction action) {
+ return new GRMRestInvoker(action);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMProperties.java b/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
index 1206896bf9..615f93f921 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
@@ -23,8 +23,11 @@ package org.onap.so.client.grm;
import org.onap.so.client.RestProperties;
public interface GRMProperties extends RestProperties {
- public String getDefaultVersion();
- public String getAuth();
- public String getKey();
- public String getContentType();
+ public String getDefaultVersion();
+
+ public String getAuth();
+
+ public String getKey();
+
+ public String getContentType();
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
index 485b9b0d15..2e8a6492ec 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
@@ -25,24 +25,25 @@ import java.util.ServiceLoader;
public class GRMPropertiesLoader {
- private final ServiceLoader<GRMProperties> services;
- private GRMPropertiesLoader() {
- services = ServiceLoader.load(GRMProperties.class);
- }
-
- private static class Helper {
- private static final GRMPropertiesLoader INSTANCE = new GRMPropertiesLoader();
- }
-
- public static GRMPropertiesLoader getInstance() {
- return Helper.INSTANCE;
- }
-
- public GRMProperties getImpl() {
- Iterator<GRMProperties> propertyImpls = services.iterator();
- while (propertyImpls.hasNext()) {
- return propertyImpls.next();
- }
- return null;
- }
+ private final ServiceLoader<GRMProperties> services;
+
+ private GRMPropertiesLoader() {
+ services = ServiceLoader.load(GRMProperties.class);
+ }
+
+ private static class Helper {
+ private static final GRMPropertiesLoader INSTANCE = new GRMPropertiesLoader();
+ }
+
+ public static GRMPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public GRMProperties getImpl() {
+ Iterator<GRMProperties> propertyImpls = services.iterator();
+ while (propertyImpls.hasNext()) {
+ return propertyImpls.next();
+ }
+ return null;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index 0bb55e627a..fa155de6a2 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
@@ -25,33 +25,32 @@ import java.net.URI;
import java.util.Base64;
import java.util.Map;
import java.util.Optional;
-
import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.utils.TargetEntity;
public class GRMRestClient extends RestClient {
- private final GRMProperties properties;
-
- public GRMRestClient(GRMProperties props, URI path) {
- super(props, Optional.of(path));
- this.properties = props;
- }
+ private final GRMProperties properties;
+
+ public GRMRestClient(GRMProperties props, URI path) {
+ super(props, Optional.of(path));
+ this.properties = props;
+ }
@Override
- public TargetEntity getTargetEntity(){
+ public TargetEntity getTargetEntity() {
return TargetEntity.GRM;
}
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- String auth = properties.getAuth();
- String key = properties.getKey();
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ String auth = properties.getAuth();
+ String key = properties.getKey();
- if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
- addBasicAuthHeader(auth, key);
- }
- }
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
index 0c95a66979..609a206341 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
@@ -21,40 +21,35 @@
package org.onap.so.client.grm;
import java.net.URI;
-
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.client.RestClient;
public class GRMRestInvoker {
-
- private final RestClient client;
- private final GRMProperties properties;
-
- public GRMRestInvoker(GRMAction action) {
- GRMProperties props = GRMPropertiesLoader.getInstance().getImpl();
- this.properties = props;
- this.client = new GRMRestClient(properties, this.createURI(action));
- }
-
- private URI createURI(GRMAction action) {
- return UriBuilder.fromUri("/GRMLWPService")
- .path(this.properties.getDefaultVersion())
- .path("serviceEndPoint")
- .path(action.getAction())
- .build();
- }
-
- private RestClient getClient() {
- return this.client;
- }
-
- public void post(Object obj) {
- getClient().post(obj);
- }
-
- public <T> T post(Object obj, Class<T> resultClass) {
- return getClient().post(obj, resultClass);
- }
-
+
+ private final RestClient client;
+ private final GRMProperties properties;
+
+ public GRMRestInvoker(GRMAction action) {
+ GRMProperties props = GRMPropertiesLoader.getInstance().getImpl();
+ this.properties = props;
+ this.client = new GRMRestClient(properties, this.createURI(action));
+ }
+
+ private URI createURI(GRMAction action) {
+ return UriBuilder.fromUri("/GRMLWPService").path(this.properties.getDefaultVersion()).path("serviceEndPoint")
+ .path(action.getAction()).build();
+ }
+
+ private RestClient getClient() {
+ return this.client;
+ }
+
+ public void post(Object obj) {
+ getClient().post(obj);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return getClient().post(obj, resultClass);
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
index 85e15f597c..a1f4d6e639 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,60 +28,60 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "createdBy", "updatedBy", "createdTimestamp", "updatedTimestamp" })
-public class OperationalInfo implements Serializable{
+@JsonPropertyOrder({"createdBy", "updatedBy", "createdTimestamp", "updatedTimestamp"})
+public class OperationalInfo implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -7213334079745439793L;
- @JsonProperty("createdBy")
- private String createdBy;
- @JsonProperty("updatedBy")
- private String updatedBy;
- @JsonProperty("createdTimestamp")
- private String createdTimestamp;
- @JsonProperty("updatedTimestamp")
- private String updatedTimestamp;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7213334079745439793L;
+ @JsonProperty("createdBy")
+ private String createdBy;
+ @JsonProperty("updatedBy")
+ private String updatedBy;
+ @JsonProperty("createdTimestamp")
+ private String createdTimestamp;
+ @JsonProperty("updatedTimestamp")
+ private String updatedTimestamp;
- @JsonProperty("createdBy")
- public String getCreatedBy() {
- return createdBy;
- }
+ @JsonProperty("createdBy")
+ public String getCreatedBy() {
+ return createdBy;
+ }
- @JsonProperty("createdBy")
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
+ @JsonProperty("createdBy")
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
- @JsonProperty("updatedBy")
- public String getUpdatedBy() {
- return updatedBy;
- }
+ @JsonProperty("updatedBy")
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
- @JsonProperty("updatedBy")
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
+ @JsonProperty("updatedBy")
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
- @JsonProperty("createdTimestamp")
- public String getCreatedTimestamp() {
- return createdTimestamp;
- }
+ @JsonProperty("createdTimestamp")
+ public String getCreatedTimestamp() {
+ return createdTimestamp;
+ }
- @JsonProperty("createdTimestamp")
- public void setCreatedTimestamp(String createdTimestamp) {
- this.createdTimestamp = createdTimestamp;
- }
+ @JsonProperty("createdTimestamp")
+ public void setCreatedTimestamp(String createdTimestamp) {
+ this.createdTimestamp = createdTimestamp;
+ }
- @JsonProperty("updatedTimestamp")
- public String getUpdatedTimestamp() {
- return updatedTimestamp;
- }
+ @JsonProperty("updatedTimestamp")
+ public String getUpdatedTimestamp() {
+ return updatedTimestamp;
+ }
- @JsonProperty("updatedTimestamp")
- public void setUpdatedTimestamp(String updatedTimestamp) {
- this.updatedTimestamp = updatedTimestamp;
- }
+ @JsonProperty("updatedTimestamp")
+ public void setUpdatedTimestamp(String updatedTimestamp) {
+ this.updatedTimestamp = updatedTimestamp;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/Property.java b/common/src/main/java/org/onap/so/client/grm/beans/Property.java
index 705db95222..dcba6ba10b 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/Property.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Property.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,36 +28,36 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "name", "value" })
-public class Property implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = -6060749559638446881L;
- @JsonProperty("name")
- private String name;
- @JsonProperty("value")
- private String value;
-
- @JsonProperty("name")
- public String getName() {
- return name;
- }
-
- @JsonProperty("name")
- public void setName(String name) {
- this.name = name;
- }
-
- @JsonProperty("value")
- public String getValue() {
- return value;
- }
-
- @JsonProperty("value")
- public void setValue(String value) {
- this.value = value;
- }
+@JsonPropertyOrder({"name", "value"})
+public class Property implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6060749559638446881L;
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("value")
+ private String value;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("value")
+ public String getValue() {
+ return value;
+ }
+
+ @JsonProperty("value")
+ public void setValue(String value) {
+ this.value = value;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
index e739f00c9a..a7260943ee 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
@@ -22,7 +22,6 @@ package org.onap.so.client.grm.beans;
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -32,216 +31,216 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "serviceEndPoint")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "name", "version", "hostAddress", "listenPort", "latitude", "longitude", "registrationTime",
- "expirationTime", "contextPath", "routeOffer", "statusInfo", "eventStatusInfo", "validatorStatusInfo",
- "operationalInfo", "protocol", "properties", "disableType" })
+@JsonPropertyOrder({"name", "version", "hostAddress", "listenPort", "latitude", "longitude", "registrationTime",
+ "expirationTime", "contextPath", "routeOffer", "statusInfo", "eventStatusInfo", "validatorStatusInfo",
+ "operationalInfo", "protocol", "properties", "disableType"})
public class ServiceEndPoint implements Serializable {
- private static final long serialVersionUID = -1594441352549128491L;
-
- @JsonProperty("name")
- private String name;
- @JsonProperty("version")
- private Version version;
- @JsonProperty("hostAddress")
- private String hostAddress;
- @JsonProperty("listenPort")
- private String listenPort;
- @JsonProperty("latitude")
- private String latitude;
- @JsonProperty("longitude")
- private String longitude;
- @JsonProperty("registrationTime")
- private String registrationTime;
- @JsonProperty("expirationTime")
- private String expirationTime;
- @JsonProperty("contextPath")
- private String contextPath;
- @JsonProperty("routeOffer")
- private String routeOffer;
- @JsonProperty("statusInfo")
- private Status statusInfo;
- @JsonProperty("eventStatusInfo")
- private Status eventStatusInfo;
- @JsonProperty("validatorStatusInfo")
- private Status validatorStatusInfo;
- @JsonProperty("operationalInfo")
- private OperationalInfo operationalInfo;
- @JsonProperty("protocol")
- private String protocol;
- @JsonProperty("properties")
- private List<Property> properties = null;
- @JsonProperty("disableType")
- private List<Object> disableType = null;
-
- @JsonProperty("name")
- public String getName() {
- return name;
- }
-
- @JsonProperty("name")
- public void setName(String name) {
- this.name = name;
- }
-
- @JsonProperty("version")
- public Version getVersion() {
- return version;
- }
-
- @JsonProperty("version")
- public void setVersion(Version version) {
- this.version = version;
- }
-
- @JsonProperty("hostAddress")
- public String getHostAddress() {
- return hostAddress;
- }
-
- @JsonProperty("hostAddress")
- public void setHostAddress(String hostAddress) {
- this.hostAddress = hostAddress;
- }
-
- @JsonProperty("listenPort")
- public String getListenPort() {
- return listenPort;
- }
-
- @JsonProperty("listenPort")
- public void setListenPort(String listenPort) {
- this.listenPort = listenPort;
- }
-
- @JsonProperty("latitude")
- public String getLatitude() {
- return latitude;
- }
-
- @JsonProperty("latitude")
- public void setLatitude(String latitude) {
- this.latitude = latitude;
- }
-
- @JsonProperty("longitude")
- public String getLongitude() {
- return longitude;
- }
-
- @JsonProperty("longitude")
- public void setLongitude(String longitude) {
- this.longitude = longitude;
- }
-
- @JsonProperty("registrationTime")
- public String getRegistrationTime() {
- return registrationTime;
- }
-
- @JsonProperty("registrationTime")
- public void setRegistrationTime(String registrationTime) {
- this.registrationTime = registrationTime;
- }
-
- @JsonProperty("expirationTime")
- public String getExpirationTime() {
- return expirationTime;
- }
-
- @JsonProperty("expirationTime")
- public void setExpirationTime(String expirationTime) {
- this.expirationTime = expirationTime;
- }
-
- @JsonProperty("contextPath")
- public String getContextPath() {
- return contextPath;
- }
-
- @JsonProperty("contextPath")
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
-
- @JsonProperty("routeOffer")
- public String getRouteOffer() {
- return routeOffer;
- }
-
- @JsonProperty("routeOffer")
- public void setRouteOffer(String routeOffer) {
- this.routeOffer = routeOffer;
- }
-
- @JsonProperty("statusInfo")
- public Status getStatusInfo() {
- return statusInfo;
- }
-
- @JsonProperty("statusInfo")
- public void setStatusInfo(Status statusInfo) {
- this.statusInfo = statusInfo;
- }
-
- @JsonProperty("eventStatusInfo")
- public Status getEventStatusInfo() {
- return eventStatusInfo;
- }
-
- @JsonProperty("eventStatusInfo")
- public void setEventStatusInfo(Status eventStatusInfo) {
- this.eventStatusInfo = eventStatusInfo;
- }
-
- @JsonProperty("validatorStatusInfo")
- public Status getValidatorStatusInfo() {
- return validatorStatusInfo;
- }
-
- @JsonProperty("validatorStatusInfo")
- public void setValidatorStatusInfo(Status validatorStatusInfo) {
- this.validatorStatusInfo = validatorStatusInfo;
- }
-
- @JsonProperty("operationalInfo")
- public OperationalInfo getOperationalInfo() {
- return operationalInfo;
- }
-
- @JsonProperty("operationalInfo")
- public void setOperationalInfo(OperationalInfo operationalInfo) {
- this.operationalInfo = operationalInfo;
- }
-
- @JsonProperty("protocol")
- public String getProtocol() {
- return protocol;
- }
-
- @JsonProperty("protocol")
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- @JsonProperty("properties")
- public List<Property> getProperties() {
- return properties;
- }
-
- @JsonProperty("properties")
- public void setProperties(List<Property> properties) {
- this.properties = properties;
- }
-
- @JsonProperty("disableType")
- public List<Object> getDisableType() {
- return disableType;
- }
-
- @JsonProperty("disableType")
- public void setDisableType(List<Object> disableType) {
- this.disableType = disableType;
- }
+ private static final long serialVersionUID = -1594441352549128491L;
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private Version version;
+ @JsonProperty("hostAddress")
+ private String hostAddress;
+ @JsonProperty("listenPort")
+ private String listenPort;
+ @JsonProperty("latitude")
+ private String latitude;
+ @JsonProperty("longitude")
+ private String longitude;
+ @JsonProperty("registrationTime")
+ private String registrationTime;
+ @JsonProperty("expirationTime")
+ private String expirationTime;
+ @JsonProperty("contextPath")
+ private String contextPath;
+ @JsonProperty("routeOffer")
+ private String routeOffer;
+ @JsonProperty("statusInfo")
+ private Status statusInfo;
+ @JsonProperty("eventStatusInfo")
+ private Status eventStatusInfo;
+ @JsonProperty("validatorStatusInfo")
+ private Status validatorStatusInfo;
+ @JsonProperty("operationalInfo")
+ private OperationalInfo operationalInfo;
+ @JsonProperty("protocol")
+ private String protocol;
+ @JsonProperty("properties")
+ private List<Property> properties = null;
+ @JsonProperty("disableType")
+ private List<Object> disableType = null;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("version")
+ public Version getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ @JsonProperty("hostAddress")
+ public String getHostAddress() {
+ return hostAddress;
+ }
+
+ @JsonProperty("hostAddress")
+ public void setHostAddress(String hostAddress) {
+ this.hostAddress = hostAddress;
+ }
+
+ @JsonProperty("listenPort")
+ public String getListenPort() {
+ return listenPort;
+ }
+
+ @JsonProperty("listenPort")
+ public void setListenPort(String listenPort) {
+ this.listenPort = listenPort;
+ }
+
+ @JsonProperty("latitude")
+ public String getLatitude() {
+ return latitude;
+ }
+
+ @JsonProperty("latitude")
+ public void setLatitude(String latitude) {
+ this.latitude = latitude;
+ }
+
+ @JsonProperty("longitude")
+ public String getLongitude() {
+ return longitude;
+ }
+
+ @JsonProperty("longitude")
+ public void setLongitude(String longitude) {
+ this.longitude = longitude;
+ }
+
+ @JsonProperty("registrationTime")
+ public String getRegistrationTime() {
+ return registrationTime;
+ }
+
+ @JsonProperty("registrationTime")
+ public void setRegistrationTime(String registrationTime) {
+ this.registrationTime = registrationTime;
+ }
+
+ @JsonProperty("expirationTime")
+ public String getExpirationTime() {
+ return expirationTime;
+ }
+
+ @JsonProperty("expirationTime")
+ public void setExpirationTime(String expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+ @JsonProperty("contextPath")
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ @JsonProperty("contextPath")
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ @JsonProperty("routeOffer")
+ public String getRouteOffer() {
+ return routeOffer;
+ }
+
+ @JsonProperty("routeOffer")
+ public void setRouteOffer(String routeOffer) {
+ this.routeOffer = routeOffer;
+ }
+
+ @JsonProperty("statusInfo")
+ public Status getStatusInfo() {
+ return statusInfo;
+ }
+
+ @JsonProperty("statusInfo")
+ public void setStatusInfo(Status statusInfo) {
+ this.statusInfo = statusInfo;
+ }
+
+ @JsonProperty("eventStatusInfo")
+ public Status getEventStatusInfo() {
+ return eventStatusInfo;
+ }
+
+ @JsonProperty("eventStatusInfo")
+ public void setEventStatusInfo(Status eventStatusInfo) {
+ this.eventStatusInfo = eventStatusInfo;
+ }
+
+ @JsonProperty("validatorStatusInfo")
+ public Status getValidatorStatusInfo() {
+ return validatorStatusInfo;
+ }
+
+ @JsonProperty("validatorStatusInfo")
+ public void setValidatorStatusInfo(Status validatorStatusInfo) {
+ this.validatorStatusInfo = validatorStatusInfo;
+ }
+
+ @JsonProperty("operationalInfo")
+ public OperationalInfo getOperationalInfo() {
+ return operationalInfo;
+ }
+
+ @JsonProperty("operationalInfo")
+ public void setOperationalInfo(OperationalInfo operationalInfo) {
+ this.operationalInfo = operationalInfo;
+ }
+
+ @JsonProperty("protocol")
+ public String getProtocol() {
+ return protocol;
+ }
+
+ @JsonProperty("protocol")
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ @JsonProperty("properties")
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @JsonProperty("properties")
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+
+ @JsonProperty("disableType")
+ public List<Object> getDisableType() {
+ return disableType;
+ }
+
+ @JsonProperty("disableType")
+ public void setDisableType(List<Object> disableType) {
+ this.disableType = disableType;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
index 2b7a81d590..b87819d528 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
@@ -21,22 +21,21 @@
package org.onap.so.client.grm.beans;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
-//@JsonIgnoreProperties(ignoreUnknown = true)
+// @JsonIgnoreProperties(ignoreUnknown = true)
public class ServiceEndPointList {
- @JsonAlias("ServiceEndPointList")
- private List<ServiceEndPoint> serviceEndPointList = null;
+ @JsonAlias("ServiceEndPointList")
+ private List<ServiceEndPoint> serviceEndPointList = null;
- public List<ServiceEndPoint> getServiceEndPointList() {
- return serviceEndPointList;
- }
+ public List<ServiceEndPoint> getServiceEndPointList() {
+ return serviceEndPointList;
+ }
- public void setServiceEndPointList(List<ServiceEndPoint> serviceEndPointList) {
- this.serviceEndPointList = serviceEndPointList;
- }
+ public void setServiceEndPointList(List<ServiceEndPoint> serviceEndPointList) {
+ this.serviceEndPointList = serviceEndPointList;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
index cab10e64f4..200a2fce64 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -29,33 +28,33 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "serviceEndPoint")
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "name", "version"})
+@JsonPropertyOrder({"name", "version"})
public class ServiceEndPointLookup implements Serializable {
- private static final long serialVersionUID = 8867758152519088615L;
+ private static final long serialVersionUID = 8867758152519088615L;
- @JsonProperty("name")
- private String name;
- @JsonProperty("version")
- private VersionLookup version;
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private VersionLookup version;
- @JsonProperty("name")
- public String getName() {
- return name;
- }
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
- @JsonProperty("name")
- public void setName(String name) {
- this.name = name;
- }
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
- @JsonProperty("version")
- public VersionLookup getVersion() {
- return version;
- }
+ @JsonProperty("version")
+ public VersionLookup getVersion() {
+ return version;
+ }
- @JsonProperty("version")
- public void setVersion(VersionLookup version) {
- this.version = version;
- }
+ @JsonProperty("version")
+ public void setVersion(VersionLookup version) {
+ this.version = version;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
index 5e886300dd..be537e4ff9 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
@@ -27,32 +27,32 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "serviceEndPoint", "env" })
+@JsonPropertyOrder({"serviceEndPoint", "env"})
public class ServiceEndPointLookupRequest {
- @JsonProperty("serviceEndPoint")
- private ServiceEndPointLookup serviceEndPoint;
- @JsonProperty("env")
- private String env;
-
- @JsonProperty("serviceEndPoint")
- public ServiceEndPointLookup getServiceEndPoint() {
- return serviceEndPoint;
- }
-
- @JsonProperty("serviceEndPoint")
- public void setServiceEndPoint(ServiceEndPointLookup serviceEndPoint) {
- this.serviceEndPoint = serviceEndPoint;
- }
-
- @JsonProperty("env")
- public String getEnv() {
- return env;
- }
-
- @JsonProperty("env")
- public void setEnv(String env) {
- this.env = env;
- }
+ @JsonProperty("serviceEndPoint")
+ private ServiceEndPointLookup serviceEndPoint;
+ @JsonProperty("env")
+ private String env;
+
+ @JsonProperty("serviceEndPoint")
+ public ServiceEndPointLookup getServiceEndPoint() {
+ return serviceEndPoint;
+ }
+
+ @JsonProperty("serviceEndPoint")
+ public void setServiceEndPoint(ServiceEndPointLookup serviceEndPoint) {
+ this.serviceEndPoint = serviceEndPoint;
+ }
+
+ @JsonProperty("env")
+ public String getEnv() {
+ return env;
+ }
+
+ @JsonProperty("env")
+ public void setEnv(String env) {
+ this.env = env;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
index f7ea352f21..6c64be33bd 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
@@ -27,32 +27,32 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "serviceEndPoint", "env" })
+@JsonPropertyOrder({"serviceEndPoint", "env"})
public class ServiceEndPointRequest {
- @JsonProperty("serviceEndPoint")
- private ServiceEndPoint serviceEndPoint;
- @JsonProperty("env")
- private String env;
-
- @JsonProperty("serviceEndPoint")
- public ServiceEndPoint getServiceEndPoint() {
- return serviceEndPoint;
- }
-
- @JsonProperty("serviceEndPoint")
- public void setServiceEndPoint(ServiceEndPoint serviceEndPoint) {
- this.serviceEndPoint = serviceEndPoint;
- }
-
- @JsonProperty("env")
- public String getEnv() {
- return env;
- }
-
- @JsonProperty("env")
- public void setEnv(String env) {
- this.env = env;
- }
+ @JsonProperty("serviceEndPoint")
+ private ServiceEndPoint serviceEndPoint;
+ @JsonProperty("env")
+ private String env;
+
+ @JsonProperty("serviceEndPoint")
+ public ServiceEndPoint getServiceEndPoint() {
+ return serviceEndPoint;
+ }
+
+ @JsonProperty("serviceEndPoint")
+ public void setServiceEndPoint(ServiceEndPoint serviceEndPoint) {
+ this.serviceEndPoint = serviceEndPoint;
+ }
+
+ @JsonProperty("env")
+ public String getEnv() {
+ return env;
+ }
+
+ @JsonProperty("env")
+ public void setEnv(String env) {
+ this.env = env;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/Status.java b/common/src/main/java/org/onap/so/client/grm/beans/Status.java
index 8794139b67..f4b0ff583e 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/Status.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Status.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,60 +28,60 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "status", "statusReasonCode", "statusReasonDescription", "statusCheckTime" })
+@JsonPropertyOrder({"status", "statusReasonCode", "statusReasonDescription", "statusCheckTime"})
public class Status implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3555636617671062648L;
- @JsonProperty("status")
- private String status;
- @JsonProperty("statusReasonCode")
- private String statusReasonCode;
- @JsonProperty("statusReasonDescription")
- private String statusReasonDescription;
- @JsonProperty("statusCheckTime")
- private String statusCheckTime;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3555636617671062648L;
+ @JsonProperty("status")
+ private String status;
+ @JsonProperty("statusReasonCode")
+ private String statusReasonCode;
+ @JsonProperty("statusReasonDescription")
+ private String statusReasonDescription;
+ @JsonProperty("statusCheckTime")
+ private String statusCheckTime;
- @JsonProperty("status")
- public String getStatus() {
- return status;
- }
+ @JsonProperty("status")
+ public String getStatus() {
+ return status;
+ }
- @JsonProperty("status")
- public void setStatus(String status) {
- this.status = status;
- }
+ @JsonProperty("status")
+ public void setStatus(String status) {
+ this.status = status;
+ }
- @JsonProperty("statusReasonCode")
- public String getStatusReasonCode() {
- return statusReasonCode;
- }
+ @JsonProperty("statusReasonCode")
+ public String getStatusReasonCode() {
+ return statusReasonCode;
+ }
- @JsonProperty("statusReasonCode")
- public void setStatusReasonCode(String statusReasonCode) {
- this.statusReasonCode = statusReasonCode;
- }
+ @JsonProperty("statusReasonCode")
+ public void setStatusReasonCode(String statusReasonCode) {
+ this.statusReasonCode = statusReasonCode;
+ }
- @JsonProperty("statusReasonDescription")
- public String getStatusReasonDescription() {
- return statusReasonDescription;
- }
+ @JsonProperty("statusReasonDescription")
+ public String getStatusReasonDescription() {
+ return statusReasonDescription;
+ }
- @JsonProperty("statusReasonDescription")
- public void setStatusReasonDescription(String statusReasonDescription) {
- this.statusReasonDescription = statusReasonDescription;
- }
+ @JsonProperty("statusReasonDescription")
+ public void setStatusReasonDescription(String statusReasonDescription) {
+ this.statusReasonDescription = statusReasonDescription;
+ }
- @JsonProperty("statusCheckTime")
- public String getStatusCheckTime() {
- return statusCheckTime;
- }
+ @JsonProperty("statusCheckTime")
+ public String getStatusCheckTime() {
+ return statusCheckTime;
+ }
- @JsonProperty("statusCheckTime")
- public void setStatusCheckTime(String statusCheckTime) {
- this.statusCheckTime = statusCheckTime;
- }
+ @JsonProperty("statusCheckTime")
+ public void setStatusCheckTime(String statusCheckTime) {
+ this.statusCheckTime = statusCheckTime;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/Version.java b/common/src/main/java/org/onap/so/client/grm/beans/Version.java
index fd1e5803ab..fd2cceec01 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/Version.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Version.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,47 +28,47 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "major", "minor", "patch" })
-public class Version implements Serializable{
+@JsonPropertyOrder({"major", "minor", "patch"})
+public class Version implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 7509573030831487410L;
- @JsonProperty("major")
- private Integer major;
- @JsonProperty("minor")
- private Integer minor;
- @JsonProperty("patch")
- private String patch;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7509573030831487410L;
+ @JsonProperty("major")
+ private Integer major;
+ @JsonProperty("minor")
+ private Integer minor;
+ @JsonProperty("patch")
+ private String patch;
- @JsonProperty("major")
- public Integer getMajor() {
- return major;
- }
+ @JsonProperty("major")
+ public Integer getMajor() {
+ return major;
+ }
- @JsonProperty("major")
- public void setMajor(Integer major) {
- this.major = major;
- }
+ @JsonProperty("major")
+ public void setMajor(Integer major) {
+ this.major = major;
+ }
- @JsonProperty("minor")
- public Integer getMinor() {
- return minor;
- }
+ @JsonProperty("minor")
+ public Integer getMinor() {
+ return minor;
+ }
- @JsonProperty("minor")
- public void setMinor(Integer minor) {
- this.minor = minor;
- }
+ @JsonProperty("minor")
+ public void setMinor(Integer minor) {
+ this.minor = minor;
+ }
- @JsonProperty("patch")
- public String getPatch() {
- return patch;
- }
+ @JsonProperty("patch")
+ public String getPatch() {
+ return patch;
+ }
- @JsonProperty("patch")
- public void setPatch(String patch) {
- this.patch = patch;
- }
+ @JsonProperty("patch")
+ public void setPatch(String patch) {
+ this.patch = patch;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
index 0dc86b04d6..661b91829c 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
@@ -21,7 +21,6 @@
package org.onap.so.client.grm.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,21 +28,21 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "major" })
+@JsonPropertyOrder({"major"})
public class VersionLookup implements Serializable {
- private static final long serialVersionUID = 3802602253627725770L;
+ private static final long serialVersionUID = 3802602253627725770L;
+
+ @JsonProperty("major")
+ private Integer major;
- @JsonProperty("major")
- private Integer major;
-
- @JsonProperty("major")
- public Integer getMajor() {
- return major;
- }
+ @JsonProperty("major")
+ public Integer getMajor() {
+ return major;
+ }
- @JsonProperty("major")
- public void setMajor(Integer major) {
- this.major = major;
- }
+ @JsonProperty("major")
+ public void setMajor(Integer major) {
+ this.major = major;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
index 7107d4027f..458cfa2a72 100644
--- a/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
+++ b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
@@ -22,11 +22,11 @@ package org.onap.so.client.grm.exceptions;
public class GRMClientCallFailed extends Exception {
- private static final long serialVersionUID = -8714110346844078779L;
+ private static final long serialVersionUID = -8714110346844078779L;
+
+ public GRMClientCallFailed(String message, Throwable cause) {
+ super(message, cause);
+ }
- public GRMClientCallFailed(String message, Throwable cause) {
- super(message, cause);
- }
-
}
diff --git a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
index f2f6f0362f..c55370f7dc 100644
--- a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
@@ -28,19 +28,19 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class CommonObjectMapperProvider {
- protected ObjectMapper mapper;
+ protected ObjectMapper mapper;
- public CommonObjectMapperProvider() {
-
- mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
+ public CommonObjectMapperProvider() {
+
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
mapper.enable(MapperFeature.USE_ANNOTATIONS);
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- }
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
- public ObjectMapper getMapper() {
- return mapper;
- }
-} \ No newline at end of file
+ public ObjectMapper getMapper() {
+ return mapper;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
index 951372db42..cf41dea7a2 100644
--- a/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
@@ -27,67 +27,67 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" })
+@JsonPropertyOrder({"ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode"})
public class DecisionAttributes {
- @JsonProperty("ServiceType")
- private String serviceType;
- @JsonProperty("VNFType")
- private String vNFType;
- @JsonProperty("BB_ID")
- private String bbID;
- @JsonProperty("WorkStep")
- private String workStep;
- @JsonProperty("ErrorCode")
- private String errorCode;
-
- @JsonProperty("ServiceType")
- public String getServiceType() {
- return serviceType;
- }
-
- @JsonProperty("ServiceType")
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- @JsonProperty("VNFType")
- public String getVNFType() {
- return vNFType;
- }
-
- @JsonProperty("VNFType")
- public void setVNFType(String vNFType) {
- this.vNFType = vNFType;
- }
-
- @JsonProperty("BB_ID")
- public String getBBID() {
- return bbID;
- }
-
- @JsonProperty("BB_ID")
- public void setBBID(String bBID) {
- this.bbID = bBID;
- }
-
- @JsonProperty("WorkStep")
- public String getWorkStep() {
- return workStep;
- }
-
- @JsonProperty("WorkStep")
- public void setWorkStep(String workStep) {
- this.workStep = workStep;
- }
-
- @JsonProperty("ErrorCode")
- public String getErrorCode() {
- return errorCode;
- }
-
- @JsonProperty("ErrorCode")
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ @JsonProperty("ServiceType")
+ private String serviceType;
+ @JsonProperty("VNFType")
+ private String vNFType;
+ @JsonProperty("BB_ID")
+ private String bbID;
+ @JsonProperty("WorkStep")
+ private String workStep;
+ @JsonProperty("ErrorCode")
+ private String errorCode;
+
+ @JsonProperty("ServiceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty("ServiceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty("VNFType")
+ public String getVNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setVNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBBID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBBID(String bBID) {
+ this.bbID = bBID;
+ }
+
+ @JsonProperty("WorkStep")
+ public String getWorkStep() {
+ return workStep;
+ }
+
+ @JsonProperty("WorkStep")
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
+
+ @JsonProperty("ErrorCode")
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ @JsonProperty("ErrorCode")
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
index 23b984a3d0..34b121366b 100644
--- a/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
@@ -21,7 +21,6 @@
package org.onap.so.client.policy;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -30,16 +29,16 @@ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
@Component
public class JettisonStyleMapperProvider extends CommonObjectMapperProvider {
-
- public JettisonStyleMapperProvider() {
-
- mapper = new ObjectMapper();
- JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
- mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- mapper.registerModule(jaxbModule);
- }
+
+ public JettisonStyleMapperProvider() {
+
+ mapper = new ObjectMapper();
+ JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.registerModule(jaxbModule);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
index 6743bc2c34..d1349260c5 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
@@ -26,10 +26,10 @@ import org.onap.so.client.policy.entities.PolicyDecision;
public interface PolicyClient {
- public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
- String errorCode);
-
- public DictionaryData getAllowedTreatments(String bbID, String workStep);
-
- public Config getConfigWithPolicyName(String policyName);
+ public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
+ String errorCode);
+
+ public DictionaryData getAllowedTreatments(String bbID, String workStep);
+
+ public Config getConfigWithPolicyName(String policyName);
}
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
index 71a3227c56..72c5a7dd5b 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
@@ -22,7 +22,6 @@ package org.onap.so.client.policy;
import java.io.IOException;
import java.util.List;
-
import org.onap.so.client.RestClient;
import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
@@ -41,7 +40,6 @@ import org.onap.so.client.policy.entities.PolicyServiceType;
import org.onap.so.client.policy.entities.Workstep;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -51,88 +49,89 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class PolicyClientImpl implements PolicyClient {
- private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
- private PolicyRestProperties props;
- private ObjectMapper mapper = new ObjectMapper();
-
- public PolicyClientImpl() {
- props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
- if (props == null) {
- logger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
- props = new PolicyRestPropertiesImpl();
- }
- }
- public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
- String errorCode) {
- DecisionAttributes decisionAttributes = new DecisionAttributes();
- decisionAttributes.setServiceType(serviceType);
- decisionAttributes.setvNFType(vnfType);
- decisionAttributes.setBbID(bbID);
- decisionAttributes.setWorkStep(workStep);
- decisionAttributes.setErrorCode(errorCode);
+ private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
+ private PolicyRestProperties props;
+ private ObjectMapper mapper = new ObjectMapper();
+
+ public PolicyClientImpl() {
+ props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
+ if (props == null) {
+ logger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
+ props = new PolicyRestPropertiesImpl();
+ }
+ }
+
+ public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
+ String errorCode) {
+ DecisionAttributes decisionAttributes = new DecisionAttributes();
+ decisionAttributes.setServiceType(serviceType);
+ decisionAttributes.setvNFType(vnfType);
+ decisionAttributes.setBbID(bbID);
+ decisionAttributes.setWorkStep(workStep);
+ decisionAttributes.setErrorCode(errorCode);
+
+ return this.getDecision(decisionAttributes);
+ }
+
+ protected PolicyDecision getDecision(DecisionAttributes decisionAttributes) {
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DECISION);
+ PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest();
+ decisionRequest.setDecisionAttributes(decisionAttributes);
+ decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME);
+
+ return client.post(decisionRequest, PolicyDecision.class);
+ }
+
+ public DictionaryData getAllowedTreatments(String bbID, String workStep) {
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DICTIONARY_ITEMS);
+ DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest();
+ dictionaryItemsRequest.setDictionaryType("Decision");
+ dictionaryItemsRequest.setDictionary("RainyDayTreatments");
+ final AllowedTreatments response = client.post(dictionaryItemsRequest, AllowedTreatments.class);
+ final DictionaryJson dictionaryJson = response.getDictionaryJson();
+ final List<DictionaryData> dictionaryDataList = dictionaryJson.getDictionaryDatas();
+ for (DictionaryData dictData : dictionaryDataList) {
+ Bbid bBid = dictData.getBbid();
+ Workstep workstep = dictData.getWorkstep();
+ String bBidString = bBid.getString();
+ String workstepString = workstep.getString();
+ if (bbID.equals(bBidString) && workStep.equals(workstepString)) {
+ return dictData;
+ }
+ }
+ logger.error("There is no AllowedTreatments with that specified parameter set");
+ return null;
+ }
+
+ @Override
+ public Config getConfigWithPolicyName(String policyName) {
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_CONFIG);
+ ConfigRequestParameters configReqParameters = new ConfigRequestParameters();
+ configReqParameters.setPolicyName(policyName);
+ PolicyConfig[] policyConfigList = client.post(configReqParameters, PolicyConfig[].class);
+ PolicyConfig policyConfig = null;
+ if (policyConfigList.length > 1) {
+ logger.debug("Too many configs for policyName: " + policyName);
+ return null;
+ }
+ try {
+ policyConfig = policyConfigList[0];
+ return this.getConfigFromStringJson(policyConfig.getConfig());
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ return null;
+ }
+ }
- return this.getDecision(decisionAttributes);
- }
+ protected Config getConfigFromStringJson(String configJson)
+ throws JsonParseException, JsonMappingException, IOException {
+ String unescapedJson = configJson.replaceAll("\\\\", "");
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ return mapper.readValue(unescapedJson, Config.class);
+ }
- protected PolicyDecision getDecision(DecisionAttributes decisionAttributes) {
- PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DECISION);
- PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest();
- decisionRequest.setDecisionAttributes(decisionAttributes);
- decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME);
-
- return client.post(decisionRequest, PolicyDecision.class);
- }
-
- public DictionaryData getAllowedTreatments(String bbID, String workStep)
- {
- PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DICTIONARY_ITEMS);
- DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest();
- dictionaryItemsRequest.setDictionaryType("Decision");
- dictionaryItemsRequest.setDictionary("RainyDayTreatments");
- final AllowedTreatments response = client.post(dictionaryItemsRequest, AllowedTreatments.class);
- final DictionaryJson dictionaryJson = response.getDictionaryJson();
- final List<DictionaryData> dictionaryDataList = dictionaryJson.getDictionaryDatas();
- for(DictionaryData dictData : dictionaryDataList){
- Bbid bBid = dictData.getBbid();
- Workstep workstep = dictData.getWorkstep();
- String bBidString = bBid.getString();
- String workstepString = workstep.getString();
- if(bbID.equals(bBidString) && workStep.equals(workstepString)){
- return dictData;
- }
- }
- logger.error("There is no AllowedTreatments with that specified parameter set");
- return null;
- }
-
- @Override
- public Config getConfigWithPolicyName(String policyName) {
- PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_CONFIG);
- ConfigRequestParameters configReqParameters = new ConfigRequestParameters();
- configReqParameters.setPolicyName(policyName);
- PolicyConfig[] policyConfigList = client.post(configReqParameters, PolicyConfig[].class);
- PolicyConfig policyConfig = null;
- if(policyConfigList.length > 1) {
- logger.debug("Too many configs for policyName: " + policyName);
- return null;
- }
- try {
- policyConfig = policyConfigList[0];
- return this.getConfigFromStringJson(policyConfig.getConfig());
- } catch (IOException e) {
- logger.error(e.getMessage());
- return null;
- }
- }
-
- protected Config getConfigFromStringJson(String configJson) throws JsonParseException, JsonMappingException, IOException {
- String unescapedJson = configJson.replaceAll("\\\\", "");
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
- return mapper.readValue(unescapedJson, Config.class);
- }
-
- protected PolicyRestClient getPolicyRestClient(PolicyServiceType policyServiceType) {
- return new PolicyRestClient(this.props, policyServiceType);
- }
+ protected PolicyRestClient getPolicyRestClient(PolicyServiceType policyServiceType) {
+ return new PolicyRestClient(this.props, policyServiceType);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
index 9427fa7eb9..95bc4282ae 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
@@ -23,32 +23,30 @@ package org.onap.so.client.policy;
import java.util.Map;
import java.util.Optional;
-
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.client.RestClient;
import org.onap.so.client.policy.entities.PolicyServiceType;
import org.onap.so.utils.TargetEntity;
public class PolicyRestClient extends RestClient {
- private final PolicyRestProperties properties;
+ private final PolicyRestProperties properties;
- public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
- super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
- this.properties = props;
- }
+ public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
+ super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
+ this.properties = props;
+ }
@Override
- public TargetEntity getTargetEntity(){
+ public TargetEntity getTargetEntity() {
return TargetEntity.POLICY;
}
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("ClientAuth", properties.getClientAuth());
- headerMap.put("Authorization", properties.getAuth());
- headerMap.put("Environment", properties.getEnvironment());
- }
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("ClientAuth", properties.getClientAuth());
+ headerMap.put("Authorization", properties.getAuth());
+ headerMap.put("Environment", properties.getEnvironment());
+ }
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
index 1de6e8cd97..2b6947104c 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
@@ -23,9 +23,11 @@ package org.onap.so.client.policy;
import org.onap.so.client.RestProperties;
public interface PolicyRestProperties extends RestProperties {
-
- public String getClientAuth();
- public String getAuth();
- public String getEnvironment();
+
+ public String getClientAuth();
+
+ public String getAuth();
+
+ public String getEnvironment();
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
index e82eca56b8..6c03b60ffb 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
@@ -25,81 +25,76 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"dictionaryJson",
-"dictionaryData",
-"responseCode",
-"responseMessage"
-})
-public class AllowedTreatments{
-
-@JsonProperty("dictionaryJson")
-private DictionaryJson dictionaryJson;
-@JsonProperty("dictionaryData")
-private Object dictionaryData;
-@JsonProperty("responseCode")
-private Integer responseCode;
-@JsonProperty("responseMessage")
-private String responseMessage;
-
-@JsonProperty("dictionaryJson")
-public DictionaryJson getDictionaryJson() {
-return dictionaryJson;
- }
-
-@JsonProperty("dictionaryJson")
-public void setDictionaryJson(DictionaryJson dictionaryJson) {
-this.dictionaryJson = dictionaryJson;
- }
-
-public AllowedTreatments withDictionaryJson(DictionaryJson dictionaryJson) {
-this.dictionaryJson = dictionaryJson;
-return this;
- }
-
-@JsonProperty("dictionaryData")
-public Object getDictionaryData() {
-return dictionaryData;
- }
-
-@JsonProperty("dictionaryData")
-public void setDictionaryData(Object dictionaryData) {
-this.dictionaryData = dictionaryData;
- }
-
-public AllowedTreatments withDictionaryData(Object dictionaryData) {
-this.dictionaryData = dictionaryData;
-return this;
- }
-
-@JsonProperty("responseCode")
-public Integer getResponseCode() {
-return responseCode;
- }
-
-@JsonProperty("responseCode")
-public void setResponseCode(Integer responseCode) {
-this.responseCode = responseCode;
- }
-
-public AllowedTreatments withResponseCode(Integer responseCode) {
-this.responseCode = responseCode;
-return this;
- }
-
-@JsonProperty("responseMessage")
-public String getResponseMessage() {
-return responseMessage;
- }
-
-@JsonProperty("responseMessage")
-public void setResponseMessage(String responseMessage) {
-this.responseMessage = responseMessage;
- }
-
-public AllowedTreatments withResponseMessage(String responseMessage) {
-this.responseMessage = responseMessage;
-return this;
- }
+@JsonPropertyOrder({"dictionaryJson", "dictionaryData", "responseCode", "responseMessage"})
+public class AllowedTreatments {
+
+ @JsonProperty("dictionaryJson")
+ private DictionaryJson dictionaryJson;
+ @JsonProperty("dictionaryData")
+ private Object dictionaryData;
+ @JsonProperty("responseCode")
+ private Integer responseCode;
+ @JsonProperty("responseMessage")
+ private String responseMessage;
+
+ @JsonProperty("dictionaryJson")
+ public DictionaryJson getDictionaryJson() {
+ return dictionaryJson;
+ }
+
+ @JsonProperty("dictionaryJson")
+ public void setDictionaryJson(DictionaryJson dictionaryJson) {
+ this.dictionaryJson = dictionaryJson;
+ }
+
+ public AllowedTreatments withDictionaryJson(DictionaryJson dictionaryJson) {
+ this.dictionaryJson = dictionaryJson;
+ return this;
+ }
+
+ @JsonProperty("dictionaryData")
+ public Object getDictionaryData() {
+ return dictionaryData;
+ }
+
+ @JsonProperty("dictionaryData")
+ public void setDictionaryData(Object dictionaryData) {
+ this.dictionaryData = dictionaryData;
+ }
+
+ public AllowedTreatments withDictionaryData(Object dictionaryData) {
+ this.dictionaryData = dictionaryData;
+ return this;
+ }
+
+ @JsonProperty("responseCode")
+ public Integer getResponseCode() {
+ return responseCode;
+ }
+
+ @JsonProperty("responseCode")
+ public void setResponseCode(Integer responseCode) {
+ this.responseCode = responseCode;
+ }
+
+ public AllowedTreatments withResponseCode(Integer responseCode) {
+ this.responseCode = responseCode;
+ return this;
+ }
+
+ @JsonProperty("responseMessage")
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ @JsonProperty("responseMessage")
+ public void setResponseMessage(String responseMessage) {
+ this.responseMessage = responseMessage;
+ }
+
+ public AllowedTreatments withResponseMessage(String responseMessage) {
+ this.responseMessage = responseMessage;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
index 34faa7df09..90ebd603bc 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
@@ -25,63 +25,59 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
+@JsonPropertyOrder({"valueType", "string", "chars"})
public class Bbid {
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
+ @JsonProperty("valueType")
+ private String valueType;
+ @JsonProperty("string")
+ private String string;
+ @JsonProperty("chars")
+ private String chars;
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
+ @JsonProperty("valueType")
+ public String getValueType() {
+ return valueType;
+ }
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
+ @JsonProperty("valueType")
+ public void setValueType(String valueType) {
+ this.valueType = valueType;
+ }
-public Bbid withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
+ public Bbid withValueType(String valueType) {
+ this.valueType = valueType;
+ return this;
+ }
-@JsonProperty("string")
-public String getString() {
-return string;
- }
+ @JsonProperty("string")
+ public String getString() {
+ return string;
+ }
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
+ @JsonProperty("string")
+ public void setString(String string) {
+ this.string = string;
+ }
-public Bbid withString(String string) {
-this.string = string;
-return this;
- }
+ public Bbid withString(String string) {
+ this.string = string;
+ return this;
+ }
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
+ @JsonProperty("chars")
+ public String getChars() {
+ return chars;
+ }
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
+ @JsonProperty("chars")
+ public void setChars(String chars) {
+ this.chars = chars;
+ }
-public Bbid withChars(String chars) {
-this.chars = chars;
-return this;
- }
+ public Bbid withChars(String chars) {
+ this.chars = chars;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Config.java b/common/src/main/java/org/onap/so/client/policy/entities/Config.java
index 6c9c0759d6..440c31916f 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Config.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Config.java
@@ -26,22 +26,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "configName",
- "riskLevel",
- "policyName",
- "policyScope",
- "guard",
- "description",
- "priority",
- "uuid",
- "version",
- "content",
- "riskType",
- "service",
- "location",
- "templateVersion"
-})
+@JsonPropertyOrder({"configName", "riskLevel", "policyName", "policyScope", "guard", "description", "priority", "uuid",
+ "version", "content", "riskType", "service", "location", "templateVersion"})
@JsonRootName(value = "config")
public class Config {
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java
index 8cd5b93a36..177a1c0ca3 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java
@@ -22,21 +22,12 @@ package org.onap.so.client.policy.entities;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "configAttributes",
- "configName",
- "ecompName",
- "onapName",
- "policyName",
- "requestID",
- "unique"
-})
+@JsonPropertyOrder({"configAttributes", "configName", "ecompName", "onapName", "policyName", "requestID", "unique"})
public class ConfigRequestParameters {
@JsonProperty("configAttributes")
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Content.java b/common/src/main/java/org/onap/so/client/policy/entities/Content.java
index a473f6c566..009774dbe6 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Content.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Content.java
@@ -26,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "fabric-config-models"
-})
+@JsonPropertyOrder({"fabric-config-models"})
public class Content {
@JsonProperty("fabric-config-models")
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
index 07db7d8568..08489f4a08 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
@@ -27,68 +27,68 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" })
+@JsonPropertyOrder({"ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode"})
public class DecisionAttributes {
- @JsonProperty("ServiceType")
- private String serviceType;
- @JsonProperty("VNFType")
- private String vNFType;
- @JsonProperty("BB_ID")
- private String bbID;
- @JsonProperty("WorkStep")
- private String workStep;
- @JsonProperty("ErrorCode")
- private String errorCode;
-
- @JsonProperty("ServiceType")
- public String getServiceType() {
- return serviceType;
- }
-
- @JsonProperty("ServiceType")
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- @JsonProperty("WorkStep")
- public String getWorkStep() {
- return workStep;
- }
-
- @JsonProperty("WorkStep")
- public void setWorkStep(String workStep) {
- this.workStep = workStep;
- }
-
- @JsonProperty("ErrorCode")
- public String getErrorCode() {
- return errorCode;
- }
-
- @JsonProperty("ErrorCode")
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
-
- @JsonProperty("VNFType")
- public String getvNFType() {
- return vNFType;
- }
-
- @JsonProperty("VNFType")
- public void setvNFType(String vNFType) {
- this.vNFType = vNFType;
- }
-
- @JsonProperty("BB_ID")
- public String getBbID() {
- return bbID;
- }
-
- @JsonProperty("BB_ID")
- public void setBbID(String bbID) {
- this.bbID = bbID;
- }
-
+ @JsonProperty("ServiceType")
+ private String serviceType;
+ @JsonProperty("VNFType")
+ private String vNFType;
+ @JsonProperty("BB_ID")
+ private String bbID;
+ @JsonProperty("WorkStep")
+ private String workStep;
+ @JsonProperty("ErrorCode")
+ private String errorCode;
+
+ @JsonProperty("ServiceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty("ServiceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty("WorkStep")
+ public String getWorkStep() {
+ return workStep;
+ }
+
+ @JsonProperty("WorkStep")
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
+
+ @JsonProperty("ErrorCode")
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ @JsonProperty("ErrorCode")
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ @JsonProperty("VNFType")
+ public String getvNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setvNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBbID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBbID(String bbID) {
+ this.bbID = bbID;
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
index 8207999a80..d509d78df7 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
@@ -25,81 +25,76 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"id",
-"bbid",
-"workstep",
-"treatments"
-})
+@JsonPropertyOrder({"id", "bbid", "workstep", "treatments"})
public class DictionaryData {
-@JsonProperty("id")
-private Id id;
-@JsonProperty("bbid")
-private Bbid bbid;
-@JsonProperty("workstep")
-private Workstep workstep;
-@JsonProperty("treatments")
-private Treatments treatments;
-
-@JsonProperty("id")
-public Id getId() {
-return id;
- }
-
-@JsonProperty("id")
-public void setId(Id id) {
-this.id = id;
- }
-
-public DictionaryData withId(Id id) {
-this.id = id;
-return this;
- }
-
-@JsonProperty("bbid")
-public Bbid getBbid() {
-return bbid;
- }
-
-@JsonProperty("bbid")
-public void setBbid(Bbid bbid) {
-this.bbid = bbid;
- }
-
-public DictionaryData withBbid(Bbid bbid) {
-this.bbid = bbid;
-return this;
- }
-
-@JsonProperty("workstep")
-public Workstep getWorkstep() {
-return workstep;
- }
-
-@JsonProperty("workstep")
-public void setWorkstep(Workstep workstep) {
-this.workstep = workstep;
- }
-
-public DictionaryData withWorkstep(Workstep workstep) {
-this.workstep = workstep;
-return this;
- }
-
-@JsonProperty("treatments")
-public Treatments getTreatments() {
-return treatments;
- }
-
-@JsonProperty("treatments")
-public void setTreatments(Treatments treatments) {
-this.treatments = treatments;
- }
-
-public DictionaryData withTreatments(Treatments treatments) {
-this.treatments = treatments;
-return this;
- }
+ @JsonProperty("id")
+ private Id id;
+ @JsonProperty("bbid")
+ private Bbid bbid;
+ @JsonProperty("workstep")
+ private Workstep workstep;
+ @JsonProperty("treatments")
+ private Treatments treatments;
+
+ @JsonProperty("id")
+ public Id getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(Id id) {
+ this.id = id;
+ }
+
+ public DictionaryData withId(Id id) {
+ this.id = id;
+ return this;
+ }
+
+ @JsonProperty("bbid")
+ public Bbid getBbid() {
+ return bbid;
+ }
+
+ @JsonProperty("bbid")
+ public void setBbid(Bbid bbid) {
+ this.bbid = bbid;
+ }
+
+ public DictionaryData withBbid(Bbid bbid) {
+ this.bbid = bbid;
+ return this;
+ }
+
+ @JsonProperty("workstep")
+ public Workstep getWorkstep() {
+ return workstep;
+ }
+
+ @JsonProperty("workstep")
+ public void setWorkstep(Workstep workstep) {
+ this.workstep = workstep;
+ }
+
+ public DictionaryData withWorkstep(Workstep workstep) {
+ this.workstep = workstep;
+ return this;
+ }
+
+ @JsonProperty("treatments")
+ public Treatments getTreatments() {
+ return treatments;
+ }
+
+ @JsonProperty("treatments")
+ public void setTreatments(Treatments treatments) {
+ this.treatments = treatments;
+ }
+
+ public DictionaryData withTreatments(Treatments treatments) {
+ this.treatments = treatments;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
index 8b063e83c7..9fa2e4d0b9 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
@@ -25,31 +25,31 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "dictionaryType", "dictionary" })
+@JsonPropertyOrder({"dictionaryType", "dictionary"})
public class DictionaryItemsRequest {
- @JsonProperty("dictionary")
- private String dictionary;
- @JsonProperty("dictionaryType")
- private String dictionaryType;
-
- @JsonProperty("dictionary")
- public String getDictionary() {
- return dictionary;
- }
-
- @JsonProperty("dictionary")
- public void setDictionary(String dictionary) {
- this.dictionary = dictionary;
- }
-
- @JsonProperty("dictionaryType")
- public String getDictionaryType() {
- return dictionaryType;
- }
-
- @JsonProperty("dictionaryType")
- public void setDictionaryType(String dictionaryType) {
- this.dictionaryType = dictionaryType;
- }
+ @JsonProperty("dictionary")
+ private String dictionary;
+ @JsonProperty("dictionaryType")
+ private String dictionaryType;
+
+ @JsonProperty("dictionary")
+ public String getDictionary() {
+ return dictionary;
+ }
+
+ @JsonProperty("dictionary")
+ public void setDictionary(String dictionary) {
+ this.dictionary = dictionary;
+ }
+
+ @JsonProperty("dictionaryType")
+ public String getDictionaryType() {
+ return dictionaryType;
+ }
+
+ @JsonProperty("dictionaryType")
+ public void setDictionaryType(String dictionaryType) {
+ this.dictionaryType = dictionaryType;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
index 097c9a5cb9..5b99fe1a05 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
@@ -22,33 +22,30 @@ package org.onap.so.client.policy.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({
-"DictionaryDatas"
-})
+@JsonPropertyOrder({"DictionaryDatas"})
public class DictionaryJson {
-@JsonProperty("DictionaryDatas")
-private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
+ @JsonProperty("DictionaryDatas")
+ private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
-@JsonProperty("DictionaryDatas")
-public List<DictionaryData> getDictionaryDatas() {
-return dictionaryDatas;
- }
+ @JsonProperty("DictionaryDatas")
+ public List<DictionaryData> getDictionaryDatas() {
+ return dictionaryDatas;
+ }
-@JsonProperty("DictionaryDatas")
-public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
- }
+ @JsonProperty("DictionaryDatas")
+ public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+ this.dictionaryDatas = dictionaryDatas;
+ }
-public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
-return this;
- }
+ public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+ this.dictionaryDatas = dictionaryDatas;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java
index d1a924cb7d..684311f997 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java
@@ -25,10 +25,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "vnfProfile",
- "lagProfile"
-})
+@JsonPropertyOrder({"vnfProfile", "lagProfile"})
public class FabricConfigModel {
@JsonProperty("vnfProfile")
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Id.java b/common/src/main/java/org/onap/so/client/policy/entities/Id.java
index af164d6866..0b957711fe 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Id.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Id.java
@@ -25,45 +25,42 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"integral",
-"valueType"
-})
+@JsonPropertyOrder({"integral", "valueType"})
public class Id {
-@JsonProperty("integral")
-private Boolean integral;
-@JsonProperty("valueType")
-private String valueType;
+ @JsonProperty("integral")
+ private Boolean integral;
+ @JsonProperty("valueType")
+ private String valueType;
-@JsonProperty("integral")
-public Boolean getIntegral() {
-return integral;
- }
+ @JsonProperty("integral")
+ public Boolean getIntegral() {
+ return integral;
+ }
-@JsonProperty("integral")
-public void setIntegral(Boolean integral) {
-this.integral = integral;
- }
+ @JsonProperty("integral")
+ public void setIntegral(Boolean integral) {
+ this.integral = integral;
+ }
-public Id withIntegral(Boolean integral) {
-this.integral = integral;
-return this;
- }
+ public Id withIntegral(Boolean integral) {
+ this.integral = integral;
+ return this;
+ }
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
+ @JsonProperty("valueType")
+ public String getValueType() {
+ return valueType;
+ }
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
+ @JsonProperty("valueType")
+ public void setValueType(String valueType) {
+ this.valueType = valueType;
+ }
-public Id withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
+ public Id withValueType(String valueType) {
+ this.valueType = valueType;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java
index 807829e323..716462f534 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java
@@ -22,24 +22,13 @@ package org.onap.so.client.policy.entities;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "policyConfigMessage",
- "policyConfigStatus",
- "type",
- "config",
- "policyName",
- "policyType",
- "policyVersion",
- "matchingConditions",
- "responseAttributes",
- "property"
-})
+@JsonPropertyOrder({"policyConfigMessage", "policyConfigStatus", "type", "config", "policyName", "policyType",
+ "policyVersion", "matchingConditions", "responseAttributes", "property"})
public class PolicyConfig {
@JsonProperty("policyConfigMessage")
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
index 57c93927cb..f907b041fa 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
@@ -27,31 +27,31 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decision", "details" })
+@JsonPropertyOrder({"decision", "details"})
public class PolicyDecision {
- @JsonProperty("decision")
- private String decision;
- @JsonProperty("details")
- private String details;
-
- @JsonProperty("decision")
- public String getDecision() {
- return decision;
- }
-
- @JsonProperty("decision")
- public void setDecision(String decision) {
- this.decision = decision;
- }
-
- @JsonProperty("details")
- public String getDetails() {
- return details;
- }
-
- @JsonProperty("details")
- public void setDetails(String details) {
- this.details = details;
- }
+ @JsonProperty("decision")
+ private String decision;
+ @JsonProperty("details")
+ private String details;
+
+ @JsonProperty("decision")
+ public String getDecision() {
+ return decision;
+ }
+
+ @JsonProperty("decision")
+ public void setDecision(String decision) {
+ this.decision = decision;
+ }
+
+ @JsonProperty("details")
+ public String getDetails() {
+ return details;
+ }
+
+ @JsonProperty("details")
+ public void setDetails(String details) {
+ this.details = details;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
index b402e85e32..be58b567bc 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
@@ -26,32 +26,32 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" })
+@JsonPropertyOrder({"decisionAttributes", "ecompcomponentName"})
public class PolicyDecisionRequest {
- @JsonProperty("decisionAttributes")
- private DecisionAttributes decisionAttributes;
- @JsonProperty("ecompcomponentName")
- private String ecompcomponentName;
-
- @JsonProperty("decisionAttributes")
- public DecisionAttributes getDecisionAttributes() {
- return decisionAttributes;
- }
-
- @JsonProperty("decisionAttributes")
- public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
- this.decisionAttributes = decisionAttributes;
- }
-
- @JsonProperty("ecompcomponentName")
- public String getEcompcomponentName() {
- return ecompcomponentName;
- }
-
- @JsonProperty("ecompcomponentName")
- public void setEcompcomponentName(String ecompcomponentName) {
- this.ecompcomponentName = ecompcomponentName;
- }
+ @JsonProperty("decisionAttributes")
+ private DecisionAttributes decisionAttributes;
+ @JsonProperty("ecompcomponentName")
+ private String ecompcomponentName;
+
+ @JsonProperty("decisionAttributes")
+ public DecisionAttributes getDecisionAttributes() {
+ return decisionAttributes;
+ }
+
+ @JsonProperty("decisionAttributes")
+ public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
+ this.decisionAttributes = decisionAttributes;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public String getEcompcomponentName() {
+ return ecompcomponentName;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public void setEcompcomponentName(String ecompcomponentName) {
+ this.ecompcomponentName = ecompcomponentName;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
index 83dc6b7862..b00d22dbad 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
@@ -21,28 +21,21 @@
package org.onap.so.client.policy.entities;
public enum PolicyServiceType {
- GET_CONFIG("getConfig"),
- SEND_EVENT("sendEvent"),
- PUSH_POLICY("pushPolicy"),
- CREATE_POLICY("createPolicy"),
- UPDATE_POLICY("updatePolicy"),
- GET_DECISION("getDecision"),
- GET_METRICS("getMetrics"),
- DELETE_POLICY("deletePolicy"),
- LIST_CONFIG("listConfig"),
- CREATE_DICTIONARY_ITEM("createDictionaryItem"),
- UPDATE_DICTIONARY_ITEM("updateDictionaryItem"),
- GET_DICTIONARY_ITEMS("getDictionaryItems");
-
- private final String name;
-
- PolicyServiceType(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
+ GET_CONFIG("getConfig"), SEND_EVENT("sendEvent"), PUSH_POLICY("pushPolicy"), CREATE_POLICY(
+ "createPolicy"), UPDATE_POLICY("updatePolicy"), GET_DECISION("getDecision"), GET_METRICS(
+ "getMetrics"), DELETE_POLICY("deletePolicy"), LIST_CONFIG("listConfig"), CREATE_DICTIONARY_ITEM(
+ "createDictionaryItem"), UPDATE_DICTIONARY_ITEM(
+ "updateDictionaryItem"), GET_DICTIONARY_ITEMS("getDictionaryItems");
+
+ private final String name;
+
+ PolicyServiceType(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
index 433d32756c..fd8a3c5e2a 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
@@ -25,63 +25,59 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
+@JsonPropertyOrder({"valueType", "string", "chars"})
public class Treatments {
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
+ @JsonProperty("valueType")
+ private String valueType;
+ @JsonProperty("string")
+ private String string;
+ @JsonProperty("chars")
+ private String chars;
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
+ @JsonProperty("valueType")
+ public String getValueType() {
+ return valueType;
+ }
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
+ @JsonProperty("valueType")
+ public void setValueType(String valueType) {
+ this.valueType = valueType;
+ }
-public Treatments withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
+ public Treatments withValueType(String valueType) {
+ this.valueType = valueType;
+ return this;
+ }
-@JsonProperty("string")
-public String getString() {
-return string;
- }
+ @JsonProperty("string")
+ public String getString() {
+ return string;
+ }
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
+ @JsonProperty("string")
+ public void setString(String string) {
+ this.string = string;
+ }
-public Treatments withString(String string) {
-this.string = string;
-return this;
- }
+ public Treatments withString(String string) {
+ this.string = string;
+ return this;
+ }
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
+ @JsonProperty("chars")
+ public String getChars() {
+ return chars;
+ }
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
+ @JsonProperty("chars")
+ public void setChars(String chars) {
+ this.chars = chars;
+ }
-public Treatments withChars(String chars) {
-this.chars = chars;
-return this;
- }
+ public Treatments withChars(String chars) {
+ this.chars = chars;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
index 4fbd6e2f8a..1bf3ce001d 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
@@ -25,63 +25,59 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
+@JsonPropertyOrder({"valueType", "string", "chars"})
public class Workstep {
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
+ @JsonProperty("valueType")
+ private String valueType;
+ @JsonProperty("string")
+ private String string;
+ @JsonProperty("chars")
+ private String chars;
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
+ @JsonProperty("valueType")
+ public String getValueType() {
+ return valueType;
+ }
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
+ @JsonProperty("valueType")
+ public void setValueType(String valueType) {
+ this.valueType = valueType;
+ }
-public Workstep withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
+ public Workstep withValueType(String valueType) {
+ this.valueType = valueType;
+ return this;
+ }
-@JsonProperty("string")
-public String getString() {
-return string;
- }
+ @JsonProperty("string")
+ public String getString() {
+ return string;
+ }
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
+ @JsonProperty("string")
+ public void setString(String string) {
+ this.string = string;
+ }
-public Workstep withString(String string) {
-this.string = string;
-return this;
- }
+ public Workstep withString(String string) {
+ this.string = string;
+ return this;
+ }
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
+ @JsonProperty("chars")
+ public String getChars() {
+ return chars;
+ }
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
+ @JsonProperty("chars")
+ public void setChars(String chars) {
+ this.chars = chars;
+ }
-public Workstep withChars(String chars) {
-this.chars = chars;
-return this;
- }
+ public Workstep withChars(String chars) {
+ this.chars = chars;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/ruby/RubyClient.java b/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
index 15b232475b..6c8f48884d 100644
--- a/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
+++ b/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
@@ -24,67 +24,64 @@ import java.io.IOException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-
import org.onap.so.client.dmaap.DmaapPublisher;
import org.onap.so.client.ruby.beans.Event;
import org.onap.so.client.ruby.beans.MsoRequest;
import org.onap.so.client.ruby.beans.Ruby;
import org.onap.so.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-
+
public class RubyClient {
-
- private static final String REQUEST_CLIENT_NAME = "MSO";
- private static final String ACTION = "Create Ticket";
-
- protected String buildRequest(String requestId, String sourceName, String reason, String workflowId, String notification) throws JsonProcessingException {
- final MsoRequest request = new MsoRequest();
- request.withRequestClientName(REQUEST_CLIENT_NAME)
- .withRequestId(requestId)
- .withSourceName(sourceName)
- .withWorkflowId(workflowId)
- .withAction(ACTION);
-
- request.withRequestTime(this.getTime());
-
- if(reason.length() <= 255){
- request.withReason(reason);
- } else {
- throw new IllegalArgumentException("reason exceeds 255 characters");
- }
- if(notification.length() <= 1024){
- request.withNotification(notification);
- } else {
- throw new IllegalArgumentException("notification exceeds 1024 characters");
- }
- final Event event = new Event();
- event.setMsoRequest(request);
- final Ruby ruby = new Ruby();
- ruby.setEvent(event);
- return this.getJson(ruby);
- }
-
- protected String getJson(Ruby obj) throws JsonProcessingException {
- final ObjectMapper mapper = new ObjectMapper();
- return mapper.writeValueAsString(obj);
- }
-
- protected DmaapPublisher getPublisher() throws IOException {
- return new RubyCreateTicketRequestPublisher();
- }
-
- protected String getTime() {
- final ZonedDateTime currentDateTime = ZonedDateTime.now(ZoneOffset.UTC);
- final DateTimeFormatter format = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z");
- return currentDateTime.format(format);
- }
-
- public void rubyCreateTicketCheckRequest(String requestId, String sourceName, String reason, String workflowId, String notification) throws Exception {
- String request = this.buildRequest(requestId, sourceName, reason, workflowId, notification);
- final DmaapPublisher publisher = this.getPublisher();
- publisher.send(request);
- }
+
+ private static final String REQUEST_CLIENT_NAME = "MSO";
+ private static final String ACTION = "Create Ticket";
+
+ protected String buildRequest(String requestId, String sourceName, String reason, String workflowId,
+ String notification) throws JsonProcessingException {
+ final MsoRequest request = new MsoRequest();
+ request.withRequestClientName(REQUEST_CLIENT_NAME).withRequestId(requestId).withSourceName(sourceName)
+ .withWorkflowId(workflowId).withAction(ACTION);
+
+ request.withRequestTime(this.getTime());
+
+ if (reason.length() <= 255) {
+ request.withReason(reason);
+ } else {
+ throw new IllegalArgumentException("reason exceeds 255 characters");
+ }
+ if (notification.length() <= 1024) {
+ request.withNotification(notification);
+ } else {
+ throw new IllegalArgumentException("notification exceeds 1024 characters");
+ }
+ final Event event = new Event();
+ event.setMsoRequest(request);
+ final Ruby ruby = new Ruby();
+ ruby.setEvent(event);
+ return this.getJson(ruby);
+ }
+
+ protected String getJson(Ruby obj) throws JsonProcessingException {
+ final ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+ }
+
+ protected DmaapPublisher getPublisher() throws IOException {
+ return new RubyCreateTicketRequestPublisher();
+ }
+
+ protected String getTime() {
+ final ZonedDateTime currentDateTime = ZonedDateTime.now(ZoneOffset.UTC);
+ final DateTimeFormatter format = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z");
+ return currentDateTime.format(format);
+ }
+
+ public void rubyCreateTicketCheckRequest(String requestId, String sourceName, String reason, String workflowId,
+ String notification) throws Exception {
+ String request = this.buildRequest(requestId, sourceName, reason, workflowId, notification);
+ final DmaapPublisher publisher = this.getPublisher();
+ publisher.send(request);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/ruby/beans/Event.java b/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
index 93745ff55e..2737342adc 100644
--- a/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
@@ -25,43 +25,40 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"msoRequest"
-})
+@JsonPropertyOrder({"msoRequest"})
public class Event {
-@JsonProperty("msoRequest")
-private MsoRequest msoRequest;
+ @JsonProperty("msoRequest")
+ private MsoRequest msoRequest;
-/**
-* No args constructor for use in serialization
-*
-*/
-public Event() {
- }
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public Event() {}
-/**
-*
-* @param msoRequest
-*/
-public Event(MsoRequest msoRequest) {
-super();
-this.msoRequest = msoRequest;
- }
+ /**
+ *
+ * @param msoRequest
+ */
+ public Event(MsoRequest msoRequest) {
+ super();
+ this.msoRequest = msoRequest;
+ }
-@JsonProperty("msoRequest")
-public MsoRequest getMsoRequest() {
-return msoRequest;
- }
+ @JsonProperty("msoRequest")
+ public MsoRequest getMsoRequest() {
+ return msoRequest;
+ }
-@JsonProperty("msoRequest")
-public void setMsoRequest(MsoRequest msoRequest) {
-this.msoRequest = msoRequest;
- }
+ @JsonProperty("msoRequest")
+ public void setMsoRequest(MsoRequest msoRequest) {
+ this.msoRequest = msoRequest;
+ }
-public Event withMsoRequest(MsoRequest msoRequest) {
-this.msoRequest = msoRequest;
-return this;
- }
+ public Event withMsoRequest(MsoRequest msoRequest) {
+ this.msoRequest = msoRequest;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
index f2c004ea6e..15cfc9222f 100644
--- a/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
@@ -25,183 +25,175 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"requestClientName",
-"requestId",
-"requestTime",
-"sourceName",
-"reason",
-"action",
-"workflowId",
-"notification"
-})
+@JsonPropertyOrder({"requestClientName", "requestId", "requestTime", "sourceName", "reason", "action", "workflowId",
+ "notification"})
public class MsoRequest {
-@JsonProperty("requestClientName")
-private String requestClientName;
-@JsonProperty("requestId")
-private String requestId;
-@JsonProperty("requestTime")
-private String requestTime;
-@JsonProperty("sourceName")
-private String sourceName;
-@JsonProperty("reason")
-private String reason;
-@JsonProperty("action")
-private String action;
-@JsonProperty("workflowId")
-private String workflowId;
-@JsonProperty("notification")
-private String notification;
-
-/**
-* No args constructor for use in serialization
-*
-*/
-public MsoRequest() {
- }
-
-/**
-*
-* @param requestClientName
-* @param requestTime
-* @param reason
-* @param requestId
-* @param workflowId
-* @param sourceName
-* @param action
-* @param notification
-*/
-public MsoRequest(String requestClientName, String requestId, String requestTime, String sourceName, String reason, String action, String workflowId, String notification) {
-super();
-this.requestClientName = requestClientName;
-this.requestId = requestId;
-this.requestTime = requestTime;
-this.sourceName = sourceName;
-this.reason = reason;
-this.action = action;
-this.workflowId = workflowId;
-this.notification = notification;
- }
-
-@JsonProperty("requestClientName")
-public String getRequestClientName() {
-return requestClientName;
- }
-
-@JsonProperty("requestClientName")
-public void setRequestClientName(String requestClientName) {
-this.requestClientName = requestClientName;
- }
-
-public MsoRequest withRequestClientName(String requestClientName) {
-this.requestClientName = requestClientName;
-return this;
- }
-
-@JsonProperty("requestId")
-public String getRequestId() {
-return requestId;
- }
-
-@JsonProperty("requestId")
-public void setRequestId(String requestId) {
-this.requestId = requestId;
- }
-
-public MsoRequest withRequestId(String requestId) {
-this.requestId = requestId;
-return this;
- }
-
-@JsonProperty("requestTime")
-public String getRequestTime() {
-return requestTime;
- }
-
-@JsonProperty("requestTime")
-public void setRequestTime(String requestTime) {
-this.requestTime = requestTime;
- }
-
-public MsoRequest withRequestTime(String requestTime) {
-this.requestTime = requestTime;
-return this;
- }
-
-@JsonProperty("sourceName")
-public String getSourceName() {
-return sourceName;
- }
-
-@JsonProperty("sourceName")
-public void setSourceName(String sourceName) {
-this.sourceName = sourceName;
- }
-
-public MsoRequest withSourceName(String sourceName) {
-this.sourceName = sourceName;
-return this;
- }
-
-@JsonProperty("reason")
-public String getReason() {
-return reason;
- }
-
-@JsonProperty("reason")
-public void setReason(String reason) {
-this.reason = reason;
- }
-
-public MsoRequest withReason(String reason) {
-this.reason = reason;
-return this;
- }
-
-@JsonProperty("action")
-public String getAction() {
-return action;
- }
-
-@JsonProperty("action")
-public void setAction(String action) {
-this.action = action;
- }
-
-public MsoRequest withAction(String action) {
-this.action = action;
-return this;
- }
-
-@JsonProperty("workflowId")
-public String getWorkflowId() {
-return workflowId;
- }
-
-@JsonProperty("workflowId")
-public void setWorkflowId(String workflowId) {
-this.workflowId = workflowId;
- }
-
-public MsoRequest withWorkflowId(String workflowId) {
-this.workflowId = workflowId;
-return this;
- }
-
-@JsonProperty("notification")
-public String getNotification() {
-return notification;
- }
-
-@JsonProperty("notification")
-public void setNotification(String notification) {
-this.notification = notification;
- }
-
-public MsoRequest withNotification(String notification) {
-this.notification = notification;
-return this;
- }
+ @JsonProperty("requestClientName")
+ private String requestClientName;
+ @JsonProperty("requestId")
+ private String requestId;
+ @JsonProperty("requestTime")
+ private String requestTime;
+ @JsonProperty("sourceName")
+ private String sourceName;
+ @JsonProperty("reason")
+ private String reason;
+ @JsonProperty("action")
+ private String action;
+ @JsonProperty("workflowId")
+ private String workflowId;
+ @JsonProperty("notification")
+ private String notification;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public MsoRequest() {}
+
+ /**
+ *
+ * @param requestClientName
+ * @param requestTime
+ * @param reason
+ * @param requestId
+ * @param workflowId
+ * @param sourceName
+ * @param action
+ * @param notification
+ */
+ public MsoRequest(String requestClientName, String requestId, String requestTime, String sourceName, String reason,
+ String action, String workflowId, String notification) {
+ super();
+ this.requestClientName = requestClientName;
+ this.requestId = requestId;
+ this.requestTime = requestTime;
+ this.sourceName = sourceName;
+ this.reason = reason;
+ this.action = action;
+ this.workflowId = workflowId;
+ this.notification = notification;
+ }
+
+ @JsonProperty("requestClientName")
+ public String getRequestClientName() {
+ return requestClientName;
+ }
+
+ @JsonProperty("requestClientName")
+ public void setRequestClientName(String requestClientName) {
+ this.requestClientName = requestClientName;
+ }
+
+ public MsoRequest withRequestClientName(String requestClientName) {
+ this.requestClientName = requestClientName;
+ return this;
+ }
+
+ @JsonProperty("requestId")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty("requestId")
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public MsoRequest withRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ @JsonProperty("requestTime")
+ public String getRequestTime() {
+ return requestTime;
+ }
+
+ @JsonProperty("requestTime")
+ public void setRequestTime(String requestTime) {
+ this.requestTime = requestTime;
+ }
+
+ public MsoRequest withRequestTime(String requestTime) {
+ this.requestTime = requestTime;
+ return this;
+ }
+
+ @JsonProperty("sourceName")
+ public String getSourceName() {
+ return sourceName;
+ }
+
+ @JsonProperty("sourceName")
+ public void setSourceName(String sourceName) {
+ this.sourceName = sourceName;
+ }
+
+ public MsoRequest withSourceName(String sourceName) {
+ this.sourceName = sourceName;
+ return this;
+ }
+
+ @JsonProperty("reason")
+ public String getReason() {
+ return reason;
+ }
+
+ @JsonProperty("reason")
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public MsoRequest withReason(String reason) {
+ this.reason = reason;
+ return this;
+ }
+
+ @JsonProperty("action")
+ public String getAction() {
+ return action;
+ }
+
+ @JsonProperty("action")
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public MsoRequest withAction(String action) {
+ this.action = action;
+ return this;
+ }
+
+ @JsonProperty("workflowId")
+ public String getWorkflowId() {
+ return workflowId;
+ }
+
+ @JsonProperty("workflowId")
+ public void setWorkflowId(String workflowId) {
+ this.workflowId = workflowId;
+ }
+
+ public MsoRequest withWorkflowId(String workflowId) {
+ this.workflowId = workflowId;
+ return this;
+ }
+
+ @JsonProperty("notification")
+ public String getNotification() {
+ return notification;
+ }
+
+ @JsonProperty("notification")
+ public void setNotification(String notification) {
+ this.notification = notification;
+ }
+
+ public MsoRequest withNotification(String notification) {
+ this.notification = notification;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
index 725e6a3a94..708b91638b 100644
--- a/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
@@ -25,43 +25,40 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"event"
-})
+@JsonPropertyOrder({"event"})
public class Ruby {
-@JsonProperty("event")
-private Event event;
+ @JsonProperty("event")
+ private Event event;
-/**
-* No args constructor for use in serialization
-*
-*/
-public Ruby() {
- }
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public Ruby() {}
-/**
-*
-* @param event
-*/
-public Ruby(Event event) {
-super();
-this.event = event;
- }
+ /**
+ *
+ * @param event
+ */
+ public Ruby(Event event) {
+ super();
+ this.event = event;
+ }
-@JsonProperty("event")
-public Event getEvent() {
-return event;
- }
+ @JsonProperty("event")
+ public Event getEvent() {
+ return event;
+ }
-@JsonProperty("event")
-public void setEvent(Event event) {
-this.event = event;
- }
+ @JsonProperty("event")
+ public void setEvent(Event event) {
+ this.event = event;
+ }
-public Ruby withEvent(Event event) {
-this.event = event;
-return this;
- }
+ public Ruby withEvent(Event event) {
+ this.event = event;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
index 93a2d96c5e..10402d9921 100644
--- a/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
@@ -23,34 +23,33 @@ package org.onap.so.client.ruby.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-
import org.onap.so.client.dmaap.DmaapPublisher;
-public class RubyCreateTicketRequestPublisher extends DmaapPublisher{
- public RubyCreateTicketRequestPublisher() throws FileNotFoundException, IOException {
- super();
- }
-
- @Override
- public String getAuth() {
- return msoProperties.get("ruby.create-ticket-request.dmaap.auth");
- }
-
- @Override
- public String getKey() {
- return msoProperties.get("mso.msoKey");
- }
-
- @Override
- public String getTopic() {
- return msoProperties.get("ruby.create-ticket-request.publisher.topic");
- }
-
- @Override
- public Optional<String> getHost() {
- return Optional.ofNullable(msoProperties.get("ruby.create-ticket-request.publisher.host"));
- }
-
+public class RubyCreateTicketRequestPublisher extends DmaapPublisher {
+ public RubyCreateTicketRequestPublisher() throws FileNotFoundException, IOException {
+ super();
+ }
+
+ @Override
+ public String getAuth() {
+ return msoProperties.get("ruby.create-ticket-request.dmaap.auth");
+ }
+
+ @Override
+ public String getKey() {
+ return msoProperties.get("mso.msoKey");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("ruby.create-ticket-request.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("ruby.create-ticket-request.publisher.host"));
+ }
+
}
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
index 93a35f34b0..9b857dc08c 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
@@ -26,7 +26,6 @@ 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;
@@ -36,123 +35,133 @@ 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();
- }
-
+ 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
index f3cab1e3e8..83624dec63 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
@@ -22,34 +22,34 @@ 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 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;
+ /**
+ * 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
index 882a390c7b..4aafd145b7 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -24,9 +24,7 @@ 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;
@@ -41,88 +39,91 @@ 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);
- }
-
-
-
+ 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
index 0de9b90d66..7e98355b4d 100644
--- 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
@@ -25,63 +25,59 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"key",
-"value"
-})
+@JsonPropertyOrder({"key", "value"})
public class AAIParamList {
-@JsonProperty("key")
-private String key;
-@JsonProperty("value")
-private String value;
+ @JsonProperty("key")
+ private String key;
+ @JsonProperty("value")
+ private String value;
-/**
-* No args constructor for use in serialization
-*
-*/
-public AAIParamList() {
- }
+ /**
+ * 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;
- }
+ /**
+ *
+ * @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 String getKey() {
+ return key;
+ }
-@JsonProperty("key")
-public void setKey(String key) {
-this.key = key;
- }
+ @JsonProperty("key")
+ public void setKey(String key) {
+ this.key = key;
+ }
-public AAIParamList withKey(String key) {
-this.key = key;
-return this;
- }
+ public AAIParamList withKey(String key) {
+ this.key = key;
+ return this;
+ }
-@JsonProperty("value")
-public String getValue() {
-return value;
- }
+ @JsonProperty("value")
+ public String getValue() {
+ return value;
+ }
-@JsonProperty("value")
-public void setValue(String value) {
-this.value = value;
- }
+ @JsonProperty("value")
+ public void setValue(String value) {
+ this.value = value;
+ }
-public AAIParamList withValue(String value) {
-this.value = value;
-return this;
- }
+ 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
index dfca9ec124..84dd83ea6f 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,11 +31,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "input"
-})
-public class Body implements Serializable
-{
+@JsonPropertyOrder({"input"})
+public class Body implements Serializable {
@JsonProperty("input")
private Input input;
@@ -68,8 +64,9 @@ public class Body implements Serializable
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
+
public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
+ this.additionalProperties = map;
}
public Body withAdditionalProperty(String name, Object value) {
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
index e565f71445..ea537bba09 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,18 +31,14 @@ 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
-{
+@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<String, Object>();
private final static long serialVersionUID = 7155546785389227528L;
@@ -57,15 +52,15 @@ public class Input implements Serializable
public void setRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
this.RequestHealthDiagnostic = RequestHealthDiagnostic;
}
-
+
@JsonProperty("request-hd-custom")
public RequestHdCustom getRequestHdCustom() {
- return requestHdCustom;
- }
+ return requestHdCustom;
+ }
@JsonProperty("request-hd-custom")
public void setRequestHdCustom(RequestHdCustom requestHdCustom) {
- this.requestHdCustom = requestHdCustom;
+ this.requestHdCustom = requestHdCustom;
}
public Input withRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
@@ -82,9 +77,9 @@ public class Input implements Serializable
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
-
+
public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
+ this.additionalProperties = map;
}
public Input withAdditionalProperty(String name, Object value) {
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
index b3a6a4815e..c08d1ef386 100644
--- 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
@@ -23,169 +23,161 @@ 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"
-})
+@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<AAIParamList>();
-
-/**
-* 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;
- }
+ /**
+ *
+ */
+ 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<AAIParamList>();
+
+ /**
+ * 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
index 69745d6bfb..c05b470b0e 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,18 +31,9 @@ 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
-{
+@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;
@@ -94,7 +84,7 @@ public class RequestHealthDiagnostic implements Serializable
this.requestNodeName = requestNodeName;
return this;
}
-
+
@JsonProperty("request-node-uuid")
public String getRequestNodeUuid() {
return requestNodeUuid;
@@ -194,9 +184,9 @@ public class RequestHealthDiagnostic implements Serializable
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
-
+
public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
+ this.additionalProperties = map;
}
public RequestHealthDiagnostic withAdditionalProperty(String name, Object value) {
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
index 7cf9c7cb06..93826c752f 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -31,89 +30,83 @@ 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"
-})
+@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<String, Object>();
-
-@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;
-}
+ @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<String, Object>();
+
+ @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
index 7c728a7bab..09f408c967 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,14 +31,8 @@ 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
-{
+@JsonPropertyOrder({"operation", "nodeLoc", "nodeType", "body"})
+public class SDNO implements Serializable {
@JsonProperty("operation")
private String operation;
@@ -62,23 +55,23 @@ public class SDNO implements Serializable
public void setOperation(String operation) {
this.operation = operation;
}
-
+
@JsonProperty("nodeLoc")
public String getNodeLoc() {
- return nodeLoc;
- }
-
+ return nodeLoc;
+ }
+
@JsonProperty("nodeLoc")
- public void setNodeLoc(String nodeLoc) {
- this.nodeLoc = nodeLoc;
- }
-
+ public void setNodeLoc(String nodeLoc) {
+ this.nodeLoc = nodeLoc;
+ }
+
public SDNO withNodeLoc(String nodeLoc) {
- this.nodeLoc = nodeLoc;
- return this;
+ this.nodeLoc = nodeLoc;
+ return this;
}
- public SDNO withOperation(String operation) {
+ public SDNO withOperation(String operation) {
this.operation = operation;
return this;
}
@@ -124,10 +117,10 @@ public class SDNO implements Serializable
}
public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
+ this.additionalProperties = map;
}
-
- public SDNO SDNO (String name, Object value) {
+
+ public SDNO SDNO(String name, Object value) {
this.additionalProperties.put(name, value);
return this;
}
diff --git a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
index a76c47c805..3589900273 100644
--- a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
@@ -28,132 +28,137 @@ import org.onap.so.jsonpath.JsonPathUtil;
public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
- private final String uuid;
- private boolean continuePolling = true;
- private final static String healthDiagnosticPath = "body.output.*";
-
- public SDNOHealthCheckDmaapConsumer() throws IOException {
- this("none");
- }
-
- public SDNOHealthCheckDmaapConsumer(String uuid) throws IOException {
- super();
- this.uuid = uuid;
- }
-
- @Override
- public String getAuth() {
- return msoProperties.get("sdno.health-check.dmaap.auth");
- }
-
- @Override
- public String getKey() {
- return msoProperties.get("mso.msoKey");
- }
-
- @Override
- public String getTopic() {
- return msoProperties.get("sdno.health-check.dmaap.subscriber.topic");
- }
-
- @Override
- public Optional<String> getHost() {
- return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.subscriber.host"));
- }
-
- @Override
- public boolean continuePolling() {
- return continuePolling;
- }
-
- @Override
- public void stopProcessingMessages() {
- continuePolling = false;
- }
- @Override
- public void processMessage(String message) throws Exception {
- if (isHealthDiagnostic(message, this.getRequestId())) {
- if (!healthDiagnosticSuccessful(message)) {
- Optional<String> statusMessage = this.getStatusMessage(message);
- if (statusMessage.isPresent()) {
- throw new SDNOException("failed with message " + statusMessage.get());
- } else {
- throw new SDNOException("failed with no status message");
- }
- } else {
- logger.info("successful health diagnostic found for request: {}" ,getRequestId());
- stopProcessingMessages();
- }
- }
- }
-
- @Override
- public boolean isAccepted(String message) {
- if (isResultInfo(message)) {
- Optional<String> code = isAccepted(message, this.getRequestId());
- if (code.isPresent()) {
- if ("202".equals(code.get())) {
- return true;
- } else {
- //TODO check other statuses 400 and 500
- }
- } else {
- //TODO throw error
- }
- }
-
- return false;
- }
-
- @Override
- public boolean isFailure(String message) {
- if (isResultInfo(message)) {
- Optional<String> code = isFailure(message, this.getRequestId());
- if (code.isPresent()) {
- if ("500".equals(code.get())) {
- return true;
- } else {
- //TODO check other statuses 400 and 500
- }
- } else {
- //TODO throw error
- }
- }
-
- return false;
- }
-
- @Override
- public String getRequestId() {
- return uuid;
- }
-
- protected Optional<String> isAccepted(String json, String uuid) {
- return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid));
- }
-
- protected Optional<String> isFailure(String json, String uuid) {
- return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='FAILURE' && @.request-id=='%s')].code", uuid));
- }
-
- protected boolean isResultInfo(String json) {
- return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]");
- }
-
- protected boolean isHealthDiagnostic(String json, String uuid) {
- return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath));
- }
-
- protected boolean healthDiagnosticSuccessful(String json) {
- return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]");
- }
-
- protected Optional<String> getStatusMessage(String json) {
- return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".error-message");
- }
-
- @Override
- public int getMaximumElapsedTime() {
- return 600000;
- }
+ private final String uuid;
+ private boolean continuePolling = true;
+ private final static String healthDiagnosticPath = "body.output.*";
+
+ public SDNOHealthCheckDmaapConsumer() throws IOException {
+ this("none");
+ }
+
+ public SDNOHealthCheckDmaapConsumer(String uuid) throws IOException {
+ super();
+ this.uuid = uuid;
+ }
+
+ @Override
+ public String getAuth() {
+ return msoProperties.get("sdno.health-check.dmaap.auth");
+ }
+
+ @Override
+ public String getKey() {
+ return msoProperties.get("mso.msoKey");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("sdno.health-check.dmaap.subscriber.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.subscriber.host"));
+ }
+
+ @Override
+ public boolean continuePolling() {
+ return continuePolling;
+ }
+
+ @Override
+ public void stopProcessingMessages() {
+ continuePolling = false;
+ }
+
+ @Override
+ public void processMessage(String message) throws Exception {
+ if (isHealthDiagnostic(message, this.getRequestId())) {
+ if (!healthDiagnosticSuccessful(message)) {
+ Optional<String> statusMessage = this.getStatusMessage(message);
+ if (statusMessage.isPresent()) {
+ throw new SDNOException("failed with message " + statusMessage.get());
+ } else {
+ throw new SDNOException("failed with no status message");
+ }
+ } else {
+ logger.info("successful health diagnostic found for request: {}", getRequestId());
+ stopProcessingMessages();
+ }
+ }
+ }
+
+ @Override
+ public boolean isAccepted(String message) {
+ if (isResultInfo(message)) {
+ Optional<String> code = isAccepted(message, this.getRequestId());
+ if (code.isPresent()) {
+ if ("202".equals(code.get())) {
+ return true;
+ } else {
+ // TODO check other statuses 400 and 500
+ }
+ } else {
+ // TODO throw error
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isFailure(String message) {
+ if (isResultInfo(message)) {
+ Optional<String> code = isFailure(message, this.getRequestId());
+ if (code.isPresent()) {
+ if ("500".equals(code.get())) {
+ return true;
+ } else {
+ // TODO check other statuses 400 and 500
+ }
+ } else {
+ // TODO throw error
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String getRequestId() {
+ return uuid;
+ }
+
+ protected Optional<String> isAccepted(String json, String uuid) {
+ return JsonPathUtil.getInstance().locateResult(json,
+ String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid));
+ }
+
+ protected Optional<String> isFailure(String json, String uuid) {
+ return JsonPathUtil.getInstance().locateResult(json,
+ String.format("$.result-info[?(@.status=='FAILURE' && @.request-id=='%s')].code", uuid));
+ }
+
+ protected boolean isResultInfo(String json) {
+ return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]");
+ }
+
+ protected boolean isHealthDiagnostic(String json, String uuid) {
+ return JsonPathUtil.getInstance().pathExists(json,
+ String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath));
+ }
+
+ protected boolean healthDiagnosticSuccessful(String json) {
+ return JsonPathUtil.getInstance().pathExists(json,
+ "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]");
+ }
+
+ protected Optional<String> getStatusMessage(String json) {
+ return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".error-message");
+ }
+
+ @Override
+ public int getMaximumElapsedTime() {
+ return 600000;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
index f4af2052ac..b1adc53f3a 100644
--- a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
@@ -23,33 +23,32 @@ package org.onap.so.client.sdno.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-
import org.onap.so.client.dmaap.DmaapPublisher;
public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
-
- public SDNOHealthCheckDmaapPublisher() throws FileNotFoundException, IOException {
- super();
- }
-
- @Override
- public String getAuth() {
- return msoProperties.get("sdno.health-check.dmaap.auth");
- }
-
- @Override
- public String getKey() {
- return msoProperties.get("sdno.health-check.dmaap.msoKey");
- }
-
- @Override
- public String getTopic() {
- return msoProperties.get("sdno.health-check.dmaap.publisher.topic");
- }
-
- @Override
- public Optional<String> getHost() {
- return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.publisher.host"));
- }
+
+ public SDNOHealthCheckDmaapPublisher() throws FileNotFoundException, IOException {
+ super();
+ }
+
+ @Override
+ public String getAuth() {
+ return msoProperties.get("sdno.health-check.dmaap.auth");
+ }
+
+ @Override
+ public String getKey() {
+ return msoProperties.get("sdno.health-check.dmaap.msoKey");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("sdno.health-check.dmaap.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.publisher.host"));
+ }
}
diff --git a/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
index a5a4cb7d53..6c2c76e87c 100644
--- a/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
@@ -21,13 +21,11 @@
package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
-
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
- * This class is used configure the parameters needed for
- * {@link org.apache.http.impl.client.CloseableHttpClient}
+ * This class is used configure the parameters needed for {@link org.apache.http.impl.client.CloseableHttpClient}
*
* @author waqas.ikram@est.tech
*/
diff --git a/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
index e943aef159..882ed95cfc 100644
--- a/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
@@ -21,7 +21,6 @@
package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
-
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
diff --git a/common/src/main/java/org/onap/so/constants/Defaults.java b/common/src/main/java/org/onap/so/constants/Defaults.java
index 5117f4de95..5b30537056 100644
--- a/common/src/main/java/org/onap/so/constants/Defaults.java
+++ b/common/src/main/java/org/onap/so/constants/Defaults.java
@@ -21,34 +21,33 @@
package org.onap.so.constants;
import java.util.Optional;
-
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
public enum Defaults {
- CLOUD_OWNER("org.onap.so.cloud-owner", "CloudOwner");
-
- private final String propName;
- private final String defaultValue;
-
- private Defaults(String propName, String defaultValue) {
- this.defaultValue = defaultValue;
- this.propName = propName;
- }
-
- @Override
- public String toString() {
- Optional<ApplicationContext> context = getAppContext();
- if (context.isPresent()) {
- return context.get().getEnvironment().getProperty(this.propName, this.defaultValue);
- } else {
- return this.defaultValue;
- }
-
- }
-
- protected Optional<ApplicationContext> getAppContext() {
- return Optional.ofNullable(SpringContextHelper.getAppContext());
- }
+ CLOUD_OWNER("org.onap.so.cloud-owner", "CloudOwner");
+
+ private final String propName;
+ private final String defaultValue;
+
+ private Defaults(String propName, String defaultValue) {
+ this.defaultValue = defaultValue;
+ this.propName = propName;
+ }
+
+ @Override
+ public String toString() {
+ Optional<ApplicationContext> context = getAppContext();
+ if (context.isPresent()) {
+ return context.get().getEnvironment().getProperty(this.propName, this.defaultValue);
+ } else {
+ return this.defaultValue;
+ }
+
+ }
+
+ protected Optional<ApplicationContext> getAppContext() {
+ return Optional.ofNullable(SpringContextHelper.getAppContext());
+ }
}
diff --git a/common/src/main/java/org/onap/so/entity/MsoRequest.java b/common/src/main/java/org/onap/so/entity/MsoRequest.java
index c61684bec7..c45b2f68f1 100644
--- a/common/src/main/java/org/onap/so/entity/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/entity/MsoRequest.java
@@ -24,41 +24,39 @@ package org.onap.so.entity;
import java.io.Serializable;
/**
- * This simple bean holds tracking information for MSO requests within
- * the adapters. This tracking information should be added to logs,
- * metrics, alarms as appropriate.
+ * This simple bean holds tracking information for MSO requests within the adapters. This tracking information should be
+ * added to logs, metrics, alarms as appropriate.
*
*
*/
-public class MsoRequest implements Serializable
-{
- private static final long serialVersionUID = 1797142528913733469L;
- private String requestId;
- private String serviceInstanceId;
-
- public MsoRequest() {
- this.requestId = null;
- this.serviceInstanceId = null;
- }
-
- public MsoRequest(String r, String s) {
- this.requestId = r;
- this.serviceInstanceId = s;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
+public class MsoRequest implements Serializable {
+ private static final long serialVersionUID = 1797142528913733469L;
+ private String requestId;
+ private String serviceInstanceId;
+
+ public MsoRequest() {
+ this.requestId = null;
+ this.serviceInstanceId = null;
+ }
+
+ public MsoRequest(String r, String s) {
+ this.requestId = r;
+ this.serviceInstanceId = s;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
}
diff --git a/common/src/main/java/org/onap/so/exceptions/MSOException.java b/common/src/main/java/org/onap/so/exceptions/MSOException.java
index f49cd8d8f8..99ae92e34b 100644
--- a/common/src/main/java/org/onap/so/exceptions/MSOException.java
+++ b/common/src/main/java/org/onap/so/exceptions/MSOException.java
@@ -21,36 +21,36 @@
package org.onap.so.exceptions;
-public class MSOException extends Exception{
+public class MSOException extends Exception {
/**
*
*/
private static final long serialVersionUID = 4563920496855255206L;
private Integer errorCode;
- public MSOException(String msg){
+ public MSOException(String msg) {
super(msg);
}
-
- public MSOException (Throwable e) {
+
+ public MSOException(Throwable e) {
super(e);
}
-
- public MSOException (String msg, Throwable e) {
- super (msg, e);
+
+ public MSOException(String msg, Throwable e) {
+ super(msg, e);
}
-
- public MSOException(String msg, int errorCode){
+
+ public MSOException(String msg, int errorCode) {
super(msg);
- this.errorCode=errorCode;
+ this.errorCode = errorCode;
}
-
- public MSOException(String msg, int errorCode, Throwable t){
- super(msg,t);
- this.errorCode=errorCode;
+
+ public MSOException(String msg, int errorCode, Throwable t) {
+ super(msg, t);
+ this.errorCode = errorCode;
}
-
- public Integer getErrorCode(){
+
+ public Integer getErrorCode() {
return errorCode;
}
}
diff --git a/common/src/main/java/org/onap/so/exceptions/MarshallerException.java b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
index 8b06a8519f..a763260aa3 100644
--- a/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
+++ b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
@@ -32,7 +32,7 @@ public class MarshallerException extends Exception {
}
public MarshallerException(String message, int errorCode, Exception e) {
- super (e);
+ super(e);
this.message = message;
this.errorCode = errorCode;
diff --git a/common/src/main/java/org/onap/so/exceptions/ValidationException.java b/common/src/main/java/org/onap/so/exceptions/ValidationException.java
index b91c30c598..fbc2d9ae99 100644
--- a/common/src/main/java/org/onap/so/exceptions/ValidationException.java
+++ b/common/src/main/java/org/onap/so/exceptions/ValidationException.java
@@ -24,8 +24,8 @@ package org.onap.so.exceptions;
public class ValidationException extends Exception {
/**
- * This class simply extends Exception (without addition additional functionality)
- * to provide an identifier for RequestsDB related exceptions on create, delete, query.
+ * This class simply extends Exception (without addition additional functionality) to provide an identifier for
+ * RequestsDB related exceptions on create, delete, query.
*
*
**/
@@ -37,18 +37,20 @@ public class ValidationException extends Exception {
private static final String REPLACE_SECOND_ELEMENT_KEY = "\\$SECOND_ELEMENT";
@Deprecated
- public ValidationException (String msg) {
- super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg));
+ public ValidationException(String msg) {
+ super(VALIDATION_FAIL.replaceAll(REPLACE_ELEMENT_KEY, msg));
}
public ValidationException(String msg, boolean overrideExistingMessage) {
super(overrideExistingMessage ? VALIDATION_FAIL.replaceAll(REPLACE_ELEMENT_KEY, msg) : msg);
}
- public ValidationException (String msg, Exception cause) {
- super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg), cause);
+ public ValidationException(String msg, Exception cause) {
+ super(VALIDATION_FAIL.replaceAll(REPLACE_ELEMENT_KEY, msg), cause);
}
+
public ValidationException(String firstElement, String secondElement) {
- super(UNMATCHED_ELEMENTS.replaceAll(REPLACE_ELEMENT_KEY, firstElement).replaceAll(REPLACE_SECOND_ELEMENT_KEY, secondElement));
+ super(UNMATCHED_ELEMENTS.replaceAll(REPLACE_ELEMENT_KEY, firstElement).replaceAll(REPLACE_SECOND_ELEMENT_KEY,
+ secondElement));
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
index cb0de998ba..ca822617c8 100644
--- a/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
+++ b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
@@ -23,7 +23,6 @@ package org.onap.so.jsonpath;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.jayway.jsonpath.Configuration;
@@ -33,55 +32,59 @@ import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
public class JsonPathUtil {
-
- private final Configuration conf;
- private final Configuration pathListConf;
- private JsonPathUtil() {
- conf = Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider()).addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
- pathListConf = Configuration.defaultConfiguration().addOptions(Option.AS_PATH_LIST, Option.SUPPRESS_EXCEPTIONS,Option.ALWAYS_RETURN_LIST);
- }
-
- private static class Helper {
- private static final JsonPathUtil INSTANCE = new JsonPathUtil();
- }
-
- public static JsonPathUtil getInstance() {
- return Helper.INSTANCE;
- }
- public boolean pathExists(String json, String jsonPath) {
- return JsonPath.using(conf).parse(json).<ArrayNode>read(jsonPath).size() != 0;
- }
-
- public Optional<String> locateResult(String json, String jsonPath) {
- final ArrayNode result = JsonPath.using(conf).parse(json).read(jsonPath);
- if (result.size() == 0) {
- return Optional.empty();
- } else {
- if (result.get(0).isValueNode()) {
- return Optional.of(result.get(0).asText());
- } else {
- return Optional.of(result.get(0).toString());
- }
-
- }
- }
-
- public List<String> locateResultList(String json, String jsonPath) {
- final ArrayNode resultNodes = JsonPath.using(conf).parse(json).read(jsonPath);
- final ArrayList<String> result = new ArrayList<>();
-
- for (JsonNode node : resultNodes) {
- if (node.isValueNode()) {
- result.add(node.asText());
- } else {
- result.add(node.toString());
- }
-
- }
- return result;
- }
-
- public List<String> getPathList(String json, String jsonPath) {
- return JsonPath.using(pathListConf).parse(json).read(jsonPath);
- }
+
+ private final Configuration conf;
+ private final Configuration pathListConf;
+
+ private JsonPathUtil() {
+ conf = Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider())
+ .addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
+ pathListConf = Configuration.defaultConfiguration().addOptions(Option.AS_PATH_LIST, Option.SUPPRESS_EXCEPTIONS,
+ Option.ALWAYS_RETURN_LIST);
+ }
+
+ private static class Helper {
+ private static final JsonPathUtil INSTANCE = new JsonPathUtil();
+ }
+
+ public static JsonPathUtil getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public boolean pathExists(String json, String jsonPath) {
+ return JsonPath.using(conf).parse(json).<ArrayNode>read(jsonPath).size() != 0;
+ }
+
+ public Optional<String> locateResult(String json, String jsonPath) {
+ final ArrayNode result = JsonPath.using(conf).parse(json).read(jsonPath);
+ if (result.size() == 0) {
+ return Optional.empty();
+ } else {
+ if (result.get(0).isValueNode()) {
+ return Optional.of(result.get(0).asText());
+ } else {
+ return Optional.of(result.get(0).toString());
+ }
+
+ }
+ }
+
+ public List<String> locateResultList(String json, String jsonPath) {
+ final ArrayNode resultNodes = JsonPath.using(conf).parse(json).read(jsonPath);
+ final ArrayList<String> result = new ArrayList<>();
+
+ for (JsonNode node : resultNodes) {
+ if (node.isValueNode()) {
+ result.add(node.asText());
+ } else {
+ result.add(node.toString());
+ }
+
+ }
+ return result;
+ }
+
+ public List<String> getPathList(String json, String jsonPath) {
+ return JsonPath.using(pathListConf).parse(json).read(jsonPath);
+ }
}
diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java
index b58189efda..2d6fb791d5 100644
--- a/common/src/main/java/org/onap/so/logger/ErrorCode.java
+++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java
@@ -2,7 +2,7 @@ package org.onap.so.logger;
public enum ErrorCode {
PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError(
- 500), UnknownError(900);
+ 500), UnknownError(900);
private int value;
diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java
index 3c8b7f7d56..30915c6171 100644
--- a/common/src/main/java/org/onap/so/logger/LogConstants.java
+++ b/common/src/main/java/org/onap/so/logger/LogConstants.java
@@ -21,8 +21,8 @@
package org.onap.so.logger;
public class LogConstants {
- public static final String TARGET_ENTITY_HEADER="X-Target-Entity";
- public static final String UNKNOWN_TARGET_ENTITY="Unknown-Target-Entity";
- public static final String HTTP_URL="Http-Url";
- public static final String URI_BASE="Uri-Base";
+ public static final String TARGET_ENTITY_HEADER = "X-Target-Entity";
+ public static final String UNKNOWN_TARGET_ENTITY = "Unknown-Target-Entity";
+ public static final String HTTP_URL = "Http-Url";
+ public static final String URI_BASE = "Uri-Base";
}
diff --git a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
index cd7859a170..fe7558693c 100644
--- a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
+++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
@@ -24,11 +24,9 @@ package org.onap.so.logger;
import java.net.InetAddress;
import java.net.UnknownHostException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.LoggerContextListener;
@@ -39,54 +37,49 @@ import ch.qos.logback.core.spi.LifeCycle;
@Component
public class LoggerStartupListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
- private boolean started = false;
- private static final Logger logger = LoggerFactory.getLogger(LoggerStartupListener.class);
+ private boolean started = false;
+ private static final Logger logger = LoggerFactory.getLogger(LoggerStartupListener.class);
@Override
public void start() {
- if (started)
- return;
- InetAddress addr= null;
- try {
- addr = InetAddress.getLocalHost();
- } catch (UnknownHostException e) {
- logger.error("UnknownHostException",e);
-
- }
+ if (started)
+ return;
+ InetAddress addr = null;
+ try {
+ addr = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ logger.error("UnknownHostException", e);
+
+ }
Context context = getContext();
if (addr != null) {
- context.putProperty("server.name", addr.getHostName());
+ context.putProperty("server.name", addr.getHostName());
}
started = true;
}
@Override
- public void stop() {
- }
+ public void stop() {}
- @Override
- public boolean isStarted() {
- return started;
- }
+ @Override
+ public boolean isStarted() {
+ return started;
+ }
- @Override
- public boolean isResetResistant() {
- return true;
- }
+ @Override
+ public boolean isResetResistant() {
+ return true;
+ }
- @Override
- public void onReset(LoggerContext arg0) {
- }
+ @Override
+ public void onReset(LoggerContext arg0) {}
- @Override
- public void onStart(LoggerContext arg0) {
- }
+ @Override
+ public void onStart(LoggerContext arg0) {}
- @Override
- public void onStop(LoggerContext arg0) {
- }
+ @Override
+ public void onStop(LoggerContext arg0) {}
- @Override
- public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) {
- }
+ @Override
+ public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) {}
}
diff --git a/common/src/main/java/org/onap/so/logger/MessageEnum.java b/common/src/main/java/org/onap/so/logger/MessageEnum.java
index fcaa52024b..e92d50a685 100644
--- a/common/src/main/java/org/onap/so/logger/MessageEnum.java
+++ b/common/src/main/java/org/onap/so/logger/MessageEnum.java
@@ -22,202 +22,15 @@ package org.onap.so.logger;
-public enum MessageEnum{
- // Api Handler Messages
- APIH_REQUEST_NULL,
- APIH_QUERY_FOUND,
- APIH_QUERY_NOT_FOUND,
- APIH_QUERY_PARAM_WRONG,
- APIH_DB_ACCESS_EXC,
- APIH_DB_ACCESS_EXC_REASON,
- APIH_VALIDATION_ERROR,
- APIH_REQUEST_VALIDATION_ERROR,
- APIH_SERVICE_VALIDATION_ERROR,
- APIH_GENERAL_EXCEPTION_ARG,
- APIH_GENERAL_EXCEPTION,
- APIH_GENERAL_WARNING,
- APIH_AUDIT_EXEC,
- APIH_GENERAL_METRICS,
- APIH_DUPLICATE_CHECK_EXC,
- APIH_DUPLICATE_FOUND,
- APIH_BAD_ORDER,
- APIH_DB_ATTRIBUTE_NOT_FOUND,
- APIH_BPEL_COMMUNICATE_ERROR,
- APIH_BPEL_RESPONSE_ERROR,
- APIH_WARP_REQUEST,
- APIH_ERROR_FROM_BPEL_SERVER,
- APIH_DB_INSERT_EXC,
- APIH_DB_UPDATE_EXC,
- APIH_NO_PROPERTIES,
- APIH_PROPERTY_LOAD_SUC,
- APIH_LOAD_PROPERTIES_FAIL,
- APIH_SDNC_COMMUNICATE_ERROR,
- APIH_SDNC_RESPONSE_ERROR,
- APIH_CANNOT_READ_SCHEMA,
- APIH_HEALTH_CHECK_EXCEPTION,
- APIH_REQUEST_VALIDATION_ERROR_REASON,
- APIH_JAXB_MARSH_ERROR,
- APIH_JAXB_UNMARSH_ERROR,
- APIH_VNFREQUEST_VALIDATION_ERROR,
- APIH_DOM2STR_ERROR,
- APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
- APIH_DUPLICATE_CHECK_EXC_ATT,
- APIH_GENERATED_REQUEST_ID,
- APIH_GENERATED_SERVICE_INSTANCE_ID,
- APIH_REPLACE_REQUEST_ID,
- // Resource Adapter Messages
- RA_GENERAL_EXCEPTION_ARG,
- RA_GENERAL_EXCEPTION,
- RA_GENERAL_WARNING,
- RA_MISSING_PARAM,
- RA_AUDIT_EXEC,
- RA_GENERAL_METRICS,
- RA_CREATE_STACK_TIMEOUT,
- RA_DELETE_STACK_TIMEOUT,
- RA_UPDATE_STACK_TIMEOUT,
- RA_CONNECTION_EXCEPTION,
- RA_PARSING_ERROR,
- RA_PROPERTIES_NOT_FOUND,
- RA_LOAD_PROPERTIES_SUC,
- RA_NETWORK_ALREADY_EXIST,
- RA_UPDATE_NETWORK_ERR,
- RA_CREATE_STACK_ERR,
- RA_UPDATE_STACK_ERR,
- RA_CREATE_TENANT_ERR,
- RA_NETWORK_NOT_FOUND,
- RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
- RA_CREATE_NETWORK_EXC,
- RA_NS_EXC,
- RA_PARAM_NOT_FOUND,
- RA_CONFIG_EXC,
- RA_UNKOWN_PARAM,
- RA_VLAN_PARSE,
- RA_DELETE_NETWORK_EXC,
- RA_ROLLBACK_NULL,
- RA_TENANT_NOT_FOUND,
- RA_QUERY_NETWORK_EXC,
- RA_CREATE_NETWORK_NOTIF_EXC,
- RA_ASYNC_ROLLBACK,
- RA_WSDL_NOT_FOUND,
- RA_WSDL_URL_CONVENTION_EXC,
- RA_INIT_NOTIF_EXC,
- RA_SET_CALLBACK_AUTH_EXC,
- RA_FAULT_INFO_EXC,
- RA_MARSHING_ERROR,
- RA_PARSING_REQUEST_ERROR,
- RA_SEND_REQUEST_SDNC,
- RA_RESPONSE_FROM_SDNC,
- RA_EXCEPTION_COMMUNICATE_SDNC,
- RA_EVALUATE_XPATH_ERROR,
- RA_ANALYZE_ERROR_EXC,
- RA_ERROR_GET_RESPONSE_SDNC,
- RA_CALLBACK_BPEL,
- RA_INIT_CALLBACK_WSDL_ERR,
- RA_CALLBACK_BPEL_EXC,
- RA_CALLBACK_BPEL_COMPLETE,
- RA_SDNC_MISS_CONFIG_PARAM,
- RA_SDNC_INVALID_CONFIG,
- RA_PRINT_URL,
- RA_ERROR_CREATE_SDNC_REQUEST,
- RA_ERROR_CREATE_SDNC_RESPONSE,
- RA_ERROR_CONVERT_XML2STR,
- RA_RECEIVE_SDNC_NOTIF,
- RA_INIT_SDNC_ADAPTER,
- RA_SEND_REQUEST_APPC_ERR,
- RA_SEND_REQUEST_SDNC_ERR,
- RA_RECEIVE_BPEL_REQUEST,
- RA_TENANT_ALREADY_EXIST,
- RA_UPDATE_TENANT_ERR,
- RA_DELETE_TEMAMT_ERR,
- RA_ROLLBACK_TENANT_ERR,
- RA_QUERY_VNF_ERR,
- RA_VNF_ALREADY_EXIST,
- RA_VNF_UNKNOWN_PARAM,
- RA_VNF_EXTRA_PARAM,
- RA_CREATE_VNF_ERR,
- RA_VNF_NOT_EXIST,
- RA_UPDATE_VNF_ERR,
- RA_DELETE_VNF_ERR,
- RA_ASYNC_CREATE_VNF,
- RA_SEND_VNF_NOTIF_ERR,
- RA_ASYNC_CREATE_VNF_COMPLETE,
- RA_ASYNC_UPDATE_VNF,
- RA_ASYNC_UPDATE_VNF_COMPLETE,
- RA_ASYNC_QUERY_VNF,
- RA_ASYNC_QUERY_VNF_COMPLETE,
- RA_ASYNC_DELETE_VNF,
- RA_ASYNC_DELETE_VNF_COMPLETE,
- RA_ASYNC_ROLLBACK_VNF,
- RA_ASYNC_ROLLBACK_VNF_COMPLETE,
- RA_ROLLBACK_VNF_ERR,
- RA_DB_INVALID_STATUS,
- RA_CANT_UPDATE_REQUEST,
- RA_DB_REQUEST_NOT_EXIST,
- RA_CONFIG_NOT_FOUND,
- RA_CONFIG_LOAD,
- RA_RECEIVE_WORKFLOW_MESSAGE,
- // BPEL engine Messages
- BPMN_GENERAL_INFO,
- BPMN_GENERAL_EXCEPTION_ARG,
- BPMN_GENERAL_EXCEPTION,
- BPMN_GENERAL_WARNING,
- BPMN_AUDIT_EXEC,
- BPMN_GENERAL_METRICS,
- BPMN_URN_MAPPING_FAIL,
- BPMN_VARIABLE_NULL,
- BPMN_CALLBACK_EXCEPTION,
- // ASDC Messages
- ASDC_GENERAL_EXCEPTION_ARG,
- ASDC_GENERAL_EXCEPTION,
- ASDC_GENERAL_WARNING,
- ASDC_GENERAL_INFO,
- ASDC_AUDIT_EXEC,
- ASDC_GENERAL_METRICS,
- ASDC_CREATE_SERVICE,
- ASDC_ARTIFACT_ALREADY_DEPLOYED,
- ASDC_CREATE_ARTIFACT,
- ASDC_ARTIFACT_INSTALL_EXC,
- ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_CHECK_EXC,
- ASDC_INIT_ASDC_CLIENT_EXC,
- ASDC_INIT_ASDC_CLIENT_SUC,
- ASDC_LOAD_ASDC_CLIENT_EXC,
- ASDC_SINGLETON_CHECKT_EXC,
- ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
- ASDC_CHECK_HEAT_TEMPLATE,
- ASDC_START_INSTALL_ARTIFACT,
- ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
- ASDC_ARTIFACT_ALREADY_EXIST,
- ASDC_ARTIFACT_DOWNLOAD_SUC,
- ASDC_ARTIFACT_DOWNLOAD_FAIL,
- ASDC_START_DEPLOY_ARTIFACT,
- ASDC_SEND_NOTIF_ASDC,
- ASDC_SEND_NOTIF_ASDC_EXEC,
- ASDC_RECEIVE_CALLBACK_NOTIF,
- ASDC_RECEIVE_SERVICE_NOTIF,
- ASDC_ARTIFACT_NULL,
- ASDC_SERVICE_NOT_SUPPORT,
- ASDC_ARTIFACT_DEPLOY_SUC,
- ASDC_PROPERTIES_NOT_FOUND,
- ASDC_PROPERTIES_LOAD_SUCCESS,
- // Default Messages, in case Log catalog is not defined
- GENERAL_EXCEPTION_ARG,
- GENERAL_EXCEPTION,
- GENERAL_WARNING,
- AUDIT_EXEC,
- GENERAL_METRICS,
- LOGGER_SETUP,
- LOGGER_NOT_FOUND,
- LOGGER_UPDATE_SUC,
- LOGGER_UPDATE_DEBUG,
- LOGGER_UPDATE_DEBUG_SUC,
- LOAD_PROPERTIES_SUC,
- NO_PROPERTIES,
- MADATORY_PARAM_MISSING,
- LOAD_PROPERTIES_FAIL,
- INIT_LOGGER,
- INIT_LOGGER_FAIL,
- JAXB_EXCEPTION,
- IDENTITY_SERVICE_NOT_FOUND;
+public enum MessageEnum {
+ // Api Handler Messages
+ APIH_REQUEST_NULL, APIH_QUERY_FOUND, APIH_QUERY_NOT_FOUND, APIH_QUERY_PARAM_WRONG, APIH_DB_ACCESS_EXC, APIH_DB_ACCESS_EXC_REASON, APIH_VALIDATION_ERROR, APIH_REQUEST_VALIDATION_ERROR, APIH_SERVICE_VALIDATION_ERROR, APIH_GENERAL_EXCEPTION_ARG, APIH_GENERAL_EXCEPTION, APIH_GENERAL_WARNING, APIH_AUDIT_EXEC, APIH_GENERAL_METRICS, APIH_DUPLICATE_CHECK_EXC, APIH_DUPLICATE_FOUND, APIH_BAD_ORDER, APIH_DB_ATTRIBUTE_NOT_FOUND, APIH_BPEL_COMMUNICATE_ERROR, APIH_BPEL_RESPONSE_ERROR, APIH_WARP_REQUEST, APIH_ERROR_FROM_BPEL_SERVER, APIH_DB_INSERT_EXC, APIH_DB_UPDATE_EXC, APIH_NO_PROPERTIES, APIH_PROPERTY_LOAD_SUC, APIH_LOAD_PROPERTIES_FAIL, APIH_SDNC_COMMUNICATE_ERROR, APIH_SDNC_RESPONSE_ERROR, APIH_CANNOT_READ_SCHEMA, APIH_HEALTH_CHECK_EXCEPTION, APIH_REQUEST_VALIDATION_ERROR_REASON, APIH_JAXB_MARSH_ERROR, APIH_JAXB_UNMARSH_ERROR, APIH_VNFREQUEST_VALIDATION_ERROR, APIH_DOM2STR_ERROR, APIH_READ_VNFOUTPUT_CLOB_EXCEPTION, APIH_DUPLICATE_CHECK_EXC_ATT, APIH_GENERATED_REQUEST_ID, APIH_GENERATED_SERVICE_INSTANCE_ID, APIH_REPLACE_REQUEST_ID,
+ // Resource Adapter Messages
+ RA_GENERAL_EXCEPTION_ARG, RA_GENERAL_EXCEPTION, RA_GENERAL_WARNING, RA_MISSING_PARAM, RA_AUDIT_EXEC, RA_GENERAL_METRICS, RA_CREATE_STACK_TIMEOUT, RA_DELETE_STACK_TIMEOUT, RA_UPDATE_STACK_TIMEOUT, RA_CONNECTION_EXCEPTION, RA_PARSING_ERROR, RA_PROPERTIES_NOT_FOUND, RA_LOAD_PROPERTIES_SUC, RA_NETWORK_ALREADY_EXIST, RA_UPDATE_NETWORK_ERR, RA_CREATE_STACK_ERR, RA_UPDATE_STACK_ERR, RA_CREATE_TENANT_ERR, RA_NETWORK_NOT_FOUND, RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, RA_CREATE_NETWORK_EXC, RA_NS_EXC, RA_PARAM_NOT_FOUND, RA_CONFIG_EXC, RA_UNKOWN_PARAM, RA_VLAN_PARSE, RA_DELETE_NETWORK_EXC, RA_ROLLBACK_NULL, RA_TENANT_NOT_FOUND, RA_QUERY_NETWORK_EXC, RA_CREATE_NETWORK_NOTIF_EXC, RA_ASYNC_ROLLBACK, RA_WSDL_NOT_FOUND, RA_WSDL_URL_CONVENTION_EXC, RA_INIT_NOTIF_EXC, RA_SET_CALLBACK_AUTH_EXC, RA_FAULT_INFO_EXC, RA_MARSHING_ERROR, RA_PARSING_REQUEST_ERROR, RA_SEND_REQUEST_SDNC, RA_RESPONSE_FROM_SDNC, RA_EXCEPTION_COMMUNICATE_SDNC, RA_EVALUATE_XPATH_ERROR, RA_ANALYZE_ERROR_EXC, RA_ERROR_GET_RESPONSE_SDNC, RA_CALLBACK_BPEL, RA_INIT_CALLBACK_WSDL_ERR, RA_CALLBACK_BPEL_EXC, RA_CALLBACK_BPEL_COMPLETE, RA_SDNC_MISS_CONFIG_PARAM, RA_SDNC_INVALID_CONFIG, RA_PRINT_URL, RA_ERROR_CREATE_SDNC_REQUEST, RA_ERROR_CREATE_SDNC_RESPONSE, RA_ERROR_CONVERT_XML2STR, RA_RECEIVE_SDNC_NOTIF, RA_INIT_SDNC_ADAPTER, RA_SEND_REQUEST_APPC_ERR, RA_SEND_REQUEST_SDNC_ERR, RA_RECEIVE_BPEL_REQUEST, RA_TENANT_ALREADY_EXIST, RA_UPDATE_TENANT_ERR, RA_DELETE_TEMAMT_ERR, RA_ROLLBACK_TENANT_ERR, RA_QUERY_VNF_ERR, RA_VNF_ALREADY_EXIST, RA_VNF_UNKNOWN_PARAM, RA_VNF_EXTRA_PARAM, RA_CREATE_VNF_ERR, RA_VNF_NOT_EXIST, RA_UPDATE_VNF_ERR, RA_DELETE_VNF_ERR, RA_ASYNC_CREATE_VNF, RA_SEND_VNF_NOTIF_ERR, RA_ASYNC_CREATE_VNF_COMPLETE, RA_ASYNC_UPDATE_VNF, RA_ASYNC_UPDATE_VNF_COMPLETE, RA_ASYNC_QUERY_VNF, RA_ASYNC_QUERY_VNF_COMPLETE, RA_ASYNC_DELETE_VNF, RA_ASYNC_DELETE_VNF_COMPLETE, RA_ASYNC_ROLLBACK_VNF, RA_ASYNC_ROLLBACK_VNF_COMPLETE, RA_ROLLBACK_VNF_ERR, RA_DB_INVALID_STATUS, RA_CANT_UPDATE_REQUEST, RA_DB_REQUEST_NOT_EXIST, RA_CONFIG_NOT_FOUND, RA_CONFIG_LOAD, RA_RECEIVE_WORKFLOW_MESSAGE,
+ // BPEL engine Messages
+ BPMN_GENERAL_INFO, BPMN_GENERAL_EXCEPTION_ARG, BPMN_GENERAL_EXCEPTION, BPMN_GENERAL_WARNING, BPMN_AUDIT_EXEC, BPMN_GENERAL_METRICS, BPMN_URN_MAPPING_FAIL, BPMN_VARIABLE_NULL, BPMN_CALLBACK_EXCEPTION,
+ // ASDC Messages
+ ASDC_GENERAL_EXCEPTION_ARG, ASDC_GENERAL_EXCEPTION, ASDC_GENERAL_WARNING, ASDC_GENERAL_INFO, ASDC_AUDIT_EXEC, ASDC_GENERAL_METRICS, ASDC_CREATE_SERVICE, ASDC_ARTIFACT_ALREADY_DEPLOYED, ASDC_CREATE_ARTIFACT, ASDC_ARTIFACT_INSTALL_EXC, ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL, ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, ASDC_ARTIFACT_CHECK_EXC, ASDC_INIT_ASDC_CLIENT_EXC, ASDC_INIT_ASDC_CLIENT_SUC, ASDC_LOAD_ASDC_CLIENT_EXC, ASDC_SINGLETON_CHECKT_EXC, ASDC_SHUTDOWN_ASDC_CLIENT_EXC, ASDC_CHECK_HEAT_TEMPLATE, ASDC_START_INSTALL_ARTIFACT, ASDC_ARTIFACT_TYPE_NOT_SUPPORT, ASDC_ARTIFACT_ALREADY_EXIST, ASDC_ARTIFACT_DOWNLOAD_SUC, ASDC_ARTIFACT_DOWNLOAD_FAIL, ASDC_START_DEPLOY_ARTIFACT, ASDC_SEND_NOTIF_ASDC, ASDC_SEND_NOTIF_ASDC_EXEC, ASDC_RECEIVE_CALLBACK_NOTIF, ASDC_RECEIVE_SERVICE_NOTIF, ASDC_ARTIFACT_NULL, ASDC_SERVICE_NOT_SUPPORT, ASDC_ARTIFACT_DEPLOY_SUC, ASDC_PROPERTIES_NOT_FOUND, ASDC_PROPERTIES_LOAD_SUCCESS,
+ // Default Messages, in case Log catalog is not defined
+ GENERAL_EXCEPTION_ARG, GENERAL_EXCEPTION, GENERAL_WARNING, AUDIT_EXEC, GENERAL_METRICS, LOGGER_SETUP, LOGGER_NOT_FOUND, LOGGER_UPDATE_SUC, LOGGER_UPDATE_DEBUG, LOGGER_UPDATE_DEBUG_SUC, LOAD_PROPERTIES_SUC, NO_PROPERTIES, MADATORY_PARAM_MISSING, LOAD_PROPERTIES_FAIL, INIT_LOGGER, INIT_LOGGER_FAIL, JAXB_EXCEPTION, IDENTITY_SERVICE_NOT_FOUND;
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
index 436faef27f..975f6bb9d8 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
@@ -54,22 +54,22 @@ import java.util.UUID;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Component
@Priority(0)
-public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter {
-
- @Context
+public class JaxRsClientLogging implements ClientRequestFilter, ClientResponseFilter {
+
+ @Context
private Providers providers;
private static final String TRACE = "trace-#";
private static final String SO = "SO";
private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class);
- public void setTargetService(TargetEntity targetEntity){
+ public void setTargetService(TargetEntity targetEntity) {
MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString());
}
@Override
public void filter(ClientRequestContext clientRequest) {
- try{
+ try {
setupMDC(clientRequest);
setupHeaders(clientRequest);
logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke");
@@ -86,26 +86,27 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil
}
private void setupMDC(ClientRequestContext clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString());
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
setInvocationId();
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
}
private String extractRequestID(ClientRequestContext clientRequest) {
String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if(requestId == null || requestId.isEmpty() || requestId.equals(TRACE)){
+ if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
requestId = UUID.randomUUID().toString();
- logger.warn("Could not Find Request ID Generating New One: {}",clientRequest.getUri().getPath());
+ logger.warn("Could not Find Request ID Generating New One: {}", clientRequest.getUri().getPath());
}
return requestId;
- }
+ }
private void setInvocationId() {
String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if(invocationId == null || invocationId.isEmpty())
- invocationId =UUID.randomUUID().toString();
+ if (invocationId == null || invocationId.isEmpty())
+ invocationId = UUID.randomUUID().toString();
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
@@ -115,16 +116,17 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil
try {
String statusCode;
- if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- }else{
- statusCode=ONAPLogConstants.ResponseStatus.ERROR.toString();
+ if (Response.Status.Family.familyOf(responseContext.getStatus())
+ .equals(Response.Status.Family.SUCCESSFUL)) {
+ statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ } else {
+ statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
}
MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
logger.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
clearClientMDCs();
- } catch ( Exception e) {
+ } catch (Exception e) {
logger.warn("Error in outgoing JAX-RS Inteceptor", e);
}
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
index 7a99594d19..635d95be2e 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
@@ -51,16 +51,16 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Priority(1)
@Provider
@Component
-public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter {
-
+public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResponseFilter {
+
protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class);
@Context
private HttpServletRequest httpServletRequest;
- @Context
+ @Context
private Providers providers;
-
+
@Autowired
private MDCSetup mdcSetup;
@@ -78,7 +78,7 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo
mdcSetup.setInstanceUUID();
mdcSetup.setEntryTimeStamp();
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
+ MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
} catch (Exception e) {
logger.warn("Error in incoming JAX-RS Inteceptor", e);
@@ -90,78 +90,71 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo
throws IOException {
try {
setResponseStatusCode(responseContext);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,payloadMessage(responseContext));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, payloadMessage(responseContext));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
MDC.clear();
- } catch ( Exception e) {
+ } catch (Exception e) {
MDC.clear();
logger.warn("Error in outgoing JAX-RS Inteceptor", e);
- }
+ }
}
private void setResponseStatusCode(ContainerResponseContext responseContext) {
String statusCode;
- if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- }else{
- statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
+ if (Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
+ statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ } else {
+ statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
+ }
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
+ }
private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
String message = "";
if (responseContext.hasEntity()) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
Class<?> entityClass = responseContext.getEntityClass();
Type entityType = responseContext.getEntityType();
Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
MediaType mediaType = responseContext.getMediaType();
@SuppressWarnings("unchecked")
- MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass,
- entityType,
- entityAnnotations,
- mediaType);
- bodyWriter.writeTo(responseContext.getEntity(),
- entityClass,
- entityType,
- entityAnnotations,
- mediaType,
- responseContext.getHeaders(),
- baos);
+ MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers
+ .getMessageBodyWriter(entityClass, entityType, entityAnnotations, mediaType);
+ bodyWriter.writeTo(responseContext.getEntity(), entityClass, entityType, entityAnnotations, mediaType,
+ responseContext.getHeaders(), baos);
message = message.concat(new String(baos.toByteArray()));
}
return message;
}
- private void setRequestId(MultivaluedMap<String, String> headers){
- String requestId=headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID);
- if(requestId == null || requestId.isEmpty())
+ private void setRequestId(MultivaluedMap<String, String> headers) {
+ String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID);
+ if (requestId == null || requestId.isEmpty())
requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId);
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
}
- private void setInvocationId(MultivaluedMap<String, String> headers){
+ private void setInvocationId(MultivaluedMap<String, String> headers) {
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers));
}
- private void setMDCPartnerName(MultivaluedMap<String, String> headers){
- String partnerName=headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME);
- if(partnerName == null || partnerName.isEmpty())
+ private void setMDCPartnerName(MultivaluedMap<String, String> headers) {
+ String partnerName = headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME);
+ if (partnerName == null || partnerName.isEmpty())
partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
-
+
private String findInvocationId(MultivaluedMap<String, String> headers) {
String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID);
- if(invocationId == null || invocationId.isEmpty())
- invocationId =UUID.randomUUID().toString();
+ if (invocationId == null || invocationId.isEmpty())
+ invocationId = UUID.randomUUID().toString();
return invocationId;
}
- private void setServiceName(ContainerRequestContext containerRequest){
+ private void setServiceName(ContainerRequestContext containerRequest) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath());
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
index f0a16561aa..607f067ec4 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
@@ -38,18 +38,18 @@ import org.springframework.stereotype.Component;
@Component
public class MDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
-
+
+ protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
+
private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID(){
+
+ public void setInstanceUUID() {
MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
}
- public void setServerFQDN(){
+ public void setServerFQDN() {
String serverFQDN = "";
- InetAddress addr= null;
+ InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
serverFQDN = addr.toString();
@@ -60,51 +60,52 @@ public class MDCSetup {
MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
}
- public void setClientIPAddress(HttpServletRequest httpServletRequest){
+ public void setClientIPAddress(HttpServletRequest httpServletRequest) {
String remoteIpAddress = "";
if (httpServletRequest != null) {
remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
+ }
MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
}
public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
}
-
+
public void setServiceName(HttpServletRequest request) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
}
public void setRequestId(Map<String, String> headers) {
- String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID);
- if(requestId == null || requestId.isEmpty())
+ String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID);
+ if (requestId == null || requestId.isEmpty())
requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId);
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
}
public void setInvocationId(Map<String, String> headers) {
String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
- if(invocationId == null || invocationId.isEmpty())
- invocationId =UUID.randomUUID().toString();
+ if (invocationId == null || invocationId.isEmpty())
+ invocationId = UUID.randomUUID().toString();
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
public void setMDCPartnerName(Map<String, String> headers) {
- String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME);
- if(partnerName == null || partnerName.isEmpty())
+ String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME);
+ if (partnerName == null || partnerName.isEmpty())
partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
-
+
public void setResponseStatusCode(HttpServletResponse response) {
String statusCode;
- if(Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- }else{
- statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
+ if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
+ statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ } else {
+ statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
+ }
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
}
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
index 9624dcd578..e644f9e030 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
@@ -21,24 +21,23 @@
package org.onap.so.logging.jaxrs.filter;
import java.util.Map;
-
import org.slf4j.MDC;
import org.springframework.core.task.TaskDecorator;
public class MDCTaskDecorator implements TaskDecorator {
-
- @Override
- public Runnable decorate(Runnable runnable) {
- Map<String, String> contextMap = MDC.getCopyOfContextMap();
- return () -> {
- try {
- if(contextMap!=null){
- MDC.setContextMap(contextMap);
- runnable.run();
- }
- } finally {
- MDC.clear();
- }
- };
- }
-} \ No newline at end of file
+
+ @Override
+ public Runnable decorate(Runnable runnable) {
+ Map<String, String> contextMap = MDC.getCopyOfContextMap();
+ return () -> {
+ try {
+ if (contextMap != null) {
+ MDC.setContextMap(contextMap);
+ runnable.run();
+ }
+ } finally {
+ MDC.clear();
+ }
+ };
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
index 7f88f22b79..21c0b52a91 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
@@ -28,7 +28,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-
import javax.annotation.Priority;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.ClientRequestContext;
@@ -38,7 +37,6 @@ import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,112 +45,114 @@ import org.slf4j.LoggerFactory;
@Priority(1)
public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
- private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class);
- private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
- private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
- private final int maxEntitySize;
-
- public PayloadLoggingFilter() {
- maxEntitySize = 1024 * 1024;
- }
-
- public PayloadLoggingFilter(int maxPayloadSize) {
- this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
- }
-
- private void log(StringBuilder sb) {
- logger.debug(sb.toString());
- }
-
- protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
- throws IOException {
- if (!stream.markSupported()) {
- stream = new BufferedInputStream(stream);
- }
- stream.mark(maxEntitySize + 1);
- final byte[] entity = new byte[maxEntitySize + 1];
- final int entitySize = stream.read(entity);
- if (entitySize != -1) {
- b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
- }
- if (entitySize > maxEntitySize) {
- b.append("...more...");
- }
- b.append('\n');
- stream.reset();
- return stream;
- }
-
- @Override
- public void filter(ClientRequestContext requestContext) throws IOException {
- if (requestContext.hasEntity()) {
- final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
- requestContext.setEntityStream(stream);
- requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
- }
- String method = formatMethod(requestContext);
- log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: " + requestContext.getHeaders().toString()));
-
- }
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- final StringBuilder sb = new StringBuilder();
- if (responseContext.hasEntity()) {
- responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
- String method = formatMethod(requestContext);
- log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: " + responseContext.getHeaders().toString()));
- }
- }
-
- @Override
- public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
- final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
- context.proceed();
- if (stream != null) {
- log(stream.getStringBuilder(DEFAULT_CHARSET));
- }
- }
-
- private class LoggingStream extends FilterOutputStream {
-
- private final StringBuilder sb = new StringBuilder();
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- LoggingStream(OutputStream out) {
- super(out);
- }
-
- StringBuilder getStringBuilder(Charset charset) {
- // write entity to the builder
- final byte[] entity = baos.toByteArray();
-
- sb.append(new String(entity, 0, entity.length, charset));
- if (entity.length > maxEntitySize) {
- sb.append("...more...");
- }
- sb.append('\n');
-
- return sb;
- }
-
- @Override
- public void write(final int i) throws IOException {
- if (baos.size() <= maxEntitySize) {
- baos.write(i);
- }
- out.write(i);
- }
- }
-
- private String formatMethod(ClientRequestContext requestContext) {
- String method = requestContext.getHeaderString("X-HTTP-Method-Override");
- if (method == null) {
- method = requestContext.getMethod();
- } else {
- method = requestContext.getMethod() + " (overridden to " + method + ")";
- }
-
- return method;
- }
+ private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class);
+ private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
+ private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
+ private final int maxEntitySize;
+
+ public PayloadLoggingFilter() {
+ maxEntitySize = 1024 * 1024;
+ }
+
+ public PayloadLoggingFilter(int maxPayloadSize) {
+ this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
+ }
+
+ private void log(StringBuilder sb) {
+ logger.debug(sb.toString());
+ }
+
+ protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
+ throws IOException {
+ if (!stream.markSupported()) {
+ stream = new BufferedInputStream(stream);
+ }
+ stream.mark(maxEntitySize + 1);
+ final byte[] entity = new byte[maxEntitySize + 1];
+ final int entitySize = stream.read(entity);
+ if (entitySize != -1) {
+ b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
+ }
+ if (entitySize > maxEntitySize) {
+ b.append("...more...");
+ }
+ b.append('\n');
+ stream.reset();
+ return stream;
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext) throws IOException {
+ if (requestContext.hasEntity()) {
+ final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
+ requestContext.setEntityStream(stream);
+ requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
+ }
+ String method = formatMethod(requestContext);
+ log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: "
+ + requestContext.getHeaders().toString()));
+
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
+ final StringBuilder sb = new StringBuilder();
+ if (responseContext.hasEntity()) {
+ responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
+ String method = formatMethod(requestContext);
+ log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: "
+ + responseContext.getHeaders().toString()));
+ }
+ }
+
+ @Override
+ public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
+ final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
+ context.proceed();
+ if (stream != null) {
+ log(stream.getStringBuilder(DEFAULT_CHARSET));
+ }
+ }
+
+ private class LoggingStream extends FilterOutputStream {
+
+ private final StringBuilder sb = new StringBuilder();
+ private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ LoggingStream(OutputStream out) {
+ super(out);
+ }
+
+ StringBuilder getStringBuilder(Charset charset) {
+ // write entity to the builder
+ final byte[] entity = baos.toByteArray();
+
+ sb.append(new String(entity, 0, entity.length, charset));
+ if (entity.length > maxEntitySize) {
+ sb.append("...more...");
+ }
+ sb.append('\n');
+
+ return sb;
+ }
+
+ @Override
+ public void write(final int i) throws IOException {
+ if (baos.size() <= maxEntitySize) {
+ baos.write(i);
+ }
+ out.write(i);
+ }
+ }
+
+ private String formatMethod(ClientRequestContext requestContext) {
+ String method = requestContext.getHeaderString("X-HTTP-Method-Override");
+ if (method == null) {
+ method = requestContext.getMethod();
+ } else {
+ method = requestContext.getMethod() + " (overridden to " + method + ")";
+ }
+
+ return method;
+ }
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
index ed63a706a2..c763dd4374 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
@@ -31,7 +31,6 @@ import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.util.StreamUtils;
-
import java.io.IOException;
import java.nio.charset.Charset;
import java.time.ZoneOffset;
@@ -40,26 +39,27 @@ import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.UUID;
import javax.ws.rs.core.Response;
-
+
public class SpringClientFilter implements ClientHttpRequestInterceptor {
-
+
private final Logger log = LoggerFactory.getLogger(this.getClass());
-
+
private static final String TRACE = "trace-#";
private static final String SO = "SO";
-
+
@Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
- processRequest(request, body);
+ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
+ throws IOException {
+ processRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
processResponse(response);
return response;
}
-
+
private void processRequest(HttpRequest request, byte[] body) throws IOException {
- setInvocationId();
- setupHeaders(request);
- setupMDC(request);
+ setInvocationId();
+ setupHeaders(request);
+ setupMDC(request);
if (log.isDebugEnabled()) {
log.debug("===========================request begin================================================");
log.debug("URI : {}", request.getURI());
@@ -69,58 +69,57 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
log.debug("==========================request end================================================");
}
}
-
+
private void setupHeaders(HttpRequest clientRequest) {
HttpHeaders headers = clientRequest.getHeaders();
headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
}
-
+
private String extractRequestID(HttpRequest clientRequest) {
String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if(requestId == null || requestId.isEmpty() || requestId.equals(TRACE)){
+ if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
requestId = UUID.randomUUID().toString();
- log.warn("Could not Find Request ID Generating New One: {}",clientRequest.getURI());
+ log.warn("Could not Find Request ID Generating New One: {}", clientRequest.getURI());
}
return requestId;
- }
+ }
private void setupMDC(HttpRequest clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
+ MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,extractTargetEntity(clientRequest));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, extractTargetEntity(clientRequest));
}
-
+
private String extractTargetEntity(HttpRequest clientRequest) {
- HttpHeaders headers = clientRequest.getHeaders();
- String headerTargetEntity = null;
- List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER);
- if(headerTargetEntityList!= null && !headerTargetEntityList.isEmpty())
- headerTargetEntity = headerTargetEntityList.get(0);
+ HttpHeaders headers = clientRequest.getHeaders();
+ String headerTargetEntity = null;
+ List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER);
+ if (headerTargetEntityList != null && !headerTargetEntityList.isEmpty())
+ headerTargetEntity = headerTargetEntityList.get(0);
String targetEntity = MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY);
- if(targetEntity != null &&
- !targetEntity.isEmpty() ){
- return targetEntity;
- }else if(headerTargetEntity != null &&
- !headerTargetEntity.isEmpty()){
- targetEntity = headerTargetEntity;
- }else{
- targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY;
- log.warn("Could not Target Entity: {}",clientRequest.getURI());
+ if (targetEntity != null && !targetEntity.isEmpty()) {
+ return targetEntity;
+ } else if (headerTargetEntity != null && !headerTargetEntity.isEmpty()) {
+ targetEntity = headerTargetEntity;
+ } else {
+ targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY;
+ log.warn("Could not Target Entity: {}", clientRequest.getURI());
}
return targetEntity;
- }
-
+ }
+
private void setInvocationId() {
String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if(invocationId == null || invocationId.isEmpty())
- invocationId =UUID.randomUUID().toString();
+ if (invocationId == null || invocationId.isEmpty())
+ invocationId = UUID.randomUUID().toString();
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
-
+
private void processResponse(ClientHttpResponse response) throws IOException {
if (log.isDebugEnabled()) {
log.debug("============================response begin==========================================");
@@ -131,18 +130,18 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
log.debug("=======================response end=================================================");
}
String statusCode;
- if(Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- }else{
- statusCode=ONAPLogConstants.ResponseStatus.ERROR.toString();
+ if (Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)) {
+ statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ } else {
+ statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
}
MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getRawStatusCode()));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,"");
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
log.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
clearClientMDCs();
}
-
+
private void clearClientMDCs() {
MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
index 9aa4e4c9b5..8e7a95b581 100644
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
@@ -47,16 +47,15 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
@Autowired
private MDCSetup mdcSetup;
-
- @Context
+
+ @Context
private Providers providers;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
-
- Map<String, String> headers = Collections.list((request).getHeaderNames())
- .stream()
+
+ Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
.collect(Collectors.toMap(h -> h, request::getHeader));
setRequestId(headers);
setInvocationId(headers);
@@ -68,69 +67,67 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
mdcSetup.setServerFQDN();
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- if (logger.isDebugEnabled())
- logRequestInformation(request);
+ if (logger.isDebugEnabled())
+ logRequestInformation(request);
return true;
}
-
+
protected void logRequestInformation(HttpServletRequest request) {
- Map<String, String> headers = Collections.list((request).getHeaderNames())
- .stream()
- .collect(Collectors.toMap(h -> h, request::getHeader));
-
- logger.debug("===========================request begin================================================");
- logger.debug("URI : {}", request.getRequestURI());
- logger.debug("Method : {}", request.getMethod());
- logger.debug("Headers : {}", headers);
- logger.debug("==========================request end================================================");
-
- }
-
- @Override
- public void postHandle(
- HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
- throws Exception {
+ Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
+ .collect(Collectors.toMap(h -> h, request::getHeader));
+
+ logger.debug("===========================request begin================================================");
+ logger.debug("URI : {}", request.getRequestURI());
+ logger.debug("Method : {}", request.getMethod());
+ logger.debug("Headers : {}", headers);
+ logger.debug("==========================request end================================================");
+
+ }
+
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
+ ModelAndView modelAndView) throws Exception {
setResponseStatusCode(response);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,"");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE,String.valueOf(response.getStatus()));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getStatus()));
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
MDC.clear();
}
- protected void setResponseStatusCode(HttpServletResponse response) {
+ protected void setResponseStatusCode(HttpServletResponse response) {
String statusCode;
- if(Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- }else{
- statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
+ if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
+ statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ } else {
+ statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
+ }
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
}
- protected void setServiceName(HttpServletRequest request) {
+ protected void setServiceName(HttpServletRequest request) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
}
-
- protected void setRequestId(Map<String, String> headers) {
- String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase());
- if(requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId);
+
+ protected void setRequestId(Map<String, String> headers) {
+ String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase());
+ if (requestId == null || requestId.isEmpty())
+ requestId = UUID.randomUUID().toString();
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
}
- protected void setInvocationId(Map<String, String> headers) {
+ protected void setInvocationId(Map<String, String> headers) {
String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase());
- if(invocationId == null || invocationId.isEmpty())
- invocationId =UUID.randomUUID().toString();
+ if (invocationId == null || invocationId.isEmpty())
+ invocationId = UUID.randomUUID().toString();
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
- protected void setMDCPartnerName(Map<String, String> headers) {
- String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase());
- if(partnerName == null || partnerName.isEmpty())
+ protected void setMDCPartnerName(Map<String, String> headers) {
+ String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase());
+ if (partnerName == null || partnerName.isEmpty())
partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
-
+
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
index 2c6590afb3..204e98a031 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
@@ -23,9 +23,7 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
import static org.hamcrest.CoreMatchers.not;
-
import org.hamcrest.Matcher;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoField;
import com.openpojo.validation.affirm.Affirm;
@@ -33,26 +31,29 @@ import com.openpojo.validation.rule.Rule;
public class CustomSetterMustExistRule implements Rule {
- private Matcher[] excludeMatchers = new Matcher[]{not(anything())};
- private Matcher<PojoField>[] includeMatchers = new Matcher[]{anything()};
- public CustomSetterMustExistRule() {
- }
- @Override
- public void evaluate(final PojoClass pojoClass) {
- for (PojoField fieldEntry : pojoClass.getPojoFields()) {
- if (!anyOf(excludeMatchers).matches(fieldEntry) && anyOf(includeMatchers).matches(fieldEntry) && !fieldEntry.isFinal() && !fieldEntry.hasSetter()) {
- Affirm.fail(String.format("[%s] is missing a setter", fieldEntry));
- }
- }
- }
- public CustomSetterMustExistRule exclude(Matcher... excludeMatchers) {
- this.excludeMatchers = excludeMatchers;
- return this;
- }
-
- public CustomSetterMustExistRule include(Matcher<PojoField>... includeMatchers) {
- this.includeMatchers = includeMatchers;
- return this;
- }
+ private Matcher[] excludeMatchers = new Matcher[] {not(anything())};
+ private Matcher<PojoField>[] includeMatchers = new Matcher[] {anything()};
+
+ public CustomSetterMustExistRule() {}
+
+ @Override
+ public void evaluate(final PojoClass pojoClass) {
+ for (PojoField fieldEntry : pojoClass.getPojoFields()) {
+ if (!anyOf(excludeMatchers).matches(fieldEntry) && anyOf(includeMatchers).matches(fieldEntry)
+ && !fieldEntry.isFinal() && !fieldEntry.hasSetter()) {
+ Affirm.fail(String.format("[%s] is missing a setter", fieldEntry));
+ }
+ }
+ }
+
+ public CustomSetterMustExistRule exclude(Matcher... excludeMatchers) {
+ this.excludeMatchers = excludeMatchers;
+ return this;
+ }
+
+ public CustomSetterMustExistRule include(Matcher<PojoField>... includeMatchers) {
+ this.includeMatchers = includeMatchers;
+ return this;
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
index 05f69caacd..e63e226457 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
@@ -24,18 +24,14 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
-
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-
import org.hamcrest.Matcher;
-
import com.openpojo.business.annotation.BusinessKey;
import com.openpojo.random.RandomFactory;
import com.openpojo.reflection.PojoClass;
@@ -46,90 +42,93 @@ import com.openpojo.validation.utils.ValidationHelper;
public class EqualsAndHashCodeTester implements Tester {
-
- private final Matcher m;
- private boolean onlyDeclaredMethods = false;
- public EqualsAndHashCodeTester() {
- m = anything();
- }
-
- public EqualsAndHashCodeTester(Matcher m) {
- this.m = m;
- }
-
- public EqualsAndHashCodeTester onlyDeclaredMethods() {
- this.onlyDeclaredMethods = true;
- return this;
- }
-
- // Marks sonar warnings about object being compared to itself as false positive
- // https://sonar.onap.org/coding_rules#rule_key=squid%3AS1764
- @SuppressWarnings("squid:S1764")
- @Override
- public void run(PojoClass pojoClass) {
- Class<?> clazz = pojoClass.getClazz();
- if (anyOf(m).matches(clazz)) {
- final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass);
- final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass);
- if (onlyDeclaredMethods) {
- Method[] methods = classInstanceOne.getClass().getDeclaredMethods();
- boolean hasEquals = false;
- boolean hasHashcode = false;
- for (Method method : methods) {
- if (method.getName().equals("equals")) {
- hasEquals = true;
- } else if (method.getName().equals("hashCode")) {
- hasHashcode = true;
- }
- }
-
- if (!(hasEquals && hasHashcode)) {
- return;
- }
- }
- Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass);
- List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields());
- otherFields.removeAll(identityFields);
-
- for (PojoField field : identityFields) {
- final Object value = RandomFactory.getRandomValue(field);
-
- field.invokeSetter(classInstanceOne, value);
- field.invokeSetter(classInstanceTwo, value);
- }
-
- for (PojoField field : otherFields) {
- if (field.hasSetter()) {
- final Object valueOne = RandomFactory.getRandomValue(field);
- final Object valueTwo = RandomFactory.getRandomValue(field);
-
- field.invokeSetter(classInstanceOne, valueOne);
- field.invokeSetter(classInstanceTwo, valueTwo);
- }
- }
-
- Affirm.affirmTrue("Equals test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.equals(classInstanceTwo));
-
- Affirm.affirmTrue("Expected true for comparison of the same references [" + classInstanceOne.getClass().getName() + "]",
- classInstanceOne.equals(classInstanceOne));
-
- Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.hashCode() == classInstanceTwo.hashCode());
-
- Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test"));
- }
- }
-
-
- private Set<PojoField> hasIdOrBusinessKey(PojoClass pojoClass) {
- final Set<PojoField> fields = new HashSet<>();
-
- fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(BusinessKey.class));
- final Set<PojoField> temp = new HashSet<>();
- temp.addAll(pojoClass.getPojoFieldsAnnotatedWith(Id.class));
- temp.removeAll(pojoClass.getPojoFieldsAnnotatedWith(GeneratedValue.class));
- fields.addAll(temp);
- return fields;
-
- }
+
+ private final Matcher m;
+ private boolean onlyDeclaredMethods = false;
+
+ public EqualsAndHashCodeTester() {
+ m = anything();
+ }
+
+ public EqualsAndHashCodeTester(Matcher m) {
+ this.m = m;
+ }
+
+ public EqualsAndHashCodeTester onlyDeclaredMethods() {
+ this.onlyDeclaredMethods = true;
+ return this;
+ }
+
+ // Marks sonar warnings about object being compared to itself as false positive
+ // https://sonar.onap.org/coding_rules#rule_key=squid%3AS1764
+ @SuppressWarnings("squid:S1764")
+ @Override
+ public void run(PojoClass pojoClass) {
+ Class<?> clazz = pojoClass.getClazz();
+ if (anyOf(m).matches(clazz)) {
+ final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass);
+ final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass);
+ if (onlyDeclaredMethods) {
+ Method[] methods = classInstanceOne.getClass().getDeclaredMethods();
+ boolean hasEquals = false;
+ boolean hasHashcode = false;
+ for (Method method : methods) {
+ if (method.getName().equals("equals")) {
+ hasEquals = true;
+ } else if (method.getName().equals("hashCode")) {
+ hasHashcode = true;
+ }
+ }
+
+ if (!(hasEquals && hasHashcode)) {
+ return;
+ }
+ }
+ Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass);
+ List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields());
+ otherFields.removeAll(identityFields);
+
+ for (PojoField field : identityFields) {
+ final Object value = RandomFactory.getRandomValue(field);
+
+ field.invokeSetter(classInstanceOne, value);
+ field.invokeSetter(classInstanceTwo, value);
+ }
+
+ for (PojoField field : otherFields) {
+ if (field.hasSetter()) {
+ final Object valueOne = RandomFactory.getRandomValue(field);
+ final Object valueTwo = RandomFactory.getRandomValue(field);
+
+ field.invokeSetter(classInstanceOne, valueOne);
+ field.invokeSetter(classInstanceTwo, valueTwo);
+ }
+ }
+
+ Affirm.affirmTrue("Equals test failed for [" + classInstanceOne.getClass().getName() + "]",
+ classInstanceOne.equals(classInstanceTwo));
+
+ Affirm.affirmTrue("Expected true for comparison of the same references ["
+ + classInstanceOne.getClass().getName() + "]", classInstanceOne.equals(classInstanceOne));
+
+ Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]",
+ classInstanceOne.hashCode() == classInstanceTwo.hashCode());
+
+ Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test"));
+ }
+ }
+
+
+ private Set<PojoField> hasIdOrBusinessKey(PojoClass pojoClass) {
+ final Set<PojoField> fields = new HashSet<>();
+
+ fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(BusinessKey.class));
+ final Set<PojoField> temp = new HashSet<>();
+ temp.addAll(pojoClass.getPojoFieldsAnnotatedWith(Id.class));
+ temp.removeAll(pojoClass.getPojoFieldsAnnotatedWith(GeneratedValue.class));
+ fields.addAll(temp);
+ return fields;
+
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
index 6a06834d87..fc9bb388f4 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
@@ -21,51 +21,50 @@
package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anything;
-
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
-
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-
import com.openpojo.reflection.PojoField;
public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
- private final Class<? extends Annotation> annotationType;
- private final Matcher<? super T> annotationMatcher;
+ private final Class<? extends Annotation> annotationType;
+ private final Matcher<? super T> annotationMatcher;
- public HasAnnotationMatcher(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
- this.annotationType = annotationType;
- this.annotationMatcher = annotationMatcher;
- }
+ public HasAnnotationMatcher(final Class<? extends Annotation> annotationType,
+ final Matcher<? super T> annotationMatcher) {
+ this.annotationType = annotationType;
+ this.annotationMatcher = annotationMatcher;
+ }
- @Override
- protected boolean matchesSafely(final PojoField item, final Description mismatchDescription) {
- final Annotation annotation = item.getAnnotation(this.annotationType);
- if (annotation == null) {
- mismatchDescription.appendText("does not have annotation ").appendText(this.annotationType.getName());
- return false;
- }
+ @Override
+ protected boolean matchesSafely(final PojoField item, final Description mismatchDescription) {
+ final Annotation annotation = item.getAnnotation(this.annotationType);
+ if (annotation == null) {
+ mismatchDescription.appendText("does not have annotation ").appendText(this.annotationType.getName());
+ return false;
+ }
- if (!this.annotationMatcher.matches(annotation)) {
- this.annotationMatcher.describeMismatch(annotation, mismatchDescription);
- return false;
- }
+ if (!this.annotationMatcher.matches(annotation)) {
+ this.annotationMatcher.describeMismatch(annotation, mismatchDescription);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override
- public void describeTo(final Description description) {
- // Intentionally left blank.
- }
+ @Override
+ public void describeTo(final Description description) {
+ // Intentionally left blank.
+ }
- public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType) {
- return hasAnnotation(annotationType, anything(""));
- }
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType) {
+ return hasAnnotation(annotationType, anything(""));
+ }
- public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
- return new HasAnnotationMatcher<T>(annotationType, annotationMatcher);
- }
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType,
+ final Matcher<? super T> annotationMatcher) {
+ return new HasAnnotationMatcher<T>(annotationType, annotationMatcher);
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
index f76a27cce2..8a47299c73 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
@@ -25,56 +25,59 @@ package org.onap.so.openpojo.rules;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-
import com.openpojo.reflection.PojoField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
- private Logger logger = LoggerFactory.getLogger(HasAnnotationPropertyWithValueMatcher.class);
- private final String attribute;
- private final Matcher<?> annotationMatcher;
- private final Class<? extends Annotation> annotationClass;
- public HasAnnotationPropertyWithValueMatcher(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) {
- this.attribute = attribute;
- this.annotationMatcher = annotationMatcher;
- this.annotationClass = clazz;
- }
+ private Logger logger = LoggerFactory.getLogger(HasAnnotationPropertyWithValueMatcher.class);
+ private final String attribute;
+ private final Matcher<?> annotationMatcher;
+ private final Class<? extends Annotation> annotationClass;
+
+ public HasAnnotationPropertyWithValueMatcher(Class<? extends Annotation> clazz, String attribute,
+ final Matcher<?> annotationMatcher) {
+ this.attribute = attribute;
+ this.annotationMatcher = annotationMatcher;
+ this.annotationClass = clazz;
+ }
- @Override
- protected boolean matchesSafely(T obj, final Description mismatchDescription) {
- final PojoField temp = (PojoField)obj;
- final Method method;
- try {
- Annotation a = temp.getAnnotation(this.annotationClass);
- if (a == null) {
- mismatchDescription.appendText("does not have annotation ").appendText(this.annotationClass.getSimpleName());
- return false;
- }
- method = a.getClass().getMethod(attribute);
- final Object result = method.invoke(a);
- if (!this.annotationMatcher.matches(result)) {
- this.annotationMatcher.describeMismatch(result, mismatchDescription);
- return false;
- }
- } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- mismatchDescription.appendText("does not have property ").appendText(attribute);
- logger.debug("Error occured", e);
- return false;
- }
- return true;
- }
+ @Override
+ protected boolean matchesSafely(T obj, final Description mismatchDescription) {
+ final PojoField temp = (PojoField) obj;
+ final Method method;
+ try {
+ Annotation a = temp.getAnnotation(this.annotationClass);
+ if (a == null) {
+ mismatchDescription.appendText("does not have annotation ")
+ .appendText(this.annotationClass.getSimpleName());
+ return false;
+ }
+ method = a.getClass().getMethod(attribute);
+ final Object result = method.invoke(a);
+ if (!this.annotationMatcher.matches(result)) {
+ this.annotationMatcher.describeMismatch(result, mismatchDescription);
+ return false;
+ }
+ } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ mismatchDescription.appendText("does not have property ").appendText(attribute);
+ logger.debug("Error occured", e);
+ return false;
+ }
+ return true;
+ }
- @Override
- public void describeTo(final Description description) {
- // Intentionally left blank.
- }
+ @Override
+ public void describeTo(final Description description) {
+ // Intentionally left blank.
+ }
- public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) {
- return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher);
- }
+ public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz,
+ String attribute, final Matcher<?> annotationMatcher) {
+ return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher);
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
index 0c7d6add73..351c5b0977 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
@@ -22,12 +22,9 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
-
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
-
import org.hamcrest.Matcher;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.validation.affirm.Affirm;
import com.openpojo.validation.rule.Rule;
@@ -37,45 +34,46 @@ import com.openpojo.validation.rule.Rule;
*/
public class HasEqualsAndHashCodeRule implements Rule {
- private final Matcher m;
- public HasEqualsAndHashCodeRule() {
- m = anything();
- }
-
- public HasEqualsAndHashCodeRule(Matcher m) {
- this.m = m;
- }
- @Override
- public void evaluate(PojoClass pojoClass) {
- Class<?> clazz = pojoClass.getClazz();
- if (anyOf(m).matches(clazz)) {
- boolean hasEquals = false;
- boolean hasHashCode = false;
- final String name = clazz.getSimpleName();
- final Method[] methods;
- if (clazz.getSuperclass().equals(Object.class)) {
- methods = clazz.getDeclaredMethods();
- } else {
- methods = clazz.getMethods();
- }
- for (Method method : methods) {
- Parameter[] parameters = method.getParameters();
- if ("equals".equals(method.getName()) && boolean.class.equals(method.getReturnType()) && parameters.length == 1 && Object.class.equals(parameters[0].getType())) {
- hasEquals = true;
- } else if ("hashCode".equals(method.getName()) && int.class.equals(method.getReturnType())) {
- hasHashCode = true;
- }
- }
-
- if (!hasEquals) {
- Affirm.fail(String.format(
- "[%s] does not override equals", name));
- }
- if (!hasHashCode) {
- Affirm.fail(String.format(
- "[%s] does not override hashCode", name));
- }
- }
- }
+ private final Matcher m;
+
+ public HasEqualsAndHashCodeRule() {
+ m = anything();
+ }
+
+ public HasEqualsAndHashCodeRule(Matcher m) {
+ this.m = m;
+ }
+
+ @Override
+ public void evaluate(PojoClass pojoClass) {
+ Class<?> clazz = pojoClass.getClazz();
+ if (anyOf(m).matches(clazz)) {
+ boolean hasEquals = false;
+ boolean hasHashCode = false;
+ final String name = clazz.getSimpleName();
+ final Method[] methods;
+ if (clazz.getSuperclass().equals(Object.class)) {
+ methods = clazz.getDeclaredMethods();
+ } else {
+ methods = clazz.getMethods();
+ }
+ for (Method method : methods) {
+ Parameter[] parameters = method.getParameters();
+ if ("equals".equals(method.getName()) && boolean.class.equals(method.getReturnType())
+ && parameters.length == 1 && Object.class.equals(parameters[0].getType())) {
+ hasEquals = true;
+ } else if ("hashCode".equals(method.getName()) && int.class.equals(method.getReturnType())) {
+ hasHashCode = true;
+ }
+ }
+
+ if (!hasEquals) {
+ Affirm.fail(String.format("[%s] does not override equals", name));
+ }
+ if (!hasHashCode) {
+ Affirm.fail(String.format("[%s] does not override hashCode", name));
+ }
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
index 8a4333e0e2..a55863122e 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
@@ -22,51 +22,50 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
-
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
-
import org.hamcrest.Matcher;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.validation.affirm.Affirm;
import com.openpojo.validation.rule.Rule;
public class HasToStringRule implements Rule {
-
- private final Matcher m;
- public HasToStringRule() {
- m = anything();
- }
-
- public HasToStringRule(Matcher m) {
- this.m = m;
- }
- @Override
- public void evaluate(PojoClass pojoClass) {
- Class<?> clazz = pojoClass.getClazz();
- if (anyOf(m).matches(clazz)) {
- boolean hasToString = false;
- final String name = clazz.getSimpleName();
- final Method[] methods;
- if (clazz.getSuperclass().equals(Object.class)) {
- methods = clazz.getDeclaredMethods();
- } else {
- methods = clazz.getMethods();
- }
- for (Method method : methods) {
- Parameter[] parameters = method.getParameters();
- if ("toString".equals(method.getName()) && String.class.equals(method.getReturnType()) && parameters.length == 0) {
- hasToString = true;
- break;
- }
- }
-
- if (!hasToString) {
- Affirm.fail(String.format(
- "[%s] does not override toString", name));
- }
- }
- }
+
+ private final Matcher m;
+
+ public HasToStringRule() {
+ m = anything();
+ }
+
+ public HasToStringRule(Matcher m) {
+ this.m = m;
+ }
+
+ @Override
+ public void evaluate(PojoClass pojoClass) {
+ Class<?> clazz = pojoClass.getClazz();
+ if (anyOf(m).matches(clazz)) {
+ boolean hasToString = false;
+ final String name = clazz.getSimpleName();
+ final Method[] methods;
+ if (clazz.getSuperclass().equals(Object.class)) {
+ methods = clazz.getDeclaredMethods();
+ } else {
+ methods = clazz.getMethods();
+ }
+ for (Method method : methods) {
+ Parameter[] parameters = method.getParameters();
+ if ("toString".equals(method.getName()) && String.class.equals(method.getReturnType())
+ && parameters.length == 0) {
+ hasToString = true;
+ break;
+ }
+ }
+
+ if (!hasToString) {
+ Affirm.fail(String.format("[%s] does not override toString", name));
+ }
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
index ff1a139768..5f1b5b61ba 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
@@ -22,9 +22,7 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
-
import org.hamcrest.Matcher;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.validation.affirm.Affirm;
import com.openpojo.validation.test.Tester;
@@ -32,24 +30,26 @@ import com.openpojo.validation.utils.ValidationHelper;
public class ToStringTester implements Tester {
- private final Matcher m;
- public ToStringTester() {
- m = anything();
- }
-
- public ToStringTester(Matcher m) {
- this.m = m;
- }
-
- @Override
- public void run(PojoClass pojoClass) {
- Class<?> clazz = pojoClass.getClazz();
- if (anyOf(m).matches(clazz)) {
- final Object classInstance = ValidationHelper.getBasicInstance(pojoClass);
-
- Affirm.affirmFalse("Found default toString output", classInstance.toString().matches(Object.class.getName() + "@" + "\\w+"));
- }
-
- }
+ private final Matcher m;
+
+ public ToStringTester() {
+ m = anything();
+ }
+
+ public ToStringTester(Matcher m) {
+ this.m = m;
+ }
+
+ @Override
+ public void run(PojoClass pojoClass) {
+ Class<?> clazz = pojoClass.getClazz();
+ if (anyOf(m).matches(clazz)) {
+ final Object classInstance = ValidationHelper.getBasicInstance(pojoClass);
+
+ Affirm.affirmFalse("Found default toString output",
+ classInstance.toString().matches(Object.class.getName() + "@" + "\\w+"));
+ }
+
+ }
}
diff --git a/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
index 84216af6e8..a7594789bc 100644
--- a/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
+++ b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
@@ -35,17 +35,17 @@ public class MsoDatabaseException extends RuntimeException {
* @param message The message to dump
* @param cause The Throwable cause object
*/
- public MsoDatabaseException (final String message) {
- super (message);
-
+ public MsoDatabaseException(final String message) {
+ super(message);
+
}
-
+
/**
* @param message The message to dump
* @param cause The Throwable cause object
*/
- public MsoDatabaseException (final String message, final Throwable cause) {
- super (message, cause);
-
+ public MsoDatabaseException(final String message, final Throwable cause) {
+ super(message, cause);
+
}
}
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
index a3d16175bc..69046a2eba 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
@@ -87,14 +87,14 @@ public interface HttpRestServiceProvider {
*/
<T> ResponseEntity<T> putHttpRequest(final Object object, final String url, final Class<T> clazz);
- /**
- * Execute the HTTP DELETE to the given URI template
- *
- * @param url the URL
- * @param clazz the type of the return value
- * @return Returns the {@link ResponseEntity}.
- */
- public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz);
+ /**
+ * Execute the HTTP DELETE to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz);
}
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index 029431c86e..8e6ebab43a 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -133,17 +133,18 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
}
}
- @Override
- public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz) {
- try {
- final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
- return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz);
-
- } catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP DELETE using url: " + url, restClientException);
- throw new InvalidRestRequestException("Unable to invoke HTTP DELETE using URL: " + url, restClientException);
+ @Override
+ public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz) {
+ try {
+ final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz);
+
+ } catch (final RestClientException restClientException) {
+ LOGGER.error("Unable to invoke HTTP DELETE using url: " + url, restClientException);
+ throw new InvalidRestRequestException("Unable to invoke HTTP DELETE using URL: " + url,
+ restClientException);
+ }
}
- }
private HttpHeaders getHttpHeaders() {
return httpHeadersProvider.getHttpHeaders();
diff --git a/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
index 82a30f05be..441623a233 100644
--- a/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
+++ b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
@@ -24,11 +24,11 @@ import org.springframework.security.web.firewall.StrictHttpFirewall;
public class MSOSpringFirewall extends StrictHttpFirewall {
-
- public MSOSpringFirewall() {
- super();
- this.setAllowUrlEncodedSlash(true);
- this.setAllowSemicolon(true);
- this.setAllowUrlEncodedPercent(true);
- }
+
+ public MSOSpringFirewall() {
+ super();
+ this.setAllowUrlEncodedSlash(true);
+ this.setAllowSemicolon(true);
+ this.setAllowUrlEncodedPercent(true);
+ }
}
diff --git a/common/src/main/java/org/onap/so/security/UserCredentials.java b/common/src/main/java/org/onap/so/security/UserCredentials.java
index f411789e00..d446af36d9 100644
--- a/common/src/main/java/org/onap/so/security/UserCredentials.java
+++ b/common/src/main/java/org/onap/so/security/UserCredentials.java
@@ -22,32 +22,32 @@ package org.onap.so.security;
public class UserCredentials {
- private String username;
- private String password;
- private String role;
+ private String username;
+ private String password;
+ private String role;
- public String getUsername() {
- return username;
- }
+ public String getUsername() {
+ return username;
+ }
- public void setUsername(String username) {
- this.username = username;
- }
+ public void setUsername(String username) {
+ this.username = username;
+ }
- public String getPassword() {
- return password;
- }
+ public String getPassword() {
+ return password;
+ }
- public void setPassword(String password) {
- this.password = password;
- }
+ public void setPassword(String password) {
+ this.password = password;
+ }
- public String getRole() {
- return role;
- }
+ public String getRole() {
+ return role;
+ }
- public void setRole(String role) {
- this.role = role;
- }
+ public void setRole(String role) {
+ this.role = role;
+ }
}
diff --git a/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
index 90d484ebf4..91d5d7e612 100644
--- a/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
+++ b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
@@ -30,27 +30,27 @@ import java.util.List;
@ConfigurationProperties(prefix = "spring.security")
public class UserDetailsServiceImpl implements UserDetailsService {
- private List<UserCredentials> usercredentials;
+ private List<UserCredentials> usercredentials;
- public List<UserCredentials> getUsercredentials() {
- return usercredentials;
- }
+ public List<UserCredentials> getUsercredentials() {
+ return usercredentials;
+ }
- public void setUsercredentials(List<UserCredentials> usercredentials) {
- this.usercredentials = usercredentials;
- }
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.usercredentials = usercredentials;
+ }
- @Override
- public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+ @Override
+ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
- for (int i = 0; usercredentials != null && i < usercredentials.size(); i++) {
- if (usercredentials.get(i).getUsername().equals(username)) {
- return User.withUsername(username).password(usercredentials.get(i).getPassword())
- .roles(usercredentials.get(i).getRole()).build();
- }
- }
+ for (int i = 0; usercredentials != null && i < usercredentials.size(); i++) {
+ if (usercredentials.get(i).getUsername().equals(username)) {
+ return User.withUsername(username).password(usercredentials.get(i).getPassword())
+ .roles(usercredentials.get(i).getRole()).build();
+ }
+ }
- throw new UsernameNotFoundException("User not found, username: " + username);
- }
+ throw new UsernameNotFoundException("User not found, username: " + username);
+ }
}
diff --git a/common/src/main/java/org/onap/so/security/WebSecurityConfig.java b/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
index 11eec46f41..635784c642 100644
--- a/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
+++ b/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
@@ -22,9 +22,7 @@ package org.onap.so.security;
import java.util.ArrayList;
import java.util.List;
-
import javax.annotation.PostConstruct;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -35,42 +33,42 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@ConfigurationProperties(prefix = "spring.security")
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
-
- private List<UserCredentials> credentials;
- private List<String> roles = new ArrayList<>();
- public List<String> getRoles() {
- return roles;
- }
+ private List<UserCredentials> credentials;
+ private List<String> roles = new ArrayList<>();
+
+ public List<String> getRoles() {
+ return roles;
+ }
+
+ @PostConstruct
+ private void addRoles() {
+ for (int i = 0; i < credentials.size(); i++) {
+ roles.add(credentials.get(i).getRole());
+ }
+ }
- @PostConstruct
- private void addRoles() {
- for(int i=0; i <credentials.size(); i++) {
- roles.add(credentials.get(i).getRole());
- }
- }
-
- public List<UserCredentials> getUsercredentials() {
- return credentials;
- }
+ public List<UserCredentials> getUsercredentials() {
+ return credentials;
+ }
- public void setUsercredentials(List<UserCredentials> usercredentials) {
- this.credentials = usercredentials;
- }
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.credentials = usercredentials;
+ }
- @Bean
- public UserDetailsService userDetailsService() {
- return new UserDetailsServiceImpl();
- }
+ @Bean
+ public UserDetailsService userDetailsService() {
+ return new UserDetailsServiceImpl();
+ }
- @Bean
- public BCryptPasswordEncoder passwordEncoder() {
- return new BCryptPasswordEncoder();
- }
+ @Bean
+ public BCryptPasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
- @Override
- protected void configure(AuthenticationManagerBuilder auth) throws Exception {
- auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
- }
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index 67d852eff8..4a284b55ec 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
@@ -21,9 +21,7 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import org.onap.so.constants.Defaults;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -34,22 +32,20 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_EMPTY)
public class CloudConfiguration implements Serializable {
- private static final long serialVersionUID = 6260165690180745471L;
- @JsonProperty("aicNodeClli")
+ private static final long serialVersionUID = 6260165690180745471L;
+ @JsonProperty("aicNodeClli")
protected String aicNodeClli;
- @JsonProperty("tenantId")
+ @JsonProperty("tenantId")
protected String tenantId;
- @JsonProperty("cloudOwner")
- protected String cloudOwner = Defaults.CLOUD_OWNER.toString();
- @JsonProperty("lcpCloudRegionId")
+ @JsonProperty("cloudOwner")
+ protected String cloudOwner = Defaults.CLOUD_OWNER.toString();
+ @JsonProperty("lcpCloudRegionId")
protected String lcpCloudRegionId;
/**
* Gets the value of the aicNodeClli property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getAicNodeClli() {
@@ -59,9 +55,7 @@ public class CloudConfiguration implements Serializable {
/**
* Sets the value of the aicNodeClli property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setAicNodeClli(String value) {
@@ -71,9 +65,7 @@ public class CloudConfiguration implements Serializable {
/**
* Gets the value of the tenantId property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getTenantId() {
@@ -83,9 +75,7 @@ public class CloudConfiguration implements Serializable {
/**
* Sets the value of the tenantId property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setTenantId(String value) {
@@ -93,27 +83,27 @@ public class CloudConfiguration implements Serializable {
}
- public String getLcpCloudRegionId() {
- return lcpCloudRegionId;
- }
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
- public void setLcpCloudRegionId(String lcpCloudRegionId) {
- this.lcpCloudRegionId = lcpCloudRegionId;
- }
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
- public String getCloudOwner() {
- return cloudOwner;
- }
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
+ }
- public void setCloudOwner(String cloudOwner) {
- this.cloudOwner = cloudOwner;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
- .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
- }
-
-
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
index e5d586f165..b85e80a670 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
@@ -19,10 +19,10 @@
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.05.03 at 03:56:30 PM CDT
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.05.03 at 03:56:30 PM CDT
//
@@ -30,20 +30,20 @@ package org.onap.so.serviceinstancebeans;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
-
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
- * <p>Java class for exceptionType complex type.
+ * <p>
+ * Java class for exceptionType complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="exceptionType">
@@ -62,15 +62,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "exceptionType", propOrder = {
- "messageId",
- "text",
- "variables"
-})
-@XmlSeeAlso({
- ServiceException.class,
- PolicyException.class
-})
+@XmlType(name = "exceptionType", propOrder = {"messageId", "text", "variables"})
+@XmlSeeAlso({ServiceException.class, PolicyException.class})
public class ExceptionType {
@XmlElement(required = true)
@@ -82,10 +75,8 @@ public class ExceptionType {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -94,10 +85,8 @@ public class ExceptionType {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -106,10 +95,8 @@ public class ExceptionType {
/**
* Gets the value of the text property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getText() {
return text;
@@ -118,10 +105,8 @@ public class ExceptionType {
/**
* Sets the value of the text property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setText(String value) {
this.text = value;
@@ -131,21 +116,20 @@ public class ExceptionType {
* Gets the value of the variables property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the variables property.
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the variables property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getVariables().add(newItem);
+ * getVariables().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
+ * Objects of the following type(s) are allowed in the list {@link String }
*
*
*/
@@ -156,13 +140,13 @@ public class ExceptionType {
return this.variables;
}
- public void setVariables(List<String> variables) {
- this.variables = variables;
- }
+ public void setVariables(List<String> variables) {
+ this.variables = variables;
+ }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("messageId", messageId).append("text", text)
- .append("variables", variables).toString();
- }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("messageId", messageId).append("text", text)
+ .append("variables", variables).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
index 7be03e635f..b1087b6e8e 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -21,27 +21,26 @@
package org.onap.so.serviceinstancebeans;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
public class GetOrchestrationListResponse {
-
- protected List<RequestList> requestList;
- public List<RequestList> getRequestList() {
- return requestList;
- }
+ protected List<RequestList> requestList;
+
+ public List<RequestList> getRequestList() {
+ return requestList;
+ }
- public void setRequestList(List<RequestList> requestList) {
- this.requestList = requestList;
- }
+ public void setRequestList(List<RequestList> requestList) {
+ this.requestList = requestList;
+ }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("requestList", requestList).toString();
- }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestList", requestList).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
index 788cdd973d..53ce3884e9 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
@@ -27,21 +27,21 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@JsonInclude(Include.NON_DEFAULT)
public class GetOrchestrationResponse {
-
- protected Request request;
- public Request getRequest() {
- return request;
- }
+ protected Request request;
- public void setRequest(Request request) {
- this.request = request;
- }
+ public Request getRequest() {
+ return request;
+ }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("request", request).toString();
- }
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("request", request).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
index ad796b21f9..2e65919d3b 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
@@ -22,8 +22,7 @@ package org.onap.so.serviceinstancebeans;
public enum InstanceDirection {
- source,
- destination;
+ source, destination;
public String value() {
return name();
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
index 72374e0580..5bff780c4c 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
@@ -21,118 +21,141 @@
package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonInclude(Include.NON_DEFAULT)
public class InstanceReferences {
- protected String serviceInstanceId;
- protected String serviceInstanceName;
- protected String vnfInstanceId;
- protected String vnfInstanceName;
- protected String vfModuleInstanceId;
- protected String vfModuleInstanceName;
- protected String volumeGroupInstanceId;
- protected String volumeGroupInstanceName;
- protected String networkInstanceId;
- protected String networkInstanceName;
- protected String requestorId;
- protected String instanceGroupId;
- protected String instanceGroupName;
-
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getVnfInstanceId() {
- return vnfInstanceId;
- }
- public void setVnfInstanceId(String vnfInstanceId) {
- this.vnfInstanceId = vnfInstanceId;
- }
- public String getVnfInstanceName() {
- return vnfInstanceName;
- }
- public void setVnfInstanceName(String vnfInstanceName) {
- this.vnfInstanceName = vnfInstanceName;
- }
- public String getVfModuleInstanceId() {
- return vfModuleInstanceId;
- }
- public void setVfModuleInstanceId(String vfModuleInstanceId) {
- this.vfModuleInstanceId = vfModuleInstanceId;
- }
- public String getVfModuleInstanceName() {
- return vfModuleInstanceName;
- }
- public void setVfModuleInstanceName(String vfModuleInstanceName) {
- this.vfModuleInstanceName = vfModuleInstanceName;
- }
- public String getVolumeGroupInstanceId() {
- return volumeGroupInstanceId;
- }
- public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
- this.volumeGroupInstanceId = volumeGroupInstanceId;
- }
- public String getVolumeGroupInstanceName() {
- return volumeGroupInstanceName;
- }
- public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
- this.volumeGroupInstanceName = volumeGroupInstanceName;
- }
- public String getNetworkInstanceId() {
- return networkInstanceId;
- }
- public void setNetworkInstanceId(String networkInstanceId) {
- this.networkInstanceId = networkInstanceId;
- }
- public String getNetworkInstanceName() {
- return networkInstanceName;
- }
- public void setNetworkInstanceName(String networkInstanceName) {
- this.networkInstanceName = networkInstanceName;
- }
-
- public String getRequestorId() {
- return requestorId;
- }
-
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
- public String getInstanceGroupId() {
- return instanceGroupId;
- }
- public void setInstanceGroupId(String instanceGroupId) {
- this.instanceGroupId = instanceGroupId;
- }
- public String getInstanceGroupName() {
- return instanceGroupName;
- }
- public void setInstanceGroupName(String instanceGroupName) {
- this.instanceGroupName = instanceGroupName;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
- .append("serviceInstanceName", serviceInstanceName).append("vnfInstanceId", vnfInstanceId)
- .append("vnfInstanceName", vnfInstanceName).append("vfModuleInstanceId", vfModuleInstanceId)
- .append("vfModuleInstanceName", vfModuleInstanceName)
- .append("volumeGroupInstanceId", volumeGroupInstanceId)
- .append("volumeGroupInstanceName", volumeGroupInstanceName)
- .append("networkInstanceId", networkInstanceId).append("networkInstanceName", networkInstanceName)
- .append("requestorId", requestorId).append("instanceGroupId", instanceGroupId)
- .append("instanceGroupName", instanceGroupName).toString();
- }
+ protected String serviceInstanceId;
+ protected String serviceInstanceName;
+ protected String vnfInstanceId;
+ protected String vnfInstanceName;
+ protected String vfModuleInstanceId;
+ protected String vfModuleInstanceName;
+ protected String volumeGroupInstanceId;
+ protected String volumeGroupInstanceName;
+ protected String networkInstanceId;
+ protected String networkInstanceName;
+ protected String requestorId;
+ protected String instanceGroupId;
+ protected String instanceGroupName;
+
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+
+ public String getVfModuleInstanceName() {
+ return vfModuleInstanceName;
+ }
+
+ public void setVfModuleInstanceName(String vfModuleInstanceName) {
+ this.vfModuleInstanceName = vfModuleInstanceName;
+ }
+
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+
+ public String getNetworkInstanceName() {
+ return networkInstanceName;
+ }
+
+ public void setNetworkInstanceName(String networkInstanceName) {
+ this.networkInstanceName = networkInstanceName;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ public void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
+
+ public String getInstanceGroupName() {
+ return instanceGroupName;
+ }
+
+ public void setInstanceGroupName(String instanceGroupName) {
+ this.instanceGroupName = instanceGroupName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
+ .append("serviceInstanceName", serviceInstanceName).append("vnfInstanceId", vnfInstanceId)
+ .append("vnfInstanceName", vnfInstanceName).append("vfModuleInstanceId", vfModuleInstanceId)
+ .append("vfModuleInstanceName", vfModuleInstanceName)
+ .append("volumeGroupInstanceId", volumeGroupInstanceId)
+ .append("volumeGroupInstanceName", volumeGroupInstanceName)
+ .append("networkInstanceId", networkInstanceId).append("networkInstanceName", networkInstanceName)
+ .append("requestorId", requestorId).append("instanceGroupId", instanceGroupId)
+ .append("instanceGroupName", instanceGroupName).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
index 27bc0e84a4..35428106b8 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,19 +30,21 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonRootName(value = "lineOfBusiness")
@JsonInclude(Include.NON_DEFAULT)
public class LineOfBusiness implements Serializable {
-
- private static final long serialVersionUID = -8574860788160041209L;
- @JsonProperty("lineOfBusinessName")
- private String lineOfBusinessName;
-
- public String getLineOfBusinessName(){
- return lineOfBusinessName;
- }
- public void setLineOfBusinessName(String value){
- this.lineOfBusinessName = value;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("lineOfBusinessName", lineOfBusinessName).toString();
- }
+
+ private static final long serialVersionUID = -8574860788160041209L;
+ @JsonProperty("lineOfBusinessName")
+ private String lineOfBusinessName;
+
+ public String getLineOfBusinessName() {
+ return lineOfBusinessName;
+ }
+
+ public void setLineOfBusinessName(String value) {
+ this.lineOfBusinessName = value;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("lineOfBusinessName", lineOfBusinessName).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
index 6976fb6791..946deefee7 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
@@ -29,7 +29,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -39,131 +38,157 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_DEFAULT)
public class ModelInfo implements Serializable {
- private static final long serialVersionUID = 5281763573935476852L;
- @JsonProperty("modelCustomizationName")
+ private static final long serialVersionUID = 5281763573935476852L;
+ @JsonProperty("modelCustomizationName")
protected String modelCustomizationName;
- @JsonProperty("modelInvariantId")
+ @JsonProperty("modelInvariantId")
protected String modelInvariantId;
- @JsonProperty("modelType")
- protected ModelType modelType;
- @JsonProperty("modelId")
- protected String modelId;
- //v2
- @JsonProperty("modelNameVersionId")
+ @JsonProperty("modelType")
+ protected ModelType modelType;
+ @JsonProperty("modelId")
+ protected String modelId;
+ // v2
+ @JsonProperty("modelNameVersionId")
protected String modelNameVersionId;
- @JsonProperty("modelName")
+ @JsonProperty("modelName")
protected String modelName;
- @JsonProperty("modelVersion")
+ @JsonProperty("modelVersion")
protected String modelVersion;
- @JsonProperty("modelCustomizationUuid")
+ @JsonProperty("modelCustomizationUuid")
protected String modelCustomizationUuid;
- //v3
- @JsonProperty("modelVersionId")
+ // v3
+ @JsonProperty("modelVersionId")
protected String modelVersionId;
- @JsonProperty("modelCustomizationId")
+ @JsonProperty("modelCustomizationId")
protected String modelCustomizationId;
-
- //Decomposition fields
- @JsonProperty("modelUuid")
+
+ // Decomposition fields
+ @JsonProperty("modelUuid")
protected String modelUuid;
- @JsonProperty("modelInvariantUuid")
- protected String modelInvariantUuid;
- @JsonProperty("modelInstanceName")
+ @JsonProperty("modelInvariantUuid")
+ protected String modelInvariantUuid;
+ @JsonProperty("modelInstanceName")
protected String modelInstanceName;
- public String getModelCustomizationName() {
- return modelCustomizationName;
- }
- public void setModelCustomizationName(String modelCustomizationName) {
- modelInstanceName = modelCustomizationName;
- this.modelCustomizationName = modelCustomizationName;
- }
- public String getModelNameVersionId() {
- return modelNameVersionId;
- }
- public void setModelNameVersionId(String modelNameVersionId) {
- this.modelNameVersionId = modelNameVersionId;
- }
- public String getModelName() {
- return modelName;
- }
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
- public String getModelVersion() {
- return modelVersion;
- }
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
- public ModelType getModelType() {
- return modelType;
- }
- public void setModelType(ModelType modelType) {
- this.modelType = modelType;
- }
- public String getModelInvariantId() {
- return modelInvariantId;
- }
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantUuid = modelInvariantId;
- this.modelInvariantId = modelInvariantId;
- }
- public String getModelCustomizationUuid() {
- return modelCustomizationUuid;
- }
- public void setModelCustomizationUuid(String modelCustomizationUuid) {
- this.modelCustomizationUuid = modelCustomizationUuid;
- }
- public String getModelVersionId() {
- return modelVersionId;
- }
- public void setModelVersionId(String modelVersionId) {
- this.modelUuid=modelVersionId;
- this.modelVersionId = modelVersionId;
- }
- public String getModelCustomizationId() {
- return modelCustomizationId;
- }
- public void setModelCustomizationId(String modelCustomizationId) {
- this.modelCustomizationUuid = modelCustomizationId;
- this.modelCustomizationId = modelCustomizationId;
- }
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ public void setModelCustomizationName(String modelCustomizationName) {
+ modelInstanceName = modelCustomizationName;
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public String getModelNameVersionId() {
+ return modelNameVersionId;
+ }
+
+ public void setModelNameVersionId(String modelNameVersionId) {
+ this.modelNameVersionId = modelNameVersionId;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public ModelType getModelType() {
+ return modelType;
+ }
+
+ public void setModelType(ModelType modelType) {
+ this.modelType = modelType;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantUuid = modelInvariantId;
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelCustomizationUuid() {
+ return modelCustomizationUuid;
+ }
+
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelUuid = modelVersionId;
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationUuid = modelCustomizationId;
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
public String getModelUuid() {
- return modelUuid;
- }
+ return modelUuid;
+ }
+
public String getModelId() {
- return modelId;
- }
- public void setModelUuid(String modelUuid) {
- this.modelId = modelUuid;
- this.modelUuid = modelUuid;
-
- }
- public void setModelId(String modelId) {
- this.modelId = modelId;
- }
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
- public String getModelInstanceName() {
- return modelInstanceName;
- }
- public void setModelInstanceName(String modelInstanceName) {
- this.modelInstanceName = modelInstanceName;
- }
- @Override
- public String toString() {
- return "ModelInfo [modelCustomizationName=" + modelCustomizationName + ", modelInvariantId=" + modelInvariantId
- + ", modelType=" + modelType + ", modelNameVersionId=" + modelNameVersionId + ", modelName=" + modelName
- + ", modelVersion=" + modelVersion + ", modelCustomizationUuid=" + modelCustomizationUuid
- + ", modelVersionId=" + modelVersionId + ", modelCustomizationId=" + modelCustomizationId
- + ", modelUuid=" + modelUuid + ", modelInvariantUuid=" + modelInvariantUuid + ", modelInstanceName="
- + modelInstanceName + "]";
- }
-
-
-} \ No newline at end of file
+ return modelId;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelId = modelUuid;
+ this.modelUuid = modelUuid;
+
+ }
+
+ public void setModelId(String modelId) {
+ this.modelId = modelId;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ @Override
+ public String toString() {
+ return "ModelInfo [modelCustomizationName=" + modelCustomizationName + ", modelInvariantId=" + modelInvariantId
+ + ", modelType=" + modelType + ", modelNameVersionId=" + modelNameVersionId + ", modelName=" + modelName
+ + ", modelVersion=" + modelVersion + ", modelCustomizationUuid=" + modelCustomizationUuid
+ + ", modelVersionId=" + modelVersionId + ", modelCustomizationId=" + modelCustomizationId
+ + ", modelUuid=" + modelUuid + ", modelInvariantUuid=" + modelInvariantUuid + ", modelInstanceName="
+ + modelInstanceName + "]";
+ }
+
+
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
index 754a70ee94..9a184b0a51 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
@@ -22,16 +22,7 @@ package org.onap.so.serviceinstancebeans;
/*
* Enum for Model Type values returned by API Handler to BPMN
-*/
+ */
public enum ModelType {
- service,
- vnf,
- vfModule,
- volumeGroup,
- network,
- configuration,
- connectionPoint,
- pnf,
- networkInstanceGroup,
- instanceGroup
+ service, vnf, vfModule, volumeGroup, network, configuration, connectionPoint, pnf, networkInstanceGroup, instanceGroup
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
index 386078a60b..8f795df654 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,66 +32,64 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonRootName(value = "networks")
@JsonInclude(Include.NON_DEFAULT)
-public class Networks implements Serializable{
-
- private static final long serialVersionUID = 8081495240474276501L;
- @JsonProperty("modelInfo")
- protected ModelInfo modelInfo;
- @JsonProperty("cloudConfiguration")
- protected CloudConfiguration cloudConfiguration;
- @JsonProperty("instanceName")
- protected String instanceName;
- @JsonProperty("productFamilyId")
- protected String productFamilyId;
- @JsonProperty("instanceParams")
- private List<Map<String, String>> instanceParams = new ArrayList<>();
-
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public String getProductFamilyId() {
- return productFamilyId;
- }
-
- public void setProductFamilyId(String productFamilyId) {
- this.productFamilyId = productFamilyId;
- }
-
- public List<Map<String, String>> getInstanceParams() {
- return instanceParams;
- }
-
- public void setInstanceParams(List<Map<String, String>> instanceParams) {
- this.instanceParams = instanceParams;
- }
-
- @Override
- public String toString() {
- return "Networks [modelInfo=" + modelInfo +
- ", cloudConfiguration=" + cloudConfiguration +
- ", instanceName=" + instanceName + ", productFamilyId=" + productFamilyId +
- ", instanceParams=" + instanceParams + "]";
- }
-
-} \ No newline at end of file
+public class Networks implements Serializable {
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "Networks [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
+ + instanceName + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + "]";
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
index f552554ad4..276706d257 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,31 +29,31 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "owningEntity")
@JsonInclude(Include.NON_DEFAULT)
public class OwningEntity implements Serializable {
-
- private static final long serialVersionUID = -3907033130633428448L;
- @JsonProperty("owningEntityId")
- private String owningEntityId;
- @JsonProperty("owningEntityName")
- private String owningEntityName;
-
- public String getOwningEntityId(){
- return owningEntityId;
- }
-
- public void setOwningEntityId(String value) {
- this.owningEntityId = value;
- }
-
- public String getOwningEntityName(){
- return owningEntityName;
- }
-
- public void setOwningEntityName(String value){
- this.owningEntityName = value;
- }
- @Override
- public String toString() {
- return "OwningEntity [owningEntityId=" + owningEntityId
- + ", owningEntityName=" + owningEntityName + "]";
- }
+
+ private static final long serialVersionUID = -3907033130633428448L;
+ @JsonProperty("owningEntityId")
+ private String owningEntityId;
+ @JsonProperty("owningEntityName")
+ private String owningEntityName;
+
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+
+ public void setOwningEntityId(String value) {
+ this.owningEntityId = value;
+ }
+
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+
+ public void setOwningEntityName(String value) {
+ this.owningEntityName = value;
+ }
+
+ @Override
+ public String toString() {
+ return "OwningEntity [owningEntityId=" + owningEntityId + ", owningEntityName=" + owningEntityName + "]";
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
index 961062299f..8c4b99fd70 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,19 +30,21 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
@JsonRootName(value = "platform")
public class Platform implements Serializable {
-
- private static final long serialVersionUID = -7334479240678605536L;
- @JsonProperty("platformName")
- private String platformName;
-
- public String getPlatformName(){
- return platformName;
- }
- public void setPlatformName(String value){
- this.platformName = value;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("platformName", platformName).toString();
- }
+
+ private static final long serialVersionUID = -7334479240678605536L;
+ @JsonProperty("platformName")
+ private String platformName;
+
+ public String getPlatformName() {
+ return platformName;
+ }
+
+ public void setPlatformName(String value) {
+ this.platformName = value;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("platformName", platformName).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
index 263089e5c1..db0ce233c3 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
@@ -19,10 +19,10 @@
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.03.30 at 02:48:23 PM CDT
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.03.30 at 02:48:23 PM CDT
//
@@ -34,9 +34,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for policyException complex type.
+ * <p>
+ * Java class for policyException complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="policyException">
@@ -51,9 +53,7 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "policyException")
-public class PolicyException
- extends ExceptionType
-{
+public class PolicyException extends ExceptionType {
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
index 47bd2bb802..e7db88921f 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,21 +30,21 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonRootName(value = "project")
@JsonInclude(Include.NON_DEFAULT)
public class Project implements Serializable {
-
- private static final long serialVersionUID = -3868114191925177035L;
- @JsonProperty("projectName")
- private String projectName;
-
- public String getProjectName(){
- return projectName;
- }
- public void setProjectName(String value) {
- this.projectName = value;
- }
+ private static final long serialVersionUID = -3868114191925177035L;
+ @JsonProperty("projectName")
+ private String projectName;
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String value) {
+ this.projectName = value;
+ }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("projectName", projectName).toString();
- }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("projectName", projectName).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
index cfdba18fe1..a6a679d42f 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,46 +30,54 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonRootName(value = "relatedInstance")
@JsonInclude(Include.NON_DEFAULT)
public class RelatedInstance implements Serializable {
-
- private static final long serialVersionUID = 137250604008221644L;
- @JsonProperty("instanceName")
- protected String instanceName;
- @JsonProperty("instanceId")
- protected String instanceId;
- @JsonProperty("modelInfo")
- protected ModelInfo modelInfo;
- //Configuration field
- @JsonProperty("instanceDirection")
- protected InstanceDirection instanceDirection;
-
-
- public String getInstanceName() {
- return instanceName;
- }
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
- public String getInstanceId() {
- return instanceId;
- }
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
- public InstanceDirection getInstanceDirection() {
- return instanceDirection;
- }
- public void setInstanceDirection(InstanceDirection instanceDirection) {
- this.instanceDirection = instanceDirection;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("instanceName", instanceName).append("instanceId", instanceId)
- .append("modelInfo", modelInfo).append("instanceDirection", instanceDirection).toString();
- }
+
+ private static final long serialVersionUID = 137250604008221644L;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceId")
+ protected String instanceId;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ // Configuration field
+ @JsonProperty("instanceDirection")
+ protected InstanceDirection instanceDirection;
+
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public InstanceDirection getInstanceDirection() {
+ return instanceDirection;
+ }
+
+ public void setInstanceDirection(InstanceDirection instanceDirection) {
+ this.instanceDirection = instanceDirection;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("instanceName", instanceName).append("instanceId", instanceId)
+ .append("modelInfo", modelInfo).append("instanceDirection", instanceDirection).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
index 9d10865e24..7a545cf9fb 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,22 +30,22 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_DEFAULT)
public class RelatedInstanceList implements Serializable {
- private static final long serialVersionUID = 6333898302094446243L;
- @JsonProperty("relatedInstance")
- protected RelatedInstance relatedInstance;
+ private static final long serialVersionUID = 6333898302094446243L;
+ @JsonProperty("relatedInstance")
+ protected RelatedInstance relatedInstance;
- public RelatedInstance getRelatedInstance() {
- return relatedInstance;
- }
+ public RelatedInstance getRelatedInstance() {
+ return relatedInstance;
+ }
- public void setRelatedInstance(RelatedInstance relatedInstance) {
- this.relatedInstance = relatedInstance;
- }
+ public void setRelatedInstance(RelatedInstance relatedInstance) {
+ this.relatedInstance = relatedInstance;
+ }
- @Override
- public String toString() {
- return "RelatedInstanceList [relatedInstance=" + relatedInstance + "]";
- }
+ @Override
+ public String toString() {
+ return "RelatedInstanceList [relatedInstance=" + relatedInstance + "]";
+ }
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index d39efddf43..8635af5b94 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -21,9 +21,7 @@
package org.onap.so.serviceinstancebeans;
import java.util.List;
-
import org.apache.commons.lang3.builder.ToStringBuilder;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -40,67 +38,86 @@ public class Request {
protected InstanceReferences instanceReferences;
protected RequestStatus requestStatus;
protected List<RequestProcessingData> requestProcessingData;
-
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getStartTime() {
- return startTime;
- }
- public void setStartTime(String startTime) {
- this.startTime = startTime;
- }
- public String getFinishTime() {
- return finishTime;
- }
- public void setFinishTime(String finishTime) {
- this.finishTime = finishTime;
- }
- public String getRequestScope() {
- return requestScope;
- }
- public void setRequestScope(String requestScope) {
- this.requestScope = requestScope;
- }
- public String getRequestType() {
- return requestType;
- }
- public void setRequestType(String requestType) {
- this.requestType = requestType;
- }
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
- public InstanceReferences getInstanceReferences() {
- return instanceReferences;
- }
- public void setInstanceReferences(InstanceReferences instanceReferences) {
- this.instanceReferences = instanceReferences;
- }
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
- public List<RequestProcessingData> getRequestProcessingData() {
- return requestProcessingData;
- }
- public void setRequestProcessingData(List<RequestProcessingData> requestProcessingData) {
- this.requestProcessingData = requestProcessingData;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime)
- .append("finishTime", finishTime).append("requestScope", requestScope).append("requestType", requestType)
- .append("requestDetails", requestDetails).append("instanceReferences", instanceReferences)
- .append("requestStatus", requestStatus).append("requestProcessingData", requestProcessingData).toString();
- }
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getFinishTime() {
+ return finishTime;
+ }
+
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public InstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+
+ public void setInstanceReferences(InstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public List<RequestProcessingData> getRequestProcessingData() {
+ return requestProcessingData;
+ }
+
+ public void setRequestProcessingData(List<RequestProcessingData> requestProcessingData) {
+ this.requestProcessingData = requestProcessingData;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime)
+ .append("finishTime", finishTime).append("requestScope", requestScope)
+ .append("requestType", requestType).append("requestDetails", requestDetails)
+ .append("instanceReferences", instanceReferences).append("requestStatus", requestStatus)
+ .append("requestProcessingData", requestProcessingData).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
index 0364043e8e..9cee8f772e 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -35,39 +34,37 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_DEFAULT)
public class RequestDetails implements Serializable {
- private static final long serialVersionUID = -73080684945860609L;
- @JsonProperty("modelInfo")
+ private static final long serialVersionUID = -73080684945860609L;
+ @JsonProperty("modelInfo")
protected ModelInfo modelInfo;
- @JsonProperty("requestInfo")
+ @JsonProperty("requestInfo")
protected RequestInfo requestInfo;
- @JsonProperty("relatedInstanceList")
+ @JsonProperty("relatedInstanceList")
protected RelatedInstanceList[] relatedInstanceList;
- @JsonProperty("subscriberInfo")
+ @JsonProperty("subscriberInfo")
protected SubscriberInfo subscriberInfo;
- @JsonProperty("cloudConfiguration")
+ @JsonProperty("cloudConfiguration")
protected CloudConfiguration cloudConfiguration;
- @JsonProperty("requestParameters")
+ @JsonProperty("requestParameters")
protected RequestParameters requestParameters;
- @JsonProperty("project")
+ @JsonProperty("project")
protected Project project;
- @JsonProperty("owningEntity")
+ @JsonProperty("owningEntity")
protected OwningEntity owningEntity;
- @JsonProperty("platform")
+ @JsonProperty("platform")
protected Platform platform;
- @JsonProperty("lineOfBusiness")
+ @JsonProperty("lineOfBusiness")
protected LineOfBusiness lineOfBusiness;
- @JsonProperty("instanceName")
- private List<Map<String, String>> instanceName = new ArrayList<>();
- @JsonProperty("configurationParameters")
- protected List<Map<String, String>> configurationParameters = new ArrayList<>();
-
+ @JsonProperty("instanceName")
+ private List<Map<String, String>> instanceName = new ArrayList<>();
+ @JsonProperty("configurationParameters")
+ protected List<Map<String, String>> configurationParameters = new ArrayList<>();
+
- /**
+ /**
* Gets the value of the serviceInfo property.
*
- * @return
- * possible object is
- * {@link ModelInfo }
+ * @return possible object is {@link ModelInfo }
*
*/
public ModelInfo getModelInfo() {
@@ -77,9 +74,7 @@ public class RequestDetails implements Serializable {
/**
* Sets the value of the serviceInfo property.
*
- * @param value
- * allowed object is
- * {@link ModelInfo }
+ * @param value allowed object is {@link ModelInfo }
*
*/
public void setModelInfo(ModelInfo value) {
@@ -89,9 +84,7 @@ public class RequestDetails implements Serializable {
/**
* Gets the value of the requestInfo property.
*
- * @return
- * possible object is
- * {@link RequestInfo }
+ * @return possible object is {@link RequestInfo }
*
*/
public RequestInfo getRequestInfo() {
@@ -101,9 +94,7 @@ public class RequestDetails implements Serializable {
/**
* Sets the value of the requestInfo property.
*
- * @param value
- * allowed object is
- * {@link RequestInfo }
+ * @param value allowed object is {@link RequestInfo }
*
*/
public void setRequestInfo(RequestInfo value) {
@@ -113,9 +104,7 @@ public class RequestDetails implements Serializable {
/**
* Gets the value of the subscriberInfo property.
*
- * @return
- * possible object is
- * {@link SubscriberInfo }
+ * @return possible object is {@link SubscriberInfo }
*
*/
public SubscriberInfo getSubscriberInfo() {
@@ -125,9 +114,7 @@ public class RequestDetails implements Serializable {
/**
* Sets the value of the subscriberInfo property.
*
- * @param value
- * allowed object is
- * {@link SubscriberInfo }
+ * @param value allowed object is {@link SubscriberInfo }
*
*/
public void setSubscriberInfo(SubscriberInfo value) {
@@ -137,9 +124,7 @@ public class RequestDetails implements Serializable {
/**
* Gets the value of the cloudConfiguration property.
*
- * @return
- * possible object is
- * {@link CloudConfiguration }
+ * @return possible object is {@link CloudConfiguration }
*
*/
public CloudConfiguration getCloudConfiguration() {
@@ -149,9 +134,7 @@ public class RequestDetails implements Serializable {
/**
* Sets the value of the cloudConfiguration property.
*
- * @param value
- * allowed object is
- * {@link CloudConfiguration }
+ * @param value allowed object is {@link CloudConfiguration }
*
*/
public void setCloudConfiguration(CloudConfiguration value) {
@@ -161,9 +144,7 @@ public class RequestDetails implements Serializable {
/**
* Gets the value of the requestParameters property.
*
- * @return
- * possible object is
- * {@link RequestParameters }
+ * @return possible object is {@link RequestParameters }
*
*/
public RequestParameters getRequestParameters() {
@@ -173,139 +154,132 @@ public class RequestDetails implements Serializable {
/**
* Sets the value of the requestParameters property.
*
- * @param value
- * allowed object is
- * {@link RequestParameters }
+ * @param value allowed object is {@link RequestParameters }
*
*/
public void setRequestParameters(RequestParameters value) {
this.requestParameters = value;
}
- public RelatedInstanceList[] getRelatedInstanceList() {
- return relatedInstanceList;
- }
+ public RelatedInstanceList[] getRelatedInstanceList() {
+ return relatedInstanceList;
+ }
+
+ public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ }
- public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
- this.relatedInstanceList = relatedInstanceList;
- }
- /**
- * Gets the value of the project property.
- *
- * @return
- * possible object is
- * {@link Project }
- *
- */
- public Project getProject(){
- return project;
- }
- /**
+ /**
+ * Gets the value of the project property.
+ *
+ * @return possible object is {@link Project }
+ *
+ */
+ public Project getProject() {
+ return project;
+ }
+
+ /**
* Sets the value of the project property.
*
- * @param value
- * allowed object is
- * {@link Project }
+ * @param value allowed object is {@link Project }
*
*/
- public void setProject(Project value){
- this.project = value;
- }
- /**
- * Gets the value of the owningEntity property.
- *
- * @return
- * possible object is
- * {@link OwningEntity }
- *
- */
- public OwningEntity getOwningEntity(){
- return owningEntity;
- }
- /**
+ public void setProject(Project value) {
+ this.project = value;
+ }
+
+ /**
+ * Gets the value of the owningEntity property.
+ *
+ * @return possible object is {@link OwningEntity }
+ *
+ */
+ public OwningEntity getOwningEntity() {
+ return owningEntity;
+ }
+
+ /**
* Sets the value of the owningEntity property.
*
- * @param value
- * allowed object is
- * {@link OwningEntity }
+ * @param value allowed object is {@link OwningEntity }
*
*/
- public void setOwningEntity(OwningEntity value){
- this.owningEntity = value;
- }
- /**
+ public void setOwningEntity(OwningEntity value) {
+ this.owningEntity = value;
+ }
+
+ /**
* Gets the value of the platform property.
*
- * @return
- * possible object is
- * {@link Platform }
+ * @return possible object is {@link Platform }
*
*/
- public Platform getPlatform(){
- return platform;
- }
- /**
+ public Platform getPlatform() {
+ return platform;
+ }
+
+ /**
* Sets the value of the platform property.
*
- * @param value
- * allowed object is
- * {@link Platform }
+ * @param value allowed object is {@link Platform }
*
*/
- public void setPlatform(Platform value){
- this.platform = value;
- }
- /**
+ public void setPlatform(Platform value) {
+ this.platform = value;
+ }
+
+ /**
* Gets the value of the lineOfBusiness property.
*
- * @return
- * possible object is
- * {@link LineOfBusiness }
+ * @return possible object is {@link LineOfBusiness }
*
*/
- public LineOfBusiness getLineOfBusiness(){
- return lineOfBusiness;
- }
- /**
+ public LineOfBusiness getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+ /**
* Sets the value of the lineOfBusiness property.
*
- * @param value
- * allowed object is
- * {@link LineOfBusiness }
+ * @param value allowed object is {@link LineOfBusiness }
*
*/
- public void setLineOfBusiness(LineOfBusiness value){
- this.lineOfBusiness = value;
- }
- /**
+ public void setLineOfBusiness(LineOfBusiness value) {
+ this.lineOfBusiness = value;
+ }
+
+ /**
* Gets the value of the instanceName property.
*/
- public List<Map<String, String>> getInstanceName() {
- return instanceName;
- }
- /**
+ public List<Map<String, String>> getInstanceName() {
+ return instanceName;
+ }
+
+ /**
* Sets the value of the instanceName property.
*
* @param value
*
*/
- public void setInstanceName(List<Map<String, String>> instanceName) {
- this.instanceName = instanceName;
- }
- public List<Map<String, String>> getConfigurationParameters() {
- return configurationParameters;
- }
+ public void setInstanceName(List<Map<String, String>> instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public List<Map<String, String>> getConfigurationParameters() {
+ return configurationParameters;
+ }
- public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
- this.configurationParameters = configurationParameters;
- }
+ public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
- @Override
- public String toString() {
- return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo=" + requestInfo + ", relatedInstanceList="
- + Arrays.toString(relatedInstanceList) + ", subscriberInfo=" + subscriberInfo + ", cloudConfiguration="
- + cloudConfiguration + ", requestParameters=" + requestParameters + ", project=" + project
- + ", owningEntity=" + owningEntity + ", platform=" + platform + ", lineOfBusiness=" + lineOfBusiness
- + ", instanceName=" + instanceName + ", configurationParameters=" + configurationParameters + "]";
- }
+ @Override
+ public String toString() {
+ return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo=" + requestInfo + ", relatedInstanceList="
+ + Arrays.toString(relatedInstanceList) + ", subscriberInfo=" + subscriberInfo + ", cloudConfiguration="
+ + cloudConfiguration + ", requestParameters=" + requestParameters + ", project=" + project
+ + ", owningEntity=" + owningEntity + ", platform=" + platform + ", lineOfBusiness=" + lineOfBusiness
+ + ", instanceName=" + instanceName + ", configurationParameters=" + configurationParameters + "]";
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
index 76137d0f58..121fd4a1a5 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
@@ -19,10 +19,10 @@
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.04.07 at 08:25:52 AM CDT
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.04.07 at 08:25:52 AM CDT
//
@@ -33,14 +33,15 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.builder.ToStringBuilder;
-
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -60,10 +61,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "policyException",
- "serviceException"
-})
+@XmlType(name = "", propOrder = {"policyException", "serviceException"})
@XmlRootElement(name = "requestError")
@JsonRootName(value = "requestError")
public class RequestError {
@@ -74,10 +72,8 @@ public class RequestError {
/**
* Gets the value of the policyException property.
*
- * @return
- * possible object is
- * {@link PolicyException }
- *
+ * @return possible object is {@link PolicyException }
+ *
*/
public PolicyException getPolicyException() {
return policyException;
@@ -86,10 +82,8 @@ public class RequestError {
/**
* Sets the value of the policyException property.
*
- * @param value
- * allowed object is
- * {@link PolicyException }
- *
+ * @param value allowed object is {@link PolicyException }
+ *
*/
public void setPolicyException(PolicyException value) {
this.policyException = value;
@@ -98,10 +92,8 @@ public class RequestError {
/**
* Gets the value of the serviceException property.
*
- * @return
- * possible object is
- * {@link ServiceException }
- *
+ * @return possible object is {@link ServiceException }
+ *
*/
public ServiceException getServiceException() {
return serviceException;
@@ -110,19 +102,17 @@ public class RequestError {
/**
* Sets the value of the serviceException property.
*
- * @param value
- * allowed object is
- * {@link ServiceException }
- *
+ * @param value allowed object is {@link ServiceException }
+ *
*/
public void setServiceException(ServiceException value) {
this.serviceException = value;
}
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("policyException", policyException)
- .append("serviceException", serviceException).toString();
- }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("policyException", policyException)
+ .append("serviceException", serviceException).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index fd7877822b..61192c3147 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -33,36 +32,34 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
@JsonInclude(Include.NON_DEFAULT)
public class RequestInfo implements Serializable {
- private static final long serialVersionUID = -1370946827136030181L;
- @JsonProperty("billingAccountNumber")
- protected String billingAccountNumber;
- @JsonProperty("callbackUrl")
- protected String callbackUrl;
- @JsonProperty("correlator")
+ private static final long serialVersionUID = -1370946827136030181L;
+ @JsonProperty("billingAccountNumber")
+ protected String billingAccountNumber;
+ @JsonProperty("callbackUrl")
+ protected String callbackUrl;
+ @JsonProperty("correlator")
protected String correlator;
- @JsonProperty("orderNumber")
+ @JsonProperty("orderNumber")
protected String orderNumber;
- @JsonProperty("productFamilyId")
+ @JsonProperty("productFamilyId")
protected String productFamilyId;
- @JsonProperty("orderVersion")
+ @JsonProperty("orderVersion")
protected Integer orderVersion;
- @JsonSerialize(include=Inclusion.ALWAYS)
- @JsonProperty("source")
+ @JsonSerialize(include = Inclusion.ALWAYS)
+ @JsonProperty("source")
protected String source;
- @JsonProperty("instanceName")
+ @JsonProperty("instanceName")
protected String instanceName;
- @JsonProperty("suppressRollback")
- @JsonSerialize(include=Inclusion.ALWAYS)
+ @JsonProperty("suppressRollback")
+ @JsonSerialize(include = Inclusion.ALWAYS)
protected boolean suppressRollback;
- @JsonProperty("requestorId")
+ @JsonProperty("requestorId")
protected String requestorId;
/**
* Gets the value of the callbackUrl property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getCallbackUrl() {
@@ -72,9 +69,7 @@ public class RequestInfo implements Serializable {
/**
* Sets the value of the callbackUrl property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setCallbackUrl(String value) {
@@ -84,9 +79,7 @@ public class RequestInfo implements Serializable {
/**
* Gets the value of the correlator property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getCorrelator() {
@@ -96,9 +89,7 @@ public class RequestInfo implements Serializable {
/**
* Sets the value of the correlator property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setCorrelator(String value) {
@@ -108,9 +99,7 @@ public class RequestInfo implements Serializable {
/**
* Gets the value of the orderNumber property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getOrderNumber() {
@@ -120,9 +109,7 @@ public class RequestInfo implements Serializable {
/**
* Sets the value of the orderNumber property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setOrderNumber(String value) {
@@ -132,9 +119,7 @@ public class RequestInfo implements Serializable {
/**
* Gets the value of the orderVersion property.
*
- * @return
- * possible object is
- * {@link Integer }
+ * @return possible object is {@link Integer }
*
*/
public Integer getOrderVersion() {
@@ -144,9 +129,7 @@ public class RequestInfo implements Serializable {
/**
* Sets the value of the orderVersion property.
*
- * @param value
- * allowed object is
- * {@link Integer }
+ * @param value allowed object is {@link Integer }
*
*/
public void setOrderVersion(Integer value) {
@@ -156,9 +139,7 @@ public class RequestInfo implements Serializable {
/**
* Gets the value of the source property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getSource() {
@@ -168,69 +149,65 @@ public class RequestInfo implements Serializable {
/**
* Sets the value of the source property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setSource(String value) {
this.source = value;
}
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public String getBillingAccountNumber() {
- return billingAccountNumber;
- }
-
- public void setBillingAccountNumber(String billingAccountNumber) {
- this.billingAccountNumber = billingAccountNumber;
- }
-
- public String getProductFamilyId() {
- return productFamilyId;
- }
-
- public void setProductFamilyId(String productFamilyId) {
- this.productFamilyId = productFamilyId;
- }
-
- /**
- * Required for Marshalers to send the fields.
- * @return
- */
- public boolean getSuppressRollback() {
- return suppressRollback;
- }
-
- public void setSuppressRollback(boolean suppressRollback) {
- this.suppressRollback = suppressRollback;
- }
-
- public String getRequestorId() {
- return requestorId;
- }
-
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
-
- @Override
- public String toString() {
- return "RequestInfo [billingAccountNumber=" + billingAccountNumber
- + ", callbackUrl=" + callbackUrl + ", correlator=" + correlator
- + ", orderNumber=" + orderNumber + ", productFamilyId="
- + productFamilyId + ", orderVersion=" + orderVersion
- + ", source=" + source + ", instanceName=" + instanceName
- + ", suppressRollback=" + suppressRollback + ", requestorId="
- + requestorId + "]";
- }
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ /**
+ * Required for Marshalers to send the fields.
+ *
+ * @return
+ */
+ public boolean getSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestInfo [billingAccountNumber=" + billingAccountNumber + ", callbackUrl=" + callbackUrl
+ + ", correlator=" + correlator + ", orderNumber=" + orderNumber + ", productFamilyId=" + productFamilyId
+ + ", orderVersion=" + orderVersion + ", source=" + source + ", instanceName=" + instanceName
+ + ", suppressRollback=" + suppressRollback + ", requestorId=" + requestorId + "]";
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
index a4c0ddfcf2..8374aa7638 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
@@ -28,17 +28,17 @@ public class RequestList {
protected Request request;
- public Request getRequest() {
- return request;
- }
-
- public void setRequest(Request request) {
- this.request = request;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("request", request).toString();
- }
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("request", request).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 2085e66dde..1df2c10411 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -35,126 +34,127 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_DEFAULT)
public class RequestParameters implements Serializable {
- private static final long serialVersionUID = -5979049912538894930L;
- @JsonProperty("subscriptionServiceType")
- private String subscriptionServiceType;
- @JsonProperty("userParams")
- private List<Map<String, Object>> userParams = new ArrayList<>();
- @JsonProperty("aLaCarte")
- private Boolean aLaCarte;
- @JsonProperty("payload")
- private String payload;
- @JsonProperty("usePreload")
- private Boolean usePreload; // usePreload would always be true for Update
-
- @JsonProperty("autoBuildVfModules")
- private Boolean autoBuildVfModules;
- @JsonProperty("cascadeDelete")
- private Boolean cascadeDelete;
- @JsonProperty("testApi")
- private String testApi; // usePreload would always be true for Update
- @JsonProperty("rebuildVolumeGroups")
- private Boolean rebuildVolumeGroups;
-
- public String getSubscriptionServiceType() {
- return subscriptionServiceType;
- }
-
- public void setSubscriptionServiceType(String subscriptionServiceType) {
- this.subscriptionServiceType = subscriptionServiceType;
- }
- @JsonProperty("aLaCarte")
- public Boolean getALaCarte() {
- return aLaCarte;
- }
- @JsonProperty("aLaCarte")
- public void setaLaCarte(Boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- }
-
- public Boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public String getPayload(){
- return payload;
- }
- public void setPayload(String value){
- this.payload = value;
- }
-
- public Boolean isUsePreload() {
- return usePreload;
- }
-
- @JsonProperty("usePreload")
- public Boolean getUsePreload() {
- return usePreload;
- }
-
- @JsonProperty("usePreload")
- public void setUsePreload(Boolean usePreload) {
- this.usePreload = usePreload;
- }
-
- public String getTestApi() {
- return testApi;
- }
-
- public void setTestApi(String testApi) {
- this.testApi = testApi;
- }
-
- public List<Map<String, Object>> getUserParams() {
- return userParams;
- }
-
- public void setUserParams(List<Map<String, Object>> userParams) {
- this.userParams = userParams;
- }
-
- public String getUserParamValue(String name){
- if(userParams!=null){
- for(Map<String, Object> param:userParams){
- if(param.containsKey("name") && param.get("name").equals(name) && param.containsKey("value")){
- return param.get("value").toString();
- }
- }
- }
- return null;
- }
-
- public Boolean getAutoBuildVfModules() {
- return autoBuildVfModules;
- }
-
- public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
- this.autoBuildVfModules = autoBuildVfModules;
- }
-
- public Boolean getCascadeDelete() {
- return cascadeDelete;
- }
-
- public void setCascadeDelete(Boolean cascadeDelete) {
- this.cascadeDelete = cascadeDelete;
- }
-
- public Boolean getRebuildVolumeGroups() {
- return rebuildVolumeGroups;
- }
-
- public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
- this.rebuildVolumeGroups = rebuildVolumeGroups;
- }
-
- @Override
- public String toString() {
- return "RequestParameters [subscriptionServiceType="
- + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
- + autoBuildVfModules + ", usePreload="
- + usePreload + ", rebuildVolumeGroups="
- + rebuildVolumeGroups + ", payload=" + payload + "]";
- }
-} \ No newline at end of file
+ private static final long serialVersionUID = -5979049912538894930L;
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+ @JsonProperty("userParams")
+ private List<Map<String, Object>> userParams = new ArrayList<>();
+ @JsonProperty("aLaCarte")
+ private Boolean aLaCarte;
+ @JsonProperty("payload")
+ private String payload;
+ @JsonProperty("usePreload")
+ private Boolean usePreload; // usePreload would always be true for Update
+
+ @JsonProperty("autoBuildVfModules")
+ private Boolean autoBuildVfModules;
+ @JsonProperty("cascadeDelete")
+ private Boolean cascadeDelete;
+ @JsonProperty("testApi")
+ private String testApi; // usePreload would always be true for Update
+ @JsonProperty("rebuildVolumeGroups")
+ private Boolean rebuildVolumeGroups;
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ @JsonProperty("aLaCarte")
+ public Boolean getALaCarte() {
+ return aLaCarte;
+ }
+
+ @JsonProperty("aLaCarte")
+ public void setaLaCarte(Boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ public Boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String value) {
+ this.payload = value;
+ }
+
+ public Boolean isUsePreload() {
+ return usePreload;
+ }
+
+ @JsonProperty("usePreload")
+ public Boolean getUsePreload() {
+ return usePreload;
+ }
+
+ @JsonProperty("usePreload")
+ public void setUsePreload(Boolean usePreload) {
+ this.usePreload = usePreload;
+ }
+
+ public String getTestApi() {
+ return testApi;
+ }
+
+ public void setTestApi(String testApi) {
+ this.testApi = testApi;
+ }
+
+ public List<Map<String, Object>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, Object>> userParams) {
+ this.userParams = userParams;
+ }
+
+ public String getUserParamValue(String name) {
+ if (userParams != null) {
+ for (Map<String, Object> param : userParams) {
+ if (param.containsKey("name") && param.get("name").equals(name) && param.containsKey("value")) {
+ return param.get("value").toString();
+ }
+ }
+ }
+ return null;
+ }
+
+ public Boolean getAutoBuildVfModules() {
+ return autoBuildVfModules;
+ }
+
+ public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
+ this.autoBuildVfModules = autoBuildVfModules;
+ }
+
+ public Boolean getCascadeDelete() {
+ return cascadeDelete;
+ }
+
+ public void setCascadeDelete(Boolean cascadeDelete) {
+ this.cascadeDelete = cascadeDelete;
+ }
+
+ public Boolean getRebuildVolumeGroups() {
+ return rebuildVolumeGroups;
+ }
+
+ public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
+ this.rebuildVolumeGroups = rebuildVolumeGroups;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
+ + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules=" + autoBuildVfModules
+ + ", usePreload=" + usePreload + ", rebuildVolumeGroups=" + rebuildVolumeGroups + ", payload=" + payload
+ + "]";
+ }
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java
index 3373f78335..508987cfeb 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java
@@ -1,19 +1,15 @@
-/* ============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
+/*
+ * ============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
+ * 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.
+ * 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=========================================================
*/
@@ -21,7 +17,6 @@ package org.onap.so.serviceinstancebeans;
import java.util.HashMap;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -29,34 +24,40 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
public class RequestProcessingData {
-
- protected String groupingId;
- protected String tag;
- protected List<HashMap<String, String>> dataPairs;
-
- public String getGroupingId() {
- return groupingId;
- }
- public void setGroupingId(String groupingId) {
- this.groupingId = groupingId;
- }
- public String getTag() {
- return tag;
- }
- public void setTag(String tag) {
- this.tag = tag;
- }
- public List<HashMap<String, String>> getDataPairs() {
- return dataPairs;
- }
- public void setDataPairs(List<HashMap<String, String>> dataPairs) {
- this.dataPairs = dataPairs;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("groupingId", groupingId).append("tag", tag)
- .append("dataPairs", dataPairs).toString();
- }
-
-
+
+ protected String groupingId;
+ protected String tag;
+ protected List<HashMap<String, String>> dataPairs;
+
+ public String getGroupingId() {
+ return groupingId;
+ }
+
+ public void setGroupingId(String groupingId) {
+ this.groupingId = groupingId;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+ public List<HashMap<String, String>> getDataPairs() {
+ return dataPairs;
+ }
+
+ public void setDataPairs(List<HashMap<String, String>> dataPairs) {
+ this.dataPairs = dataPairs;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("groupingId", groupingId).append("tag", tag)
+ .append("dataPairs", dataPairs).toString();
+ }
+
+
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
index 088e414094..19ce5e72f3 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
@@ -21,9 +21,7 @@
package org.onap.so.serviceinstancebeans;
import java.net.URL;
-
import org.apache.commons.lang3.builder.ToStringBuilder;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -31,33 +29,40 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonRootName(value = "requestReferences")
@JsonInclude(Include.NON_DEFAULT)
public class RequestReferences {
-
- String requestId;
- String instanceId;
- URL requestSelfLink;
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getInstanceId() {
- return instanceId;
- }
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
- public URL getRequestSelfLink() {
- return requestSelfLink;
- }
- public void setRequestSelfLink(URL requestSelfLink) {
- this.requestSelfLink = requestSelfLink;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("requestId", requestId).append("instanceId", instanceId).append("requestSelfLink", requestSelfLink).toString();
- }
+
+ String requestId;
+ String instanceId;
+ URL requestSelfLink;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public URL getRequestSelfLink() {
+ return requestSelfLink;
+ }
+
+ public void setRequestSelfLink(URL requestSelfLink) {
+ this.requestSelfLink = requestSelfLink;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", requestId).append("instanceId", instanceId)
+ .append("requestSelfLink", requestSelfLink).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index 710c820148..f659ae241a 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -28,42 +28,50 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
public class RequestStatus {
- @JsonProperty("requestState")
- protected String requestState;
- @JsonProperty("statusMessage")
+ @JsonProperty("requestState")
+ protected String requestState;
+ @JsonProperty("statusMessage")
protected String statusMessage;
- @JsonProperty("percentProgress")
+ @JsonProperty("percentProgress")
protected Integer percentProgress;
- @JsonProperty("timestamp")
+ @JsonProperty("timestamp")
protected String timeStamp;
- public String getRequestState() {
- return requestState;
- }
- public void setRequestState(String requestState) {
- this.requestState = requestState;
- }
- public String getStatusMessage() {
- return statusMessage;
- }
- public void setStatusMessage(String statusMessage) {
- this.statusMessage = statusMessage;
- }
- public Integer getPercentProgress() {
- return percentProgress;
- }
- public void setPercentProgress(Integer percentProgress) {
- this.percentProgress = percentProgress;
- }
- public String getTimeStamp() {
- return timeStamp;
- }
- public void setTimeStamp(String timeStamp) {
- this.timeStamp = timeStamp;
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
- .append("percentProgress", percentProgress).append("timestamp", timeStamp).toString();
- }
+ public String getRequestState() {
+ return requestState;
+ }
+
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+
+ public Integer getPercentProgress() {
+ return percentProgress;
+ }
+
+ public void setPercentProgress(Integer percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+
+ public String getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(String timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
+ .append("percentProgress", percentProgress).append("timestamp", timeStamp).toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
index 68fd95c293..f239774d57 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -33,28 +32,32 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "resources")
@JsonInclude(Include.NON_DEFAULT)
-public class Resources implements Serializable{
-
- private static final long serialVersionUID = 2194797231782624520L;
- @JsonProperty("vnfs")
- private List<Vnfs> vnfs = new ArrayList<>();
- @JsonProperty("networks")
- private List<Networks> networks = new ArrayList<>();
-
- public List<Vnfs> getVnfs() {
- return vnfs;
- }
- public void setVnfs(List<Vnfs> vnfs) {
- this.vnfs = vnfs;
- }
- public List<Networks> getNetworks() {
- return networks;
- }
- public void setNetworks(List<Networks> networks) {
- this.networks = networks;
- }
- @Override
- public String toString() {
- return "Resources [vnfs=" + vnfs + ", networks=" + networks + "]";
- }
-} \ No newline at end of file
+public class Resources implements Serializable {
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("vnfs")
+ private List<Vnfs> vnfs = new ArrayList<>();
+ @JsonProperty("networks")
+ private List<Networks> networks = new ArrayList<>();
+
+ public List<Vnfs> getVnfs() {
+ return vnfs;
+ }
+
+ public void setVnfs(List<Vnfs> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ public List<Networks> getNetworks() {
+ return networks;
+ }
+
+ public void setNetworks(List<Networks> networks) {
+ this.networks = networks;
+ }
+
+ @Override
+ public String toString() {
+ return "Resources [vnfs=" + vnfs + ", networks=" + networks + "]";
+ }
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
index 66848d343c..c368f67907 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,66 +32,63 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonRootName(value = "service")
@JsonInclude(Include.NON_DEFAULT)
-public class Service implements Serializable{
-
- private static final long serialVersionUID = 2194797231782624520L;
- @JsonProperty("modelInfo")
- protected ModelInfo modelInfo;
- @JsonProperty("cloudConfiguration")
- protected CloudConfiguration cloudConfiguration;
- @JsonProperty("instanceName")
- protected String instanceName;
- @JsonProperty("instanceParams")
- private List<Map<String, String>> instanceParams = new ArrayList<>();
- @JsonProperty("resources")
- protected Resources resources;
+public class Service implements Serializable {
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("resources")
+ protected Resources resources;
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
- public String getInstanceName() {
- return instanceName;
- }
+ public String getInstanceName() {
+ return instanceName;
+ }
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
- public List<Map<String, String>> getInstanceParams() {
- return instanceParams;
- }
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
- public void setInstanceParams(List<Map<String, String>> instanceParams) {
- this.instanceParams = instanceParams;
- }
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
- public Resources getResources() {
- return resources;
- }
+ public Resources getResources() {
+ return resources;
+ }
- public void setResources(Resources resources) {
- this.resources = resources;
- }
+ public void setResources(Resources resources) {
+ this.resources = resources;
+ }
- @Override
- public String toString() {
- return "Service [modelInfo=" + modelInfo +
- ", cloudConfiguration=" + cloudConfiguration
- + ", instanceName=" + instanceName +
- ", instanceParams=" + instanceParams +
- ", resources=" + resources + "]";
- }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "Service [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
+ + instanceName + ", instanceParams=" + instanceParams + ", resources=" + resources + "]";
+ }
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
index 7efb7f0bff..f2976136e9 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
@@ -19,10 +19,10 @@
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.03.30 at 02:48:23 PM CDT
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.03.30 at 02:48:23 PM CDT
//
@@ -31,14 +31,15 @@ package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
-
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * <p>Java class for serviceException complex type.
+ * <p>
+ * Java class for serviceException complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="serviceException">
@@ -54,9 +55,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serviceException")
@JsonRootName(value = "serviceException")
-public class ServiceException
- extends ExceptionType
-{
+public class ServiceException extends ExceptionType {
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
index ea241aa074..1a0e13587e 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
@@ -21,104 +21,103 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class ServiceInstancesRequest implements Serializable {
- private static final long serialVersionUID = -4959169541182257787L;
- @JsonProperty("requestDetails")
- private RequestDetails requestDetails;
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
- @JsonProperty("vnfInstanceId")
- private String vnfInstanceId;
- @JsonProperty("networkInstanceId")
- private String networkInstanceId;
- @JsonProperty("volumeGroupInstanceId")
- private String volumeGroupInstanceId;
- @JsonProperty("vfModuleInstanceId")
- private String vfModuleInstanceId;
- @JsonProperty("configurationId")
- private String configurationId;
- @JsonProperty("instanceGroupId")
- private String instanceGroupId;
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getVnfInstanceId() {
- return vnfInstanceId;
- }
-
- public void setVnfInstanceId(String vnfInstanceId) {
- this.vnfInstanceId = vnfInstanceId;
- }
-
- public String getNetworkInstanceId() {
- return networkInstanceId;
- }
-
- public void setNetworkInstanceId(String networkInstanceId) {
- this.networkInstanceId = networkInstanceId;
- }
-
- public String getVolumeGroupInstanceId() {
- return volumeGroupInstanceId;
- }
-
- public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
- this.volumeGroupInstanceId = volumeGroupInstanceId;
- }
-
- public String getVfModuleInstanceId() {
- return vfModuleInstanceId;
- }
-
- public void setVfModuleInstanceId(String vfModuleInstanceId) {
- this.vfModuleInstanceId = vfModuleInstanceId;
- }
-
- public String getConfigurationId() {
- return configurationId;
- }
-
- public void setConfigurationId(String configurationId) {
- this.configurationId = configurationId;
- }
-
- public String getInstanceGroupId() {
- return instanceGroupId;
- }
-
- public void setInstanceGroupId(String instanceGroupId) {
- this.instanceGroupId = instanceGroupId;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("ServiceInstancesRequest{");
- sb.append("requestDetails=").append(requestDetails);
- sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\'');
- sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\'');
- sb.append(", networkInstanceId='").append(networkInstanceId).append('\'');
- sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
- sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
- sb.append(", configurationId='").append(configurationId).append('\'');
- sb.append('}');
- return sb.toString();
- }
+ private static final long serialVersionUID = -4959169541182257787L;
+ @JsonProperty("requestDetails")
+ private RequestDetails requestDetails;
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("vnfInstanceId")
+ private String vnfInstanceId;
+ @JsonProperty("networkInstanceId")
+ private String networkInstanceId;
+ @JsonProperty("volumeGroupInstanceId")
+ private String volumeGroupInstanceId;
+ @JsonProperty("vfModuleInstanceId")
+ private String vfModuleInstanceId;
+ @JsonProperty("configurationId")
+ private String configurationId;
+ @JsonProperty("instanceGroupId")
+ private String instanceGroupId;
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ public void setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ public void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("ServiceInstancesRequest{");
+ sb.append("requestDetails=").append(requestDetails);
+ sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\'');
+ sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\'');
+ sb.append(", networkInstanceId='").append(networkInstanceId).append('\'');
+ sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
+ sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
+ sb.append(", configurationId='").append(configurationId).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
index db3add8d47..ded0a21652 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
@@ -23,21 +23,21 @@ package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
public class ServiceInstancesResponse {
-
- RequestReferences requestReferences;
-
- public RequestReferences getRequestReferences() {
- return requestReferences;
- }
-
- public void setRequestReferences(RequestReferences requestReferences) {
- this.requestReferences = requestReferences;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("requestReferences", requestReferences).toString();
- }
-
+
+ RequestReferences requestReferences;
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setRequestReferences(RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestReferences", requestReferences).toString();
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
index 03780231fc..590be0955a 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
@@ -21,7 +21,6 @@
package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,18 +30,16 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_DEFAULT)
public class SubscriberInfo implements Serializable {
- private static final long serialVersionUID = -1750701712128104652L;
- @JsonProperty("globalSubscriberId")
+ private static final long serialVersionUID = -1750701712128104652L;
+ @JsonProperty("globalSubscriberId")
protected String globalSubscriberId;
- @JsonProperty("subscriberName")
+ @JsonProperty("subscriberName")
protected String subscriberName;
/**
* Gets the value of the globalSubscriberId property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getGlobalSubscriberId() {
@@ -52,9 +49,7 @@ public class SubscriberInfo implements Serializable {
/**
* Sets the value of the globalSubscriberId property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setGlobalSubscriberId(String value) {
@@ -64,9 +59,7 @@ public class SubscriberInfo implements Serializable {
/**
* Gets the value of the subscriberName property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getSubscriberName() {
@@ -76,19 +69,16 @@ public class SubscriberInfo implements Serializable {
/**
* Sets the value of the subscriberName property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setSubscriberName(String value) {
this.subscriberName = value;
}
- @Override
- public String toString() {
- return "SubscriberInfo [globalSubscriberId=" + globalSubscriberId
- + ", subscriberName=" + subscriberName + "]";
- }
+ @Override
+ public String toString() {
+ return "SubscriberInfo [globalSubscriberId=" + globalSubscriberId + ", subscriberName=" + subscriberName + "]";
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
index 74f8af80a7..5c4834d021 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,67 +32,66 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonRootName(value = "vfmodules")
@JsonInclude(Include.NON_DEFAULT)
-public class VfModules implements Serializable{
-
- private static final long serialVersionUID = 8081495240474276501L;
- @JsonProperty("modelInfo")
- protected ModelInfo modelInfo;
- @JsonProperty("cloudConfiguration")
- protected CloudConfiguration cloudConfiguration;
- @JsonProperty("instanceName")
- protected String instanceName;
- @JsonProperty("volumeGroupInstanceName")
- protected String volumeGroupInstanceName;
- @JsonProperty("instanceParams")
- private List<Map<String, String>> instanceParams = new ArrayList<>();
-
-
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public String getVolumeGroupInstanceName() {
- return volumeGroupInstanceName;
- }
-
- public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
- this.volumeGroupInstanceName = volumeGroupInstanceName;
- }
-
- public List<Map<String, String>> getInstanceParams() {
- return instanceParams;
- }
-
- public void setInstanceParams(List<Map<String, String>> instanceParams) {
- this.instanceParams = instanceParams;
- }
-
- @Override
- public String toString() {
- return "VfModules [modelInfo=" + modelInfo +
- ", cloudConfiguration=" + cloudConfiguration +
- ", instanceName=" + instanceName + ", volumeGroupInstanceName="
- + volumeGroupInstanceName + ", instanceParams=" + instanceParams + "]";
- }
-
-} \ No newline at end of file
+public class VfModules implements Serializable {
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("volumeGroupInstanceName")
+ protected String volumeGroupInstanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "VfModules [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
+ + instanceName + ", volumeGroupInstanceName=" + volumeGroupInstanceName + ", instanceParams="
+ + instanceParams + "]";
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
index b55a528935..a2eb35464b 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,99 +32,97 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonRootName(value = "vnfs")
@JsonInclude(Include.NON_DEFAULT)
-public class Vnfs implements Serializable{
-
- private static final long serialVersionUID = 8081495240474276501L;
- @JsonProperty("modelInfo")
- protected ModelInfo modelInfo;
- @JsonProperty("cloudConfiguration")
- protected CloudConfiguration cloudConfiguration;
- @JsonProperty("instanceName")
- protected String instanceName;
- @JsonProperty("platform")
- protected Platform platform;
- @JsonProperty("lineOfBusiness")
- protected LineOfBusiness lineOfBusiness;
- @JsonProperty("productFamilyId")
- protected String productFamilyId;
- @JsonProperty("instanceParams")
- private List<Map<String, String>> instanceParams = new ArrayList<>();
- @JsonProperty("vfModules")
- private List<VfModules> vfModules = new ArrayList<>();
-
-
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public Platform getPlatform() {
- return platform;
- }
-
- public void setPlatform(Platform platform) {
- this.platform = platform;
- }
-
- public LineOfBusiness getLineOfBusiness() {
- return lineOfBusiness;
- }
-
- public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
- this.lineOfBusiness = lineOfBusiness;
- }
-
- public String getProductFamilyId() {
- return productFamilyId;
- }
-
- public void setProductFamilyId(String productFamilyId) {
- this.productFamilyId = productFamilyId;
- }
-
- public List<Map<String, String>> getInstanceParams() {
- return instanceParams;
- }
-
- public void setInstanceParams(List<Map<String, String>> instanceParams) {
- this.instanceParams = instanceParams;
- }
-
- public List<VfModules> getVfModules() {
- return vfModules;
- }
-
- public void setVfModules(List<VfModules> vfModules) {
- this.vfModules = vfModules;
- }
-
- @Override
- public String toString() {
- return "Vnfs [modelInfo=" + modelInfo +
- ", cloudConfiguration=" + cloudConfiguration +
- ", instanceName=" + instanceName + ", platform=" + platform + ", " +
- "lineOfBusiness=" + lineOfBusiness +
- ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams +
- ", vfModules=" + vfModules + "]";
- }
-
-} \ No newline at end of file
+public class Vnfs implements Serializable {
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("platform")
+ protected Platform platform;
+ @JsonProperty("lineOfBusiness")
+ protected LineOfBusiness lineOfBusiness;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("vfModules")
+ private List<VfModules> vfModules = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public Platform getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(Platform platform) {
+ this.platform = platform;
+ }
+
+ public LineOfBusiness getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+ public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ public List<VfModules> getVfModules() {
+ return vfModules;
+ }
+
+ public void setVfModules(List<VfModules> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ @Override
+ public String toString() {
+ return "Vnfs [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
+ + instanceName + ", platform=" + platform + ", " + "lineOfBusiness=" + lineOfBusiness
+ + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + ", vfModules="
+ + vfModules + "]";
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/spring/SpringContextHelper.java b/common/src/main/java/org/onap/so/spring/SpringContextHelper.java
index 1fae5f3e23..b8b08a3917 100644
--- a/common/src/main/java/org/onap/so/spring/SpringContextHelper.java
+++ b/common/src/main/java/org/onap/so/spring/SpringContextHelper.java
@@ -27,14 +27,14 @@ import org.springframework.stereotype.Component;
@Component
public class SpringContextHelper implements ApplicationContextAware {
- private static ApplicationContext context;
+ private static ApplicationContext context;
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) {
- context = applicationContext;
- }
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ context = applicationContext;
+ }
- public static ApplicationContext getAppContext() {
- return context;
- }
+ public static ApplicationContext getAppContext() {
+ return context;
+ }
}
diff --git a/common/src/main/java/org/onap/so/test/categories/SlowTests.java b/common/src/main/java/org/onap/so/test/categories/SlowTests.java
index 58a14041d0..ae5b40b2d6 100644
--- a/common/src/main/java/org/onap/so/test/categories/SlowTests.java
+++ b/common/src/main/java/org/onap/so/test/categories/SlowTests.java
@@ -21,5 +21,5 @@
package org.onap.so.test.categories;
public interface SlowTests {
-/* category marker */
+ /* category marker */
}
diff --git a/common/src/main/java/org/onap/so/utils/CheckResults.java b/common/src/main/java/org/onap/so/utils/CheckResults.java
index 4f6089d0e3..5b4c40e3db 100644
--- a/common/src/main/java/org/onap/so/utils/CheckResults.java
+++ b/common/src/main/java/org/onap/so/utils/CheckResults.java
@@ -24,7 +24,6 @@ package org.onap.so.utils;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -33,33 +32,33 @@ import javax.xml.bind.annotation.XmlRootElement;
public class CheckResults {
@XmlElement(name = "checkresult")
- private List <CheckResult> results;
+ private List<CheckResult> results;
- public CheckResults () {
+ public CheckResults() {
results = new ArrayList<>();
}
- public List <CheckResult> getResults () {
+ public List<CheckResult> getResults() {
return results;
}
- public void addHostCheckResult (String hostname, int state, String output) {
- CheckResult newResult = new CheckResult ();
- newResult.setType ("host");
- newResult.setHostname (hostname);
- newResult.setState (state);
- newResult.setOutput (output);
- results.add (newResult);
+ public void addHostCheckResult(String hostname, int state, String output) {
+ CheckResult newResult = new CheckResult();
+ newResult.setType("host");
+ newResult.setHostname(hostname);
+ newResult.setState(state);
+ newResult.setOutput(output);
+ results.add(newResult);
}
- public void addServiceCheckResult (String hostname, String servicename, int state, String output) {
- CheckResult newResult = new CheckResult ();
- newResult.setType ("service");
- newResult.setHostname (hostname);
- newResult.setServicename (servicename);
- newResult.setState (state);
- newResult.setOutput (output);
- results.add (newResult);
+ public void addServiceCheckResult(String hostname, String servicename, int state, String output) {
+ CheckResult newResult = new CheckResult();
+ newResult.setType("service");
+ newResult.setHostname(hostname);
+ newResult.setServicename(servicename);
+ newResult.setState(state);
+ newResult.setOutput(output);
+ results.add(newResult);
}
public static class CheckResult {
@@ -71,47 +70,47 @@ public class CheckResults {
private String output;
@XmlAttribute(required = true)
- public String getType () {
+ public String getType() {
return type;
}
- public void setType (String type) {
+ public void setType(String type) {
this.type = type;
}
@XmlElement(required = true)
- public String getHostname () {
+ public String getHostname() {
return hostname;
}
- public void setHostname (String hostname) {
+ public void setHostname(String hostname) {
this.hostname = hostname;
}
@XmlElement(required = false)
- public String getServicename () {
+ public String getServicename() {
return servicename;
}
- public void setServicename (String servicename) {
+ public void setServicename(String servicename) {
this.servicename = servicename;
}
@XmlElement(required = true)
- public int getState () {
+ public int getState() {
return state;
}
- public void setState (int state) {
+ public void setState(int state) {
this.state = state;
}
@XmlElement(required = true)
- public String getOutput () {
+ public String getOutput() {
return output;
}
- public void setOutput (String output) {
+ public void setOutput(String output) {
this.output = output;
}
}
diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 7d272e39c7..09b48d266f 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -27,7 +27,6 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@@ -52,13 +51,12 @@ public final class CryptoUtils {
private static final String AES_GCM_NO_PADDING = "AES/GCM/NoPadding";
/**
- * encrypt a value and generate a keyfile
- * if the keyfile is not found then a new one is created
+ * encrypt a value and generate a keyfile if the keyfile is not found then a new one is created
*
* @throws GeneralSecurityException
*/
- public static String encrypt (String value, String keyString) throws GeneralSecurityException {
- SecretKeySpec sks = getSecretKeySpec (keyString);
+ public static String encrypt(String value, String keyString) throws GeneralSecurityException {
+ SecretKeySpec sks = getSecretKeySpec(keyString);
Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
byte[] initVector = new byte[GCM_IV_LENGTH];
(new SecureRandom()).nextBytes(initVector);
@@ -76,8 +74,8 @@ public final class CryptoUtils {
*
* @throws GeneralSecurityException
*/
- public static String decrypt (String message, String keyString) throws GeneralSecurityException {
- SecretKeySpec sks = getSecretKeySpec (keyString);
+ public static String decrypt(String message, String keyString) throws GeneralSecurityException {
+ SecretKeySpec sks = getSecretKeySpec(keyString);
byte[] cipherText = hexStringToByteArray(message);
Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
byte[] initVector = Arrays.copyOfRange(cipherText, 0, GCM_IV_LENGTH);
@@ -86,31 +84,33 @@ public final class CryptoUtils {
byte[] plaintext = cipher.doFinal(cipherText, GCM_IV_LENGTH, cipherText.length - GCM_IV_LENGTH);
return new String(plaintext);
}
-
+
public static String encryptCloudConfigPassword(String message) {
- try {
- return CryptoUtils.encrypt(message, CLOUD_KEY);
- } catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
- ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
- return null;
- }
+ try {
+ return CryptoUtils.encrypt(message, CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
+ return null;
+ }
}
+
public static String decryptCloudConfigPassword(String message) {
- try {
- return CryptoUtils.decrypt(message, CLOUD_KEY);
- } catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
- ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
- return null;
- }
+ try {
+ return CryptoUtils.decrypt(message, CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
+ return null;
+ }
}
- private static SecretKeySpec getSecretKeySpec (String keyString) {
- byte[] key = hexStringToByteArray (keyString);
- return new SecretKeySpec (key, AES);
+
+ private static SecretKeySpec getSecretKeySpec(String keyString) {
+ byte[] key = hexStringToByteArray(keyString);
+ return new SecretKeySpec(key, AES);
}
- public static String byteArrayToHexString (byte[] b) {
+ public static String byteArrayToHexString(byte[] b) {
StringBuilder sb = new StringBuilder(b.length * 2);
for (byte aB : b) {
int v = aB & 0xff;
@@ -119,14 +119,14 @@ public final class CryptoUtils {
}
sb.append(Integer.toHexString(v));
}
- return sb.toString ().toUpperCase ();
+ return sb.toString().toUpperCase();
}
- private static byte[] hexStringToByteArray (String s) {
- byte[] b = new byte[s.length () / 2];
+ private static byte[] hexStringToByteArray(String s) {
+ byte[] b = new byte[s.length() / 2];
for (int i = 0; i < b.length; i++) {
int index = i * 2;
- int v = Integer.parseInt (s.substring (index, index + 2), 16);
+ int v = Integer.parseInt(s.substring(index, index + 2), 16);
b[i] = (byte) v;
}
return b;
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
index a4480f2d95..5f87378b79 100644
--- a/common/src/main/java/org/onap/so/utils/TargetEntity.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java
@@ -23,18 +23,17 @@ package org.onap.so.utils;
import java.util.EnumSet;
public enum TargetEntity {
- OPENSTACK_ADAPTER, BPMN, GRM ,AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB,
- VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD;
+ OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD;
private static final String PREFIX = "SO";
public static EnumSet<TargetEntity> getSOInternalComponents() {
- return EnumSet.of(OPENSTACK_ADAPTER, BPMN,CATALOG_DB,REQUEST_DB,VNF_ADAPTER,SDNC_ADAPTER);
+ return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER);
}
@Override
- public String toString(){
- if(getSOInternalComponents().contains(this))
+ public String toString() {
+ if (getSOInternalComponents().contains(this))
return TargetEntity.PREFIX + "." + this.name();
else
return this.name();
diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index 19a92b834c..585ffcc7c4 100644
--- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
@@ -24,7 +24,6 @@
package org.onap.so.utils;
import java.util.UUID;
-
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,10 +34,9 @@ public class UUIDChecker {
private static final Logger logger = LoggerFactory.getLogger(UUIDChecker.class);
- private UUIDChecker() {
- }
+ private UUIDChecker() {}
- public static boolean isValidUUID (String id) {
+ public static boolean isValidUUID(String id) {
try {
if (null == id) {
return false;
@@ -51,7 +49,7 @@ public class UUIDChecker {
}
}
- public static String getUUID () {
+ public static String getUUID() {
String result = UUID.randomUUID().toString();
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result);
return result;
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
index 4aeecf88d8..0022ecbb96 100644
--- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -25,7 +25,6 @@ package org.onap.so.utils;
import java.io.StringReader;
import java.io.StringWriter;
-
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -33,7 +32,6 @@ import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
-
import org.onap.so.exceptions.MarshallerException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -54,8 +52,8 @@ public class XmlMarshaller {
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.marshal(object, stringWriter);
} catch (JAXBException e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- ErrorCode.SchemaError.getValue(), e.getMessage(), e);
+ logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
+ e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
@@ -79,8 +77,8 @@ public class XmlMarshaller {
SAXSource source = new SAXSource(xmlReader, inputSource);
object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- ErrorCode.SchemaError.getValue(), e.getMessage(), e);
+ logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
+ e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
diff --git a/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
index 048634190a..7fec597521 100644
--- a/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
+++ b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
@@ -25,22 +25,21 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "message"
-})
+@JsonPropertyOrder({"message"})
public class ExceptionResponse {
- @JsonProperty("message")
- private String message;
+ @JsonProperty("message")
+ private String message;
- public ExceptionResponse(String message) {
- this.message = message;
- }
- public String getMessage() {
- return message;
- }
+ public ExceptionResponse(String message) {
+ this.message = message;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
}
diff --git a/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
index 2c249f1607..d20433df2e 100644
--- a/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
@@ -26,23 +26,22 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;
-
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
- private static Logger logger = LoggerFactory.getLogger(RuntimeExceptionMapper.class);
+ private static Logger logger = LoggerFactory.getLogger(RuntimeExceptionMapper.class);
+
+ @Override
+ public Response toResponse(RuntimeException exception) {
- @Override
- public Response toResponse(RuntimeException exception) {
-
- if (exception instanceof NotFoundException) {
- return Response.status(Status.NOT_FOUND).build();
- } else {
- logger.error("Error occured", exception);
- return Response.status(Status.INTERNAL_SERVER_ERROR).entity(new ExceptionResponse("Unexpected Internal Exception")).build();
- }
- }
+ if (exception instanceof NotFoundException) {
+ return Response.status(Status.NOT_FOUND).build();
+ } else {
+ logger.error("Error occured", exception);
+ return Response.status(Status.INTERNAL_SERVER_ERROR)
+ .entity(new ExceptionResponse("Unexpected Internal Exception")).build();
+ }
+ }
}