From 7f5a54dd33d03238c791d9b01a66f2e179cbd1bf Mon Sep 17 00:00:00 2001 From: Luji7 Date: Mon, 25 Sep 2017 11:45:28 +0800 Subject: change project structure Change-Id: Ie2b844f4fff8a3a26c2b34f8a5ee747f498f1bb2 Issue-Id: USECASEUI-36 Signed-off-by: Luji7 --- pom.xml | 13 +- server/pom.xml | 264 ++++++++++++++++ .../server/UsecaseuiServerApplication.java | 37 +++ .../usecaseui/server/bean/ActiveAlarmInfo.java | 341 +++++++++++++++++++++ .../onap/usecaseui/server/bean/AlarmsHeader.java | 319 +++++++++++++++++++ .../usecaseui/server/bean/AlarmsInformation.java | 89 ++++++ .../usecaseui/server/bean/PerformanceHeader.java | 244 +++++++++++++++ .../server/bean/PerformanceInformation.java | 89 ++++++ .../usecaseui/server/bean/lcm/ServiceTemplate.java | 19 ++ .../server/bean/lcm/ServiceTemplateInput.java | 45 +++ .../server/bean/lcm/ServiceTemplateInputRsp.java | 40 +++ .../usecaseui/server/bean/lcm/TemplateInput.java | 57 ++++ .../usecaseui/server/bean/lcm/VfNsPackageInfo.java | 49 +++ .../onap/usecaseui/server/constant/Constant.java | 22 ++ .../server/controller/AlarmController.java | 142 +++++++++ .../server/controller/PerformanceController.java | 164 ++++++++++ .../server/controller/lcm/CustomerController.java | 43 +++ .../lcm/PackageDistributionController.java | 45 +++ .../controller/lcm/ServiceInstanceController.java | 54 ++++ .../controller/lcm/ServiceLcmController.java | 57 ++++ .../controller/lcm/ServiceTemplateController.java | 51 +++ .../usecaseui/server/dao/UsecaseuiDataSource.java | 50 +++ .../server/exception/ErrorCodeException.java | 131 ++++++++ .../server/hibernate/HibernateConfiguration.java | 57 ++++ .../listener/UsecaseServerEventListener.java | 38 +++ .../server/security/RestfulSecurityConfig.java | 53 ++++ .../usecaseui/server/service/AlarmService.java | 25 ++ .../server/service/AlarmsHeaderService.java | 32 ++ .../server/service/AlarmsInformationService.java | 31 ++ .../server/service/InitializationService.java | 22 ++ .../server/service/PerformanceHeaderService.java | 31 ++ .../service/PerformanceInformationService.java | 31 ++ .../server/service/impl/AlarmServiceImpl.java | 77 +++++ .../service/impl/AlarmsHeaderServiceImpl.java | 222 ++++++++++++++ .../service/impl/AlarmsInformationServiceImpl.java | 157 ++++++++++ .../service/impl/InitializationServiceImpl.java | 42 +++ .../service/impl/PerformanceHeaderServiceImpl.java | 202 ++++++++++++ .../impl/PerformanceInformationServiceImpl.java | 160 ++++++++++ .../server/service/lcm/CustomerService.java | 24 ++ .../service/lcm/PackageDistributionService.java | 23 ++ .../server/service/lcm/ServiceInstanceService.java | 25 ++ .../server/service/lcm/ServiceLcmService.java | 29 ++ .../server/service/lcm/ServiceTemplateService.java | 28 ++ .../server/service/lcm/domain/aai/AAIService.java | 53 ++++ .../service/lcm/domain/aai/bean/AAICustomer.java | 53 ++++ .../lcm/domain/aai/bean/ServiceInstance.java | 89 ++++++ .../service/lcm/domain/aai/bean/VimInfo.java | 44 +++ .../lcm/domain/aai/exceptions/AAIException.java | 23 ++ .../service/lcm/domain/sdc/SDCCatalogService.java | 43 +++ .../lcm/domain/sdc/bean/SDCServiceTemplate.java | 21 ++ .../server/service/lcm/domain/sdc/bean/Vnf.java | 19 ++ .../service/lcm/domain/sdc/consts/SDCConsts.java | 24 ++ .../domain/sdc/exceptions/SDCCatalogException.java | 23 ++ .../server/service/lcm/domain/so/SOService.java | 37 +++ .../so/bean/OperationProgressInformation.java | 19 ++ .../so/bean/ServiceInstantiationRequest.java | 59 ++++ .../lcm/domain/so/bean/ServiceOperation.java | 36 +++ .../lcm/domain/so/exceptions/SOException.java | 23 ++ .../service/lcm/impl/DefaultCustomerService.java | 57 ++++ .../impl/DefaultPackageDistributionService.java | 64 ++++ .../lcm/impl/DefaultServiceInstanceService.java | 57 ++++ .../service/lcm/impl/DefaultServiceLcmService.java | 71 +++++ .../lcm/impl/DefaultServiceTemplateService.java | 122 ++++++++ .../org/onap/usecaseui/server/util/CSVUtils.java | 78 +++++ .../org/onap/usecaseui/server/util/DataUtils.java | 19 ++ .../java/org/onap/usecaseui/server/util/Page.java | 98 ++++++ .../usecaseui/server/util/RestfulServices.java | 30 ++ server/src/main/resources/application.properties | 33 ++ .../server/UsecaseuiServerApplicationTests.java | 71 +++++ .../server/UsecaseuiServerApplication.java | 37 --- .../usecaseui/server/bean/ActiveAlarmInfo.java | 341 --------------------- .../onap/usecaseui/server/bean/AlarmsHeader.java | 319 ------------------- .../usecaseui/server/bean/AlarmsInformation.java | 89 ------ .../usecaseui/server/bean/PerformanceHeader.java | 244 --------------- .../server/bean/PerformanceInformation.java | 89 ------ .../usecaseui/server/bean/lcm/ServiceTemplate.java | 19 -- .../server/bean/lcm/ServiceTemplateInput.java | 45 --- .../server/bean/lcm/ServiceTemplateInputRsp.java | 40 --- .../usecaseui/server/bean/lcm/TemplateInput.java | 57 ---- .../usecaseui/server/bean/lcm/VfNsPackageInfo.java | 49 --- .../onap/usecaseui/server/constant/Constant.java | 22 -- .../server/controller/AlarmController.java | 142 --------- .../server/controller/PerformanceController.java | 164 ---------- .../server/controller/lcm/CustomerController.java | 43 --- .../lcm/PackageDistributionController.java | 45 --- .../controller/lcm/ServiceInstanceController.java | 54 ---- .../controller/lcm/ServiceLcmController.java | 57 ---- .../controller/lcm/ServiceTemplateController.java | 51 --- .../usecaseui/server/dao/UsecaseuiDataSource.java | 50 --- .../server/exception/ErrorCodeException.java | 131 -------- .../server/hibernate/HibernateConfiguration.java | 57 ---- .../listener/UsecaseServerEventListener.java | 38 --- .../server/security/RestfulSecurityConfig.java | 53 ---- .../usecaseui/server/service/AlarmService.java | 25 -- .../server/service/AlarmsHeaderService.java | 32 -- .../server/service/AlarmsInformationService.java | 31 -- .../server/service/InitializationService.java | 22 -- .../server/service/PerformanceHeaderService.java | 31 -- .../service/PerformanceInformationService.java | 31 -- .../server/service/impl/AlarmServiceImpl.java | 77 ----- .../service/impl/AlarmsHeaderServiceImpl.java | 222 -------------- .../service/impl/AlarmsInformationServiceImpl.java | 157 ---------- .../service/impl/InitializationServiceImpl.java | 42 --- .../service/impl/PerformanceHeaderServiceImpl.java | 202 ------------ .../impl/PerformanceInformationServiceImpl.java | 160 ---------- .../server/service/lcm/CustomerService.java | 24 -- .../service/lcm/PackageDistributionService.java | 23 -- .../server/service/lcm/ServiceInstanceService.java | 25 -- .../server/service/lcm/ServiceLcmService.java | 29 -- .../server/service/lcm/ServiceTemplateService.java | 28 -- .../server/service/lcm/domain/aai/AAIService.java | 53 ---- .../service/lcm/domain/aai/bean/AAICustomer.java | 53 ---- .../lcm/domain/aai/bean/ServiceInstance.java | 89 ------ .../service/lcm/domain/aai/bean/VimInfo.java | 44 --- .../lcm/domain/aai/exceptions/AAIException.java | 23 -- .../service/lcm/domain/sdc/SDCCatalogService.java | 43 --- .../lcm/domain/sdc/bean/SDCServiceTemplate.java | 21 -- .../server/service/lcm/domain/sdc/bean/Vnf.java | 19 -- .../service/lcm/domain/sdc/consts/SDCConsts.java | 24 -- .../domain/sdc/exceptions/SDCCatalogException.java | 23 -- .../server/service/lcm/domain/so/SOService.java | 37 --- .../so/bean/OperationProgressInformation.java | 19 -- .../so/bean/ServiceInstantiationRequest.java | 59 ---- .../lcm/domain/so/bean/ServiceOperation.java | 36 --- .../lcm/domain/so/exceptions/SOException.java | 23 -- .../service/lcm/impl/DefaultCustomerService.java | 57 ---- .../impl/DefaultPackageDistributionService.java | 64 ---- .../lcm/impl/DefaultServiceInstanceService.java | 57 ---- .../service/lcm/impl/DefaultServiceLcmService.java | 71 ----- .../lcm/impl/DefaultServiceTemplateService.java | 122 -------- .../org/onap/usecaseui/server/util/CSVUtils.java | 78 ----- .../org/onap/usecaseui/server/util/DataUtils.java | 19 -- .../java/org/onap/usecaseui/server/util/Page.java | 98 ------ .../usecaseui/server/util/RestfulServices.java | 30 -- src/main/resources/application.properties | 33 -- .../server/UsecaseuiServerApplicationTests.java | 71 ----- 136 files changed, 4936 insertions(+), 4667 deletions(-) create mode 100644 server/pom.xml create mode 100644 server/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/constant/Constant.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/AlarmService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/InitializationService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/util/DataUtils.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/util/Page.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java create mode 100644 server/src/main/resources/application.properties create mode 100644 server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java delete mode 100644 src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java delete mode 100644 src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java delete mode 100644 src/main/java/org/onap/usecaseui/server/constant/Constant.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/AlarmController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java delete mode 100644 src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java delete mode 100644 src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java delete mode 100644 src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java delete mode 100644 src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java delete mode 100644 src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/AlarmService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/InitializationService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java delete mode 100644 src/main/java/org/onap/usecaseui/server/util/CSVUtils.java delete mode 100644 src/main/java/org/onap/usecaseui/server/util/DataUtils.java delete mode 100644 src/main/java/org/onap/usecaseui/server/util/Page.java delete mode 100644 src/main/java/org/onap/usecaseui/server/util/RestfulServices.java delete mode 100644 src/main/resources/application.properties delete mode 100644 src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java diff --git a/pom.xml b/pom.xml index 32866acd..434e3f68 100644 --- a/pom.xml +++ b/pom.xml @@ -24,12 +24,17 @@ org.onap.usecase-ui.server - usecase-ui-server + usecase-ui-server-parent 1.0.0-SNAPSHOT - jar - usecase-ui/server + pom + usecase-ui-server project for usecase-ui server + + server + + + UTF-8 UTF-8 @@ -186,7 +191,7 @@ org.openecomp.sdc.jtosca jtosca - 1.1.3-SNAPSHOT + 1.1.11-SNAPSHOT diff --git a/server/pom.xml b/server/pom.xml new file mode 100644 index 00000000..c4ab57a7 --- /dev/null +++ b/server/pom.xml @@ -0,0 +1,264 @@ + + + + 4.0.0 + + + org.onap.usecase-ui.server + usecase-ui-server-parent + 1.0.0-SNAPSHOT + + + org.onap.usecase-ui.server + usecase-ui-server + 1.0.0-SNAPSHOT + jar + usecase-ui/server + project for usecase-ui server + + + UTF-8 + UTF-8 + 1.8 + 5.0.11.Final + 4.3.4.RELEASE + 1.0.2 + 1.4 + 2.9.0 + + + + + + + org.springframework.boot + spring-boot-starter-parent + 1.4.2.RELEASE + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.data + spring-data-rest-hal-browser + + + org.springframework.boot + spring-boot-starter-jersey + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + mysql + mysql-connector-java + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.restdocs + spring-restdocs-mockmvc + test + + + org.springframework.security + spring-security-test + test + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.hibernate + hibernate-core + ${hibernate.version} + + + javax.persistence + persistence-api + ${javax.persistence.version} + + + + + org.apache.commons + commons-csv + ${common.csv.version} + + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + + com.squareup.retrofit2 + retrofit + 2.3.0 + + + com.squareup.retrofit2 + converter-jackson + 2.3.0 + + + + org.openecomp.sdc.jtosca + jtosca + 1.1.11-SNAPSHOT + + + + com.google.guava + guava + 23.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/server/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java b/server/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java new file mode 100644 index 00000000..c12bb24e --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.client.RestTemplate; + +@SpringBootApplication +@ComponentScan(basePackages = "org.onap.usecaseui.server") +public class UsecaseuiServerApplication { + + @Bean + public RestTemplate getRestTemplate(){ + return new RestTemplate(); + } + + public static void main(String[] args) { + SpringApplication.run(UsecaseuiServerApplication.class, args); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java b/server/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java new file mode 100644 index 00000000..d204d682 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java @@ -0,0 +1,341 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name = "EP_ACTIVE_ALARM") +public class ActiveAlarmInfo +{ + + @Id + @Column(name = "id", nullable = true) + private String id; + + + @Column(name = "devName") + private String devName; + + + @Column(name = "devIp") + private String devIp; + + + @Column(name = "serialNumber") + private String serialNumber; + + + @Column(name = "alarmRaisedTime") + private String alarmRaisedTime; + + + @Column(name = "alarmChangedTime") + private String alarmChangedTime; + + + @Column(name = "alarmIdentifier") + private String alarmIdentifier; + + + @Column(name = "notificationType") + private String notificationType; + + + @Column(name = "managedObjectInstance") + private String managedObjectInstance; + + + @Column(name = "eventType") + private Integer eventType; + + + @Column(name = "probableCause") + private String probableCause; + + + @Column(name = "specificProblem") + private String specificProblem; + + + @Column(name = "perceivedSeverity") + private String perceivedSeverity; + + + @Column(name = "additionalText") + private String additionalText; + + + @Column(name = "additionalInformation") + private String additionalInformation; + + + @Column(name = "clearedManner") + private String clearedManner; + + + @Column(name = "alarmState") + private Integer alarmState; + + + @Column(name = "ackTime") + private String ackTime; + + + @Column(name = "ackUser") + private String ackUser; + + public String getId() + { + return id; + } + + public void setId(String id) + { + this.id = id; + } + + public String getDevName() + { + return devName; + } + + public void setDevName(String devName) + { + this.devName = devName; + } + + public String getDevIp() + { + return devIp; + } + + public void setDevIp(String devIp) + { + this.devIp = devIp; + } + + public String getSerialNumber() + { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) + { + this.serialNumber = serialNumber; + } + + public String getAlarmRaisedTime() + { + return alarmRaisedTime; + } + + public void setAlarmRaisedTime(String alarmRaisedTime) + { + this.alarmRaisedTime = alarmRaisedTime; + } + + public String getAlarmChangedTime() + { + return alarmChangedTime; + } + + public void setAlarmChangedTime(String alarmChangedTime) + { + this.alarmChangedTime = alarmChangedTime; + } + + public String getAlarmIdentifier() + { + return alarmIdentifier; + } + + public void setAlarmIdentifier(String alarmIdentifier) + { + this.alarmIdentifier = alarmIdentifier; + } + + public String getNotificationType() + { + return notificationType; + } + + public void setNotificationType(String notificationType) + { + this.notificationType = notificationType; + } + + public String getManagedObjectInstance() + { + return managedObjectInstance; + } + + public void setManagedObjectInstance(String managedObjectInstance) + { + this.managedObjectInstance = managedObjectInstance; + } + + public Integer getEventType() + { + return eventType; + } + + public void setEventType(Integer eventType) + { + this.eventType = eventType; + } + + public String getProbableCause() + { + return probableCause; + } + + public void setProbableCause(String probableCause) + { + this.probableCause = probableCause; + } + + public String getSpecificProblem() + { + return specificProblem; + } + + public void setSpecificProblem(String specificProblem) + { + this.specificProblem = specificProblem; + } + + public String getPerceivedSeverity() + { + return perceivedSeverity; + } + + public void setPerceivedSeverity(String perceivedSeverity) + { + this.perceivedSeverity = perceivedSeverity; + } + + public String getAdditionalText() + { + return additionalText; + } + + public void setAdditionalText(String additionalText) + { + this.additionalText = additionalText; + } + + public String getAdditionalInformation() + { + return additionalInformation; + } + + public void setAdditionalInformation(String additionalInformation) + { + this.additionalInformation = additionalInformation; + } + + public Integer getAlarmState() + { + return alarmState; + } + + public void setAlarmState(Integer alarmState) + { + this.alarmState = alarmState; + } + + public String getClearedManner() + { + return clearedManner; + } + + public void setClearedManner(String clearedManner) + { + this.clearedManner = clearedManner; + } + + public String getAckTime() + { + return ackTime; + } + + public void setAckTime(String ackTime) + { + this.ackTime = ackTime; + } + + public String getAckUser() + { + return ackUser; + } + + public void setAckUser(String ackUser) + { + this.ackUser = ackUser; + } + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append("ActiveAlarmInfo["); + sb.append("id="); + sb.append(id); + sb.append(",devName="); + sb.append(devName); + sb.append(",devIp="); + sb.append(devIp); + sb.append(",serialNumber="); + sb.append(serialNumber); + sb.append(",alarmRaisedTime="); + sb.append(alarmRaisedTime); + sb.append(",alarmChangedTime="); + sb.append(alarmChangedTime); + sb.append(",alarmIdentifier="); + sb.append(alarmIdentifier); + sb.append(",notificationType="); + sb.append(notificationType); + sb.append(",managedObjectInstance="); + sb.append(managedObjectInstance); + sb.append(",eventType="); + sb.append(eventType); + sb.append(",probableCause="); + sb.append(probableCause); + sb.append(",specificProblem="); + sb.append(specificProblem); + sb.append(",perceivedSeverity="); + sb.append(perceivedSeverity); + sb.append(",additionalText="); + sb.append(additionalText); + sb.append(",additionalInformation="); + sb.append(additionalInformation); + sb.append(",clearedManner="); + sb.append(clearedManner); + sb.append(",alarmState="); + sb.append(alarmState); + sb.append(",ackTime="); + sb.append(ackTime); + sb.append(",ackUser="); + sb.append(ackUser); + sb.append("]"); + return sb.toString(); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java new file mode 100644 index 00000000..1bfc13c5 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name="alarms_commoneventheader") +public class AlarmsHeader implements Serializable{ + + @Column(name = "version") + private String version; + + @Column(name = "eventName") + private String eventName; + + @Column(name = "domain") + private String domain; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "eventType") + private String eventType; + + @Column(name = "nfcNamingCode", nullable=false) + private String nfcNamingCode; + + @Column(name = "nfNamingCode", nullable=false) + private String nfNamingCode; + + @Column(name = "sourceId") + private String sourceId; + + @Column(name = "sourceName") + private String sourceName; + + @Column(name = "reportingEntityId") + private String reportingEntityId; + + @Column(name = "reportingEntityName") + private String reportingEntityName; + + @Column(name = "priority") + private String priority; + + @Column(name = "startEpochMicrosec") + private String startEpochMicrosec; + + @Column(name = "lastEpochMicroSec") + private String lastEpochMicroSec; + + @Column(name = "sequence") + private String sequence; + + @Column(name = "faultFieldsVersion") + private String faultFieldsVersion; + + @Column(name = "eventServrity") + private String eventServrity; + + @Column(name = "eventSourceType") + private String eventSourceType; + + @Column(name = "eventCategory") + private String eventCategory; + + @Column(name = "alarmCondition") + private String alarmCondition; + + @Column(name = "specificProblem") + private String specificProblem; + + @Column(name = "vfStatus") + private String vfStatus; + + @Column(name = "alarmInterfaceA") + private String alarmInterfaceA; + + @Column(name = "status") + private String status; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getReportingEntityId() { + return reportingEntityId; + } + + public void setReportingEntityId(String reportingEntityId) { + this.reportingEntityId = reportingEntityId; + } + + public String getReportingEntityName() { + return reportingEntityName; + } + + public void setReportingEntityName(String reportingEntityName) { + this.reportingEntityName = reportingEntityName; + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public String getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(String startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public String getLastEpochMicroSec() { + return lastEpochMicroSec; + } + + public void setLastEpochMicroSec(String lastEpochMicroSec) { + this.lastEpochMicroSec = lastEpochMicroSec; + } + + public String getSequence() { + return sequence; + } + + public void setSequence(String sequence) { + this.sequence = sequence; + } + + public String getFaultFieldsVersion() { + return faultFieldsVersion; + } + + public void setFaultFieldsVersion(String faultFieldsVersion) { + this.faultFieldsVersion = faultFieldsVersion; + } + + public String getEventServrity() { + return eventServrity; + } + + public void setEventServrity(String eventServrity) { + this.eventServrity = eventServrity; + } + + public String getEventSourceType() { + return eventSourceType; + } + + public void setEventSourceType(String eventSourceType) { + this.eventSourceType = eventSourceType; + } + + public String getEventCategory() { + return eventCategory; + } + + public void setEventCategory(String eventCategory) { + this.eventCategory = eventCategory; + } + + public String getAlarmCondition() { + return alarmCondition; + } + + public void setAlarmCondition(String alarmCondition) { + this.alarmCondition = alarmCondition; + } + + public String getSpecificProblem() { + return specificProblem; + } + + public void setSpecificProblem(String specificProblem) { + this.specificProblem = specificProblem; + } + + public String getVfStatus() { + return vfStatus; + } + + public void setVfStatus(String vfStatus) { + this.vfStatus = vfStatus; + } + + public String getAlarmInterfaceA() { + return alarmInterfaceA; + } + + public void setAlarmInterfaceA(String alarmInterfaceA) { + this.alarmInterfaceA = alarmInterfaceA; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java new file mode 100644 index 00000000..7a44a045 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name="alarms_additionalinformation") +public class AlarmsInformation implements Serializable{ + + @Id + @Column(name = "name") + private String name; + + @Column(name = "value") + private String value; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java new file mode 100644 index 00000000..acaff0e3 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name="alarms_commoneventheader") +public class PerformanceHeader implements Serializable{ + + @Column(name = "version") + private String version; + + @Column(name = "eventName") + private String eventName; + + @Column(name = "domain") + private String domain; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "eventType") + private String eventType; + + @Column(name = "nfcNamingCode", nullable=false) + private String nfcNamingCode; + + @Column(name = "nfNamingCode", nullable=false) + private String nfNamingCode; + + @Column(name = "sourceId") + private String sourceId; + + @Column(name = "sourceName") + private String sourceName; + + @Column(name = "reportingEntityId") + private String reportingEntityId; + + @Column(name = "reportingEntityName") + private String reportingEntityName; + + @Column(name = "priority") + private String priority; + + @Column(name = "startEpochMicrosec") + private String startEpochMicrosec; + + @Column(name = "lastEpochMicroSec") + private String lastEpochMicroSec; + + @Column(name = "sequence") + private String sequence; + + @Column(name = "measurementsForVfScalingVersion") + private String measurementsForVfScalingVersion; + + @Column(name = "measurementInterval") + private String measurementInterval; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getReportingEntityId() { + return reportingEntityId; + } + + public void setReportingEntityId(String reportingEntityId) { + this.reportingEntityId = reportingEntityId; + } + + public String getReportingEntityName() { + return reportingEntityName; + } + + public void setReportingEntityName(String reportingEntityName) { + this.reportingEntityName = reportingEntityName; + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public String getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(String startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public String getLastEpochMicroSec() { + return lastEpochMicroSec; + } + + public void setLastEpochMicroSec(String lastEpochMicroSec) { + this.lastEpochMicroSec = lastEpochMicroSec; + } + + public String getSequence() { + return sequence; + } + + public void setSequence(String sequence) { + this.sequence = sequence; + } + + public String getMeasurementsForVfScalingVersion() { + return measurementsForVfScalingVersion; + } + + public void setMeasurementsForVfScalingVersion(String measurementsForVfScalingVersion) { + this.measurementsForVfScalingVersion = measurementsForVfScalingVersion; + } + + public String getMeasurementInterval() { + return measurementInterval; + } + + public void setMeasurementInterval(String measurementInterval) { + this.measurementInterval = measurementInterval; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java new file mode 100644 index 00000000..0e9124be --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name="alarms_additionalinformation") +public class PerformanceInformation implements Serializable{ + + @Id + @Column(name = "name") + private String name; + + @Column(name = "value") + private String value; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java new file mode 100644 index 00000000..bc23ac76 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java @@ -0,0 +1,19 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean.lcm; + +public class ServiceTemplate { +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java new file mode 100644 index 00000000..c847f573 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java @@ -0,0 +1,45 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean.lcm; + +import java.util.List; + +public class ServiceTemplateInput { + + private String name; + + private String type; + + private List inputs; + + public ServiceTemplateInput(String name, String type, List inputs) { + this.name = name; + this.type = type; + this.inputs = inputs; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public List getInputs() { + return inputs; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java new file mode 100644 index 00000000..f4228739 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java @@ -0,0 +1,40 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean.lcm; + +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; + +import java.util.List; + +public class ServiceTemplateInputRsp { + + private ServiceTemplateInput serviceTemplateInput; + + private List vimInfos; + + public ServiceTemplateInputRsp(ServiceTemplateInput serviceTemplateInput, List vimInfos) { + this.serviceTemplateInput = serviceTemplateInput; + this.vimInfos = vimInfos; + } + + public ServiceTemplateInput getServiceTemplateInput() { + return serviceTemplateInput; + } + + public List getVimInfos() { + return vimInfos; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java new file mode 100644 index 00000000..6367d58f --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java @@ -0,0 +1,57 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean.lcm; + +public class TemplateInput { + + private String name; + + private String type; + + private String description; + + private String isRequired; + + private String defaultValue; + + public TemplateInput(String name, String type, String description, String isRequired, String defaultValue) { + this.name = name; + this.type = type; + this.description = description; + this.isRequired = isRequired; + this.defaultValue = defaultValue; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public String getDescription() { + return description; + } + + public String getIsRequired() { + return isRequired; + } + + public String getDefaultValue() { + return defaultValue; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java new file mode 100644 index 00000000..d51ec4b9 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java @@ -0,0 +1,49 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.bean.lcm; + +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; + +import java.util.List; + +public class VfNsPackageInfo { + + private List nsPackage; + + private List vnfPackages; + + private List vimInfos; + + public VfNsPackageInfo(List nsPackage, List vnfPackages, List vimInfos) { + this.nsPackage = nsPackage; + this.vnfPackages = vnfPackages; + this.vimInfos = vimInfos; + } + + public List getNsPackage() { + return nsPackage; + } + + public List getVnfPackages() { + return vnfPackages; + } + + public List getVimInfos() { + return vimInfos; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java new file mode 100644 index 00000000..bf311d6c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.constant; + + +public final class Constant +{ + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java new file mode 100644 index 00000000..8377dd50 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.usecaseui.server.bean.AlarmsHeader; +import org.onap.usecaseui.server.bean.AlarmsInformation; +import org.onap.usecaseui.server.service.AlarmsHeaderService; +import org.onap.usecaseui.server.service.AlarmsInformationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class AlarmController +{ + + + private static final Logger logger = LoggerFactory.getLogger(AlarmController.class); + + @Resource(name = "AlarmsHeaderService") + private AlarmsHeaderService alarmsHeaderService; + + @Resource(name = "AlarmsInformationService") + private AlarmsInformationService alarmsInformationService; + + + @ResponseBody + @RequestMapping(value = {"/alarm/getData"}, method = RequestMethod.GET , produces = "application/json") + public String getAlarmData(HttpServletRequest request) throws JsonProcessingException { + String eventId = request.getParameter("ALARM_eventId"); + String vfStatus = request.getParameter("ALARM_vfStatus"); + String status = request.getParameter("ALARM_status"); + String eventName = request.getParameter("ALARM_eventName"); + String name = request.getParameter("ALARM_name"); + String value = request.getParameter("ALARM_value"); + int currentPage = Integer.parseInt(request.getParameter("ALARM_currentPage")); + int pageSize = Integer.parseInt(request.getParameter("ALARM_pageSize")); + AlarmsHeader alarmsHeader = new AlarmsHeader(); + AlarmsInformation alarmsInformation = new AlarmsInformation(); + if (null != eventId){ + alarmsHeader.setEventId(eventId); + alarmsInformation.setEventId(eventId); + } + if (null != vfStatus) + alarmsHeader.setVfStatus(vfStatus); + if (null != status) + alarmsHeader.setStatus(status); + if (null != eventName) + alarmsHeader.setEventName(eventName); + if (null != name) + alarmsInformation.setName(name); + if (null != value) + alarmsInformation.setValue(value); + List alarmsHeaders = alarmsHeaderService.queryAlarmsHeader(alarmsHeader,currentPage,pageSize).getList(); + List alarmsInformations = alarmsInformationService.queryAlarmsInformation(alarmsInformation,currentPage,pageSize).getList(); + Map maps = new HashMap<>(); + if (null != alarmsHeaders && alarmsHeaders.size() > 0) + maps.put("alarms_header",alarmsHeaders); + if (null != alarmsInformations && alarmsInformations.size() > 0) + maps.put("alarms_information",alarmsInformations); + return new ObjectMapper().writeValueAsString(maps); + } + + @RequestMapping(value = { "/alarm/genCsv" } , method = RequestMethod.GET , produces = "application/json") + public String generateCsvFile(HttpServletRequest request){ + String[] headers = new String[]{"version", + "eventName","domain","eventId","eventType","nfcNamingCode", + "nfNamingCode","sourceId","sourceName","reportingEntityId", + "reportingEntityName","priority","startEpochMicrosec","lastEpochMicroSec", + "sequence","measurementsForVfScalingVersion","measurementInterval","value","name", + "createTime","updateTime"}; + String event_ids = request.getParameter("ids"); + String[] eventId = event_ids.split(","); + + return ""; + } + + + @RequestMapping(value = { "/alarm/updateStatus" } , method = RequestMethod.GET , produces = "application/json") + public String updateStatus(HttpServletRequest request){ + String id = request.getParameter("ALARM_eventId"); + String vfStatus = request.getParameter("ALARM_vfstatus"); + String status = request.getParameter("ALARM_status"); + AlarmsHeader alarmsHeader = new AlarmsHeader(); + if (null != id) + alarmsHeader.setEventId(id); + if (null != vfStatus) + alarmsHeader.setVfStatus(vfStatus); + if (null != status) + alarmsHeader.setStatus(status); + String result = alarmsHeaderService.updateAlarmsHeader(alarmsHeader); + return result; + } + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java new file mode 100644 index 00000000..bd39843d --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.usecaseui.server.bean.PerformanceHeader; +import org.onap.usecaseui.server.bean.PerformanceInformation; +import org.onap.usecaseui.server.service.PerformanceHeaderService; +import org.onap.usecaseui.server.service.PerformanceInformationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.xml.crypto.Data; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Controller +@Configuration +@EnableAspectJAutoProxy +public class PerformanceController { + + @Resource(name = "PerformanceHeaderService") + private PerformanceHeaderService performanceHeaderService; + + @Resource(name = "PerformanceInformationService") + private PerformanceInformationService performanceInformationService; + + private final String csvPath = ""; + + private Logger looger = LoggerFactory.getLogger(PerformanceController.class); + + @ResponseBody + @RequestMapping(value = {"/pro/getData"},method = RequestMethod.GET, produces = "application/json") + public String getPerformanceData(HttpServletRequest request) throws JsonProcessingException { + String eventId = request.getParameter("PERFORMANCE_eventId"); + String eventName = request.getParameter("PERFORMANCE_eventName"); + String name = request.getParameter("PERFORMANCE_name"); + String value = request.getParameter("PERFORMANCE_value"); + int currentPage = Integer.parseInt(request.getParameter("PERFORMANCE_currentPage")); + int pageSize = Integer.parseInt(request.getParameter("PERFORMANCE_pageSize")); + PerformanceHeader performanceHeader = new PerformanceHeader(); + PerformanceInformation performanceInformation = new PerformanceInformation(); + if (null != eventId){ + performanceHeader.setEventId(eventId); + performanceInformation.setEventId(eventId); + } + if (null != eventName) + performanceHeader.setEventName(eventName); + if (null != name) + performanceInformation.setName(name); + if (null != value) + performanceInformation.setValue(value); + List performanceHeaders = performanceHeaderService.queryPerformanceHeader(performanceHeader,currentPage,pageSize).getList(); + List performanceInformations = performanceInformationService.queryPerformanceInformation(performanceInformation,currentPage,pageSize).getList(); + Map maps = new HashMap<>(); + if (null != performanceHeaders && performanceHeaders.size() > 0) + maps.put("performance_header",performanceHeaders); + if (null != performanceInformations && performanceInformations.size() > 0) + maps.put("performance_information",performanceInformations); + return new ObjectMapper().writeValueAsString(maps); + } + + @RequestMapping(value = {"/pro/genCsv"}, method = RequestMethod.GET, produces = "application/json") + public String generateCsvFile(HttpServletRequest request){ + String[] headers = new String[]{"version", + "eventName","domain","eventId","eventType","nfcNamingCode", + "nfNamingCode","sourceId","sourceName","reportingEntityId", + "reportingEntityName","priority","startEpochMicrosec","lastEpochMicroSec", + "sequence","measurementsForVfScalingVersion","measurementInterval","value","name", + "createTime","updateTime"}; + List performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList(); + List performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList(); + List csvData = new ArrayList<>(); + + return ""; + } + + @RequestMapping(value = {"/pro/genDiaCsv"}, method = RequestMethod.GET, produces = "application/json") + public String generateDiaCsvFile(HttpServletRequest request){ + String[] headers = new String[]{"","","",""}; + List performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList(); + List performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList(); + List csvData = new ArrayList<>(); + + return ""; + } + + @ResponseBody + @RequestMapping(value = {"/pro/genDia"}, method = RequestMethod.GET, produces = "application/json") + public String generateDiagram(HttpServletRequest request) throws ParseException, JsonProcessingException { + String id = request.getParameter("PERFORMANCE_id"); + String data = request.getParameter("PERFORMANCE_data"); + SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd"); + Date beginDate = new Date(); + Calendar date = Calendar.getInstance(); + date.setTime(beginDate); + PerformanceInformation p = new PerformanceInformation(); + p.setEventId(id); + if ("hour".equals(data)){ + date.set(Calendar.DATE, date.get(Calendar.HOUR) - 1); + Date endDate = dft.parse(dft.format(date.getTime())); + p.setCreateTime(endDate); + } + if ("day".equals(data)){ + date.set(Calendar.DATE, date.get(Calendar.DATE) - 1); + Date endDate = dft.parse(dft.format(date.getTime())); + p.setCreateTime(endDate); + } + if ("month".equals(data)){ + date.set(Calendar.DATE, date.get(Calendar.MONTH) - 1); + Date endDate = dft.parse(dft.format(date.getTime())); + p.setCreateTime(endDate); + } + if ("year".equals(data)){ + date.set(Calendar.DATE, date.get(Calendar.YEAR) - 1); + Date endDate = dft.parse(dft.format(date.getTime())); + p.setCreateTime(endDate); + } + List informationList = performanceInformationService.queryPerformanceInformation(p,1,4).getList(); + return new ObjectMapper().writeValueAsString(informationList); + } + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java new file mode 100644 index 00000000..a1b8d0ef --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java @@ -0,0 +1,43 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.lcm; + +import org.onap.usecaseui.server.service.lcm.CustomerService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class CustomerController { + + @Resource(name="CustomerService") + private CustomerService customerService; + + @ResponseBody + @RequestMapping(value = {"/lcm/customers"}, method = RequestMethod.GET , produces = "application/json") + public List getCustomers(HttpServletRequest request){ + return customerService.listCustomer(); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java new file mode 100644 index 00000000..05364b24 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java @@ -0,0 +1,45 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.lcm; + +import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; +import org.onap.usecaseui.server.service.lcm.PackageDistributionService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; + +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class PackageDistributionController { + + private static final Logger logger = LoggerFactory.getLogger(PackageDistributionController.class); + + @Resource(name="PackageDistributionService") + private PackageDistributionService packageDistributionService; + + @ResponseBody + @RequestMapping(value = {"/lcm/vf-ns-packages"}, method = RequestMethod.GET , produces = "application/json") + public VfNsPackageInfo instantiateService(){ + return packageDistributionService.retrievePackageInfo(); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java new file mode 100644 index 00000000..3d51f649 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java @@ -0,0 +1,54 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.lcm; + +import org.onap.usecaseui.server.service.lcm.ServiceInstanceService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class ServiceInstanceController { + + private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceController.class); + + @Resource(name="ServiceInstanceService") + private ServiceInstanceService serviceInstanceService; + + @ResponseBody + @RequestMapping(value = {"/lcm/service-instances"}, method = RequestMethod.GET , produces = "application/json") + public List getCustomers(HttpServletRequest request){ + String customerId = request.getParameter("customerId"); + String serviceType = request.getParameter("serviceType"); + logger.info(String.format( + "list service instances with [customerId=%s, serviceType=%s]", + customerId, + serviceType)); + + return serviceInstanceService.listServiceInstances(customerId, serviceType); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java new file mode 100644 index 00000000..d0c95521 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java @@ -0,0 +1,57 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.lcm; + +import org.onap.usecaseui.server.service.lcm.ServiceLcmService; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class ServiceLcmController { + + private static final Logger logger = LoggerFactory.getLogger(ServiceLcmController.class); + + @Resource(name="ServiceLcmService") + private ServiceLcmService serviceLcmService; + + @ResponseBody + @RequestMapping(value = {"/lcm/services"}, method = RequestMethod.POST , produces = "application/json") + public ServiceOperation instantiateService(@RequestBody ServiceInstantiationRequest request){ + return serviceLcmService.instantiateService(request); + } + + @ResponseBody + @RequestMapping(value = {"/lcm/services/{serviceId}/operations/{operationId}"}, method = RequestMethod.GET , produces = "application/json") + public OperationProgressInformation instantiateService(@PathVariable(value="serviceId") String serviceId, @PathVariable(value="operationId") String operationId){ + return serviceLcmService.queryOperationProgress(serviceId, operationId); + } + + @ResponseBody + @RequestMapping(value = {"/lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json") + public ServiceOperation terminateService(@PathVariable(value = "serviceId") String serviceId){ + return serviceLcmService.terminateService(serviceId); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java new file mode 100644 index 00000000..2d8333a4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java @@ -0,0 +1,51 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.lcm; + +import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; +import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class ServiceTemplateController { + + private static final Logger logger = LoggerFactory.getLogger(ServiceTemplateController.class); + + @Resource(name="ServiceTemplateService") + private ServiceTemplateService serviceTemplateService; + + @ResponseBody + @RequestMapping(value = {"/lcm/service-templates"}, method = RequestMethod.GET , produces = "application/json") + public List getServiceTemplates(){ + return serviceTemplateService.listDistributedServiceTemplate(); + } + + @ResponseBody + @RequestMapping(value = {"/lcm/service-templates/service-template/{uuid}"}, method = RequestMethod.GET , produces = "application/json") + public ServiceTemplateInputRsp getServiceTemplateInput(@PathVariable("uuid") String uuid, @RequestParam("toscaModelPath") String toscaModelPath){ + return serviceTemplateService.fetchServiceTemplateInput(uuid, toscaModelPath); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java b/server/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java new file mode 100644 index 00000000..475adc01 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.dao; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.stereotype.Component; + + +@Component +public class UsecaseuiDataSource +{ + @Value("${spring.database.driver.classname}") + private String dbDriverClassName; + + @Value("${spring.datasource.url}") + private String dbUrl; + + @Value("${spring.datasource.username}") + private String dbUsername; + + @Value("${spring.datasource.password}") + private String dbPassword; + + @Bean + public DataSource dataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(dbDriverClassName); + dataSource.setUrl(dbUrl); + dataSource.setUsername(dbUsername); + dataSource.setPassword(dbPassword); + return dataSource; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java b/server/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java new file mode 100644 index 00000000..b4850fcb --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.exception; + + +public class ErrorCodeException extends Exception +{ + private static final long serialVersionUID = 3220072444842529499L; + + private int categoryCode = 0; + + private int errorCode = 1; + + private String[] arguments = null; + + private static String defaultText = null; + + public static void setDefaultText(String text) + { + defaultText = text; + } + + public static String getDefaultText() + { + return defaultText; + } + + public ErrorCodeException(int code, String debugMessage) + { + this(code, debugMessage, null); + } + + public ErrorCodeException(int code, String debugMessage, String[] arguments) + { + super(debugMessage); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int code) + { + this(source, code, (String[])null); + } + + public ErrorCodeException(Throwable source, int code, String[] arguments) + { + super(source); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int code, String debugMessage) + { + this(source, code, debugMessage, null); + } + + public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) + { + super(debugMessage, source); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(int category, int code, String debugMessage) + { + this(category, code, debugMessage, null); + } + + public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) + { + super(debugMessage); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int category, int code) + { + this(source, category, code, (String[])null); + } + + public ErrorCodeException(Throwable source, int category, int code, String[] arguments) + { + super(source); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int category, int code, String debugMessage) + { + this(source, category, code, debugMessage, null); + } + + public ErrorCodeException(Throwable source, int category, int code, String debugMessage, + String[] arguments) + { + super(debugMessage, source); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public int getCategory() + { + return categoryCode; + } + + public int getErrorCode() + { + return errorCode; + } + + public String[] getArguments() + { + return arguments; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java b/server/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java new file mode 100644 index 00000000..70a3bce8 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.hibernate; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.orm.hibernate4.LocalSessionFactoryBean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.transaction.PlatformTransactionManager; + + +@org.springframework.context.annotation.Configuration +public class HibernateConfiguration +{ + @Autowired + private DataSource dataSource; + + @Bean + public LocalSessionFactoryBean sessionFactory() { + + LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + sessionFactory.setDataSource(dataSource); + sessionFactory.setHibernateProperties(hibernateProperties()); + sessionFactory.setPackagesToScan(new String[] {"org.onap.usecaseui.server.bean"}); + return sessionFactory; + } + + private Properties hibernateProperties() { + Properties properties = new Properties(); + properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); + properties.put("hibernate.show_sql", "false"); + return properties; + } + + @Bean + public PlatformTransactionManager transactionManager() { + return new JpaTransactionManager(); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java b/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java new file mode 100644 index 00000000..5038c469 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.listener; + +import org.onap.usecaseui.server.service.InitializationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; + + +public class UsecaseServerEventListener implements ApplicationListener +{ + private static final Logger logger = LoggerFactory.getLogger(UsecaseServerEventListener.class); + + @Autowired + InitializationService initializationService; + + public void onApplicationEvent(ApplicationReadyEvent arg0) + { + initializationService.initialize(); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java b/server/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java new file mode 100644 index 00000000..0363b814 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + + +//@Configuration +//@EnableWebSecurity +public class RestfulSecurityConfig extends WebSecurityConfigurerAdapter +{ + @Override + protected void configure(HttpSecurity http) + throws Exception + { + // TODO Auto-generated method stub + super.configure(http); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) + throws Exception + { + // TODO Auto-generated method stub + super.configure(auth); + } + + @Override + @Bean + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmService.java new file mode 100644 index 00000000..0834cece --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmService.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + +import org.onap.usecaseui.server.bean.ActiveAlarmInfo; + +public interface AlarmService +{ + String hello(); + + String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java new file mode 100644 index 00000000..7ea8aec9 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + + +import org.onap.usecaseui.server.bean.AlarmsHeader; +import org.onap.usecaseui.server.util.Page; + +public interface AlarmsHeaderService { + + String saveAlarmsHeader(AlarmsHeader alarmsHeader); + + String updateAlarmsHeader(AlarmsHeader alarmsHeader); + + int getAllCount(); + + Page queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize); + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java new file mode 100644 index 00000000..a9e01a56 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + +import org.onap.usecaseui.server.bean.AlarmsInformation; +import org.onap.usecaseui.server.util.Page; + + +public interface AlarmsInformationService { + + String saveAlarmsInformation(AlarmsInformation alarmsInformation); + + String updateAlarmsInformation(AlarmsInformation alarmsInformation); + + int getAllCount(); + + Page queryAlarmsInformation(AlarmsInformation alarmsInformation,int currentPage,int pageSize); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/InitializationService.java b/server/src/main/java/org/onap/usecaseui/server/service/InitializationService.java new file mode 100644 index 00000000..330d1424 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/InitializationService.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + + +public interface InitializationService +{ + void initialize(); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java new file mode 100644 index 00000000..ed4226cd --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + +import org.onap.usecaseui.server.bean.PerformanceHeader; +import org.onap.usecaseui.server.util.Page; + + +public interface PerformanceHeaderService { + + String savePerformanceHeader(PerformanceHeader performanceHeder); + + String updatePerformanceHeader(PerformanceHeader performanceHeder); + + int getAllCount(); + + Page queryPerformanceHeader(PerformanceHeader performanceHeder,int currentPage,int pageSize); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java new file mode 100644 index 00000000..51c0e1a3 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + +import org.onap.usecaseui.server.bean.PerformanceInformation; +import org.onap.usecaseui.server.util.Page; + + +public interface PerformanceInformationService { + + String savePerformanceInformation(PerformanceInformation performanceInformation); + + String updatePerformanceInformation(PerformanceInformation performanceInformation); + + int getAllCount(); + + Page queryPerformanceInformation(PerformanceInformation performanceInformation,int currentPage,int pageSize); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java new file mode 100644 index 00000000..4e0f8f9c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + +import java.util.UUID; + +import javax.transaction.Transactional; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.onap.usecaseui.server.bean.ActiveAlarmInfo; +import org.onap.usecaseui.server.service.AlarmService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("AlarmService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class AlarmServiceImpl implements AlarmService +{ + private static final Logger logger = LoggerFactory.getLogger(AlarmServiceImpl.class); + + @Autowired + private SessionFactory sessionFactory; + + public String hello() + { + return "Hello"; + } + + + @Transactional + public String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo) + { + try + { + if (null == acAlarmInfo) + { + logger.error("AlarmServiceImpl saveActiveAlarmInfo acAlarmInfo is null!"); + } + logger.info("AlarmServiceImpl saveActiveAlarmInfo: acAlarmInfo={}", acAlarmInfo); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + acAlarmInfo.setId(UUID.randomUUID().toString()); + session.save(acAlarmInfo); + tx.commit(); + session.flush(); + session.close(); + } + catch (Exception e) + { + logger.error("Exception occurred while performing AlarmServiceImpl saveActiveAlarmInfo. Details:" + e.getMessage()); + } + + return acAlarmInfo.getId(); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java new file mode 100644 index 00000000..d0e571a3 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.onap.usecaseui.server.bean.AlarmsHeader; +import org.onap.usecaseui.server.service.AlarmsHeaderService; +import org.onap.usecaseui.server.util.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("AlarmsHeaderService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class AlarmsHeaderServiceImpl implements AlarmsHeaderService { + + private static final Logger logger = LoggerFactory.getLogger(AlarmsHeaderServiceImpl.class); + + @Autowired + private SessionFactory sessionFactory; + + + public String saveAlarmsHeader(AlarmsHeader alarmsHeader) { + try{ + if (null == alarmsHeader) { + logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!"); + } + logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.save(alarmsHeader); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage()); + return "0"; + } + + } + + + @Override + public String updateAlarmsHeader(AlarmsHeader alarmsHeader) { + try{ + if (null == alarmsHeader){ + logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!"); + } + logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.update(alarmsHeader); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage()); + return "0"; + } + } + + public int getAllCount() { + try{ + Session session = sessionFactory.openSession(); + long q=(long)session.createQuery("select count(*) from AlarmsHeader").uniqueResult(); + session.flush(); + session.close(); + return (int)q; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage()); + return -1; + } + } + + @SuppressWarnings("unchecked") + @Override + public Page queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize) { + Page page = new Page(); + int allRow =this.getAllCount(); + int offset = page.countOffset(currentPage, pageSize); + + try{ + Date date = new Date(); +// SimpleDateFormat date = new SimpleDateFormat("yy-MM-dd hh:mm:ss"); + StringBuffer hql =new StringBuffer("from AlarmsHeader a where 1=1"); + if (null == alarmsHeader) { + logger.error("AlarmsHeaderServiceImpl queryAlarmsHeader alarmsHeader is null!"); + }else if(null!=alarmsHeader.getVersion()) { + String ver=alarmsHeader.getVersion(); + hql.append(" and a.version like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getEventName()) { + String ver=alarmsHeader.getEventName(); + hql.append(" and a.eventName like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getAlarmCondition()) { + String ver=alarmsHeader.getAlarmCondition(); + hql.append(" and a.alarmCondition like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getDomain()) { + String ver=alarmsHeader.getDomain(); + hql.append(" and a.domain like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getEventId()) { + String ver=alarmsHeader.getEventId(); + hql.append(" and a.eventId like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getNfcNamingCode()) { + String ver=alarmsHeader.getNfcNamingCode(); + hql.append(" and a.nfcNamingCode like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getNfNamingCode()) { + String ver=alarmsHeader.getNfNamingCode(); + hql.append(" and a.nfNamingCode like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getSourceId()) { + String ver =alarmsHeader.getSourceId(); + hql.append(" and a.sourceId like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getSourceName()) { + String ver =alarmsHeader.getSourceName(); + hql.append(" and a.sourceName like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getReportingEntityId()) { + String ver =alarmsHeader.getReportingEntityId(); + hql.append(" and a.reportingEntityId like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getReportingEntityName()) { + String ver =alarmsHeader.getReportingEntityName(); + hql.append(" and a.reportingEntityName like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getPriority()) { + String ver =alarmsHeader.getPriority(); + hql.append(" and a.priority like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getStartEpochMicrosec()) { + String ver =alarmsHeader.getStartEpochMicrosec(); + hql.append(" and a.startEpochMicrosec like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getLastEpochMicroSec()) { + String ver =alarmsHeader.getLastEpochMicroSec(); + hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getSequence()) { + String ver =alarmsHeader.getSequence(); + hql.append(" and a.sequence like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getFaultFieldsVersion()) { + String ver =alarmsHeader.getFaultFieldsVersion(); + hql.append(" and a.faultFieldsVersion like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getEventServrity()) { + String ver =alarmsHeader.getEventServrity(); + hql.append(" and a.eventServrity like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getEventType()) { + String ver =alarmsHeader.getEventType(); + hql.append(" and a.eventSourceType like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getEventCategory()) { + String ver =alarmsHeader.getEventCategory(); + hql.append(" and a.eventCategory like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getAlarmCondition()) { + String ver =alarmsHeader.getAlarmCondition(); + hql.append(" and a.alarmCondition like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getSpecificProblem()) { + String ver =alarmsHeader.getSpecificProblem(); + hql.append(" and a.specificProblem like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getVfStatus()) { + String ver =alarmsHeader.getVfStatus(); + hql.append(" and a.vfStatus like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getAlarmInterfaceA()) { + String ver =alarmsHeader.getAlarmInterfaceA(); + hql.append(" and a.alarmInterfaceA like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getStatus()) { + String ver =alarmsHeader.getStatus(); + hql.append(" and a.status like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getCreateTime()) { + Date ver =alarmsHeader.getCreateTime(); + hql.append(" and a.createTime like '%"+ver+"%'"); + }else if(null!=alarmsHeader.getUpdateTime()) { + Date ver =alarmsHeader.getUpdateTime(); + hql.append(" and a.updateTime like '%"+ver+"%'"); + } + logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + Query query = session.createQuery(hql.toString()); + query.setFirstResult(offset); + query.setMaxResults(pageSize); + List list= query.list(); + page.setPageNo(currentPage); + page.setPageSize(pageSize); + page.setTotalRecords(allRow); + page.setList(list); + tx.commit(); + session.flush(); + session.close(); + return page; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage()); + return null; + } + } + + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java new file mode 100644 index 00000000..8c9af44c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.onap.usecaseui.server.bean.AlarmsInformation; +import org.onap.usecaseui.server.service.AlarmsInformationService; +import org.onap.usecaseui.server.util.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("AlarmsInformationService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class AlarmsInformationServiceImpl implements AlarmsInformationService { + private static final Logger logger = LoggerFactory.getLogger(AlarmsInformationServiceImpl.class); + + @Autowired + private SessionFactory sessionFactory; + + @Override + public String saveAlarmsInformation(AlarmsInformation alarmsInformation) { + try{ + if (null == alarmsInformation) { + logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!"); + } + logger.info("AlarmsInformationServiceImpl saveAlarmsInformation: alarmsInformation={}", alarmsInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.save(alarmsInformation); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage()); + return "0"; + } + + } + + @Override + public String updateAlarmsInformation(AlarmsInformation alarmsInformation) { + try{ + if (null == alarmsInformation) { + logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!"); + } + logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}", alarmsInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.update(alarmsInformation); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage()); + return "0"; + } + } + + + public int getAllCount() { + try{ + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + long q=(long)session.createQuery("select count(*) from AlarmsInformation").uniqueResult(); + tx.commit(); + session.flush(); + session.close(); + return (int)q; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage()); + return 0; + } + } + + @SuppressWarnings("unchecked") + @Override + public Page queryAlarmsInformation(AlarmsInformation alarmsInformation, int currentPage, + int pageSize) { + Page page = new Page(); + int allRow =this.getAllCount(); + int offset = page.countOffset(currentPage, pageSize); + + try{ + StringBuffer hql =new StringBuffer("from AlarmsInformation a where 1=1"); + if (null == alarmsInformation) { + logger.error("AlarmsInformationServiceImpl queryAlarmsInformation alarmsInformation is null!"); + }else if(null!=alarmsInformation.getName()) { + String ver=alarmsInformation.getName(); + hql.append(" and a.name like '%"+ver+"%'"); + }else if(null!=alarmsInformation.getValue()) { + String ver=alarmsInformation.getValue(); + hql.append(" and a.value like '%"+ver+"%'"); + }else if(null!=alarmsInformation.getEventId()) { + String ver=alarmsInformation.getEventId(); + hql.append(" and a.eventId like '%"+ver+"%'"); + }else if(null!=alarmsInformation.getCreateTime()) { + Date ver =alarmsInformation.getCreateTime(); + hql.append(" and a.createTime like '%"+ver+"%'"); + }else if(null!=alarmsInformation.getUpdateTime()) { + Date ver =alarmsInformation.getUpdateTime(); + hql.append(" and a.updateTime like '%"+ver+"%'"); + } + logger.info("AlarmsInformationServiceImpl queryAlarmsInformation: alarmsInformation={}", alarmsInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + Query query = session.createQuery(hql.toString()); + query.setFirstResult(offset); + query.setMaxResults(pageSize); + List list= query.list(); + page.setPageNo(currentPage); + page.setPageSize(pageSize); + page.setTotalRecords(allRow); + page.setList(list); + tx.commit(); + session.flush(); + session.close(); + return page; + } catch (Exception e) { + logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage()); + return null; + } + } + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java new file mode 100644 index 00000000..adc1ffe9 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + +import javax.transaction.Transactional; + +import org.onap.usecaseui.server.service.InitializationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("InitializationService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class InitializationServiceImpl implements InitializationService +{ + private static final Logger logger = LoggerFactory.getLogger(InitializationServiceImpl.class); + /**{@inheritDoc} + */ + public void initialize() + { + logger.info("InitializationServiceImpl initialize init..."); + + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java new file mode 100644 index 00000000..244a96b2 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.onap.usecaseui.server.bean.PerformanceHeader; +import org.onap.usecaseui.server.service.PerformanceHeaderService; +import org.onap.usecaseui.server.util.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("PerformanceHeaderService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class PerformanceHeaderServiceImpl implements PerformanceHeaderService { + + private static final Logger logger = LoggerFactory.getLogger(PerformanceHeaderServiceImpl.class); + + @Autowired + private SessionFactory sessionFactory; + + + @Override + public String savePerformanceHeader(PerformanceHeader performanceHeder) { + try{ + if (null == performanceHeder){ + logger.error("PerformanceHeaderServiceImpl savePerformanceHeader performanceHeder is null!"); + } + logger.info("PerformanceHeaderServiceImpl savePerformanceHeader: performanceHeder={}", performanceHeder); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.save(performanceHeder); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage()); + return "0"; + } + + } + + + @Override + public String updatePerformanceHeader(PerformanceHeader performanceHeder) { + try{ + if (null == performanceHeder){ + logger.error("PerformanceHeaderServiceImpl updatePerformanceHeader performanceHeder is null!"); + } + logger.info("PerformanceHeaderServiceImpl savePerformanceHeader: performanceHeder={}", performanceHeder); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.update(performanceHeder); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage()); + return "0"; + } + } + + + public int getAllCount() { + try{ + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + long q=(long)session.createQuery("select count(*) from PerformanceHeader").uniqueResult(); + tx.commit(); + session.flush(); + session.close(); + return (int)q; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage()); + return 0; + } + } + + @SuppressWarnings("unchecked") + @Override + public Page queryPerformanceHeader(PerformanceHeader performanceHeder, int currentPage, + int pageSize) { + Page page = new Page(); + int allRow =this.getAllCount(); + int offset = page.countOffset(currentPage, pageSize); + + try{ + StringBuffer hql =new StringBuffer("from PerformanceHeader a where 1=1"); + if (null == performanceHeder) { + logger.error("PerformanceHeaderServiceImpl queryAlarmsHeader performanceHeder is null!"); + }else if(null!=performanceHeder.getVersion()) { + String ver=performanceHeder.getVersion(); + hql.append(" and a.version like '%"+ver+"%'"); + }else if(null!=performanceHeder.getEventName()) { + String ver=performanceHeder.getEventName(); + hql.append(" and a.eventName like '%"+ver+"%'"); + }else if(null!=performanceHeder.getDomain()) { + String ver=performanceHeder.getDomain(); + hql.append(" and a.domain like '%"+ver+"%'"); + }else if(null!=performanceHeder.getEventId()) { + String ver=performanceHeder.getEventId(); + hql.append(" and a.eventId like '%"+ver+"%'"); + }else if(null!=performanceHeder.getNfcNamingCode()) { + String ver=performanceHeder.getNfcNamingCode(); + hql.append(" and a.nfcNamingCode like '%"+ver+"%'"); + }else if(null!=performanceHeder.getNfNamingCode()) { + String ver=performanceHeder.getNfNamingCode(); + hql.append(" and a.nfNamingCode like '%"+ver+"%'"); + }else if(null!=performanceHeder.getSourceId()) { + String ver =performanceHeder.getSourceId(); + hql.append(" and a.sourceId like '%"+ver+"%'"); + }else if(null!=performanceHeder.getSourceName()) { + String ver =performanceHeder.getSourceName(); + hql.append(" and a.sourceName like '%"+ver+"%'"); + }else if(null!=performanceHeder.getReportingEntityId()) { + String ver =performanceHeder.getReportingEntityId(); + hql.append(" and a.reportingEntityId like '%"+ver+"%'"); + }else if(null!=performanceHeder.getReportingEntityName()) { + String ver =performanceHeder.getReportingEntityName(); + hql.append(" and a.reportingEntityName like '%"+ver+"%'"); + }else if(null!=performanceHeder.getPriority()) { + String ver =performanceHeder.getPriority(); + hql.append(" and a.priority like '%"+ver+"%'"); + }else if(null!=performanceHeder.getStartEpochMicrosec()) { + String ver =performanceHeder.getStartEpochMicrosec(); + hql.append(" and a.startEpochMicrosec like '%"+ver+"%'"); + }else if(null!=performanceHeder.getLastEpochMicroSec()) { + String ver =performanceHeder.getLastEpochMicroSec(); + hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'"); + }else if(null!=performanceHeder.getSequence()) { + String ver =performanceHeder.getSequence(); + hql.append(" and a.sequence like '%"+ver+"%'"); + }else if(null!=performanceHeder.getMeasurementsForVfScalingVersion()) { + String ver =performanceHeder.getMeasurementsForVfScalingVersion(); + hql.append(" and a.measurementsForVfScalingVersion like '%"+ver+"%'"); + }else if(null!=performanceHeder.getMeasurementInterval()) { + String ver =performanceHeder.getMeasurementInterval(); + hql.append(" and a.measurementInterval like '%"+ver+"%'"); + }else if(null!=performanceHeder.getEventType()) { + String ver =performanceHeder.getEventType(); + hql.append(" and a.eventSourceType like '%"+ver+"%'"); + }else if(null!=performanceHeder.getCreateTime()) { + Date ver =performanceHeder.getCreateTime(); + hql.append(" and a.createTime like '%"+ver+"%'"); + }else if(null!=performanceHeder.getUpdateTime()) { + Date ver =performanceHeder.getUpdateTime(); + hql.append(" and a.updateTime like '%"+ver+"%'"); + } + logger.info("PerformanceHeaderServiceImpl queryPerformanceHeader: performanceHeder={}", performanceHeder); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + Query query = session.createQuery(hql.toString()); + query.setFirstResult(offset); + query.setMaxResults(pageSize); + List list= query.list(); + page.setPageNo(currentPage); + page.setPageSize(pageSize); + page.setTotalRecords(allRow); + page.setList(list); + tx.commit(); + session.flush(); + session.close(); + return page; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage()); + return null; + } + } + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java new file mode 100644 index 00000000..04ef2fae --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.impl; + + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.onap.usecaseui.server.bean.PerformanceInformation; +import org.onap.usecaseui.server.service.PerformanceInformationService; +import org.onap.usecaseui.server.util.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + + +@Service("PerformanceInformationService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class PerformanceInformationServiceImpl implements PerformanceInformationService { + private static final Logger logger = LoggerFactory.getLogger(PerformanceInformationServiceImpl.class); + + @Autowired + private SessionFactory sessionFactory; + + + @Override + public String savePerformanceInformation(PerformanceInformation performanceInformation) { + try { + if (null == performanceInformation) { + logger.error("performanceInformation PerformanceInformation performanceInformation is null!"); + } + logger.info("PerformanceInformationServiceImpl savePerformanceInformation: performanceInformation={}", performanceInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.save(performanceInformation); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage()); + return "0"; + } + + } + + + @Override + public String updatePerformanceInformation(PerformanceInformation performanceInformation) { + try { + if (null == performanceInformation) { + logger.error("performanceInformation PerformanceInformation performanceInformation is null!"); + } + logger.info("PerformanceInformationServiceImpl savePerformanceInformation: performanceInformation={}", performanceInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + session.update(performanceInformation); + tx.commit(); + session.flush(); + session.close(); + return "1"; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage()); + return "0"; + } + } + + + public int getAllCount() { + try{ + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + long q=(long)session.createQuery("select count(*) from PerformanceInformation").uniqueResult(); + tx.commit(); + session.flush(); + session.close(); + return (int)q; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage()); + return 0; + } + } + + @SuppressWarnings("unchecked") + @Override + public Page queryPerformanceInformation(PerformanceInformation performanceInformation, + int currentPage, int pageSize) { + Page page = new Page(); + int allRow =this.getAllCount(); + int offset = page.countOffset(currentPage, pageSize); + + try{ + StringBuffer hql =new StringBuffer("from PerformanceInformation a where 1=1"); + if (null == performanceInformation) { + logger.error("AlarmsInformationServiceImpl queryPerformanceInformation performanceInformation is null!"); + }else if(null!=performanceInformation.getName()) { + String ver=performanceInformation.getName(); + hql.append(" and a.name like '%"+ver+"%'"); + }else if(null!=performanceInformation.getValue()) { + String ver=performanceInformation.getValue(); + hql.append(" and a.value like '%"+ver+"%'"); + }else if(null!=performanceInformation.getEventId()) { + String ver=performanceInformation.getEventId(); + hql.append(" and a.eventId like '%"+ver+"%'"); + }else if(null!=performanceInformation.getCreateTime()) { + Date ver =performanceInformation.getCreateTime(); + hql.append(" and a.createTime like '%"+ver+"%'"); + }else if(null!=performanceInformation.getUpdateTime()) { + Date ver =performanceInformation.getUpdateTime(); + hql.append(" and a.updateTime like '%"+ver+"%'"); + } + logger.info("PerformanceInformationServiceImpl queryPerformanceInformation: performanceInformation={}", performanceInformation); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + Query query = session.createQuery(hql.toString()); + query.setFirstResult(offset); + query.setMaxResults(pageSize); + List list= query.list(); + page.setPageNo(currentPage); + page.setPageSize(pageSize); + page.setTotalRecords(allRow); + page.setList(list); + tx.commit(); + session.flush(); + session.close(); + return page; + } catch (Exception e) { + logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage()); + return null; + } + } + + + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java new file mode 100644 index 00000000..9c659469 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java @@ -0,0 +1,24 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm; + +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; + +import java.util.List; + +public interface CustomerService { + List listCustomer(); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java new file mode 100644 index 00000000..867df4d4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java @@ -0,0 +1,23 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm; + +import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; + +public interface PackageDistributionService { + + VfNsPackageInfo retrievePackageInfo(); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java new file mode 100644 index 00000000..1775211c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java @@ -0,0 +1,25 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm; + +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; + +import java.util.List; + +public interface ServiceInstanceService { + + List listServiceInstances(String customerId, String serviceType); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java new file mode 100644 index 00000000..fc893f3b --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java @@ -0,0 +1,29 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm; + +import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; + +public interface ServiceLcmService { + + ServiceOperation instantiateService(ServiceInstantiationRequest request); + + OperationProgressInformation queryOperationProgress(String serviceId, String operationId); + + ServiceOperation terminateService(String serviceId); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java new file mode 100644 index 00000000..22479e61 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java @@ -0,0 +1,28 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm; + +import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; + +import java.util.List; + +public interface ServiceTemplateService { + + List listDistributedServiceTemplate(); + + ServiceTemplateInputRsp fetchServiceTemplateInput(String uuid, String toscaModelPath); +} \ No newline at end of file diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java new file mode 100644 index 00000000..fc83f4f0 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java @@ -0,0 +1,53 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.aai; + +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.Path; + +import java.util.List; + +public interface AAIService { + + @Headers({ + "X-TransactionId: 7777", + "X-FromAppId: uui", + "Authorization: QUFJOkFBSQ==" + }) + @GET("/api/aai-business/v11/customers") + Call> listCustomer(); + + @Headers({ + "X-TransactionId: 7777", + "X-FromAppId: uui", + "Authorization: QUFJOkFBSQ==" + }) + @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + Call> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); + + @Headers({ + "X-TransactionId: 7777", + "X-FromAppId: uui", + "Authorization: QUFJOkFBSQ==" + }) + @GET("/cloud-infrastructure/cloud-regions") + Call> listVimInfo(); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java new file mode 100644 index 00000000..e1135236 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java @@ -0,0 +1,53 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AAICustomer { + + private String globalCustomerId; + + private String subscriberName; + + private String subscriberType; + + @JsonCreator + public AAICustomer( + @JsonProperty("global-customer-id") String globalCustomerId, + @JsonProperty("subscriber-name") String subscriberName, + @JsonProperty("subscriber-type") String subscriberType) { + this.globalCustomerId = globalCustomerId; + this.subscriberName = subscriberName; + this.subscriberType = subscriberType; + } + + @JsonProperty("global-customer-id") + public String getGlobalCustomerId() { + return globalCustomerId; + } + + @JsonProperty("subscriber-name") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriber-type") + public String getSubscriberType() { + return subscriberType; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java new file mode 100644 index 00000000..5245d27b --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java @@ -0,0 +1,89 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceInstance { + + private String globalCustomerId; + + private String serviceType; + + private String serviceInstanceId; + + private String subscriberName; + + private String subscriberType; + + private String serviceInstanceName; + + private String serviceInstanceLocationId; + + @JsonCreator + public ServiceInstance( + @JsonProperty("global-customer-id") String globalCustomerId, + @JsonProperty("service-type") String serviceType, + @JsonProperty("service-instance-id") String serviceInstanceId, + @JsonProperty("subscriber-name") String subscriberName, + @JsonProperty("subscriber-type") String subscriberType, + @JsonProperty("service-instance-name") String serviceInstanceName, + @JsonProperty("service-instance-location-id") String serviceInstanceLocationId) { + this.globalCustomerId = globalCustomerId; + this.serviceType = serviceType; + this.serviceInstanceId = serviceInstanceId; + this.subscriberName = subscriberName; + this.subscriberType = subscriberType; + this.serviceInstanceName = serviceInstanceName; + this.serviceInstanceLocationId = serviceInstanceLocationId; + } + + @JsonProperty("global-customer-id") + public String getGlobalCustomerId() { + return globalCustomerId; + } + + @JsonProperty("service-type") + public String getServiceType() { + return serviceType; + } + + @JsonProperty("service-instance-id") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("subscriber-name") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriber-type") + public String getSubscriberType() { + return subscriberType; + } + + @JsonProperty("service-instance-name") + public String getServiceInstanceName() { + return serviceInstanceName; + } + + @JsonProperty("service-instance-location-id") + public String getServiceInstanceLocationId() { + return serviceInstanceLocationId; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java new file mode 100644 index 00000000..73a98732 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java @@ -0,0 +1,44 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimInfo { + + private String cloudOwner; + + private String cloudRegionId; + + @JsonCreator + public VimInfo( + @JsonProperty("cloud-owner") String cloudOwner, + @JsonProperty("cloud-region-id") String cloudRegionId) { + this.cloudOwner = cloudOwner; + this.cloudRegionId = cloudRegionId; + } + + @JsonProperty("cloud-owner") + public String getCloudOwner() { + return cloudOwner; + } + + @JsonProperty("cloud-region-id") + public String getCloudRegionId() { + return cloudRegionId; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java new file mode 100644 index 00000000..e7bc0d9b --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java @@ -0,0 +1,23 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.aai.exceptions; + +public class AAIException extends RuntimeException { + + public AAIException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java new file mode 100644 index 00000000..46d5389c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java @@ -0,0 +1,43 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.sdc; + +import okhttp3.ResponseBody; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; + +import java.util.List; + +public interface SDCCatalogService { + + @GET("sdc/v1/catalog/services") + Call> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus); + + @Headers({ + "X-ECOMP-InstanceID: 777", + "Authorization: what?" + }) + @GET + Call downloadCsar(@Url String fileUrl); + + @GET("sdc/v1/catalog/resources") + Call> listResources(@Query("resourceType") String resourceType, @Query("distributionStatus") String distributionStatus); +} \ No newline at end of file diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java new file mode 100644 index 00000000..48da58a4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java @@ -0,0 +1,21 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.sdc.bean; + +public class SDCServiceTemplate { + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java new file mode 100644 index 00000000..8b98c71c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java @@ -0,0 +1,19 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.sdc.bean; + +public class Vnf { +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java new file mode 100644 index 00000000..76914e4a --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java @@ -0,0 +1,24 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.sdc.consts; + +public class SDCConsts { + + public static final String CATEGORY_E2E_SERVICE = "e2e"; + public static final String CATEGORY_NS = "ns"; + public static final String DISTRIBUTION_STATUS_DISTRIBUTED = "DISTRIBUTED"; + public static final String RESOURCETYPE_VF = "VF"; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java new file mode 100644 index 00000000..b0998486 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java @@ -0,0 +1,23 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions; + +public class SDCCatalogException extends RuntimeException { + + public SDCCatalogException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java new file mode 100644 index 00000000..4d8fac98 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java @@ -0,0 +1,37 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.so; + +import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; + +public interface SOService { + + @POST("/so/e2eServiceInstances/v2") + Call instantiateService(ServiceInstantiationRequest request); + + @GET("/so/e2eServiceInstances/v2/{serviceId}/operations/{operationId}") + Call queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId); + + @DELETE("/so/e2eServiceInstances/v2/{serviceId}") + Call terminateService(@Path("serviceId") String serviceId); +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java new file mode 100644 index 00000000..3c70452e --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java @@ -0,0 +1,19 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.so.bean; + +public class OperationProgressInformation { +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java new file mode 100644 index 00000000..98984093 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java @@ -0,0 +1,59 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.so.bean; + +import java.util.Map; + +public class ServiceInstantiationRequest { + + private String name; + + private String description; + + private String serviceDefId; + + private String templateId; + + private Map parameters; + + public ServiceInstantiationRequest(String name, String description, String serviceDefId, String templateId, Map parameters) { + this.name = name; + this.description = description; + this.serviceDefId = serviceDefId; + this.templateId = templateId; + this.parameters = parameters; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getServiceDefId() { + return serviceDefId; + } + + public String getTemplateId() { + return templateId; + } + + public Map getParameters() { + return parameters; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java new file mode 100644 index 00000000..8a642872 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java @@ -0,0 +1,36 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.so.bean; + +public class ServiceOperation { + + private String serviceId; + + private String operationId; + + public ServiceOperation(String serviceId, String operationId) { + this.serviceId = serviceId; + this.operationId = operationId; + } + + public String getServiceId() { + return serviceId; + } + + public String getOperationId() { + return operationId; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java new file mode 100644 index 00000000..409fd0e4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java @@ -0,0 +1,23 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.domain.so.exceptions; + +public class SOException extends RuntimeException { + + public SOException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java new file mode 100644 index 00000000..9332dcf7 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java @@ -0,0 +1,57 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import org.onap.usecaseui.server.service.lcm.CustomerService; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; +import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; + +@Service("CustomerService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultCustomerService implements CustomerService { + + private static final Logger logger = LoggerFactory.getLogger(DefaultCustomerService.class); + + private AAIService aaiService; + + public DefaultCustomerService() { + this(RestfulServices.create(AAIService.class)); + } + + public DefaultCustomerService(AAIService aaiService) { + this.aaiService = aaiService; + } + + @Override + public List listCustomer() { + try { + return this.aaiService.listCustomer().execute().body(); + } catch (IOException e) { + logger.error("list customers occur exception"); + throw new AAIException("AAI is not available.", e); + } + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java new file mode 100644 index 00000000..477e4579 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java @@ -0,0 +1,64 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; +import org.onap.usecaseui.server.service.lcm.PackageDistributionService; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; +import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; +import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; + +import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.*; + +@Service("PackageDistributionService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultPackageDistributionService implements PackageDistributionService { + + private SDCCatalogService sdcCatalogService; + + private AAIService aaiService; + + public DefaultPackageDistributionService() { + this(RestfulServices.create(SDCCatalogService.class), RestfulServices.create(AAIService.class)); + } + + public DefaultPackageDistributionService(SDCCatalogService sdcCatalogService, AAIService aaiService) { + this.sdcCatalogService = sdcCatalogService; + this.aaiService = aaiService; + } + + @Override + public VfNsPackageInfo retrievePackageInfo() { + try { + List nsTemplate = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); + List vnfs = sdcCatalogService.listResources(RESOURCETYPE_VF, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); + List vim = aaiService.listVimInfo().execute().body(); + return new VfNsPackageInfo(nsTemplate, vnfs, vim); + } catch (IOException e) { + throw new SDCCatalogException("SDC Service is not available!", e); + } + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java new file mode 100644 index 00000000..540a0dad --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java @@ -0,0 +1,57 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import org.onap.usecaseui.server.service.lcm.ServiceInstanceService; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; +import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; + +@Service("ServiceInstanceService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultServiceInstanceService implements ServiceInstanceService { + + private static final Logger logger = LoggerFactory.getLogger(DefaultServiceInstanceService.class); + + private AAIService aaiService; + + public DefaultServiceInstanceService() { + this(RestfulServices.create(AAIService.class)); + } + + public DefaultServiceInstanceService(AAIService aaiService) { + this.aaiService = aaiService; + } + + @Override + public List listServiceInstances(String customerId, String serviceType) { + try { + return aaiService.listServiceInstances(customerId, serviceType).execute().body(); + } catch (IOException e) { + logger.error("list services instances occur exception"); + throw new AAIException("AAI is not available.", e); + } + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java new file mode 100644 index 00000000..7bb3777a --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java @@ -0,0 +1,71 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import org.onap.usecaseui.server.service.lcm.ServiceLcmService; +import org.onap.usecaseui.server.service.lcm.domain.so.SOService; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; +import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.IOException; + +@Service("ServiceLcmService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultServiceLcmService implements ServiceLcmService { + + private SOService soService; + + public DefaultServiceLcmService() { + this(RestfulServices.create(SOService.class)); + } + + public DefaultServiceLcmService(SOService soService) { + this.soService = soService; + } + + @Override + public ServiceOperation instantiateService(ServiceInstantiationRequest request) { + try { + return soService.instantiateService(request).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } + + @Override + public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) { + try { + return soService.queryOperationProgress(serviceId, operationId).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } + + @Override + public ServiceOperation terminateService(String serviceId) { + try { + return soService.terminateService(serviceId).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java new file mode 100644 index 00000000..9a0204ab --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java @@ -0,0 +1,122 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import com.google.common.io.Files; +import okhttp3.ResponseBody; +import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput; +import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; +import org.onap.usecaseui.server.bean.lcm.TemplateInput; +import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; +import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService; +import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; +import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.openecomp.sdc.toscaparser.api.ToscaTemplate; +import org.openecomp.sdc.toscaparser.api.common.JToscaException; +import org.openecomp.sdc.toscaparser.api.parameters.Input; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.CATEGORY_E2E_SERVICE; +import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.DISTRIBUTION_STATUS_DISTRIBUTED; + +@Service("ServiceTemplateService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultServiceTemplateService implements ServiceTemplateService { + + private static final Logger logger = LoggerFactory.getLogger(DefaultServiceTemplateService.class); + + private SDCCatalogService sdcCatalog; + + private AAIService aaiService; + + public DefaultServiceTemplateService() { + this(RestfulServices.create(SDCCatalogService.class), RestfulServices.create(AAIService.class)); + } + + public DefaultServiceTemplateService(SDCCatalogService sdcCatalog, AAIService aaiService) { + this.sdcCatalog = sdcCatalog; + this.aaiService = aaiService; + } + + @Override + public List listDistributedServiceTemplate() { + try { + return this.sdcCatalog.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); + } catch (IOException e) { + logger.error("Visit SDC Catalog occur exception"); + logger.info("SDC Catalog Exception: ", e); + throw new SDCCatalogException("SDC Catalog is not available.", e); + } + } + + @Override + public ServiceTemplateInputRsp fetchServiceTemplateInput(String uuid, String toscaModelPath) { + String rootPath = "http://localhost";// get from msb + String templateUrl = String.format("%s/%s", rootPath, toscaModelPath); + + String toPath = String.format("temp/%s.csar", uuid); + try { + downloadFile(templateUrl, toPath); + ServiceTemplateInput serviceTemplateInput = extractInputs(toPath); + List vimInfos = aaiService.listVimInfo().execute().body(); + return new ServiceTemplateInputRsp(serviceTemplateInput, vimInfos); + } catch (IOException e) { + throw new SDCCatalogException("download csar file failed!", e); + } catch (JToscaException e) { + throw new SDCCatalogException("parse csar file failed!", e); + } + } + + private void downloadFile(String templateUrl, String toPath) throws IOException { + try { + ResponseBody body = sdcCatalog.downloadCsar(templateUrl).execute().body(); + Files.write(body.bytes(),new File(toPath)); + } catch (IOException e) { + logger.error(String.format("Download %s failed!", templateUrl)); + throw e; + } + } + + private ServiceTemplateInput extractInputs(String toPath) throws JToscaException { + ToscaTemplate tosca = new ToscaTemplate(toPath,null,true,null,true); + String name = tosca.getMetaData().getValue("name"); + String type = tosca.getMetaData().getValue("type"); + List templateInputs = new ArrayList<>(); + for(Input input : tosca.getInputs()) { + templateInputs.add(new TemplateInput( + input.getName(), + input.getType(), + input.getDescription(), + String.valueOf(input.isRequired()), + String.valueOf(input.getDefault()) + )); + + } + return new ServiceTemplateInput(name, type, templateInputs); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java b/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java new file mode 100644 index 00000000..8c7a4895 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.util; + +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVParser; +import org.apache.commons.csv.CSVPrinter; +import org.apache.commons.csv.CSVRecord; +import org.aspectj.util.FileUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.util.List; + + +public class CSVUtils { + //CSV文件分隔符 + private final static String NEW_LINE_SEPARATOR="\n"; + private static Logger logger = LoggerFactory.getLogger(CSVUtils.class); + + + /**写入csv文件 + * @param headers 列头 + * @param data 数据内容 + * @param filePath 创建的csv文件路径 + * **/ + public static void writeCsv(String[] headers,List data,String filePath) { + try{ + CSVFormat formator = CSVFormat.DEFAULT.withHeader(headers); + String dir = filePath.substring(0,filePath.lastIndexOf('/')); + File file = new File(dir); + if (!file.exists()) + file.mkdirs(); + try(Writer writer = new FileWriter(filePath); + CSVPrinter printer = new CSVPrinter(writer,formator)){ + for(String[] str : data){ + printer.printRecord(str); + } + } + + logger.info("CSV File Generate Success,FilePath:"+filePath); + }catch (IOException e){ + logger.error("CSV File Generate Failure:"+e.getMessage()); + } + } + + /**读取csv文件 + * @param filePath 文件路径 + * @param headers csv列头 + * @return CSVRecord 列表 + * @throws IOException **/ + public static List readCSV(String filePath, String[] headers) throws IOException{ + //创建CSVFormat + CSVFormat formator = CSVFormat.DEFAULT.withHeader(headers); + FileReader fileReader=new FileReader(filePath); + //创建CSVParser对象 + CSVParser parser=new CSVParser(fileReader,formator); + List records=parser.getRecords(); + parser.close(); + fileReader.close(); + return records; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DataUtils.java b/server/src/main/java/org/onap/usecaseui/server/util/DataUtils.java new file mode 100644 index 00000000..beaa29b6 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/util/DataUtils.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.util; + +public class DataUtils { +} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/Page.java b/server/src/main/java/org/onap/usecaseui/server/util/Page.java new file mode 100644 index 00000000..fd7665f5 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/util/Page.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.util; + +import java.util.List; + +public class Page { + + private List list; + + private int totalRecords; + + private int pageSize; + + private int pageNo; + + + + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public int getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(int totalRecords) { + this.totalRecords = totalRecords; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + + public int getTotalPages() { + return (totalRecords+pageSize-1)/pageSize; + } + + + public int countOffset(int currentPage,int pageSize) { + int offset =pageSize*(currentPage-1); + return offset; + } + + public int getTopageNo() { + return 1; + } + + public int getPreviousPageNo() { + if(pageNo<=1) { + return 1; + } + return pageNo-1; + } + + public int getNextPageNo() { + if(pageNo>=getBottomPageNo()) { + return getBottomPageNo(); + } + return pageNo+1; + } + + public int getBottomPageNo() { + return getTotalPages(); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java new file mode 100644 index 00000000..c26aab69 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java @@ -0,0 +1,30 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.util; + +import retrofit2.Retrofit; +import retrofit2.converter.jackson.JacksonConverterFactory; + +public class RestfulServices { + + public static T create(Class clazz) { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://localhost") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + return retrofit.create(clazz); + } +} diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties new file mode 100644 index 00000000..4630f2b4 --- /dev/null +++ b/server/src/main/resources/application.properties @@ -0,0 +1,33 @@ +## +## Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +## General App Properties +server.contextPath=/usecase +server.port=8082 +spring.http.multipart.max-file-size=128MB +spring.http.multipart.max-request-size=128MB + +## App DB Properties +spring.datasource.url=jdbc:mysql://localhost:3306/uui +spring.datasource.username=root +spring.datasource.password= +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect +spring.database.driver.classname=com.mysql.jdbc.Driver +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false + +## Basic Authentication Properties +security.user.name=usecase +security.user.password=usecase \ No newline at end of file diff --git a/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java b/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java new file mode 100644 index 00000000..4fc3e747 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.usecaseui.server.bean.AlarmsHeader; +import org.onap.usecaseui.server.bean.AlarmsInformation; +import org.onap.usecaseui.server.service.AlarmsHeaderService; +import org.onap.usecaseui.server.service.AlarmsInformationService; +import org.onap.usecaseui.server.service.impl.AlarmsHeaderServiceImpl; +import org.onap.usecaseui.server.service.impl.AlarmsInformationServiceImpl; +import org.onap.usecaseui.server.util.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class UsecaseuiServerApplicationTests { + +// @Autowired +// AlarmsInformationService info; + + @Autowired + AlarmsHeaderService alarm; + + @Test + public void contextLoads() throws ParseException { +// AlarmsInformation in= new AlarmsInformation(); +// Date date =new Date(); +// in.setName("name"); +// in.setEventId("eventId"); +// in.setValue("value"); +// in.setCreateTime(date); +// in.setUpdateTime(date); +// String d=info.saveAlarmsInformation(in); +// String d=info.updateAlarmsInformation(in); + +// int c=alarm.getAllCount(); + + AlarmsHeader a = new AlarmsHeader(); +// a.setVersion("1"); + a.setDomain("3"); +// SimpleDateFormat e =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// a.setCreateTime(e.parse("2017-09-03 15:25:11")); + Page b = alarm.queryAlarmsHeader(a, 1, 5); + String c =b.getList().get(0).getEventName(); + System.out.println("============"+c); + Assert.assertEquals("2", c); + + } +} diff --git a/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java b/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java deleted file mode 100644 index c12bb24e..00000000 --- a/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.web.client.RestTemplate; - -@SpringBootApplication -@ComponentScan(basePackages = "org.onap.usecaseui.server") -public class UsecaseuiServerApplication { - - @Bean - public RestTemplate getRestTemplate(){ - return new RestTemplate(); - } - - public static void main(String[] args) { - SpringApplication.run(UsecaseuiServerApplication.class, args); - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java b/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java deleted file mode 100644 index d204d682..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - - -@Entity -@Table(name = "EP_ACTIVE_ALARM") -public class ActiveAlarmInfo -{ - - @Id - @Column(name = "id", nullable = true) - private String id; - - - @Column(name = "devName") - private String devName; - - - @Column(name = "devIp") - private String devIp; - - - @Column(name = "serialNumber") - private String serialNumber; - - - @Column(name = "alarmRaisedTime") - private String alarmRaisedTime; - - - @Column(name = "alarmChangedTime") - private String alarmChangedTime; - - - @Column(name = "alarmIdentifier") - private String alarmIdentifier; - - - @Column(name = "notificationType") - private String notificationType; - - - @Column(name = "managedObjectInstance") - private String managedObjectInstance; - - - @Column(name = "eventType") - private Integer eventType; - - - @Column(name = "probableCause") - private String probableCause; - - - @Column(name = "specificProblem") - private String specificProblem; - - - @Column(name = "perceivedSeverity") - private String perceivedSeverity; - - - @Column(name = "additionalText") - private String additionalText; - - - @Column(name = "additionalInformation") - private String additionalInformation; - - - @Column(name = "clearedManner") - private String clearedManner; - - - @Column(name = "alarmState") - private Integer alarmState; - - - @Column(name = "ackTime") - private String ackTime; - - - @Column(name = "ackUser") - private String ackUser; - - public String getId() - { - return id; - } - - public void setId(String id) - { - this.id = id; - } - - public String getDevName() - { - return devName; - } - - public void setDevName(String devName) - { - this.devName = devName; - } - - public String getDevIp() - { - return devIp; - } - - public void setDevIp(String devIp) - { - this.devIp = devIp; - } - - public String getSerialNumber() - { - return serialNumber; - } - - public void setSerialNumber(String serialNumber) - { - this.serialNumber = serialNumber; - } - - public String getAlarmRaisedTime() - { - return alarmRaisedTime; - } - - public void setAlarmRaisedTime(String alarmRaisedTime) - { - this.alarmRaisedTime = alarmRaisedTime; - } - - public String getAlarmChangedTime() - { - return alarmChangedTime; - } - - public void setAlarmChangedTime(String alarmChangedTime) - { - this.alarmChangedTime = alarmChangedTime; - } - - public String getAlarmIdentifier() - { - return alarmIdentifier; - } - - public void setAlarmIdentifier(String alarmIdentifier) - { - this.alarmIdentifier = alarmIdentifier; - } - - public String getNotificationType() - { - return notificationType; - } - - public void setNotificationType(String notificationType) - { - this.notificationType = notificationType; - } - - public String getManagedObjectInstance() - { - return managedObjectInstance; - } - - public void setManagedObjectInstance(String managedObjectInstance) - { - this.managedObjectInstance = managedObjectInstance; - } - - public Integer getEventType() - { - return eventType; - } - - public void setEventType(Integer eventType) - { - this.eventType = eventType; - } - - public String getProbableCause() - { - return probableCause; - } - - public void setProbableCause(String probableCause) - { - this.probableCause = probableCause; - } - - public String getSpecificProblem() - { - return specificProblem; - } - - public void setSpecificProblem(String specificProblem) - { - this.specificProblem = specificProblem; - } - - public String getPerceivedSeverity() - { - return perceivedSeverity; - } - - public void setPerceivedSeverity(String perceivedSeverity) - { - this.perceivedSeverity = perceivedSeverity; - } - - public String getAdditionalText() - { - return additionalText; - } - - public void setAdditionalText(String additionalText) - { - this.additionalText = additionalText; - } - - public String getAdditionalInformation() - { - return additionalInformation; - } - - public void setAdditionalInformation(String additionalInformation) - { - this.additionalInformation = additionalInformation; - } - - public Integer getAlarmState() - { - return alarmState; - } - - public void setAlarmState(Integer alarmState) - { - this.alarmState = alarmState; - } - - public String getClearedManner() - { - return clearedManner; - } - - public void setClearedManner(String clearedManner) - { - this.clearedManner = clearedManner; - } - - public String getAckTime() - { - return ackTime; - } - - public void setAckTime(String ackTime) - { - this.ackTime = ackTime; - } - - public String getAckUser() - { - return ackUser; - } - - public void setAckUser(String ackUser) - { - this.ackUser = ackUser; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("ActiveAlarmInfo["); - sb.append("id="); - sb.append(id); - sb.append(",devName="); - sb.append(devName); - sb.append(",devIp="); - sb.append(devIp); - sb.append(",serialNumber="); - sb.append(serialNumber); - sb.append(",alarmRaisedTime="); - sb.append(alarmRaisedTime); - sb.append(",alarmChangedTime="); - sb.append(alarmChangedTime); - sb.append(",alarmIdentifier="); - sb.append(alarmIdentifier); - sb.append(",notificationType="); - sb.append(notificationType); - sb.append(",managedObjectInstance="); - sb.append(managedObjectInstance); - sb.append(",eventType="); - sb.append(eventType); - sb.append(",probableCause="); - sb.append(probableCause); - sb.append(",specificProblem="); - sb.append(specificProblem); - sb.append(",perceivedSeverity="); - sb.append(perceivedSeverity); - sb.append(",additionalText="); - sb.append(additionalText); - sb.append(",additionalInformation="); - sb.append(additionalInformation); - sb.append(",clearedManner="); - sb.append(clearedManner); - sb.append(",alarmState="); - sb.append(alarmState); - sb.append(",ackTime="); - sb.append(ackTime); - sb.append(",ackUser="); - sb.append(ackUser); - sb.append("]"); - return sb.toString(); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java deleted file mode 100644 index 1bfc13c5..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - - -@Entity -@Table(name="alarms_commoneventheader") -public class AlarmsHeader implements Serializable{ - - @Column(name = "version") - private String version; - - @Column(name = "eventName") - private String eventName; - - @Column(name = "domain") - private String domain; - - @Id - @Column(name = "eventId") - private String eventId; - - @Column(name = "eventType") - private String eventType; - - @Column(name = "nfcNamingCode", nullable=false) - private String nfcNamingCode; - - @Column(name = "nfNamingCode", nullable=false) - private String nfNamingCode; - - @Column(name = "sourceId") - private String sourceId; - - @Column(name = "sourceName") - private String sourceName; - - @Column(name = "reportingEntityId") - private String reportingEntityId; - - @Column(name = "reportingEntityName") - private String reportingEntityName; - - @Column(name = "priority") - private String priority; - - @Column(name = "startEpochMicrosec") - private String startEpochMicrosec; - - @Column(name = "lastEpochMicroSec") - private String lastEpochMicroSec; - - @Column(name = "sequence") - private String sequence; - - @Column(name = "faultFieldsVersion") - private String faultFieldsVersion; - - @Column(name = "eventServrity") - private String eventServrity; - - @Column(name = "eventSourceType") - private String eventSourceType; - - @Column(name = "eventCategory") - private String eventCategory; - - @Column(name = "alarmCondition") - private String alarmCondition; - - @Column(name = "specificProblem") - private String specificProblem; - - @Column(name = "vfStatus") - private String vfStatus; - - @Column(name = "alarmInterfaceA") - private String alarmInterfaceA; - - @Column(name = "status") - private String status; - - @Column(name = "createTime") - private Date createTime; - - @Column(name = "updateTime") - private Date updateTime; - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getEventName() { - return eventName; - } - - public void setEventName(String eventName) { - this.eventName = eventName; - } - - public String getDomain() { - return domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getNfcNamingCode() { - return nfcNamingCode; - } - - public void setNfcNamingCode(String nfcNamingCode) { - this.nfcNamingCode = nfcNamingCode; - } - - public String getNfNamingCode() { - return nfNamingCode; - } - - public void setNfNamingCode(String nfNamingCode) { - this.nfNamingCode = nfNamingCode; - } - - public String getSourceId() { - return sourceId; - } - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getReportingEntityId() { - return reportingEntityId; - } - - public void setReportingEntityId(String reportingEntityId) { - this.reportingEntityId = reportingEntityId; - } - - public String getReportingEntityName() { - return reportingEntityName; - } - - public void setReportingEntityName(String reportingEntityName) { - this.reportingEntityName = reportingEntityName; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getStartEpochMicrosec() { - return startEpochMicrosec; - } - - public void setStartEpochMicrosec(String startEpochMicrosec) { - this.startEpochMicrosec = startEpochMicrosec; - } - - public String getLastEpochMicroSec() { - return lastEpochMicroSec; - } - - public void setLastEpochMicroSec(String lastEpochMicroSec) { - this.lastEpochMicroSec = lastEpochMicroSec; - } - - public String getSequence() { - return sequence; - } - - public void setSequence(String sequence) { - this.sequence = sequence; - } - - public String getFaultFieldsVersion() { - return faultFieldsVersion; - } - - public void setFaultFieldsVersion(String faultFieldsVersion) { - this.faultFieldsVersion = faultFieldsVersion; - } - - public String getEventServrity() { - return eventServrity; - } - - public void setEventServrity(String eventServrity) { - this.eventServrity = eventServrity; - } - - public String getEventSourceType() { - return eventSourceType; - } - - public void setEventSourceType(String eventSourceType) { - this.eventSourceType = eventSourceType; - } - - public String getEventCategory() { - return eventCategory; - } - - public void setEventCategory(String eventCategory) { - this.eventCategory = eventCategory; - } - - public String getAlarmCondition() { - return alarmCondition; - } - - public void setAlarmCondition(String alarmCondition) { - this.alarmCondition = alarmCondition; - } - - public String getSpecificProblem() { - return specificProblem; - } - - public void setSpecificProblem(String specificProblem) { - this.specificProblem = specificProblem; - } - - public String getVfStatus() { - return vfStatus; - } - - public void setVfStatus(String vfStatus) { - this.vfStatus = vfStatus; - } - - public String getAlarmInterfaceA() { - return alarmInterfaceA; - } - - public void setAlarmInterfaceA(String alarmInterfaceA) { - this.alarmInterfaceA = alarmInterfaceA; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java deleted file mode 100644 index 7a44a045..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - - -@Entity -@Table(name="alarms_additionalinformation") -public class AlarmsInformation implements Serializable{ - - @Id - @Column(name = "name") - private String name; - - @Column(name = "value") - private String value; - - @Id - @Column(name = "eventId") - private String eventId; - - @Column(name = "createTime") - private Date createTime; - - @Column(name = "updateTime") - private Date updateTime; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java deleted file mode 100644 index acaff0e3..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - - -@Entity -@Table(name="alarms_commoneventheader") -public class PerformanceHeader implements Serializable{ - - @Column(name = "version") - private String version; - - @Column(name = "eventName") - private String eventName; - - @Column(name = "domain") - private String domain; - - @Id - @Column(name = "eventId") - private String eventId; - - @Column(name = "eventType") - private String eventType; - - @Column(name = "nfcNamingCode", nullable=false) - private String nfcNamingCode; - - @Column(name = "nfNamingCode", nullable=false) - private String nfNamingCode; - - @Column(name = "sourceId") - private String sourceId; - - @Column(name = "sourceName") - private String sourceName; - - @Column(name = "reportingEntityId") - private String reportingEntityId; - - @Column(name = "reportingEntityName") - private String reportingEntityName; - - @Column(name = "priority") - private String priority; - - @Column(name = "startEpochMicrosec") - private String startEpochMicrosec; - - @Column(name = "lastEpochMicroSec") - private String lastEpochMicroSec; - - @Column(name = "sequence") - private String sequence; - - @Column(name = "measurementsForVfScalingVersion") - private String measurementsForVfScalingVersion; - - @Column(name = "measurementInterval") - private String measurementInterval; - - @Column(name = "createTime") - private Date createTime; - - @Column(name = "updateTime") - private Date updateTime; - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getEventName() { - return eventName; - } - - public void setEventName(String eventName) { - this.eventName = eventName; - } - - public String getDomain() { - return domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getNfcNamingCode() { - return nfcNamingCode; - } - - public void setNfcNamingCode(String nfcNamingCode) { - this.nfcNamingCode = nfcNamingCode; - } - - public String getNfNamingCode() { - return nfNamingCode; - } - - public void setNfNamingCode(String nfNamingCode) { - this.nfNamingCode = nfNamingCode; - } - - public String getSourceId() { - return sourceId; - } - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getReportingEntityId() { - return reportingEntityId; - } - - public void setReportingEntityId(String reportingEntityId) { - this.reportingEntityId = reportingEntityId; - } - - public String getReportingEntityName() { - return reportingEntityName; - } - - public void setReportingEntityName(String reportingEntityName) { - this.reportingEntityName = reportingEntityName; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getStartEpochMicrosec() { - return startEpochMicrosec; - } - - public void setStartEpochMicrosec(String startEpochMicrosec) { - this.startEpochMicrosec = startEpochMicrosec; - } - - public String getLastEpochMicroSec() { - return lastEpochMicroSec; - } - - public void setLastEpochMicroSec(String lastEpochMicroSec) { - this.lastEpochMicroSec = lastEpochMicroSec; - } - - public String getSequence() { - return sequence; - } - - public void setSequence(String sequence) { - this.sequence = sequence; - } - - public String getMeasurementsForVfScalingVersion() { - return measurementsForVfScalingVersion; - } - - public void setMeasurementsForVfScalingVersion(String measurementsForVfScalingVersion) { - this.measurementsForVfScalingVersion = measurementsForVfScalingVersion; - } - - public String getMeasurementInterval() { - return measurementInterval; - } - - public void setMeasurementInterval(String measurementInterval) { - this.measurementInterval = measurementInterval; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java deleted file mode 100644 index 0e9124be..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - - -@Entity -@Table(name="alarms_additionalinformation") -public class PerformanceInformation implements Serializable{ - - @Id - @Column(name = "name") - private String name; - - @Column(name = "value") - private String value; - - @Id - @Column(name = "eventId") - private String eventId; - - @Column(name = "createTime") - private Date createTime; - - @Column(name = "updateTime") - private Date updateTime; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java deleted file mode 100644 index bc23ac76..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean.lcm; - -public class ServiceTemplate { -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java deleted file mode 100644 index c847f573..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean.lcm; - -import java.util.List; - -public class ServiceTemplateInput { - - private String name; - - private String type; - - private List inputs; - - public ServiceTemplateInput(String name, String type, List inputs) { - this.name = name; - this.type = type; - this.inputs = inputs; - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public List getInputs() { - return inputs; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java deleted file mode 100644 index f4228739..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean.lcm; - -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; - -import java.util.List; - -public class ServiceTemplateInputRsp { - - private ServiceTemplateInput serviceTemplateInput; - - private List vimInfos; - - public ServiceTemplateInputRsp(ServiceTemplateInput serviceTemplateInput, List vimInfos) { - this.serviceTemplateInput = serviceTemplateInput; - this.vimInfos = vimInfos; - } - - public ServiceTemplateInput getServiceTemplateInput() { - return serviceTemplateInput; - } - - public List getVimInfos() { - return vimInfos; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java deleted file mode 100644 index 6367d58f..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean.lcm; - -public class TemplateInput { - - private String name; - - private String type; - - private String description; - - private String isRequired; - - private String defaultValue; - - public TemplateInput(String name, String type, String description, String isRequired, String defaultValue) { - this.name = name; - this.type = type; - this.description = description; - this.isRequired = isRequired; - this.defaultValue = defaultValue; - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public String getDescription() { - return description; - } - - public String getIsRequired() { - return isRequired; - } - - public String getDefaultValue() { - return defaultValue; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java deleted file mode 100644 index d51ec4b9..00000000 --- a/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.bean.lcm; - -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; - -import java.util.List; - -public class VfNsPackageInfo { - - private List nsPackage; - - private List vnfPackages; - - private List vimInfos; - - public VfNsPackageInfo(List nsPackage, List vnfPackages, List vimInfos) { - this.nsPackage = nsPackage; - this.vnfPackages = vnfPackages; - this.vimInfos = vimInfos; - } - - public List getNsPackage() { - return nsPackage; - } - - public List getVnfPackages() { - return vnfPackages; - } - - public List getVimInfos() { - return vimInfos; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/src/main/java/org/onap/usecaseui/server/constant/Constant.java deleted file mode 100644 index bf311d6c..00000000 --- a/src/main/java/org/onap/usecaseui/server/constant/Constant.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.constant; - - -public final class Constant -{ - -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java deleted file mode 100644 index 8377dd50..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.onap.usecaseui.server.bean.AlarmsHeader; -import org.onap.usecaseui.server.bean.AlarmsInformation; -import org.onap.usecaseui.server.service.AlarmsHeaderService; -import org.onap.usecaseui.server.service.AlarmsInformationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class AlarmController -{ - - - private static final Logger logger = LoggerFactory.getLogger(AlarmController.class); - - @Resource(name = "AlarmsHeaderService") - private AlarmsHeaderService alarmsHeaderService; - - @Resource(name = "AlarmsInformationService") - private AlarmsInformationService alarmsInformationService; - - - @ResponseBody - @RequestMapping(value = {"/alarm/getData"}, method = RequestMethod.GET , produces = "application/json") - public String getAlarmData(HttpServletRequest request) throws JsonProcessingException { - String eventId = request.getParameter("ALARM_eventId"); - String vfStatus = request.getParameter("ALARM_vfStatus"); - String status = request.getParameter("ALARM_status"); - String eventName = request.getParameter("ALARM_eventName"); - String name = request.getParameter("ALARM_name"); - String value = request.getParameter("ALARM_value"); - int currentPage = Integer.parseInt(request.getParameter("ALARM_currentPage")); - int pageSize = Integer.parseInt(request.getParameter("ALARM_pageSize")); - AlarmsHeader alarmsHeader = new AlarmsHeader(); - AlarmsInformation alarmsInformation = new AlarmsInformation(); - if (null != eventId){ - alarmsHeader.setEventId(eventId); - alarmsInformation.setEventId(eventId); - } - if (null != vfStatus) - alarmsHeader.setVfStatus(vfStatus); - if (null != status) - alarmsHeader.setStatus(status); - if (null != eventName) - alarmsHeader.setEventName(eventName); - if (null != name) - alarmsInformation.setName(name); - if (null != value) - alarmsInformation.setValue(value); - List alarmsHeaders = alarmsHeaderService.queryAlarmsHeader(alarmsHeader,currentPage,pageSize).getList(); - List alarmsInformations = alarmsInformationService.queryAlarmsInformation(alarmsInformation,currentPage,pageSize).getList(); - Map maps = new HashMap<>(); - if (null != alarmsHeaders && alarmsHeaders.size() > 0) - maps.put("alarms_header",alarmsHeaders); - if (null != alarmsInformations && alarmsInformations.size() > 0) - maps.put("alarms_information",alarmsInformations); - return new ObjectMapper().writeValueAsString(maps); - } - - @RequestMapping(value = { "/alarm/genCsv" } , method = RequestMethod.GET , produces = "application/json") - public String generateCsvFile(HttpServletRequest request){ - String[] headers = new String[]{"version", - "eventName","domain","eventId","eventType","nfcNamingCode", - "nfNamingCode","sourceId","sourceName","reportingEntityId", - "reportingEntityName","priority","startEpochMicrosec","lastEpochMicroSec", - "sequence","measurementsForVfScalingVersion","measurementInterval","value","name", - "createTime","updateTime"}; - String event_ids = request.getParameter("ids"); - String[] eventId = event_ids.split(","); - - return ""; - } - - - @RequestMapping(value = { "/alarm/updateStatus" } , method = RequestMethod.GET , produces = "application/json") - public String updateStatus(HttpServletRequest request){ - String id = request.getParameter("ALARM_eventId"); - String vfStatus = request.getParameter("ALARM_vfstatus"); - String status = request.getParameter("ALARM_status"); - AlarmsHeader alarmsHeader = new AlarmsHeader(); - if (null != id) - alarmsHeader.setEventId(id); - if (null != vfStatus) - alarmsHeader.setVfStatus(vfStatus); - if (null != status) - alarmsHeader.setStatus(status); - String result = alarmsHeaderService.updateAlarmsHeader(alarmsHeader); - return result; - } - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java deleted file mode 100644 index bd39843d..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.onap.usecaseui.server.bean.PerformanceHeader; -import org.onap.usecaseui.server.bean.PerformanceInformation; -import org.onap.usecaseui.server.service.PerformanceHeaderService; -import org.onap.usecaseui.server.service.PerformanceInformationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.xml.crypto.Data; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; - -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Controller -@Configuration -@EnableAspectJAutoProxy -public class PerformanceController { - - @Resource(name = "PerformanceHeaderService") - private PerformanceHeaderService performanceHeaderService; - - @Resource(name = "PerformanceInformationService") - private PerformanceInformationService performanceInformationService; - - private final String csvPath = ""; - - private Logger looger = LoggerFactory.getLogger(PerformanceController.class); - - @ResponseBody - @RequestMapping(value = {"/pro/getData"},method = RequestMethod.GET, produces = "application/json") - public String getPerformanceData(HttpServletRequest request) throws JsonProcessingException { - String eventId = request.getParameter("PERFORMANCE_eventId"); - String eventName = request.getParameter("PERFORMANCE_eventName"); - String name = request.getParameter("PERFORMANCE_name"); - String value = request.getParameter("PERFORMANCE_value"); - int currentPage = Integer.parseInt(request.getParameter("PERFORMANCE_currentPage")); - int pageSize = Integer.parseInt(request.getParameter("PERFORMANCE_pageSize")); - PerformanceHeader performanceHeader = new PerformanceHeader(); - PerformanceInformation performanceInformation = new PerformanceInformation(); - if (null != eventId){ - performanceHeader.setEventId(eventId); - performanceInformation.setEventId(eventId); - } - if (null != eventName) - performanceHeader.setEventName(eventName); - if (null != name) - performanceInformation.setName(name); - if (null != value) - performanceInformation.setValue(value); - List performanceHeaders = performanceHeaderService.queryPerformanceHeader(performanceHeader,currentPage,pageSize).getList(); - List performanceInformations = performanceInformationService.queryPerformanceInformation(performanceInformation,currentPage,pageSize).getList(); - Map maps = new HashMap<>(); - if (null != performanceHeaders && performanceHeaders.size() > 0) - maps.put("performance_header",performanceHeaders); - if (null != performanceInformations && performanceInformations.size() > 0) - maps.put("performance_information",performanceInformations); - return new ObjectMapper().writeValueAsString(maps); - } - - @RequestMapping(value = {"/pro/genCsv"}, method = RequestMethod.GET, produces = "application/json") - public String generateCsvFile(HttpServletRequest request){ - String[] headers = new String[]{"version", - "eventName","domain","eventId","eventType","nfcNamingCode", - "nfNamingCode","sourceId","sourceName","reportingEntityId", - "reportingEntityName","priority","startEpochMicrosec","lastEpochMicroSec", - "sequence","measurementsForVfScalingVersion","measurementInterval","value","name", - "createTime","updateTime"}; - List performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList(); - List performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList(); - List csvData = new ArrayList<>(); - - return ""; - } - - @RequestMapping(value = {"/pro/genDiaCsv"}, method = RequestMethod.GET, produces = "application/json") - public String generateDiaCsvFile(HttpServletRequest request){ - String[] headers = new String[]{"","","",""}; - List performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList(); - List performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList(); - List csvData = new ArrayList<>(); - - return ""; - } - - @ResponseBody - @RequestMapping(value = {"/pro/genDia"}, method = RequestMethod.GET, produces = "application/json") - public String generateDiagram(HttpServletRequest request) throws ParseException, JsonProcessingException { - String id = request.getParameter("PERFORMANCE_id"); - String data = request.getParameter("PERFORMANCE_data"); - SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd"); - Date beginDate = new Date(); - Calendar date = Calendar.getInstance(); - date.setTime(beginDate); - PerformanceInformation p = new PerformanceInformation(); - p.setEventId(id); - if ("hour".equals(data)){ - date.set(Calendar.DATE, date.get(Calendar.HOUR) - 1); - Date endDate = dft.parse(dft.format(date.getTime())); - p.setCreateTime(endDate); - } - if ("day".equals(data)){ - date.set(Calendar.DATE, date.get(Calendar.DATE) - 1); - Date endDate = dft.parse(dft.format(date.getTime())); - p.setCreateTime(endDate); - } - if ("month".equals(data)){ - date.set(Calendar.DATE, date.get(Calendar.MONTH) - 1); - Date endDate = dft.parse(dft.format(date.getTime())); - p.setCreateTime(endDate); - } - if ("year".equals(data)){ - date.set(Calendar.DATE, date.get(Calendar.YEAR) - 1); - Date endDate = dft.parse(dft.format(date.getTime())); - p.setCreateTime(endDate); - } - List informationList = performanceInformationService.queryPerformanceInformation(p,1,4).getList(); - return new ObjectMapper().writeValueAsString(informationList); - } - - -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java deleted file mode 100644 index a1b8d0ef..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller.lcm; - -import org.onap.usecaseui.server.service.lcm.CustomerService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class CustomerController { - - @Resource(name="CustomerService") - private CustomerService customerService; - - @ResponseBody - @RequestMapping(value = {"/lcm/customers"}, method = RequestMethod.GET , produces = "application/json") - public List getCustomers(HttpServletRequest request){ - return customerService.listCustomer(); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java deleted file mode 100644 index 05364b24..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller.lcm; - -import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; -import org.onap.usecaseui.server.service.lcm.PackageDistributionService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; - -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class PackageDistributionController { - - private static final Logger logger = LoggerFactory.getLogger(PackageDistributionController.class); - - @Resource(name="PackageDistributionService") - private PackageDistributionService packageDistributionService; - - @ResponseBody - @RequestMapping(value = {"/lcm/vf-ns-packages"}, method = RequestMethod.GET , produces = "application/json") - public VfNsPackageInfo instantiateService(){ - return packageDistributionService.retrievePackageInfo(); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java deleted file mode 100644 index 3d51f649..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller.lcm; - -import org.onap.usecaseui.server.service.lcm.ServiceInstanceService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class ServiceInstanceController { - - private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceController.class); - - @Resource(name="ServiceInstanceService") - private ServiceInstanceService serviceInstanceService; - - @ResponseBody - @RequestMapping(value = {"/lcm/service-instances"}, method = RequestMethod.GET , produces = "application/json") - public List getCustomers(HttpServletRequest request){ - String customerId = request.getParameter("customerId"); - String serviceType = request.getParameter("serviceType"); - logger.info(String.format( - "list service instances with [customerId=%s, serviceType=%s]", - customerId, - serviceType)); - - return serviceInstanceService.listServiceInstances(customerId, serviceType); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java deleted file mode 100644 index d0c95521..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller.lcm; - -import org.onap.usecaseui.server.service.lcm.ServiceLcmService; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class ServiceLcmController { - - private static final Logger logger = LoggerFactory.getLogger(ServiceLcmController.class); - - @Resource(name="ServiceLcmService") - private ServiceLcmService serviceLcmService; - - @ResponseBody - @RequestMapping(value = {"/lcm/services"}, method = RequestMethod.POST , produces = "application/json") - public ServiceOperation instantiateService(@RequestBody ServiceInstantiationRequest request){ - return serviceLcmService.instantiateService(request); - } - - @ResponseBody - @RequestMapping(value = {"/lcm/services/{serviceId}/operations/{operationId}"}, method = RequestMethod.GET , produces = "application/json") - public OperationProgressInformation instantiateService(@PathVariable(value="serviceId") String serviceId, @PathVariable(value="operationId") String operationId){ - return serviceLcmService.queryOperationProgress(serviceId, operationId); - } - - @ResponseBody - @RequestMapping(value = {"/lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json") - public ServiceOperation terminateService(@PathVariable(value = "serviceId") String serviceId){ - return serviceLcmService.terminateService(serviceId); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java deleted file mode 100644 index 2d8333a4..00000000 --- a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.controller.lcm; - -import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; -import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -@Controller -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class ServiceTemplateController { - - private static final Logger logger = LoggerFactory.getLogger(ServiceTemplateController.class); - - @Resource(name="ServiceTemplateService") - private ServiceTemplateService serviceTemplateService; - - @ResponseBody - @RequestMapping(value = {"/lcm/service-templates"}, method = RequestMethod.GET , produces = "application/json") - public List getServiceTemplates(){ - return serviceTemplateService.listDistributedServiceTemplate(); - } - - @ResponseBody - @RequestMapping(value = {"/lcm/service-templates/service-template/{uuid}"}, method = RequestMethod.GET , produces = "application/json") - public ServiceTemplateInputRsp getServiceTemplateInput(@PathVariable("uuid") String uuid, @RequestParam("toscaModelPath") String toscaModelPath){ - return serviceTemplateService.fetchServiceTemplateInput(uuid, toscaModelPath); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java b/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java deleted file mode 100644 index 475adc01..00000000 --- a/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.dao; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.stereotype.Component; - - -@Component -public class UsecaseuiDataSource -{ - @Value("${spring.database.driver.classname}") - private String dbDriverClassName; - - @Value("${spring.datasource.url}") - private String dbUrl; - - @Value("${spring.datasource.username}") - private String dbUsername; - - @Value("${spring.datasource.password}") - private String dbPassword; - - @Bean - public DataSource dataSource() { - DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(dbDriverClassName); - dataSource.setUrl(dbUrl); - dataSource.setUsername(dbUsername); - dataSource.setPassword(dbPassword); - return dataSource; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java b/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java deleted file mode 100644 index b4850fcb..00000000 --- a/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.exception; - - -public class ErrorCodeException extends Exception -{ - private static final long serialVersionUID = 3220072444842529499L; - - private int categoryCode = 0; - - private int errorCode = 1; - - private String[] arguments = null; - - private static String defaultText = null; - - public static void setDefaultText(String text) - { - defaultText = text; - } - - public static String getDefaultText() - { - return defaultText; - } - - public ErrorCodeException(int code, String debugMessage) - { - this(code, debugMessage, null); - } - - public ErrorCodeException(int code, String debugMessage, String[] arguments) - { - super(debugMessage); - this.errorCode = code; - this.arguments = arguments; - } - - public ErrorCodeException(Throwable source, int code) - { - this(source, code, (String[])null); - } - - public ErrorCodeException(Throwable source, int code, String[] arguments) - { - super(source); - this.errorCode = code; - this.arguments = arguments; - } - - public ErrorCodeException(Throwable source, int code, String debugMessage) - { - this(source, code, debugMessage, null); - } - - public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) - { - super(debugMessage, source); - this.errorCode = code; - this.arguments = arguments; - } - - public ErrorCodeException(int category, int code, String debugMessage) - { - this(category, code, debugMessage, null); - } - - public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) - { - super(debugMessage); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } - - public ErrorCodeException(Throwable source, int category, int code) - { - this(source, category, code, (String[])null); - } - - public ErrorCodeException(Throwable source, int category, int code, String[] arguments) - { - super(source); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } - - public ErrorCodeException(Throwable source, int category, int code, String debugMessage) - { - this(source, category, code, debugMessage, null); - } - - public ErrorCodeException(Throwable source, int category, int code, String debugMessage, - String[] arguments) - { - super(debugMessage, source); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } - - public int getCategory() - { - return categoryCode; - } - - public int getErrorCode() - { - return errorCode; - } - - public String[] getArguments() - { - return arguments; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java b/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java deleted file mode 100644 index 70a3bce8..00000000 --- a/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.hibernate; - -import java.util.Properties; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.orm.hibernate4.LocalSessionFactoryBean; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.transaction.PlatformTransactionManager; - - -@org.springframework.context.annotation.Configuration -public class HibernateConfiguration -{ - @Autowired - private DataSource dataSource; - - @Bean - public LocalSessionFactoryBean sessionFactory() { - - LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setHibernateProperties(hibernateProperties()); - sessionFactory.setPackagesToScan(new String[] {"org.onap.usecaseui.server.bean"}); - return sessionFactory; - } - - private Properties hibernateProperties() { - Properties properties = new Properties(); - properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); - properties.put("hibernate.show_sql", "false"); - return properties; - } - - @Bean - public PlatformTransactionManager transactionManager() { - return new JpaTransactionManager(); - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java b/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java deleted file mode 100644 index 5038c469..00000000 --- a/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.listener; - -import org.onap.usecaseui.server.service.InitializationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.ApplicationListener; - - -public class UsecaseServerEventListener implements ApplicationListener -{ - private static final Logger logger = LoggerFactory.getLogger(UsecaseServerEventListener.class); - - @Autowired - InitializationService initializationService; - - public void onApplicationEvent(ApplicationReadyEvent arg0) - { - initializationService.initialize(); - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java b/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java deleted file mode 100644 index 0363b814..00000000 --- a/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.security; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - - -//@Configuration -//@EnableWebSecurity -public class RestfulSecurityConfig extends WebSecurityConfigurerAdapter -{ - @Override - protected void configure(HttpSecurity http) - throws Exception - { - // TODO Auto-generated method stub - super.configure(http); - } - - @Override - protected void configure(AuthenticationManagerBuilder auth) - throws Exception - { - // TODO Auto-generated method stub - super.configure(auth); - } - - @Override - @Bean - public AuthenticationManager authenticationManagerBean() throws Exception { - return super.authenticationManagerBean(); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmService.java deleted file mode 100644 index 0834cece..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/AlarmService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - -import org.onap.usecaseui.server.bean.ActiveAlarmInfo; - -public interface AlarmService -{ - String hello(); - - String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java deleted file mode 100644 index 7ea8aec9..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - - -import org.onap.usecaseui.server.bean.AlarmsHeader; -import org.onap.usecaseui.server.util.Page; - -public interface AlarmsHeaderService { - - String saveAlarmsHeader(AlarmsHeader alarmsHeader); - - String updateAlarmsHeader(AlarmsHeader alarmsHeader); - - int getAllCount(); - - Page queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize); - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java deleted file mode 100644 index a9e01a56..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - -import org.onap.usecaseui.server.bean.AlarmsInformation; -import org.onap.usecaseui.server.util.Page; - - -public interface AlarmsInformationService { - - String saveAlarmsInformation(AlarmsInformation alarmsInformation); - - String updateAlarmsInformation(AlarmsInformation alarmsInformation); - - int getAllCount(); - - Page queryAlarmsInformation(AlarmsInformation alarmsInformation,int currentPage,int pageSize); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/InitializationService.java b/src/main/java/org/onap/usecaseui/server/service/InitializationService.java deleted file mode 100644 index 330d1424..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/InitializationService.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - - -public interface InitializationService -{ - void initialize(); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java deleted file mode 100644 index ed4226cd..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - -import org.onap.usecaseui.server.bean.PerformanceHeader; -import org.onap.usecaseui.server.util.Page; - - -public interface PerformanceHeaderService { - - String savePerformanceHeader(PerformanceHeader performanceHeder); - - String updatePerformanceHeader(PerformanceHeader performanceHeder); - - int getAllCount(); - - Page queryPerformanceHeader(PerformanceHeader performanceHeder,int currentPage,int pageSize); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java deleted file mode 100644 index 51c0e1a3..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service; - -import org.onap.usecaseui.server.bean.PerformanceInformation; -import org.onap.usecaseui.server.util.Page; - - -public interface PerformanceInformationService { - - String savePerformanceInformation(PerformanceInformation performanceInformation); - - String updatePerformanceInformation(PerformanceInformation performanceInformation); - - int getAllCount(); - - Page queryPerformanceInformation(PerformanceInformation performanceInformation,int currentPage,int pageSize); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java deleted file mode 100644 index 4e0f8f9c..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - -import java.util.UUID; - -import javax.transaction.Transactional; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.onap.usecaseui.server.bean.ActiveAlarmInfo; -import org.onap.usecaseui.server.service.AlarmService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("AlarmService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class AlarmServiceImpl implements AlarmService -{ - private static final Logger logger = LoggerFactory.getLogger(AlarmServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - public String hello() - { - return "Hello"; - } - - - @Transactional - public String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo) - { - try - { - if (null == acAlarmInfo) - { - logger.error("AlarmServiceImpl saveActiveAlarmInfo acAlarmInfo is null!"); - } - logger.info("AlarmServiceImpl saveActiveAlarmInfo: acAlarmInfo={}", acAlarmInfo); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - acAlarmInfo.setId(UUID.randomUUID().toString()); - session.save(acAlarmInfo); - tx.commit(); - session.flush(); - session.close(); - } - catch (Exception e) - { - logger.error("Exception occurred while performing AlarmServiceImpl saveActiveAlarmInfo. Details:" + e.getMessage()); - } - - return acAlarmInfo.getId(); - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java deleted file mode 100644 index d0e571a3..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import javax.transaction.Transactional; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.onap.usecaseui.server.bean.AlarmsHeader; -import org.onap.usecaseui.server.service.AlarmsHeaderService; -import org.onap.usecaseui.server.util.Page; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("AlarmsHeaderService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class AlarmsHeaderServiceImpl implements AlarmsHeaderService { - - private static final Logger logger = LoggerFactory.getLogger(AlarmsHeaderServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - - public String saveAlarmsHeader(AlarmsHeader alarmsHeader) { - try{ - if (null == alarmsHeader) { - logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!"); - } - logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(alarmsHeader); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage()); - return "0"; - } - - } - - - @Override - public String updateAlarmsHeader(AlarmsHeader alarmsHeader) { - try{ - if (null == alarmsHeader){ - logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!"); - } - logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.update(alarmsHeader); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage()); - return "0"; - } - } - - public int getAllCount() { - try{ - Session session = sessionFactory.openSession(); - long q=(long)session.createQuery("select count(*) from AlarmsHeader").uniqueResult(); - session.flush(); - session.close(); - return (int)q; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage()); - return -1; - } - } - - @SuppressWarnings("unchecked") - @Override - public Page queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize) { - Page page = new Page(); - int allRow =this.getAllCount(); - int offset = page.countOffset(currentPage, pageSize); - - try{ - Date date = new Date(); -// SimpleDateFormat date = new SimpleDateFormat("yy-MM-dd hh:mm:ss"); - StringBuffer hql =new StringBuffer("from AlarmsHeader a where 1=1"); - if (null == alarmsHeader) { - logger.error("AlarmsHeaderServiceImpl queryAlarmsHeader alarmsHeader is null!"); - }else if(null!=alarmsHeader.getVersion()) { - String ver=alarmsHeader.getVersion(); - hql.append(" and a.version like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getEventName()) { - String ver=alarmsHeader.getEventName(); - hql.append(" and a.eventName like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getAlarmCondition()) { - String ver=alarmsHeader.getAlarmCondition(); - hql.append(" and a.alarmCondition like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getDomain()) { - String ver=alarmsHeader.getDomain(); - hql.append(" and a.domain like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getEventId()) { - String ver=alarmsHeader.getEventId(); - hql.append(" and a.eventId like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getNfcNamingCode()) { - String ver=alarmsHeader.getNfcNamingCode(); - hql.append(" and a.nfcNamingCode like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getNfNamingCode()) { - String ver=alarmsHeader.getNfNamingCode(); - hql.append(" and a.nfNamingCode like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getSourceId()) { - String ver =alarmsHeader.getSourceId(); - hql.append(" and a.sourceId like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getSourceName()) { - String ver =alarmsHeader.getSourceName(); - hql.append(" and a.sourceName like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getReportingEntityId()) { - String ver =alarmsHeader.getReportingEntityId(); - hql.append(" and a.reportingEntityId like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getReportingEntityName()) { - String ver =alarmsHeader.getReportingEntityName(); - hql.append(" and a.reportingEntityName like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getPriority()) { - String ver =alarmsHeader.getPriority(); - hql.append(" and a.priority like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getStartEpochMicrosec()) { - String ver =alarmsHeader.getStartEpochMicrosec(); - hql.append(" and a.startEpochMicrosec like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getLastEpochMicroSec()) { - String ver =alarmsHeader.getLastEpochMicroSec(); - hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getSequence()) { - String ver =alarmsHeader.getSequence(); - hql.append(" and a.sequence like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getFaultFieldsVersion()) { - String ver =alarmsHeader.getFaultFieldsVersion(); - hql.append(" and a.faultFieldsVersion like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getEventServrity()) { - String ver =alarmsHeader.getEventServrity(); - hql.append(" and a.eventServrity like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getEventType()) { - String ver =alarmsHeader.getEventType(); - hql.append(" and a.eventSourceType like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getEventCategory()) { - String ver =alarmsHeader.getEventCategory(); - hql.append(" and a.eventCategory like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getAlarmCondition()) { - String ver =alarmsHeader.getAlarmCondition(); - hql.append(" and a.alarmCondition like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getSpecificProblem()) { - String ver =alarmsHeader.getSpecificProblem(); - hql.append(" and a.specificProblem like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getVfStatus()) { - String ver =alarmsHeader.getVfStatus(); - hql.append(" and a.vfStatus like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getAlarmInterfaceA()) { - String ver =alarmsHeader.getAlarmInterfaceA(); - hql.append(" and a.alarmInterfaceA like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getStatus()) { - String ver =alarmsHeader.getStatus(); - hql.append(" and a.status like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getCreateTime()) { - Date ver =alarmsHeader.getCreateTime(); - hql.append(" and a.createTime like '%"+ver+"%'"); - }else if(null!=alarmsHeader.getUpdateTime()) { - Date ver =alarmsHeader.getUpdateTime(); - hql.append(" and a.updateTime like '%"+ver+"%'"); - } - logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - Query query = session.createQuery(hql.toString()); - query.setFirstResult(offset); - query.setMaxResults(pageSize); - List list= query.list(); - page.setPageNo(currentPage); - page.setPageSize(pageSize); - page.setTotalRecords(allRow); - page.setList(list); - tx.commit(); - session.flush(); - session.close(); - return page; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage()); - return null; - } - } - - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java deleted file mode 100644 index 8c9af44c..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - - -import java.util.Date; -import java.util.List; - -import javax.transaction.Transactional; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.onap.usecaseui.server.bean.AlarmsInformation; -import org.onap.usecaseui.server.service.AlarmsInformationService; -import org.onap.usecaseui.server.util.Page; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("AlarmsInformationService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class AlarmsInformationServiceImpl implements AlarmsInformationService { - private static final Logger logger = LoggerFactory.getLogger(AlarmsInformationServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - @Override - public String saveAlarmsInformation(AlarmsInformation alarmsInformation) { - try{ - if (null == alarmsInformation) { - logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!"); - } - logger.info("AlarmsInformationServiceImpl saveAlarmsInformation: alarmsInformation={}", alarmsInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(alarmsInformation); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage()); - return "0"; - } - - } - - @Override - public String updateAlarmsInformation(AlarmsInformation alarmsInformation) { - try{ - if (null == alarmsInformation) { - logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!"); - } - logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}", alarmsInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.update(alarmsInformation); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage()); - return "0"; - } - } - - - public int getAllCount() { - try{ - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - long q=(long)session.createQuery("select count(*) from AlarmsInformation").uniqueResult(); - tx.commit(); - session.flush(); - session.close(); - return (int)q; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage()); - return 0; - } - } - - @SuppressWarnings("unchecked") - @Override - public Page queryAlarmsInformation(AlarmsInformation alarmsInformation, int currentPage, - int pageSize) { - Page page = new Page(); - int allRow =this.getAllCount(); - int offset = page.countOffset(currentPage, pageSize); - - try{ - StringBuffer hql =new StringBuffer("from AlarmsInformation a where 1=1"); - if (null == alarmsInformation) { - logger.error("AlarmsInformationServiceImpl queryAlarmsInformation alarmsInformation is null!"); - }else if(null!=alarmsInformation.getName()) { - String ver=alarmsInformation.getName(); - hql.append(" and a.name like '%"+ver+"%'"); - }else if(null!=alarmsInformation.getValue()) { - String ver=alarmsInformation.getValue(); - hql.append(" and a.value like '%"+ver+"%'"); - }else if(null!=alarmsInformation.getEventId()) { - String ver=alarmsInformation.getEventId(); - hql.append(" and a.eventId like '%"+ver+"%'"); - }else if(null!=alarmsInformation.getCreateTime()) { - Date ver =alarmsInformation.getCreateTime(); - hql.append(" and a.createTime like '%"+ver+"%'"); - }else if(null!=alarmsInformation.getUpdateTime()) { - Date ver =alarmsInformation.getUpdateTime(); - hql.append(" and a.updateTime like '%"+ver+"%'"); - } - logger.info("AlarmsInformationServiceImpl queryAlarmsInformation: alarmsInformation={}", alarmsInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - Query query = session.createQuery(hql.toString()); - query.setFirstResult(offset); - query.setMaxResults(pageSize); - List list= query.list(); - page.setPageNo(currentPage); - page.setPageSize(pageSize); - page.setTotalRecords(allRow); - page.setList(list); - tx.commit(); - session.flush(); - session.close(); - return page; - } catch (Exception e) { - logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage()); - return null; - } - } - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java deleted file mode 100644 index adc1ffe9..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - -import javax.transaction.Transactional; - -import org.onap.usecaseui.server.service.InitializationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("InitializationService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class InitializationServiceImpl implements InitializationService -{ - private static final Logger logger = LoggerFactory.getLogger(InitializationServiceImpl.class); - /**{@inheritDoc} - */ - public void initialize() - { - logger.info("InitializationServiceImpl initialize init..."); - - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java deleted file mode 100644 index 244a96b2..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - - -import java.util.Date; -import java.util.List; - -import javax.transaction.Transactional; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.onap.usecaseui.server.bean.PerformanceHeader; -import org.onap.usecaseui.server.service.PerformanceHeaderService; -import org.onap.usecaseui.server.util.Page; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("PerformanceHeaderService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class PerformanceHeaderServiceImpl implements PerformanceHeaderService { - - private static final Logger logger = LoggerFactory.getLogger(PerformanceHeaderServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - - @Override - public String savePerformanceHeader(PerformanceHeader performanceHeder) { - try{ - if (null == performanceHeder){ - logger.error("PerformanceHeaderServiceImpl savePerformanceHeader performanceHeder is null!"); - } - logger.info("PerformanceHeaderServiceImpl savePerformanceHeader: performanceHeder={}", performanceHeder); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(performanceHeder); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage()); - return "0"; - } - - } - - - @Override - public String updatePerformanceHeader(PerformanceHeader performanceHeder) { - try{ - if (null == performanceHeder){ - logger.error("PerformanceHeaderServiceImpl updatePerformanceHeader performanceHeder is null!"); - } - logger.info("PerformanceHeaderServiceImpl savePerformanceHeader: performanceHeder={}", performanceHeder); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.update(performanceHeder); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage()); - return "0"; - } - } - - - public int getAllCount() { - try{ - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - long q=(long)session.createQuery("select count(*) from PerformanceHeader").uniqueResult(); - tx.commit(); - session.flush(); - session.close(); - return (int)q; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage()); - return 0; - } - } - - @SuppressWarnings("unchecked") - @Override - public Page queryPerformanceHeader(PerformanceHeader performanceHeder, int currentPage, - int pageSize) { - Page page = new Page(); - int allRow =this.getAllCount(); - int offset = page.countOffset(currentPage, pageSize); - - try{ - StringBuffer hql =new StringBuffer("from PerformanceHeader a where 1=1"); - if (null == performanceHeder) { - logger.error("PerformanceHeaderServiceImpl queryAlarmsHeader performanceHeder is null!"); - }else if(null!=performanceHeder.getVersion()) { - String ver=performanceHeder.getVersion(); - hql.append(" and a.version like '%"+ver+"%'"); - }else if(null!=performanceHeder.getEventName()) { - String ver=performanceHeder.getEventName(); - hql.append(" and a.eventName like '%"+ver+"%'"); - }else if(null!=performanceHeder.getDomain()) { - String ver=performanceHeder.getDomain(); - hql.append(" and a.domain like '%"+ver+"%'"); - }else if(null!=performanceHeder.getEventId()) { - String ver=performanceHeder.getEventId(); - hql.append(" and a.eventId like '%"+ver+"%'"); - }else if(null!=performanceHeder.getNfcNamingCode()) { - String ver=performanceHeder.getNfcNamingCode(); - hql.append(" and a.nfcNamingCode like '%"+ver+"%'"); - }else if(null!=performanceHeder.getNfNamingCode()) { - String ver=performanceHeder.getNfNamingCode(); - hql.append(" and a.nfNamingCode like '%"+ver+"%'"); - }else if(null!=performanceHeder.getSourceId()) { - String ver =performanceHeder.getSourceId(); - hql.append(" and a.sourceId like '%"+ver+"%'"); - }else if(null!=performanceHeder.getSourceName()) { - String ver =performanceHeder.getSourceName(); - hql.append(" and a.sourceName like '%"+ver+"%'"); - }else if(null!=performanceHeder.getReportingEntityId()) { - String ver =performanceHeder.getReportingEntityId(); - hql.append(" and a.reportingEntityId like '%"+ver+"%'"); - }else if(null!=performanceHeder.getReportingEntityName()) { - String ver =performanceHeder.getReportingEntityName(); - hql.append(" and a.reportingEntityName like '%"+ver+"%'"); - }else if(null!=performanceHeder.getPriority()) { - String ver =performanceHeder.getPriority(); - hql.append(" and a.priority like '%"+ver+"%'"); - }else if(null!=performanceHeder.getStartEpochMicrosec()) { - String ver =performanceHeder.getStartEpochMicrosec(); - hql.append(" and a.startEpochMicrosec like '%"+ver+"%'"); - }else if(null!=performanceHeder.getLastEpochMicroSec()) { - String ver =performanceHeder.getLastEpochMicroSec(); - hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'"); - }else if(null!=performanceHeder.getSequence()) { - String ver =performanceHeder.getSequence(); - hql.append(" and a.sequence like '%"+ver+"%'"); - }else if(null!=performanceHeder.getMeasurementsForVfScalingVersion()) { - String ver =performanceHeder.getMeasurementsForVfScalingVersion(); - hql.append(" and a.measurementsForVfScalingVersion like '%"+ver+"%'"); - }else if(null!=performanceHeder.getMeasurementInterval()) { - String ver =performanceHeder.getMeasurementInterval(); - hql.append(" and a.measurementInterval like '%"+ver+"%'"); - }else if(null!=performanceHeder.getEventType()) { - String ver =performanceHeder.getEventType(); - hql.append(" and a.eventSourceType like '%"+ver+"%'"); - }else if(null!=performanceHeder.getCreateTime()) { - Date ver =performanceHeder.getCreateTime(); - hql.append(" and a.createTime like '%"+ver+"%'"); - }else if(null!=performanceHeder.getUpdateTime()) { - Date ver =performanceHeder.getUpdateTime(); - hql.append(" and a.updateTime like '%"+ver+"%'"); - } - logger.info("PerformanceHeaderServiceImpl queryPerformanceHeader: performanceHeder={}", performanceHeder); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - Query query = session.createQuery(hql.toString()); - query.setFirstResult(offset); - query.setMaxResults(pageSize); - List list= query.list(); - page.setPageNo(currentPage); - page.setPageSize(pageSize); - page.setTotalRecords(allRow); - page.setList(list); - tx.commit(); - session.flush(); - session.close(); - return page; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage()); - return null; - } - } - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java deleted file mode 100644 index 04ef2fae..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.impl; - - -import java.util.Date; -import java.util.List; - -import javax.transaction.Transactional; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.onap.usecaseui.server.bean.PerformanceInformation; -import org.onap.usecaseui.server.service.PerformanceInformationService; -import org.onap.usecaseui.server.util.Page; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - - -@Service("PerformanceInformationService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class PerformanceInformationServiceImpl implements PerformanceInformationService { - private static final Logger logger = LoggerFactory.getLogger(PerformanceInformationServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - - @Override - public String savePerformanceInformation(PerformanceInformation performanceInformation) { - try { - if (null == performanceInformation) { - logger.error("performanceInformation PerformanceInformation performanceInformation is null!"); - } - logger.info("PerformanceInformationServiceImpl savePerformanceInformation: performanceInformation={}", performanceInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(performanceInformation); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage()); - return "0"; - } - - } - - - @Override - public String updatePerformanceInformation(PerformanceInformation performanceInformation) { - try { - if (null == performanceInformation) { - logger.error("performanceInformation PerformanceInformation performanceInformation is null!"); - } - logger.info("PerformanceInformationServiceImpl savePerformanceInformation: performanceInformation={}", performanceInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.update(performanceInformation); - tx.commit(); - session.flush(); - session.close(); - return "1"; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage()); - return "0"; - } - } - - - public int getAllCount() { - try{ - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - long q=(long)session.createQuery("select count(*) from PerformanceInformation").uniqueResult(); - tx.commit(); - session.flush(); - session.close(); - return (int)q; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage()); - return 0; - } - } - - @SuppressWarnings("unchecked") - @Override - public Page queryPerformanceInformation(PerformanceInformation performanceInformation, - int currentPage, int pageSize) { - Page page = new Page(); - int allRow =this.getAllCount(); - int offset = page.countOffset(currentPage, pageSize); - - try{ - StringBuffer hql =new StringBuffer("from PerformanceInformation a where 1=1"); - if (null == performanceInformation) { - logger.error("AlarmsInformationServiceImpl queryPerformanceInformation performanceInformation is null!"); - }else if(null!=performanceInformation.getName()) { - String ver=performanceInformation.getName(); - hql.append(" and a.name like '%"+ver+"%'"); - }else if(null!=performanceInformation.getValue()) { - String ver=performanceInformation.getValue(); - hql.append(" and a.value like '%"+ver+"%'"); - }else if(null!=performanceInformation.getEventId()) { - String ver=performanceInformation.getEventId(); - hql.append(" and a.eventId like '%"+ver+"%'"); - }else if(null!=performanceInformation.getCreateTime()) { - Date ver =performanceInformation.getCreateTime(); - hql.append(" and a.createTime like '%"+ver+"%'"); - }else if(null!=performanceInformation.getUpdateTime()) { - Date ver =performanceInformation.getUpdateTime(); - hql.append(" and a.updateTime like '%"+ver+"%'"); - } - logger.info("PerformanceInformationServiceImpl queryPerformanceInformation: performanceInformation={}", performanceInformation); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - Query query = session.createQuery(hql.toString()); - query.setFirstResult(offset); - query.setMaxResults(pageSize); - List list= query.list(); - page.setPageNo(currentPage); - page.setPageSize(pageSize); - page.setTotalRecords(allRow); - page.setList(list); - tx.commit(); - session.flush(); - session.close(); - return page; - } catch (Exception e) { - logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage()); - return null; - } - } - - - - - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java deleted file mode 100644 index 9c659469..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm; - -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; - -import java.util.List; - -public interface CustomerService { - List listCustomer(); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java deleted file mode 100644 index 867df4d4..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm; - -import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; - -public interface PackageDistributionService { - - VfNsPackageInfo retrievePackageInfo(); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java deleted file mode 100644 index 1775211c..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm; - -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; - -import java.util.List; - -public interface ServiceInstanceService { - - List listServiceInstances(String customerId, String serviceType); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java deleted file mode 100644 index fc893f3b..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm; - -import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; - -public interface ServiceLcmService { - - ServiceOperation instantiateService(ServiceInstantiationRequest request); - - OperationProgressInformation queryOperationProgress(String serviceId, String operationId); - - ServiceOperation terminateService(String serviceId); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java deleted file mode 100644 index 22479e61..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm; - -import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; - -import java.util.List; - -public interface ServiceTemplateService { - - List listDistributedServiceTemplate(); - - ServiceTemplateInputRsp fetchServiceTemplateInput(String uuid, String toscaModelPath); -} \ No newline at end of file diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java deleted file mode 100644 index fc83f4f0..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.aai; - -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; -import retrofit2.Call; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.Path; - -import java.util.List; - -public interface AAIService { - - @Headers({ - "X-TransactionId: 7777", - "X-FromAppId: uui", - "Authorization: QUFJOkFBSQ==" - }) - @GET("/api/aai-business/v11/customers") - Call> listCustomer(); - - @Headers({ - "X-TransactionId: 7777", - "X-FromAppId: uui", - "Authorization: QUFJOkFBSQ==" - }) - @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") - Call> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); - - @Headers({ - "X-TransactionId: 7777", - "X-FromAppId: uui", - "Authorization: QUFJOkFBSQ==" - }) - @GET("/cloud-infrastructure/cloud-regions") - Call> listVimInfo(); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java deleted file mode 100644 index e1135236..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.aai.bean; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class AAICustomer { - - private String globalCustomerId; - - private String subscriberName; - - private String subscriberType; - - @JsonCreator - public AAICustomer( - @JsonProperty("global-customer-id") String globalCustomerId, - @JsonProperty("subscriber-name") String subscriberName, - @JsonProperty("subscriber-type") String subscriberType) { - this.globalCustomerId = globalCustomerId; - this.subscriberName = subscriberName; - this.subscriberType = subscriberType; - } - - @JsonProperty("global-customer-id") - public String getGlobalCustomerId() { - return globalCustomerId; - } - - @JsonProperty("subscriber-name") - public String getSubscriberName() { - return subscriberName; - } - - @JsonProperty("subscriber-type") - public String getSubscriberType() { - return subscriberType; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java deleted file mode 100644 index 5245d27b..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.aai.bean; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceInstance { - - private String globalCustomerId; - - private String serviceType; - - private String serviceInstanceId; - - private String subscriberName; - - private String subscriberType; - - private String serviceInstanceName; - - private String serviceInstanceLocationId; - - @JsonCreator - public ServiceInstance( - @JsonProperty("global-customer-id") String globalCustomerId, - @JsonProperty("service-type") String serviceType, - @JsonProperty("service-instance-id") String serviceInstanceId, - @JsonProperty("subscriber-name") String subscriberName, - @JsonProperty("subscriber-type") String subscriberType, - @JsonProperty("service-instance-name") String serviceInstanceName, - @JsonProperty("service-instance-location-id") String serviceInstanceLocationId) { - this.globalCustomerId = globalCustomerId; - this.serviceType = serviceType; - this.serviceInstanceId = serviceInstanceId; - this.subscriberName = subscriberName; - this.subscriberType = subscriberType; - this.serviceInstanceName = serviceInstanceName; - this.serviceInstanceLocationId = serviceInstanceLocationId; - } - - @JsonProperty("global-customer-id") - public String getGlobalCustomerId() { - return globalCustomerId; - } - - @JsonProperty("service-type") - public String getServiceType() { - return serviceType; - } - - @JsonProperty("service-instance-id") - public String getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty("subscriber-name") - public String getSubscriberName() { - return subscriberName; - } - - @JsonProperty("subscriber-type") - public String getSubscriberType() { - return subscriberType; - } - - @JsonProperty("service-instance-name") - public String getServiceInstanceName() { - return serviceInstanceName; - } - - @JsonProperty("service-instance-location-id") - public String getServiceInstanceLocationId() { - return serviceInstanceLocationId; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java deleted file mode 100644 index 73a98732..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.aai.bean; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class VimInfo { - - private String cloudOwner; - - private String cloudRegionId; - - @JsonCreator - public VimInfo( - @JsonProperty("cloud-owner") String cloudOwner, - @JsonProperty("cloud-region-id") String cloudRegionId) { - this.cloudOwner = cloudOwner; - this.cloudRegionId = cloudRegionId; - } - - @JsonProperty("cloud-owner") - public String getCloudOwner() { - return cloudOwner; - } - - @JsonProperty("cloud-region-id") - public String getCloudRegionId() { - return cloudRegionId; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java deleted file mode 100644 index e7bc0d9b..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.aai.exceptions; - -public class AAIException extends RuntimeException { - - public AAIException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java deleted file mode 100644 index 46d5389c..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.sdc; - -import okhttp3.ResponseBody; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; -import retrofit2.Call; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.Query; -import retrofit2.http.Url; - -import java.util.List; - -public interface SDCCatalogService { - - @GET("sdc/v1/catalog/services") - Call> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus); - - @Headers({ - "X-ECOMP-InstanceID: 777", - "Authorization: what?" - }) - @GET - Call downloadCsar(@Url String fileUrl); - - @GET("sdc/v1/catalog/resources") - Call> listResources(@Query("resourceType") String resourceType, @Query("distributionStatus") String distributionStatus); -} \ No newline at end of file diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java deleted file mode 100644 index 48da58a4..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.sdc.bean; - -public class SDCServiceTemplate { - - -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java deleted file mode 100644 index 8b98c71c..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.sdc.bean; - -public class Vnf { -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java deleted file mode 100644 index 76914e4a..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.sdc.consts; - -public class SDCConsts { - - public static final String CATEGORY_E2E_SERVICE = "e2e"; - public static final String CATEGORY_NS = "ns"; - public static final String DISTRIBUTION_STATUS_DISTRIBUTED = "DISTRIBUTED"; - public static final String RESOURCETYPE_VF = "VF"; -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java deleted file mode 100644 index b0998486..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions; - -public class SDCCatalogException extends RuntimeException { - - public SDCCatalogException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java deleted file mode 100644 index 4d8fac98..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.so; - -import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; -import retrofit2.Call; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.POST; -import retrofit2.http.Path; - -public interface SOService { - - @POST("/so/e2eServiceInstances/v2") - Call instantiateService(ServiceInstantiationRequest request); - - @GET("/so/e2eServiceInstances/v2/{serviceId}/operations/{operationId}") - Call queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId); - - @DELETE("/so/e2eServiceInstances/v2/{serviceId}") - Call terminateService(@Path("serviceId") String serviceId); -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java deleted file mode 100644 index 3c70452e..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.so.bean; - -public class OperationProgressInformation { -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java deleted file mode 100644 index 98984093..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.so.bean; - -import java.util.Map; - -public class ServiceInstantiationRequest { - - private String name; - - private String description; - - private String serviceDefId; - - private String templateId; - - private Map parameters; - - public ServiceInstantiationRequest(String name, String description, String serviceDefId, String templateId, Map parameters) { - this.name = name; - this.description = description; - this.serviceDefId = serviceDefId; - this.templateId = templateId; - this.parameters = parameters; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getServiceDefId() { - return serviceDefId; - } - - public String getTemplateId() { - return templateId; - } - - public Map getParameters() { - return parameters; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java deleted file mode 100644 index 8a642872..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.so.bean; - -public class ServiceOperation { - - private String serviceId; - - private String operationId; - - public ServiceOperation(String serviceId, String operationId) { - this.serviceId = serviceId; - this.operationId = operationId; - } - - public String getServiceId() { - return serviceId; - } - - public String getOperationId() { - return operationId; - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java deleted file mode 100644 index 409fd0e4..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.domain.so.exceptions; - -public class SOException extends RuntimeException { - - public SOException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java deleted file mode 100644 index 9332dcf7..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.impl; - -import org.onap.usecaseui.server.service.lcm.CustomerService; -import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; -import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; -import org.onap.usecaseui.server.util.RestfulServices; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.List; - -@Service("CustomerService") -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class DefaultCustomerService implements CustomerService { - - private static final Logger logger = LoggerFactory.getLogger(DefaultCustomerService.class); - - private AAIService aaiService; - - public DefaultCustomerService() { - this(RestfulServices.create(AAIService.class)); - } - - public DefaultCustomerService(AAIService aaiService) { - this.aaiService = aaiService; - } - - @Override - public List listCustomer() { - try { - return this.aaiService.listCustomer().execute().body(); - } catch (IOException e) { - logger.error("list customers occur exception"); - throw new AAIException("AAI is not available.", e); - } - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java deleted file mode 100644 index 477e4579..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.impl; - -import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; -import org.onap.usecaseui.server.service.lcm.PackageDistributionService; -import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; -import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf; -import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException; -import org.onap.usecaseui.server.util.RestfulServices; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.List; - -import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.*; - -@Service("PackageDistributionService") -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class DefaultPackageDistributionService implements PackageDistributionService { - - private SDCCatalogService sdcCatalogService; - - private AAIService aaiService; - - public DefaultPackageDistributionService() { - this(RestfulServices.create(SDCCatalogService.class), RestfulServices.create(AAIService.class)); - } - - public DefaultPackageDistributionService(SDCCatalogService sdcCatalogService, AAIService aaiService) { - this.sdcCatalogService = sdcCatalogService; - this.aaiService = aaiService; - } - - @Override - public VfNsPackageInfo retrievePackageInfo() { - try { - List nsTemplate = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); - List vnfs = sdcCatalogService.listResources(RESOURCETYPE_VF, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); - List vim = aaiService.listVimInfo().execute().body(); - return new VfNsPackageInfo(nsTemplate, vnfs, vim); - } catch (IOException e) { - throw new SDCCatalogException("SDC Service is not available!", e); - } - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java deleted file mode 100644 index 540a0dad..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.impl; - -import org.onap.usecaseui.server.service.lcm.ServiceInstanceService; -import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; -import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; -import org.onap.usecaseui.server.util.RestfulServices; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.List; - -@Service("ServiceInstanceService") -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class DefaultServiceInstanceService implements ServiceInstanceService { - - private static final Logger logger = LoggerFactory.getLogger(DefaultServiceInstanceService.class); - - private AAIService aaiService; - - public DefaultServiceInstanceService() { - this(RestfulServices.create(AAIService.class)); - } - - public DefaultServiceInstanceService(AAIService aaiService) { - this.aaiService = aaiService; - } - - @Override - public List listServiceInstances(String customerId, String serviceType) { - try { - return aaiService.listServiceInstances(customerId, serviceType).execute().body(); - } catch (IOException e) { - logger.error("list services instances occur exception"); - throw new AAIException("AAI is not available.", e); - } - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java deleted file mode 100644 index 7bb3777a..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.impl; - -import org.onap.usecaseui.server.service.lcm.ServiceLcmService; -import org.onap.usecaseui.server.service.lcm.domain.so.SOService; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; -import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; -import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException; -import org.onap.usecaseui.server.util.RestfulServices; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import java.io.IOException; - -@Service("ServiceLcmService") -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class DefaultServiceLcmService implements ServiceLcmService { - - private SOService soService; - - public DefaultServiceLcmService() { - this(RestfulServices.create(SOService.class)); - } - - public DefaultServiceLcmService(SOService soService) { - this.soService = soService; - } - - @Override - public ServiceOperation instantiateService(ServiceInstantiationRequest request) { - try { - return soService.instantiateService(request).execute().body(); - } catch (IOException e) { - throw new SOException("SO Service is not available!", e); - } - } - - @Override - public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) { - try { - return soService.queryOperationProgress(serviceId, operationId).execute().body(); - } catch (IOException e) { - throw new SOException("SO Service is not available!", e); - } - } - - @Override - public ServiceOperation terminateService(String serviceId) { - try { - return soService.terminateService(serviceId).execute().body(); - } catch (IOException e) { - throw new SOException("SO Service is not available!", e); - } - } -} diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java deleted file mode 100644 index 9a0204ab..00000000 --- a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.service.lcm.impl; - -import com.google.common.io.Files; -import okhttp3.ResponseBody; -import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput; -import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInputRsp; -import org.onap.usecaseui.server.bean.lcm.TemplateInput; -import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; -import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; -import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService; -import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; -import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException; -import org.onap.usecaseui.server.util.RestfulServices; -import org.openecomp.sdc.toscaparser.api.ToscaTemplate; -import org.openecomp.sdc.toscaparser.api.common.JToscaException; -import org.openecomp.sdc.toscaparser.api.parameters.Input; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.CATEGORY_E2E_SERVICE; -import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.DISTRIBUTION_STATUS_DISTRIBUTED; - -@Service("ServiceTemplateService") -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class DefaultServiceTemplateService implements ServiceTemplateService { - - private static final Logger logger = LoggerFactory.getLogger(DefaultServiceTemplateService.class); - - private SDCCatalogService sdcCatalog; - - private AAIService aaiService; - - public DefaultServiceTemplateService() { - this(RestfulServices.create(SDCCatalogService.class), RestfulServices.create(AAIService.class)); - } - - public DefaultServiceTemplateService(SDCCatalogService sdcCatalog, AAIService aaiService) { - this.sdcCatalog = sdcCatalog; - this.aaiService = aaiService; - } - - @Override - public List listDistributedServiceTemplate() { - try { - return this.sdcCatalog.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); - } catch (IOException e) { - logger.error("Visit SDC Catalog occur exception"); - logger.info("SDC Catalog Exception: ", e); - throw new SDCCatalogException("SDC Catalog is not available.", e); - } - } - - @Override - public ServiceTemplateInputRsp fetchServiceTemplateInput(String uuid, String toscaModelPath) { - String rootPath = "http://localhost";// get from msb - String templateUrl = String.format("%s/%s", rootPath, toscaModelPath); - - String toPath = String.format("temp/%s.csar", uuid); - try { - downloadFile(templateUrl, toPath); - ServiceTemplateInput serviceTemplateInput = extractInputs(toPath); - List vimInfos = aaiService.listVimInfo().execute().body(); - return new ServiceTemplateInputRsp(serviceTemplateInput, vimInfos); - } catch (IOException e) { - throw new SDCCatalogException("download csar file failed!", e); - } catch (JToscaException e) { - throw new SDCCatalogException("parse csar file failed!", e); - } - } - - private void downloadFile(String templateUrl, String toPath) throws IOException { - try { - ResponseBody body = sdcCatalog.downloadCsar(templateUrl).execute().body(); - Files.write(body.bytes(),new File(toPath)); - } catch (IOException e) { - logger.error(String.format("Download %s failed!", templateUrl)); - throw e; - } - } - - private ServiceTemplateInput extractInputs(String toPath) throws JToscaException { - ToscaTemplate tosca = new ToscaTemplate(toPath,null,true,null,true); - String name = tosca.getMetaData().getValue("name"); - String type = tosca.getMetaData().getValue("type"); - List templateInputs = new ArrayList<>(); - for(Input input : tosca.getInputs()) { - templateInputs.add(new TemplateInput( - input.getName(), - input.getType(), - input.getDescription(), - String.valueOf(input.isRequired()), - String.valueOf(input.getDefault()) - )); - - } - return new ServiceTemplateInput(name, type, templateInputs); - } -} diff --git a/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java b/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java deleted file mode 100644 index 8c7a4895..00000000 --- a/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVPrinter; -import org.apache.commons.csv.CSVRecord; -import org.aspectj.util.FileUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.*; -import java.util.List; - - -public class CSVUtils { - //CSV文件分隔符 - private final static String NEW_LINE_SEPARATOR="\n"; - private static Logger logger = LoggerFactory.getLogger(CSVUtils.class); - - - /**写入csv文件 - * @param headers 列头 - * @param data 数据内容 - * @param filePath 创建的csv文件路径 - * **/ - public static void writeCsv(String[] headers,List data,String filePath) { - try{ - CSVFormat formator = CSVFormat.DEFAULT.withHeader(headers); - String dir = filePath.substring(0,filePath.lastIndexOf('/')); - File file = new File(dir); - if (!file.exists()) - file.mkdirs(); - try(Writer writer = new FileWriter(filePath); - CSVPrinter printer = new CSVPrinter(writer,formator)){ - for(String[] str : data){ - printer.printRecord(str); - } - } - - logger.info("CSV File Generate Success,FilePath:"+filePath); - }catch (IOException e){ - logger.error("CSV File Generate Failure:"+e.getMessage()); - } - } - - /**读取csv文件 - * @param filePath 文件路径 - * @param headers csv列头 - * @return CSVRecord 列表 - * @throws IOException **/ - public static List readCSV(String filePath, String[] headers) throws IOException{ - //创建CSVFormat - CSVFormat formator = CSVFormat.DEFAULT.withHeader(headers); - FileReader fileReader=new FileReader(filePath); - //创建CSVParser对象 - CSVParser parser=new CSVParser(fileReader,formator); - List records=parser.getRecords(); - parser.close(); - fileReader.close(); - return records; - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/util/DataUtils.java b/src/main/java/org/onap/usecaseui/server/util/DataUtils.java deleted file mode 100644 index beaa29b6..00000000 --- a/src/main/java/org/onap/usecaseui/server/util/DataUtils.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -public class DataUtils { -} diff --git a/src/main/java/org/onap/usecaseui/server/util/Page.java b/src/main/java/org/onap/usecaseui/server/util/Page.java deleted file mode 100644 index fd7665f5..00000000 --- a/src/main/java/org/onap/usecaseui/server/util/Page.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -import java.util.List; - -public class Page { - - private List list; - - private int totalRecords; - - private int pageSize; - - private int pageNo; - - - - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public int getTotalRecords() { - return totalRecords; - } - - public void setTotalRecords(int totalRecords) { - this.totalRecords = totalRecords; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getPageNo() { - return pageNo; - } - - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - - public int getTotalPages() { - return (totalRecords+pageSize-1)/pageSize; - } - - - public int countOffset(int currentPage,int pageSize) { - int offset =pageSize*(currentPage-1); - return offset; - } - - public int getTopageNo() { - return 1; - } - - public int getPreviousPageNo() { - if(pageNo<=1) { - return 1; - } - return pageNo-1; - } - - public int getNextPageNo() { - if(pageNo>=getBottomPageNo()) { - return getBottomPageNo(); - } - return pageNo+1; - } - - public int getBottomPageNo() { - return getTotalPages(); - } - -} diff --git a/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java b/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java deleted file mode 100644 index c26aab69..00000000 --- a/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2016-2017 ZTE Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -import retrofit2.Retrofit; -import retrofit2.converter.jackson.JacksonConverterFactory; - -public class RestfulServices { - - public static T create(Class clazz) { - Retrofit retrofit = new Retrofit.Builder() - .baseUrl("http://localhost") - .addConverterFactory(JacksonConverterFactory.create()) - .build(); - return retrofit.create(clazz); - } -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 4630f2b4..00000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,33 +0,0 @@ -## -## Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## -## General App Properties -server.contextPath=/usecase -server.port=8082 -spring.http.multipart.max-file-size=128MB -spring.http.multipart.max-request-size=128MB - -## App DB Properties -spring.datasource.url=jdbc:mysql://localhost:3306/uui -spring.datasource.username=root -spring.datasource.password= -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect -spring.database.driver.classname=com.mysql.jdbc.Driver -spring.jpa.show-sql=false -spring.jpa.properties.hibernate.format_sql=false - -## Basic Authentication Properties -security.user.name=usecase -security.user.password=usecase \ No newline at end of file diff --git a/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java b/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java deleted file mode 100644 index 4fc3e747..00000000 --- a/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.usecaseui.server.bean.AlarmsHeader; -import org.onap.usecaseui.server.bean.AlarmsInformation; -import org.onap.usecaseui.server.service.AlarmsHeaderService; -import org.onap.usecaseui.server.service.AlarmsInformationService; -import org.onap.usecaseui.server.service.impl.AlarmsHeaderServiceImpl; -import org.onap.usecaseui.server.service.impl.AlarmsInformationServiceImpl; -import org.onap.usecaseui.server.util.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class UsecaseuiServerApplicationTests { - -// @Autowired -// AlarmsInformationService info; - - @Autowired - AlarmsHeaderService alarm; - - @Test - public void contextLoads() throws ParseException { -// AlarmsInformation in= new AlarmsInformation(); -// Date date =new Date(); -// in.setName("name"); -// in.setEventId("eventId"); -// in.setValue("value"); -// in.setCreateTime(date); -// in.setUpdateTime(date); -// String d=info.saveAlarmsInformation(in); -// String d=info.updateAlarmsInformation(in); - -// int c=alarm.getAllCount(); - - AlarmsHeader a = new AlarmsHeader(); -// a.setVersion("1"); - a.setDomain("3"); -// SimpleDateFormat e =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// a.setCreateTime(e.parse("2017-09-03 15:25:11")); - Page b = alarm.queryAlarmsHeader(a, 1, 5); - String c =b.getList().get(0).getEventName(); - System.out.println("============"+c); - Assert.assertEquals("2", c); - - } -} -- cgit 1.2.3-korg