diff options
Diffstat (limited to 'src/main')
29 files changed, 2475 insertions, 0 deletions
diff --git a/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java b/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java new file mode 100644 index 00000000..83b09dc4 --- /dev/null +++ b/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.openecomp.usecaseui.server") +public class UsecaseuiServerApplication { + + @Bean + public RestTemplate getRestTemplate(){ + return new RestTemplate(); + } + + public static void main(String[] args) { + SpringApplication.run(UsecaseuiServerApplication.class, args); + } + +} diff --git a/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java b/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java new file mode 100644 index 00000000..c11eb5eb --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java @@ -0,0 +1,387 @@ +/* + * 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 javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * <活跃告警管理> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@Entity +@Table(name = "EP_ACTIVE_ALARM") +public class ActiveAlarmInfo implements Serializable +{ + /** + * 主键 + */ + @Id + @Column(name = "id", nullable = true) + private String id; + + /** + * 设备名称 + */ + @Column(name = "devName") + private String devName; + + /** + * 设备IP + */ + @Column(name = "devIp") + private String devIp; + + /** + * 设备序列号 + */ + @Column(name = "serialNumber") + private String serialNumber; + + /** + * 告警产生时间 + */ + @Column(name = "alarmRaisedTime") + private String alarmRaisedTime; + + /** + * 告警更新时间 + */ + @Column(name = "alarmChangedTime") + private String alarmChangedTime; + + /** + * 告警序列号 + */ + @Column(name = "alarmIdentifier") + private String alarmIdentifier; + + /** + * 通知类型 + */ + @Column(name = "notificationType") + private String notificationType; + + /** + * 告警对象实例 + */ + @Column(name = "managedObjectInstance") + private String managedObjectInstance; + + /** + * 告警类型 + */ + @Column(name = "eventType") + private Integer eventType; + + /** + * 告警可能原因 + */ + @Column(name = "probableCause") + private String probableCause; + + /** + * 告警描述 + */ + @Column(name = "specificProblem") + private String specificProblem; + + /** + * 告警级别 + */ + @Column(name = "perceivedSeverity") + private String perceivedSeverity; + + /** + * 告警附加文本 + */ + @Column(name = "additionalText") + private String additionalText; + + /** + * 告警附加信息 + */ + @Column(name = "additionalInformation") + private String additionalInformation; + + /** + * 告警清除类型 + */ + @Column(name = "clearedManner") + private String clearedManner; + + /** + * 告警状态 + */ + @Column(name = "alarmState") + private Integer alarmState; + + /** + * 确认时间 + */ + @Column(name = "ackTime") + private String ackTime; + + /** + * 确认人 + */ + @Column(name = "ackUser") + private String ackUser; + + public String getId() + { + return id; + } + + public void setId(String id) + { + this.id = id; + } + + public String getDevName() + { + return devName; + } + + public void setDevName(String devName) + { + this.devName = devName; + } + + public String getDevIp() + { + return devIp; + } + + public void setDevIp(String devIp) + { + this.devIp = devIp; + } + + public String getSerialNumber() + { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) + { + this.serialNumber = serialNumber; + } + + public String getAlarmRaisedTime() + { + return alarmRaisedTime; + } + + public void setAlarmRaisedTime(String alarmRaisedTime) + { + this.alarmRaisedTime = alarmRaisedTime; + } + + public String getAlarmChangedTime() + { + return alarmChangedTime; + } + + public void setAlarmChangedTime(String alarmChangedTime) + { + this.alarmChangedTime = alarmChangedTime; + } + + public String getAlarmIdentifier() + { + return alarmIdentifier; + } + + public void setAlarmIdentifier(String alarmIdentifier) + { + this.alarmIdentifier = alarmIdentifier; + } + + public String getNotificationType() + { + return notificationType; + } + + public void setNotificationType(String notificationType) + { + this.notificationType = notificationType; + } + + public String getManagedObjectInstance() + { + return managedObjectInstance; + } + + public void setManagedObjectInstance(String managedObjectInstance) + { + this.managedObjectInstance = managedObjectInstance; + } + + public Integer getEventType() + { + return eventType; + } + + public void setEventType(Integer eventType) + { + this.eventType = eventType; + } + + public String getProbableCause() + { + return probableCause; + } + + public void setProbableCause(String probableCause) + { + this.probableCause = probableCause; + } + + public String getSpecificProblem() + { + return specificProblem; + } + + public void setSpecificProblem(String specificProblem) + { + this.specificProblem = specificProblem; + } + + public String getPerceivedSeverity() + { + return perceivedSeverity; + } + + public void setPerceivedSeverity(String perceivedSeverity) + { + this.perceivedSeverity = perceivedSeverity; + } + + public String getAdditionalText() + { + return additionalText; + } + + public void setAdditionalText(String additionalText) + { + this.additionalText = additionalText; + } + + public String getAdditionalInformation() + { + return additionalInformation; + } + + public void setAdditionalInformation(String additionalInformation) + { + this.additionalInformation = additionalInformation; + } + + public Integer getAlarmState() + { + return alarmState; + } + + public void setAlarmState(Integer alarmState) + { + this.alarmState = alarmState; + } + + public String getClearedManner() + { + return clearedManner; + } + + public void setClearedManner(String clearedManner) + { + this.clearedManner = clearedManner; + } + + public String getAckTime() + { + return ackTime; + } + + public void setAckTime(String ackTime) + { + this.ackTime = ackTime; + } + + public String getAckUser() + { + return ackUser; + } + + public void setAckUser(String ackUser) + { + this.ackUser = ackUser; + } + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append("ActiveAlarmInfo["); + sb.append("id="); + sb.append(id); + sb.append(",devName="); + sb.append(devName); + sb.append(",devIp="); + sb.append(devIp); + sb.append(",serialNumber="); + sb.append(serialNumber); + sb.append(",alarmRaisedTime="); + sb.append(alarmRaisedTime); + sb.append(",alarmChangedTime="); + sb.append(alarmChangedTime); + sb.append(",alarmIdentifier="); + sb.append(alarmIdentifier); + sb.append(",notificationType="); + sb.append(notificationType); + sb.append(",managedObjectInstance="); + sb.append(managedObjectInstance); + sb.append(",eventType="); + sb.append(eventType); + sb.append(",probableCause="); + sb.append(probableCause); + sb.append(",specificProblem="); + sb.append(specificProblem); + sb.append(",perceivedSeverity="); + sb.append(perceivedSeverity); + sb.append(",additionalText="); + sb.append(additionalText); + sb.append(",additionalInformation="); + sb.append(additionalInformation); + sb.append(",clearedManner="); + sb.append(clearedManner); + sb.append(",alarmState="); + sb.append(alarmState); + sb.append(",ackTime="); + sb.append(ackTime); + sb.append(",ackUser="); + sb.append(ackUser); + sb.append("]"); + return sb.toString(); + } +} diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java new file mode 100644 index 00000000..76344035 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java @@ -0,0 +1,323 @@ +/* + * 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; + +/** + * + * @author xuekui + * + */ +@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 int 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 int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java new file mode 100644 index 00000000..96489211 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java @@ -0,0 +1,93 @@ +/* + * 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; + +/** + * + * @author xuekui + * + */ +@Entity +@Table(name="alarms_additionalinformation") +public class AlarmsInformation implements Serializable{ + + @Id + @Column(name = "name") + private String name; + + @Column(name = "value") + private String value; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java new file mode 100644 index 00000000..a72864b3 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java @@ -0,0 +1,248 @@ +/* + * 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; + +/** + * + * @author xuekui + * + */ +@Entity +@Table(name="alarms_commoneventheader") +public class PerformanceHeader implements Serializable{ + + @Column(name = "version") + private String version; + + @Column(name = "eventName") + private String eventName; + + @Column(name = "domain") + private String domain; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "eventType") + private String eventType; + + @Column(name = "nfcNamingCode", nullable=false) + private String nfcNamingCode; + + @Column(name = "nfNamingCode", nullable=false) + private String nfNamingCode; + + @Column(name = "sourceId") + private String sourceId; + + @Column(name = "sourceName") + private String sourceName; + + @Column(name = "reportingEntityId") + private String reportingEntityId; + + @Column(name = "reportingEntityName") + private String reportingEntityName; + + @Column(name = "priority") + private String priority; + + @Column(name = "startEpochMicrosec") + private String startEpochMicrosec; + + @Column(name = "lastEpochMicroSec") + private String lastEpochMicroSec; + + @Column(name = "sequence") + private String sequence; + + @Column(name = "measurementsForVfScalingVersion") + private String measurementsForVfScalingVersion; + + @Column(name = "measurementInterval") + private String measurementInterval; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getReportingEntityId() { + return reportingEntityId; + } + + public void setReportingEntityId(String reportingEntityId) { + this.reportingEntityId = reportingEntityId; + } + + public String getReportingEntityName() { + return reportingEntityName; + } + + public void setReportingEntityName(String reportingEntityName) { + this.reportingEntityName = reportingEntityName; + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public String getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(String startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public String getLastEpochMicroSec() { + return lastEpochMicroSec; + } + + public void setLastEpochMicroSec(String lastEpochMicroSec) { + this.lastEpochMicroSec = lastEpochMicroSec; + } + + public String getSequence() { + return sequence; + } + + public void setSequence(String sequence) { + this.sequence = sequence; + } + + public String getMeasurementsForVfScalingVersion() { + return measurementsForVfScalingVersion; + } + + public void setMeasurementsForVfScalingVersion(String measurementsForVfScalingVersion) { + this.measurementsForVfScalingVersion = measurementsForVfScalingVersion; + } + + public String getMeasurementInterval() { + return measurementInterval; + } + + public void setMeasurementInterval(String measurementInterval) { + this.measurementInterval = measurementInterval; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java new file mode 100644 index 00000000..fec3237b --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java @@ -0,0 +1,93 @@ +/* + * 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; + +/** + * + * @author xuekui + * + */ +@Entity +@Table(name="alarms_additionalinformation") +public class PerformanceInformation implements Serializable{ + + @Id + @Column(name = "name") + private String name; + + @Column(name = "value") + private String value; + + @Id + @Column(name = "eventId") + private String eventId; + + @Column(name = "createTime") + private Date createTime; + + @Column(name = "updateTime") + private Date updateTime; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} diff --git a/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/src/main/java/org/onap/usecaseui/server/constant/Constant.java new file mode 100644 index 00000000..62b075c3 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/constant/Constant.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.constant; + +public final class Constant +{ + +} diff --git a/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java new file mode 100644 index 00000000..74f618ce --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/controller/AlarmController.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.controller; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * <告警rest控制器实现> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@Controller +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class AlarmController +{ + + + private static final Logger logger = LoggerFactory.getLogger(AlarmController.class); + + + @ResponseBody + @RequestMapping(value = {"/alarm/getData"}, method = RequestMethod.GET , produces = "application/json") + public String getAlarmData(HttpServletRequest request){ + String eventId = request.getParameter("eventId"); + String vfStatus = request.getParameter("vfStatus"); + String status = request.getParameter("status"); + + return ""; + } + + @RequestMapping(value = { "/alarm/genCsv" } , method = RequestMethod.GET , produces = "application/json") + public String generateCsvFile(HttpServletRequest request){ + String result = "{result:failure}"; + String ids = request.getParameter("ids"); + + return result; + } + + @RequestMapping(value = { "/alarm/updateStatus" } , method = RequestMethod.GET , produces = "application/json") + public String updateStatus(HttpServletRequest request){ + return ""; + } + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java new file mode 100644 index 00000000..6732bc9f --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java @@ -0,0 +1,56 @@ +/* + * 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.servlet.http.HttpServletRequest; + +@Controller +@Configuration +@EnableAspectJAutoProxy +public class PerformanceController { + + private Logger looger = LoggerFactory.getLogger(PerformanceController.class); + + @ResponseBody + @RequestMapping(value = {"/pro/getData"},method = RequestMethod.GET, produces = "application/json") + public String getPerformanceData(HttpServletRequest request){ + + return ""; + } + + @RequestMapping(value = {"/pro/genCsv"}, method = RequestMethod.GET, produces = "application/json") + public String generateCsvFile(HttpServletRequest request){ + String[] headers = new String[]{}; + return ""; + } + + @RequestMapping(value = {"/pro/genDia"}, method = RequestMethod.GET, produces = "application/json") + public String generateDiagram(HttpServletRequest request){ + + return ""; + } + + +} diff --git a/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java b/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java new file mode 100644 index 00000000..4ac6251b --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.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.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; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@Component +public class UsecaseuiDataSource +{ + @Value("${spring.database.driver.classname}") + private String dbDriverClassName; + + @Value("${spring.datasource.url}") + private String dbUrl; + + @Value("${spring.datasource.username}") + private String dbUsername; + + @Value("${spring.datasource.password}") + private String dbPassword; + + @Bean + public DataSource dataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(dbDriverClassName); + dataSource.setUrl(dbUrl); + dataSource.setUsername(dbUsername); + dataSource.setPassword(dbPassword); + return dataSource; + } +} diff --git a/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java b/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java new file mode 100644 index 00000000..65bc776f --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.exception; + +public class ErrorCodeException extends Exception +{ + private static final long serialVersionUID = 3220072444842529499L; + + private int categoryCode = 0; + + private int errorCode = 1; + + private String[] arguments = null; + + private static String defaultText = null; + + public static void setDefaultText(String text) + { + defaultText = text; + } + + public static String getDefaultText() + { + return defaultText; + } + + public ErrorCodeException(int code, String debugMessage) + { + this(code, debugMessage, null); + } + + public ErrorCodeException(int code, String debugMessage, String[] arguments) + { + super(debugMessage); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int code) + { + this(source, code, (String[])null); + } + + public ErrorCodeException(Throwable source, int code, String[] arguments) + { + super(source); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int code, String debugMessage) + { + this(source, code, debugMessage, null); + } + + public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) + { + super(debugMessage, source); + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(int category, int code, String debugMessage) + { + this(category, code, debugMessage, null); + } + + public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) + { + super(debugMessage); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int category, int code) + { + this(source, category, code, (String[])null); + } + + public ErrorCodeException(Throwable source, int category, int code, String[] arguments) + { + super(source); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public ErrorCodeException(Throwable source, int category, int code, String debugMessage) + { + this(source, category, code, debugMessage, null); + } + + public ErrorCodeException(Throwable source, int category, int code, String debugMessage, + String[] arguments) + { + super(debugMessage, source); + this.categoryCode = category; + this.errorCode = code; + this.arguments = arguments; + } + + public int getCategory() + { + return categoryCode; + } + + public int getErrorCode() + { + return errorCode; + } + + public String[] getArguments() + { + return arguments; + } +} diff --git a/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java b/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java new file mode 100644 index 00000000..292b0008 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java @@ -0,0 +1,64 @@ +/* + * 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; + +/** + * <Hibernate配置> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@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.openecomp.usecaseui.server.bean"}); + return sessionFactory; + } + + private Properties hibernateProperties() { + Properties properties = new Properties(); + properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); + properties.put("hibernate.show_sql", "false"); + return properties; + } + + @Bean + public PlatformTransactionManager transactionManager() { + return new JpaTransactionManager(); + } + +} diff --git a/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java b/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java new file mode 100644 index 00000000..2590d2c7 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java @@ -0,0 +1,45 @@ +/* + * 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; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +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/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java b/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java new file mode 100644 index 00000000..25c23644 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java @@ -0,0 +1,60 @@ +/* + * 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; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月21日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +//@Configuration +//@EnableWebSecurity +public class RestfulSecurityConfig extends WebSecurityConfigurerAdapter +{ + @Override + protected void configure(HttpSecurity http) + throws Exception + { + // TODO Auto-generated method stub + super.configure(http); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) + throws Exception + { + // TODO Auto-generated method stub + super.configure(auth); + } + + @Override + @Bean + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } +} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmService.java new file mode 100644 index 00000000..5f00227f --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/AlarmService.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service; + +import org.onap.usecaseui.server.bean.ActiveAlarmInfo; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +public interface AlarmService +{ + String hello(); + + String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo); +} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java new file mode 100644 index 00000000..0c017afd --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java @@ -0,0 +1,30 @@ +/* + * 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 java.util.List; + +import org.onap.usecaseui.server.bean.AlarmsHeader; + +public interface AlarmsHeaderService { + + String saveAlarmsHeader(AlarmsHeader alarmsHeader); + + String updateAlarmsHeader(AlarmsHeader alarmsHeader); + + List<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader); + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java new file mode 100644 index 00000000..126eb185 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java @@ -0,0 +1,27 @@ +/* + * 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; + + +public interface AlarmsInformationService { + + String saveAlarmsInformation(AlarmsInformation alarmsInformation); + + String updateAlarmsInformation(AlarmsInformation alarmsInformation); + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/InitializationService.java b/src/main/java/org/onap/usecaseui/server/service/InitializationService.java new file mode 100644 index 00000000..330d1424 --- /dev/null +++ b/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/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java new file mode 100644 index 00000000..04de0433 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java @@ -0,0 +1,27 @@ +/* + * 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; + + +public interface PerformanceHeaderService { + + String savePerformanceHeader(PerformanceHeader performanceHeder); + + String updatePerformanceHeader(PerformanceHeader performanceHeder); + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java new file mode 100644 index 00000000..545c0f0c --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java @@ -0,0 +1,27 @@ +/* + * 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; + + +public interface PerformanceInformationService { + + String savePerformanceInformation(PerformanceInformation performanceInformation); + + String updatePerformanceInformation(PerformanceInformation performanceInformation); + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java new file mode 100644 index 00000000..6cc8de1e --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java @@ -0,0 +1,90 @@ +/* + * 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; + +/** + * <告警接口实现类> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@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"; + } + + /** + * <保存活跃告警信息> + * <功能详细描述> + * @param acAlarmInfo 活跃告警对象 + * @return 对象id + * @see [类、类#方法、类#成员] + */ + @Transactional + public String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo) + { + try + { + if (null == acAlarmInfo) + { + logger.error("AlarmServiceImpl saveActiveAlarmInfo acAlarmInfo is null!"); + } + logger.info("AlarmServiceImpl saveActiveAlarmInfo: acAlarmInfo={}", acAlarmInfo); + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + acAlarmInfo.setId(UUID.randomUUID().toString()); + session.save(acAlarmInfo); + tx.commit(); + session.flush(); + session.close(); + } + catch (Exception e) + { + logger.error("Exception occurred while performing AlarmServiceImpl saveActiveAlarmInfo. Details:" + e.getMessage()); + } + + return acAlarmInfo.getId(); + } + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java new file mode 100644 index 00000000..8e419687 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java @@ -0,0 +1,97 @@ +/* + * 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.List; + +import javax.transaction.Transactional; + +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.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; + + @Override + 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 saveActiveAlarmInfo. 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 saveActiveAlarmInfo. Details:" + e.getMessage()); + return "0"; + } + } + + @Override + public List<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader) { + // TODO Auto-generated method stub + return null; + } + + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java new file mode 100644 index 00000000..a3545267 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java @@ -0,0 +1,87 @@ +/* + * 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.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.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("AlarmsHeaderServiceImpl 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("AlarmsHeaderServiceImpl saveAlarmsInformation: 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 saveAlarmsInformation. Details:" + e.getMessage()); + return "0"; + } + } + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java new file mode 100644 index 00000000..9322cc41 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java @@ -0,0 +1,49 @@ +/* + * 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; + +/** + * <系统初始化> + * <功能详细描述> + * @author donghu + * @version [版本号, 2017年8月17日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +@Service("InitializationService") +@Transactional +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class InitializationServiceImpl implements InitializationService +{ + private static final Logger logger = LoggerFactory.getLogger(InitializationServiceImpl.class); + /**{@inheritDoc} + */ + public void initialize() + { + logger.info("InitializationServiceImpl initialize init..."); + + } + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java new file mode 100644 index 00000000..e5ba0a7f --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java @@ -0,0 +1,88 @@ +/* + * 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.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.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 savePerformanceHeader 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 savePerformanceHeader. Details:" + e.getMessage()); + return "0"; + } + } + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java new file mode 100644 index 00000000..1b299876 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java @@ -0,0 +1,88 @@ +/* + * 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.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.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 performanceInformation. 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 performanceInformation. Details:" + e.getMessage()); + return "0"; + } + } + + + + + +} diff --git a/src/main/java/org/onap/usecaseui/server/util/BeanUtils.java b/src/main/java/org/onap/usecaseui/server/util/BeanUtils.java new file mode 100644 index 00000000..b7812a0c --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/util/BeanUtils.java @@ -0,0 +1,24 @@ +/* + * 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 BeanUtils { + + +} diff --git a/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java b/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java new file mode 100644 index 00000000..e11adde7 --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java @@ -0,0 +1,62 @@ +/* + * 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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +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) { + } + + /**读取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/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 00000000..5851136a --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,33 @@ +## +## Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +## General App Properties +server.contextPath=/usecase +server.port=8082 +spring.http.multipart.max-file-size=128MB +spring.http.multipart.max-request-size=128MB + +## App DB Properties +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/usecase +spring.datasource.username=root +spring.datasource.password=root +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect +spring.database.driver.classname=com.mysql.jdbc.Driver +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false + +## Basic Authentication Properties +security.user.name=usecase +security.user.password=usecase
\ No newline at end of file |