aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main/java/org/onap')
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java37
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java341
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java319
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java89
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java244
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java89
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java19
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java45
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInputRsp.java40
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/TemplateInput.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/VfNsPackageInfo.java49
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/constant/Constant.java22
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java142
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java164
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java43
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java45
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java54
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java51
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java50
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java131
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java38
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java53
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmService.java25
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java32
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java31
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/InitializationService.java22
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java31
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java31
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java77
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java222
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java157
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java42
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java202
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java160
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java24
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java23
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java25
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java29
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java28
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java53
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java53
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java89
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfo.java44
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java23
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java43
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java21
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java19
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java24
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java23
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java37
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java19
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceInstantiationRequest.java59
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java36
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java23
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java64
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java71
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java122
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java78
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/DataUtils.java19
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/Page.java98
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java30
65 files changed, 4559 insertions, 0 deletions
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<TemplateInput> inputs;
+
+ public ServiceTemplateInput(String name, String type, List<TemplateInput> inputs) {
+ this.name = name;
+ this.type = type;
+ this.inputs = inputs;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public List<TemplateInput> 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<VimInfo> vimInfos;
+
+ public ServiceTemplateInputRsp(ServiceTemplateInput serviceTemplateInput, List<VimInfo> vimInfos) {
+ this.serviceTemplateInput = serviceTemplateInput;
+ this.vimInfos = vimInfos;
+ }
+
+ public ServiceTemplateInput getServiceTemplateInput() {
+ return serviceTemplateInput;
+ }
+
+ public List<VimInfo> 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<SDCServiceTemplate> nsPackage;
+
+ private List<Vnf> vnfPackages;
+
+ private List<VimInfo> vimInfos;
+
+ public VfNsPackageInfo(List<SDCServiceTemplate> nsPackage, List<Vnf> vnfPackages, List<VimInfo> vimInfos) {
+ this.nsPackage = nsPackage;
+ this.vnfPackages = vnfPackages;
+ this.vimInfos = vimInfos;
+ }
+
+ public List<SDCServiceTemplate> getNsPackage() {
+ return nsPackage;
+ }
+
+ public List<Vnf> getVnfPackages() {
+ return vnfPackages;
+ }
+
+ public List<VimInfo> 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<AlarmsHeader> alarmsHeaders = alarmsHeaderService.queryAlarmsHeader(alarmsHeader,currentPage,pageSize).getList();
+ List<AlarmsInformation> alarmsInformations = alarmsInformationService.queryAlarmsInformation(alarmsInformation,currentPage,pageSize).getList();
+ Map<String,Object> 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<PerformanceHeader> performanceHeaders = performanceHeaderService.queryPerformanceHeader(performanceHeader,currentPage,pageSize).getList();
+ List<PerformanceInformation> performanceInformations = performanceInformationService.queryPerformanceInformation(performanceInformation,currentPage,pageSize).getList();
+ Map<String,Object> 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<PerformanceHeader> performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList();
+ List<PerformanceInformation> performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList();
+ List<String[]> csvData = new ArrayList<>();
+
+ return "";
+ }
+
+ @RequestMapping(value = {"/pro/genDiaCsv"}, method = RequestMethod.GET, produces = "application/json")
+ public String generateDiaCsvFile(HttpServletRequest request){
+ String[] headers = new String[]{"","","",""};
+ List<PerformanceHeader> performanceHeaders = performanceHeaderService.queryPerformanceHeader(null,1,100).getList();
+ List<PerformanceInformation> performanceInformations = performanceInformationService.queryPerformanceInformation(null,1,100).getList();
+ List<String[]> 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<PerformanceInformation> 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<AAICustomer> 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<ServiceInstance> 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<SDCServiceTemplate> 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<ApplicationReadyEvent>
+{
+ 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<AlarmsHeader> 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<AlarmsInformation> 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<PerformanceHeader> 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<PerformanceInformation> 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<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize) {
+ Page<AlarmsHeader> page = new Page<AlarmsHeader>();
+ 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<AlarmsHeader> 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<AlarmsInformation> queryAlarmsInformation(AlarmsInformation alarmsInformation, int currentPage,
+ int pageSize) {
+ Page<AlarmsInformation> page = new Page<AlarmsInformation>();
+ 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<AlarmsInformation> 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<PerformanceHeader> queryPerformanceHeader(PerformanceHeader performanceHeder, int currentPage,
+ int pageSize) {
+ Page<PerformanceHeader> page = new Page<PerformanceHeader>();
+ 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<PerformanceHeader> 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<PerformanceInformation> queryPerformanceInformation(PerformanceInformation performanceInformation,
+ int currentPage, int pageSize) {
+ Page<PerformanceInformation> page = new Page<PerformanceInformation>();
+ 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<PerformanceInformation> 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<AAICustomer> 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<ServiceInstance> 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<SDCServiceTemplate> 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<List<AAICustomer>> 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<List<ServiceInstance>> 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<List<VimInfo>> 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<List<SDCServiceTemplate>> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus);
+
+ @Headers({
+ "X-ECOMP-InstanceID: 777",
+ "Authorization: what?"
+ })
+ @GET
+ Call<ResponseBody> downloadCsar(@Url String fileUrl);
+
+ @GET("sdc/v1/catalog/resources")
+ Call<List<Vnf>> 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<ServiceOperation> instantiateService(ServiceInstantiationRequest request);
+
+ @GET("/so/e2eServiceInstances/v2/{serviceId}/operations/{operationId}")
+ Call<OperationProgressInformation> queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId);
+
+ @DELETE("/so/e2eServiceInstances/v2/{serviceId}")
+ Call<ServiceOperation> 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<String, String> parameters;
+
+ public ServiceInstantiationRequest(String name, String description, String serviceDefId, String templateId, Map<String, String> 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<String, String> 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<AAICustomer> 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<SDCServiceTemplate> nsTemplate = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body();
+ List<Vnf> vnfs = sdcCatalogService.listResources(RESOURCETYPE_VF, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body();
+ List<VimInfo> 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<ServiceInstance> 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<SDCServiceTemplate> 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<VimInfo> 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<TemplateInput> 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<String[]> 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<CSVRecord> 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<CSVRecord> 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<E> {
+
+ private List<E> list;
+
+ private int totalRecords;
+
+ private int pageSize;
+
+ private int pageNo;
+
+
+
+
+ public List<E> getList() {
+ return list;
+ }
+
+ public void setList(List<E> 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> T create(Class<T> clazz) {
+ Retrofit retrofit = new Retrofit.Builder()
+ .baseUrl("http://localhost")
+ .addConverterFactory(JacksonConverterFactory.create())
+ .build();
+ return retrofit.create(clazz);
+ }
+}