aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshentao <shentao@chinamobile.com>2017-09-20 21:32:03 +0800
committershentao <shentao@chinamobile.com>2017-09-20 21:32:14 +0800
commit3132da22b04febc6df23504f82e0f8b13d163697 (patch)
treef948a464fdee9afdc6a0bf59667f84eaedc96585
parentc4163c72a1ffb6742dd203e197f76fefe9baa9f9 (diff)
Upload monitor service code for usecase-ui
Change-Id: I0e437747bbeba94d93da47b9b7dc1e4f53cc78f3 Issue-Id: USECASEUI-41 Signed-off-by: shentao <shentao@chinamobile.com>
-rw-r--r--pom.xml9
-rw-r--r--src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java2
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java88
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java12
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java6
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java6
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java6
-rw-r--r--src/main/java/org/onap/usecaseui/server/constant/Constant.java1
-rw-r--r--src/main/java/org/onap/usecaseui/server/controller/AlarmController.java107
-rw-r--r--src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java120
-rw-r--r--src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java9
-rw-r--r--src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java1
-rw-r--r--src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java11
-rw-r--r--src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java9
-rw-r--r--src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java9
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/AlarmService.java8
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java6
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java4
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java4
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java4
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java17
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java139
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java76
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java9
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java118
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java76
-rw-r--r--src/main/java/org/onap/usecaseui/server/util/CSVUtils.java24
-rw-r--r--src/main/java/org/onap/usecaseui/server/util/DataUtils.java (renamed from src/main/java/org/onap/usecaseui/server/util/BeanUtils.java)7
-rw-r--r--src/main/java/org/onap/usecaseui/server/util/Page.java98
-rw-r--r--src/main/resources/application.properties4
-rw-r--r--src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java45
31 files changed, 823 insertions, 212 deletions
diff --git a/pom.xml b/pom.xml
index d82d6398..fedfb8eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -189,6 +189,15 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java b/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java
index 83b09dc4..c12bb24e 100644
--- a/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java
+++ b/src/main/java/org/onap/usecaseui/server/UsecaseuiServerApplication.java
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
-@ComponentScan(basePackages = "org.openecomp.usecaseui.server")
+@ComponentScan(basePackages = "org.onap.usecaseui.server")
public class UsecaseuiServerApplication {
@Bean
diff --git a/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java b/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java
index c11eb5eb..d204d682 100644
--- a/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java
+++ b/src/main/java/org/onap/usecaseui/server/bean/ActiveAlarmInfo.java
@@ -15,136 +15,90 @@
*/
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
+public class ActiveAlarmInfo
{
- /**
- * 主键
- */
+
@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;
diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
index 76344035..1bfc13c5 100644
--- a/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
+++ b/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
@@ -23,11 +23,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
-/**
- *
- * @author xuekui
- *
- */
+
@Entity
@Table(name="alarms_commoneventheader")
public class AlarmsHeader implements Serializable{
@@ -103,7 +99,7 @@ public class AlarmsHeader implements Serializable{
private String alarmInterfaceA;
@Column(name = "status")
- private int status;
+ private String status;
@Column(name = "createTime")
private Date createTime;
@@ -295,11 +291,11 @@ public class AlarmsHeader implements Serializable{
this.alarmInterfaceA = alarmInterfaceA;
}
- public int getStatus() {
+ public String getStatus() {
return status;
}
- public void setStatus(int status) {
+ public void setStatus(String status) {
this.status = status;
}
diff --git a/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
index 96489211..7a44a045 100644
--- a/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
+++ b/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
@@ -23,11 +23,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
-/**
- *
- * @author xuekui
- *
- */
+
@Entity
@Table(name="alarms_additionalinformation")
public class AlarmsInformation implements Serializable{
diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
index a72864b3..acaff0e3 100644
--- a/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
+++ b/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
@@ -23,11 +23,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
-/**
- *
- * @author xuekui
- *
- */
+
@Entity
@Table(name="alarms_commoneventheader")
public class PerformanceHeader implements Serializable{
diff --git a/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
index fec3237b..0e9124be 100644
--- a/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
+++ b/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
@@ -23,11 +23,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
-/**
- *
- * @author xuekui
- *
- */
+
@Entity
@Table(name="alarms_additionalinformation")
public class PerformanceInformation implements Serializable{
diff --git a/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/src/main/java/org/onap/usecaseui/server/constant/Constant.java
index 62b075c3..bf311d6c 100644
--- a/src/main/java/org/onap/usecaseui/server/constant/Constant.java
+++ b/src/main/java/org/onap/usecaseui/server/constant/Constant.java
@@ -15,6 +15,7 @@
*/
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
index 74f618ce..8377dd50 100644
--- a/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
+++ b/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
@@ -15,28 +15,42 @@
*/
package org.onap.usecaseui.server.controller;
-import java.io.IOException;
-
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+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.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 [产品/模块版本]
+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
@@ -47,28 +61,79 @@ 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){
- String eventId = request.getParameter("eventId");
- String vfStatus = request.getParameter("vfStatus");
- String status = request.getParameter("status");
-
- return "";
+ 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 result = "{result:failure}";
- String ids = request.getParameter("ids");
+ 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 result;
+ return "";
}
+
@RequestMapping(value = { "/alarm/updateStatus" } , method = RequestMethod.GET , produces = "application/json")
public String updateStatus(HttpServletRequest request){
- return "";
+ String id = request.getParameter("ALARM_eventId");
+ String vfStatus = request.getParameter("ALARM_vfstatus");
+ String status = request.getParameter("ALARM_status");
+ AlarmsHeader alarmsHeader = new AlarmsHeader();
+ if (null != id)
+ alarmsHeader.setEventId(id);
+ if (null != vfStatus)
+ alarmsHeader.setVfStatus(vfStatus);
+ if (null != status)
+ alarmsHeader.setStatus(status);
+ String result = alarmsHeaderService.updateAlarmsHeader(alarmsHeader);
+ return result;
}
diff --git a/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
index 6732bc9f..bd39843d 100644
--- a/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
+++ b/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
@@ -15,8 +15,16 @@
*/
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;
@@ -24,33 +32,133 @@ 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){
-
- return "";
+ 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[]{};
+ 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/genDia"}, method = RequestMethod.GET, produces = "application/json")
- public String generateDiagram(HttpServletRequest request){
+ @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/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java b/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java
index 4ac6251b..475adc01 100644
--- a/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java
+++ b/src/main/java/org/onap/usecaseui/server/dao/UsecaseuiDataSource.java
@@ -22,14 +22,7 @@ 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
{
diff --git a/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java b/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java
index 65bc776f..b4850fcb 100644
--- a/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java
+++ b/src/main/java/org/onap/usecaseui/server/exception/ErrorCodeException.java
@@ -15,6 +15,7 @@
*/
package org.onap.usecaseui.server.exception;
+
public class ErrorCodeException extends Exception
{
private static final long serialVersionUID = 3220072444842529499L;
diff --git a/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java b/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java
index 292b0008..70a3bce8 100644
--- a/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java
+++ b/src/main/java/org/onap/usecaseui/server/hibernate/HibernateConfiguration.java
@@ -25,14 +25,7 @@ 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
{
@@ -45,7 +38,7 @@ public class HibernateConfiguration
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
sessionFactory.setHibernateProperties(hibernateProperties());
- sessionFactory.setPackagesToScan(new String[] {"org.openecomp.usecaseui.server.bean"});
+ sessionFactory.setPackagesToScan(new String[] {"org.onap.usecaseui.server.bean"});
return sessionFactory;
}
diff --git a/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java b/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
index 2590d2c7..5038c469 100644
--- a/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
+++ b/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
@@ -22,14 +22,7 @@ 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);
diff --git a/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java b/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java
index 25c23644..0363b814 100644
--- a/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java
+++ b/src/main/java/org/onap/usecaseui/server/security/RestfulSecurityConfig.java
@@ -24,14 +24,7 @@ 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
diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmService.java
index 5f00227f..0834cece 100644
--- a/src/main/java/org/onap/usecaseui/server/service/AlarmService.java
+++ b/src/main/java/org/onap/usecaseui/server/service/AlarmService.java
@@ -17,14 +17,6 @@ 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();
diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
index 0c017afd..7ea8aec9 100644
--- a/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
+++ b/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
@@ -15,9 +15,9 @@
*/
package org.onap.usecaseui.server.service;
-import java.util.List;
import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.util.Page;
public interface AlarmsHeaderService {
@@ -25,6 +25,8 @@ public interface AlarmsHeaderService {
String updateAlarmsHeader(AlarmsHeader alarmsHeader);
- List<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader);
+ int getAllCount();
+
+ Page<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader,int currentPage,int pageSize);
}
diff --git a/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java b/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
index 126eb185..a9e01a56 100644
--- a/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
+++ b/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service;
import org.onap.usecaseui.server.bean.AlarmsInformation;
+import org.onap.usecaseui.server.util.Page;
public interface AlarmsInformationService {
@@ -24,4 +25,7 @@ public interface AlarmsInformationService {
String updateAlarmsInformation(AlarmsInformation alarmsInformation);
+ int getAllCount();
+
+ Page<AlarmsInformation> queryAlarmsInformation(AlarmsInformation alarmsInformation,int currentPage,int pageSize);
}
diff --git a/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java
index 04de0433..ed4226cd 100644
--- a/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java
+++ b/src/main/java/org/onap/usecaseui/server/service/PerformanceHeaderService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service;
import org.onap.usecaseui.server.bean.PerformanceHeader;
+import org.onap.usecaseui.server.util.Page;
public interface PerformanceHeaderService {
@@ -24,4 +25,7 @@ public interface PerformanceHeaderService {
String updatePerformanceHeader(PerformanceHeader performanceHeder);
+ int getAllCount();
+
+ Page<PerformanceHeader> queryPerformanceHeader(PerformanceHeader performanceHeder,int currentPage,int pageSize);
}
diff --git a/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java b/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
index 545c0f0c..51c0e1a3 100644
--- a/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
+++ b/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service;
import org.onap.usecaseui.server.bean.PerformanceInformation;
+import org.onap.usecaseui.server.util.Page;
public interface PerformanceInformationService {
@@ -24,4 +25,7 @@ public interface PerformanceInformationService {
String updatePerformanceInformation(PerformanceInformation performanceInformation);
+ int getAllCount();
+
+ Page<PerformanceInformation> queryPerformanceInformation(PerformanceInformation performanceInformation,int currentPage,int pageSize);
}
diff --git a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java
index 6cc8de1e..4e0f8f9c 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmServiceImpl.java
@@ -30,14 +30,7 @@ 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
@@ -54,13 +47,7 @@ public class AlarmServiceImpl implements AlarmService
return "Hello";
}
- /**
- * <保存活跃告警信息>
- * <功能详细描述>
- * @param acAlarmInfo 活跃告警对象
- * @return 对象id
- * @see [类、类#方法、类#成员]
- */
+
@Transactional
public String saveActiveAlarmInfo(ActiveAlarmInfo acAlarmInfo)
{
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
index 8e419687..d0e571a3 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
@@ -16,15 +16,19 @@
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;
@@ -42,8 +46,8 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
@Autowired
private SessionFactory sessionFactory;
-
- @Override
+
+
public String saveAlarmsHeader(AlarmsHeader alarmsHeader) {
try{
if (null == alarmsHeader) {
@@ -58,11 +62,12 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveActiveAlarmInfo. Details:" + e.getMessage());
+ logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());
return "0";
}
}
+
@Override
public String updateAlarmsHeader(AlarmsHeader alarmsHeader) {
@@ -79,15 +84,135 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveActiveAlarmInfo. Details:" + e.getMessage());
+ 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 List<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader) {
- // TODO Auto-generated method stub
- return null;
+ 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/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
index a3545267..8c9af44c 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
@@ -16,13 +16,18 @@
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;
@@ -46,7 +51,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
if (null == alarmsInformation) {
logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!");
}
- logger.info("AlarmsHeaderServiceImpl saveAlarmsInformation: alarmsInformation={}", alarmsInformation);
+ logger.info("AlarmsInformationServiceImpl saveAlarmsInformation: alarmsInformation={}", alarmsInformation);
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.save(alarmsInformation);
@@ -67,7 +72,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
if (null == alarmsInformation) {
logger.error("alarmsInformation AlarmsInformation alarmsInformation is null!");
}
- logger.info("AlarmsHeaderServiceImpl saveAlarmsInformation: alarmsInformation={}", alarmsInformation);
+ logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}", alarmsInformation);
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.update(alarmsInformation);
@@ -76,10 +81,75 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage());
+ 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/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java
index 9322cc41..adc1ffe9 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/InitializationServiceImpl.java
@@ -23,14 +23,7 @@ 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
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
index e5ba0a7f..244a96b2 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
@@ -16,13 +16,18 @@
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;
@@ -41,6 +46,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
@Autowired
private SessionFactory sessionFactory;
+
@Override
public String savePerformanceHeader(PerformanceHeader performanceHeder) {
try{
@@ -62,11 +68,12 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
}
+
@Override
public String updatePerformanceHeader(PerformanceHeader performanceHeder) {
try{
if (null == performanceHeder){
- logger.error("PerformanceHeaderServiceImpl savePerformanceHeader performanceHeder is null!");
+ logger.error("PerformanceHeaderServiceImpl updatePerformanceHeader performanceHeder is null!");
}
logger.info("PerformanceHeaderServiceImpl savePerformanceHeader: performanceHeder={}", performanceHeder);
Session session = sessionFactory.openSession();
@@ -77,12 +84,119 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage());
+ 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/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
index 1b299876..04ef2fae 100644
--- a/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
+++ b/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
@@ -16,13 +16,18 @@
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;
@@ -40,6 +45,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
@Autowired
private SessionFactory sessionFactory;
+
@Override
public String savePerformanceInformation(PerformanceInformation performanceInformation) {
try {
@@ -55,12 +61,13 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl performanceInformation. Details:" + e.getMessage());
+ logger.error("Exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage());
return "0";
}
}
+
@Override
public String updatePerformanceInformation(PerformanceInformation performanceInformation) {
try {
@@ -76,12 +83,77 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl performanceInformation. Details:" + e.getMessage());
+ 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/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java b/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
index e11adde7..8c7a4895 100644
--- a/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
+++ b/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
@@ -19,15 +19,14 @@ 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.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
+import java.io.*;
import java.util.List;
+
public class CSVUtils {
//CSV文件分隔符
private final static String NEW_LINE_SEPARATOR="\n";
@@ -40,6 +39,23 @@ public class CSVUtils {
* @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文件
diff --git a/src/main/java/org/onap/usecaseui/server/util/BeanUtils.java b/src/main/java/org/onap/usecaseui/server/util/DataUtils.java
index b7812a0c..beaa29b6 100644
--- a/src/main/java/org/onap/usecaseui/server/util/BeanUtils.java
+++ b/src/main/java/org/onap/usecaseui/server/util/DataUtils.java
@@ -15,10 +15,5 @@
*/
package org.onap.usecaseui.server.util;
-/**
- *
- */
-public class BeanUtils {
-
-
+public class DataUtils {
}
diff --git a/src/main/java/org/onap/usecaseui/server/util/Page.java b/src/main/java/org/onap/usecaseui/server/util/Page.java
new file mode 100644
index 00000000..fd7665f5
--- /dev/null
+++ b/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/src/main/resources/application.properties b/src/main/resources/application.properties
index 5851136a..4630f2b4 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -20,9 +20,9 @@ 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.url=jdbc:mysql://localhost:3306/uui
spring.datasource.username=root
-spring.datasource.password=root
+spring.datasource.password=
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.database.driver.classname=com.mysql.jdbc.Driver
spring.jpa.show-sql=false
diff --git a/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java b/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
index 34aad8e2..4fc3e747 100644
--- a/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
+++ b/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
@@ -15,16 +15,57 @@
*/
package org.onap.usecaseui.server;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.bean.AlarmsInformation;
+import org.onap.usecaseui.server.service.AlarmsHeaderService;
+import org.onap.usecaseui.server.service.AlarmsInformationService;
+import org.onap.usecaseui.server.service.impl.AlarmsHeaderServiceImpl;
+import org.onap.usecaseui.server.service.impl.AlarmsInformationServiceImpl;
+import org.onap.usecaseui.server.util.Page;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class UsecaseuiServerApplicationTests {
-
+
+// @Autowired
+// AlarmsInformationService info;
+
+ @Autowired
+ AlarmsHeaderService alarm;
+
@Test
- public void contextLoads() {
+ public void contextLoads() throws ParseException {
+// AlarmsInformation in= new AlarmsInformation();
+// Date date =new Date();
+// in.setName("name");
+// in.setEventId("eventId");
+// in.setValue("value");
+// in.setCreateTime(date);
+// in.setUpdateTime(date);
+// String d=info.saveAlarmsInformation(in);
+// String d=info.updateAlarmsInformation(in);
+
+// int c=alarm.getAllCount();
+
+ AlarmsHeader a = new AlarmsHeader();
+// a.setVersion("1");
+ a.setDomain("3");
+// SimpleDateFormat e =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// a.setCreateTime(e.parse("2017-09-03 15:25:11"));
+ Page<AlarmsHeader> b = alarm.queryAlarmsHeader(a, 1, 5);
+ String c =b.getList().get(0).getEventName();
+ System.out.println("============"+c);
+ Assert.assertEquals("2", c);
+
}
}