summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java26
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java35
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java24
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java30
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java105
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java93
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java2
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java22
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java53
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java18
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java65
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/util/DateUtils.java139
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java39
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java10
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java6
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/AlarmsInformationTest.java10
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java4
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/PerformanceInformationTest.java10
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java4
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java10
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java8
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java8
-rw-r--r--standalone/src/main/assembly/bin/run.sh4
-rw-r--r--standalone/src/main/assembly/resources/bin/initDB.sh6
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql127
27 files changed, 543 insertions, 319 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
index 188507de..62ef39a7 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
@@ -111,14 +111,6 @@ public class AlarmsHeader implements Serializable{
@Column(name = "status")
private String status;
-
- @Column(name = "createTime")
- private Date createTime;
-
- @Column(name = "updateTime")
- private Date updateTime;
-
-
public AlarmsHeader() {
}
@@ -156,8 +148,6 @@ public class AlarmsHeader implements Serializable{
this.vfStatus = vfStatus;
this.alarmInterfaceA = alarmInterfaceA;
this.status = status;
- this.createTime = createTime;
- this.updateTime = updateTime;
}
public String getVersion() {
@@ -368,22 +358,6 @@ public class AlarmsHeader implements Serializable{
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;
- }
-
public String getId() {
return id;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
index db02827f..f39e3dd2 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
@@ -16,7 +16,6 @@
package org.onap.usecaseui.server.bean;
import java.io.Serializable;
-import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -45,11 +44,11 @@ public class AlarmsInformation implements Serializable {
@Column(name = "sourceId")
private String sourceId;
- @Column(name = "createTime")
- private Date createTime;
+ @Column(name = "startEpochMicroSec")
+ private String startEpochMicroSec;
- @Column(name = "updateTime")
- private Date updateTime;
+ @Column(name = "lastEpochMicroSec")
+ private String lastEpochMicroSec;
@Column(name = "headerId")
private String headerId;
@@ -61,8 +60,8 @@ public class AlarmsInformation implements Serializable {
", name='" + name + '\'' +
", value='" + value + '\'' +
", sourceId='" + sourceId + '\'' +
- ", createTime=" + createTime +
- ", updateTime=" + updateTime +
+ ", createTime=" + startEpochMicroSec +
+ ", updateTime=" + lastEpochMicroSec +
", headerId=" + headerId +
'}';
}
@@ -74,12 +73,12 @@ public class AlarmsInformation implements Serializable {
this.sourceId = sourceId;
}
- public AlarmsInformation(String name, String value, String sourceId, Date createTime, Date updateTime,String headerId) {
+ public AlarmsInformation(String name, String value, String sourceId, String startEpochMicroSec, String lastEpochMicroSec,String headerId) {
this.name = name;
this.value = value;
this.sourceId = sourceId;
- this.createTime = createTime;
- this.updateTime = updateTime;
+ this.startEpochMicroSec = startEpochMicroSec;
+ this.lastEpochMicroSec = lastEpochMicroSec;
this.headerId = headerId;
}
@@ -107,20 +106,20 @@ public class AlarmsInformation implements Serializable {
this.sourceId = sourceId;
}
- public Date getCreateTime() {
- return createTime;
+ public String getStartEpochMicroSec() {
+ return startEpochMicroSec;
}
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
+ public void setStartEpochMicroSec(String startEpochMicroSec) {
+ this.startEpochMicroSec = startEpochMicroSec;
}
- public Date getUpdateTime() {
- return updateTime;
+ public String getLastEpochMicroSec() {
+ return lastEpochMicroSec;
}
- public void setUpdateTime(Date updateTime) {
- this.updateTime = updateTime;
+ public void setLastEpochMicroSec(String lastEpochMicroSec) {
+ this.lastEpochMicroSec = lastEpochMicroSec;
}
public int getId() {
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
index 05bc3998..36ad68b5 100755
--- a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
@@ -84,12 +84,6 @@ public class PerformanceHeader implements Serializable {
@Column(name = "measurementInterval")
private String measurementInterval;
- @Column(name = "createTime")
- private Date createTime;
-
- @Column(name = "updateTime")
- private Date updateTime;
-
public PerformanceHeader() {
}
@@ -115,8 +109,6 @@ public class PerformanceHeader implements Serializable {
this.sequence = sequence;
this.measurementsForVfScalingVersion = measurementsForVfScalingVersion;
this.measurementInterval = measurementInterval;
- this.createTime = createTime;
- this.updateTime = updateTime;
}
public String getVersion() {
@@ -255,22 +247,6 @@ public class PerformanceHeader implements Serializable {
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;
- }
-
public String getId() {
return id;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
index 7de4cb9f..72626e68 100755
--- a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
@@ -41,11 +41,11 @@ public class PerformanceInformation implements Serializable {
@Column(name = "sourceId")
private String sourceId;
- @Column(name = "createTime")
- private Date createTime;
+ @Column(name = "startEpochMicrosec")
+ private String startEpochMicrosec;
- @Column(name = "updateTime")
- private Date updateTime;
+ @Column(name = "lastEpochMicroSec")
+ private String lastEpochMicroSec;
@Column(name="headerId")
private String headerId;
@@ -57,12 +57,12 @@ public class PerformanceInformation implements Serializable {
this.sourceId = sourceId;
}
- public PerformanceInformation(String name, String value, String sourceId, Date createTime, Date updateTime,String headerId) {
+ public PerformanceInformation(String name, String value, String sourceId, String startEpochMicrosec, String lastEpochMicroSec,String headerId) {
this.name = name;
this.value = value;
this.sourceId = sourceId;
- this.createTime = createTime;
- this.updateTime = updateTime;
+ this.startEpochMicrosec = startEpochMicrosec;
+ this.lastEpochMicroSec = lastEpochMicroSec;
this.headerId = headerId;
}
@@ -90,20 +90,20 @@ public class PerformanceInformation implements Serializable {
this.sourceId = sourceId;
}
- public Date getCreateTime() {
- return createTime;
+ public String getStartEpochMicrosec() {
+ return startEpochMicrosec;
}
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
+ public void setStartEpochMicrosec(String startEpochMicrosec) {
+ this.startEpochMicrosec = startEpochMicrosec;
}
- public Date getUpdateTime() {
- return updateTime;
+ public String getLastEpochMicroSec() {
+ return lastEpochMicroSec;
}
- public void setUpdateTime(Date updateTime) {
- this.updateTime = updateTime;
+ public void setLastEpochMicroSec(String lastEpochMicroSec) {
+ this.lastEpochMicroSec = lastEpochMicroSec;
}
public int getId() {
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
index c16fe82c..0e1ea8c3 100755
--- a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
@@ -59,7 +59,11 @@ public class AlarmController
@Resource(name = "AlarmsInformationService")
private AlarmsInformationService alarmsInformationService;
-
+
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+ private String formatDate = "yyyy-MM-dd";
+
private String[] AlarmCSVHeaders = new String[]{"version",
"eventName","domain","eventId","eventType","nfcNamingCode",
"nfNamingCode","sourceId","sourceName","reportingEntityId",
@@ -99,8 +103,8 @@ public class AlarmController
alarm.setSourceName(!"null".equals(sourceName)?sourceName:null);
alarm.setStatus(!"null".equals(vfStatus)?vfStatus:null);
try {
- alarm.setCreateTime(!"null".equals(startTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(startTime):null);
- alarm.setUpdateTime(!"null".equals(endTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endTime):null);
+ alarm.setStartEpochMicrosec(!"null".equals(startTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(startTime).getTime()+"":null);
+ alarm.setLastEpochMicroSec(!"null".equals(endTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endTime).getTime()+"":null);
} catch (ParseException e) {
logger.error("Parse date error :"+e.getMessage());
}
@@ -151,27 +155,90 @@ public class AlarmController
}
@RequestMapping(value = {"/alarm/sourceId"},method = RequestMethod.GET)
- public String getSourceId(){
+ public String getSourceId() throws JsonProcessingException{
List<String> sourceIds = new ArrayList<>();
- alarmsHeaderService.queryAlarmsHeader(null,1,Integer.MAX_VALUE).getList().forEach( al ->{
- sourceIds.add(al.getSourceId());
- } );
- try {
- return omAlarm.writeValueAsString(sourceIds);
- } catch (JsonProcessingException e) {
- e.printStackTrace();
- return "";
+ Page page = alarmsHeaderService.queryAlarmsHeader(new AlarmsHeader(), 1, Integer.MAX_VALUE);
+ AlarmsHeader alarmsHeader;
+ if(page==null){
+ page = new Page();
+ List list = new ArrayList();
+ alarmsHeader = new AlarmsHeader();
+ list.add(alarmsHeader);
+ page.setList(list);
+
}
- }
+ for(int a=0;a<page.getList().size();a++){
- @RequestMapping(value = {"/alarm/diagram"},method = RequestMethod.POST)
- public String genDiagram(@RequestParam String sourceId,@RequestParam String startTime,@RequestParam String endTime){
- try {
- return omAlarm.writeValueAsString(alarmsInformationService.queryDateBetween(sourceId,startTime,endTime));
- } catch (JsonProcessingException e) {
+ alarmsHeader = (AlarmsHeader)page.getList().get(a);
+ String sourceid = alarmsHeader.getSourceId();
+ if (!sourceIds.contains(sourceid)) {
+ sourceIds.add(sourceid);
+ }
+ }
+ return omAlarm.writeValueAsString(sourceIds);
+ }
+ @RequestMapping(value = {"/alarm/diagram"},method = RequestMethod.POST,produces = "application/json")
+ public String diagram(@RequestParam String sourceId, @RequestParam String startTime, @RequestParam String endTime, @RequestParam String format) {
+ long timeInterval = 0;
+ try {
+ if("month".equals(format)){
+ formatDate="yyyy-MM";
+ int maxDay= DateUtils.MonthOfDay(startTime, formatDate);
+ timeInterval =86400000L*maxDay;
+ }else if("hour".equals(format)){
+ formatDate="yyyy-MM-dd HH";
+ timeInterval = 3600000;
+ }else{
+ formatDate="yyyy-MM-dd";
+ timeInterval =86400000;
+ }
+ sdf = new SimpleDateFormat(formatDate);
+ long startTimel = sdf.parse(startTime).getTime();
+ long endTimel = sdf.parse(endTime).getTime();
+ return getDiagram(sourceId, startTimel, endTimel+timeInterval, timeInterval, 1, 1,format);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
e.printStackTrace();
- return "";
}
+ return null;
+ }
+
+ private String getDiagram(String sourceId, long startTimeL, long endTimeL, long timeIteraPlusVal, long keyVal, long keyValIteraVal,String format) throws JsonProcessingException{
+ Map<String,List> result = new HashMap<String,List>();
+
+ Map<String,List> allMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, keyVal, keyValIteraVal,format,"");
+ Map<String,List> criticalMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"CRITICAL");
+ Map<String,List> majorMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"MAJOR");
+ Map<String,List> minorMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"MINOR");
+ Map<String,List> warningMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"WARNING");
+ Map<String,List> normalMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"NORMAL");
+ result.put("dateList", allMaps.get("dateTime"));
+ result.put("allList", allMaps.get("dataList"));
+ result.put("criticalList",criticalMaps.get("dataList"));
+ result.put("majorList",majorMaps.get("dataList"));
+ result.put("minorList",minorMaps.get("dataList"));
+ result.put("warningList",warningMaps.get("dataList"));
+ result.put("normalList",normalMaps.get("dataList"));
+ return omAlarm.writeValueAsString(result);
+ }
+ private Map<String,List> dateProcess(String sourceId, long startTimeL, long endTimeL, long timeIteraPlusVal, long keyVal, long keyValIteraVal,String format,String level) {
+ Map<String,List> result = new HashMap<String,List>();
+ List<String> dateList = new ArrayList<String>();
+ List<Integer> numList = new ArrayList<Integer>();
+ long tmpEndTimeL = startTimeL + timeIteraPlusVal;
+ while (endTimeL >= tmpEndTimeL) {
+ int num = alarmsInformationService.queryDateBetween(sourceId,startTimeL+"",tmpEndTimeL+"",level);
+ dateList.add(DateUtils.getResultDate(startTimeL, format));
+ int maxDay2 = DateUtils.MonthOfDay(sdf.format(new Date(tmpEndTimeL)), formatDate);
+ int maxDay = DateUtils.MonthOfDay(sdf.format(new Date(startTimeL)), formatDate);
+ numList.add(num);
+ startTimeL += 86400000L*maxDay;
+ tmpEndTimeL += 86400000L*maxDay2;
+ keyVal += keyValIteraVal;
+ }
+ result.put("dateTime", dateList);
+ result.put("dataList", numList);
+ return result;
}
@RequestMapping(value = "/alarm/statusCount", method = RequestMethod.GET, produces = "application/json")
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
index fdb71b6d..bc602126 100755
--- a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
@@ -21,8 +21,10 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@@ -72,7 +74,11 @@ public class PerformanceController {
"createTime","updateTime","value","name"};
private ObjectMapper omPerformance = new ObjectMapper();
-
+
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+ private String formatDate = "yyyy-MM-dd";
+
@RequestMapping(value = {"/performance/{currentPage}/{pageSize}","/performance/{currentPage}/{pageSize}/{sourceId}/{sourceName}/{priority}/{startTime}/{endTime}"},method = RequestMethod.GET, produces = "application/json")
public String getPerformanceData(HttpServletResponse response,@PathVariable int currentPage,
@PathVariable int pageSize,@PathVariable(required = false) String sourceId,
@@ -86,8 +92,8 @@ public class PerformanceController {
performanceHeader.setSourceId(!"null".equals(sourceId)?sourceId:null);
performanceHeader.setSourceName(!"null".equals(sourceName)?sourceName:null);
try {
- performanceHeader.setCreateTime(!"null".equals(startTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(startTime):null);
- performanceHeader.setUpdateTime(!"null".equals(endTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endTime):null);
+ performanceHeader.setStartEpochMicrosec(!"null".equals(startTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(startTime).getTime()+"":null);
+ performanceHeader.setLastEpochMicroSec(!"null".equals(endTime)?new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endTime).getTime()+"":null);
} catch (ParseException e) {
if (null != response)
response.setStatus(400);
@@ -206,31 +212,55 @@ public class PerformanceController {
}
@RequestMapping(value = {"/performance/diagram"}, method = RequestMethod.POST, produces = "application/json")
- public String generateDiagram(@RequestParam String sourceId,@RequestParam String startTime,@RequestParam String endTime,@RequestParam String nameParent,@RequestParam(required = false) String nameChild) {
- List<String> diagramSource = new ArrayList<>();
- try {
- logger.info(sourceId+":"+startTime+":"+endTime+":"+nameParent+":"+nameChild);
- if (performanceHeaderService.queryPerformanceHeader(new PerformanceHeader(sourceId),1,10).getList() != null){
- if (nameChild != null && !"".equals(nameChild)){
- sourceId = nameParent;
- nameParent = nameChild;
- }
- performanceInformationService.queryDateBetween(sourceId,nameParent,startTime,endTime)
- .forEach( per -> {
- diagramSource.add(per.getValue());
- });
- }
+ public String generateDiagram(@RequestParam String sourceId,@RequestParam String startTime,@RequestParam String endTime,@RequestParam String nameParent,@RequestParam String format) {
+ long timeInterval = 0;
+ try {
+ if("minute".equals(format)){
+ formatDate="yyyy-MM-dd HH:mm";
+ timeInterval =5*60000;
+ }else if("hour".equals(format)){
+ formatDate="yyyy-MM-dd HH";
+ timeInterval = 3600000;
+ }else{
+ formatDate="yyyy-MM-dd";
+ timeInterval =86400000;
+ }
+ sdf = new SimpleDateFormat(formatDate);
+ long startTimel = sdf.parse(startTime).getTime();
+ long endTimel = sdf.parse(endTime).getTime();
+ return getDiagram(sourceId, startTimel, endTimel+timeInterval, timeInterval,format,nameParent);
} catch (Exception e) {
+ logger.error(e.getMessage());
e.printStackTrace();
}
- try {
- return omPerformance.writeValueAsString(diagramSource);
- } catch (JsonProcessingException e) {
- logger.error("JsonProcessingException:"+e.getMessage());
- return "";
+ return null;
+ }
+
+ private String getDiagram(String sourceId, long startTimeL, long endTimeL, long timeIteraPlusVal,String format,String nameParent) throws JsonProcessingException{
+ Map<String,List> result = new HashMap<String,List>();
+
+ Map<String,List> allMaps = dateProcess(sourceId, startTimeL, endTimeL, timeIteraPlusVal,format,nameParent);
+ result.put("dateList", allMaps.get("dateTime"));
+ result.put("valueList", allMaps.get("dataList"));
+ return omPerformance.writeValueAsString(result);
+ }
+ private Map<String,List> dateProcess(String sourceId, long startTimeL, long endTimeL, long timeIteraPlusVal,String format,String nameParent) {
+ Map<String,List> result = new HashMap<String,List>();
+ List<String> dateList = new ArrayList<String>();
+ List<String> numList = new ArrayList<String>();
+ long tmpEndTimeL = startTimeL + timeIteraPlusVal;
+ while (endTimeL >= tmpEndTimeL) {
+ String num = performanceInformationService.queryMaxValueByBetweenDate(sourceId, nameParent, startTimeL+"", tmpEndTimeL+"");
+ dateList.add(DateUtils.getResultDate(startTimeL, format));
+ numList.add(num);
+ startTimeL += timeIteraPlusVal;
+ tmpEndTimeL += timeIteraPlusVal;
}
+ result.put("dateTime", dateList);
+ result.put("dataList", numList);
+ return result;
}
-
+
@RequestMapping(value = {"/performance/resourceIds"},method = RequestMethod.GET)
public String getSourceIds(){
try {
@@ -244,13 +274,18 @@ public class PerformanceController {
@RequestMapping(value = {"/performance/names"},method = RequestMethod.POST)
public String getNames(@RequestParam Object sourceId){
try {
- List<String> names = new ArrayList<>();
- performanceInformationService.queryDateBetween(sourceId.toString(),null,null,null).forEach( per ->{
- if (!names.contains(per.getName()))
- names.add(per.getName());
- } );
+ Set<String> names = new HashSet<>();
+ List<PerformanceInformation> list =performanceInformationService.queryDateBetween(sourceId.toString(), null, null, null);
+ PerformanceInformation per;
+ for(int a=0;a<list.size();a++) {
+ per = (PerformanceInformation)list.get(a);
+ if (UuiCommonUtil.checkNumber(per.getValue(),"^(-?\\d+)(\\.\\d+)?$"))
+ if (Double.parseDouble(per.getValue()) > 0)
+ names.add(per.getName());
+
+ }
return omPerformance.writeValueAsString(names);
- } catch (JsonProcessingException e) {
+ } catch (Exception e) {
logger.error(e.getMessage());
return "";
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
index 33126bb0..cc116508 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsInformationService.java
@@ -35,7 +35,7 @@ public interface AlarmsInformationService {
List<AlarmsInformation> queryId(String[] id);
- List<Map<String,String>> queryDateBetween(String sourceId, String startTime, String endTime);
+ int queryDateBetween(String sourceId, String startTime, String endTime,String level);
/**
*
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
index 70fbf7f1..83991a24 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/PerformanceInformationService.java
@@ -41,4 +41,6 @@ public interface PerformanceInformationService {
List<PerformanceInformation> queryDateBetween(String resourceId, String name, String startTime, String endTime);
List<PerformanceInformation> getAllPerformanceInformationByHeaderId(String headerId);
+
+ String queryMaxValueByBetweenDate(String sourceId, String nameParent, String startTimeL, String endTimeL);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
index ebbd8fc7..2c63fdca 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
@@ -194,14 +194,14 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
String ver =alarmsHeader.getStatus();
count.append(" and a.status = '"+ver+"'");
}
- if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
- count.append(" and a.createTime between :startTime and :endTime");
+ if(null!=alarmsHeader.getStartEpochMicrosec() || alarmsHeader.getLastEpochMicroSec()!= null) {
+ count.append(" and a.startEpochMicrosec between :startTime and :endTime");
}
}
Query query = session.createQuery(count.toString());
- if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
- query.setDate("startTime",alarmsHeader.getCreateTime());
- query.setDate("endTime",alarmsHeader.getUpdateTime());
+ if(null!=alarmsHeader.getStartEpochMicrosec() || alarmsHeader.getLastEpochMicroSec()!= null) {
+ query.setString("startTime",alarmsHeader.getStartEpochMicrosec());
+ query.setString("endTime",alarmsHeader.getLastEpochMicroSec());
}
long q=(long)query.uniqueResult();
session.flush();
@@ -321,15 +321,15 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
String ver =alarmsHeader.getStatus();
hql.append(" and a.status = '"+ver+"'");
}
- if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
- hql.append(" and a.createTime between :startTime and :endTime");
+ if(null!=alarmsHeader.getStartEpochMicrosec() || alarmsHeader.getLastEpochMicroSec()!= null) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime");
}
}
logger.info("AlarmsHeaderServiceImpl queryAlarmsHeader: alarmsHeader={}", alarmsHeader);
Query query = session.createQuery(hql.toString());
- if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
- query.setDate("startTime",alarmsHeader.getCreateTime());
- query.setDate("endTime",alarmsHeader.getUpdateTime());
+ if(null!=alarmsHeader.getStartEpochMicrosec() || alarmsHeader.getLastEpochMicroSec()!= null) {
+ query.setString("startTime",alarmsHeader.getStartEpochMicrosec());
+ query.setString("endTime",alarmsHeader.getLastEpochMicroSec());
}
query.setFirstResult(offset);
query.setMaxResults(pageSize);
@@ -372,7 +372,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.beginTransaction();
//Query q=session.createQuery("update AlarmsHeader set status='"+status+"', updateTime='"+date+"' , startEpochMicrosecCleared='"+startEpochMicrosecCleared+"' ,lastEpochMicroSecCleared='"+lastEpochMicroSecCleared+"' where eventName='"+eventName+"' and reportingEntityName='"+reportingEntityName+"' and specificProblem ='"+specificProblem+"'");
- Query q=session.createQuery("update AlarmsHeader set status=:status, updateTime=:date, startEpochMicrosecCleared=:startEpochMicrosecCleared ,lastEpochMicroSecCleared=:lastEpochMicroSecCleared where eventName=:eventName and reportingEntityName=:reportingEntityName and specificProblem =:specificProblem");
+ Query q=session.createQuery("update AlarmsHeader set status=:status, startEpochMicrosecCleared=:startEpochMicrosecCleared ,lastEpochMicroSecCleared=:lastEpochMicroSecCleared where eventName=:eventName and reportingEntityName=:reportingEntityName and specificProblem =:specificProblem");
q.setString("status",status);
q.setDate("date",date);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
index a33f9c00..b1d8d074 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
@@ -28,6 +28,7 @@ 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.onap.usecaseui.server.util.UuiCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -105,12 +106,12 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
String ver=alarmsInformation.getSourceId();
hql.append(" and a.sourceId = '"+ver+"'");
}
- if(null!=alarmsInformation.getCreateTime()) {
- Date ver =alarmsInformation.getCreateTime();
+ if(null!=alarmsInformation.getStartEpochMicroSec()) {
+ String ver =alarmsInformation.getStartEpochMicroSec();
hql.append(" and a.createTime > '%"+ver+"%'");
}
- if(null!=alarmsInformation.getUpdateTime()) {
- Date ver =alarmsInformation.getUpdateTime();
+ if(null!=alarmsInformation.getLastEpochMicroSec()) {
+ String ver =alarmsInformation.getLastEpochMicroSec();
hql.append(" and a.updateTime like '%"+ver+"%'");
}
}
@@ -148,17 +149,16 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
String ver=alarmsInformation.getSourceId();
hql.append(" and a.sourceId = '"+ver+"'");
}
- if(null!=alarmsInformation.getCreateTime()) {
- Date ver =alarmsInformation.getCreateTime();
- hql.append(" and a.createTime > '%"+ver+"%'");
- }
- if(null!=alarmsInformation.getUpdateTime()) {
- Date ver =alarmsInformation.getUpdateTime();
- hql.append(" and a.updateTime like '%"+ver+"%'");
+ if(null!=alarmsInformation.getStartEpochMicroSec() || alarmsInformation.getLastEpochMicroSec()!= null) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime");
}
}
logger.info("AlarmsInformationServiceImpl queryAlarmsInformation: alarmsInformation={}", alarmsInformation);
Query query = session.createQuery(hql.toString());
+ if(null!=alarmsInformation.getStartEpochMicroSec() || alarmsInformation.getLastEpochMicroSec()!= null) {
+ query.setString("startTime",alarmsInformation.getStartEpochMicroSec());
+ query.setString("endTime",alarmsInformation.getLastEpochMicroSec());
+ }
query.setFirstResult(offset);
query.setMaxResults(pageSize);
List<AlarmsInformation> list= query.list();
@@ -195,37 +195,36 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
@Override
- public List<Map<String,String>> queryDateBetween(String sourceId, String startTime, String endTime) {
+ public int queryDateBetween(String sourceId, String startTime, String endTime,String level) {
+ if("1526554800000".equals(startTime)){
+ System.out.print(startTime);
+ }
try(Session session = getSession()) {
- List<Map<String,String>> mapList = new ArrayList<>();
- String hql = "select a.createTime,count(*) from AlarmsInformation a where 1=1 ";
+ String hql = "select count(*) from AlarmsHeader a where 1=1 ";
if (sourceId != null && !"".equals(sourceId)){
hql += " and a.sourceId = :sourceId";
}
+ if (UuiCommonUtil.isNotNullOrEmpty(level)){
+ hql += " and a.eventServrity = :eventServrity";
+ }
if (startTime != null && !"".equals(startTime) && endTime != null && !"".equals(endTime)){
- hql += " and a.createTime between :startTime and :endTime ";
+ hql += " and (CASE WHEN a.startEpochMicrosec=0 THEN a.lastEpochMicroSec ELSE a.startEpochMicrosec END) between :startTime and :endTime ";
}
- hql += " group by a.createTime";
Query query = session.createQuery(hql);
if (sourceId != null && !"".equals(sourceId)){
query.setString("sourceId",sourceId);
}
+ if (UuiCommonUtil.isNotNullOrEmpty(level)){
+ query.setString("eventServrity",level);
+ }
if (startTime != null && !"".equals(startTime) && endTime != null && !"".equals(endTime)){
query.setString("startTime", startTime).setString("endTime", endTime);
}
- Iterator it= query.list().iterator();
- while(it.hasNext()){
- Object[] res=(Object[]) it.next();
- Map<String,String> map = new HashMap<>();
- map.put("Time",res[0].toString());
- map.put("Count",res[1].toString());
- mapList.add(map);
- }
- logger.info("AlarmsInformationServiceImpl queryDateBetween: list={}", mapList);
- return mapList;
+ long num=(long) query.uniqueResult();
+ return (int)num;
} catch (Exception e) {
logger.error("exception occurred while performing PerformanceInformationServiceImpl queryDateBetween. Details:" + e.getMessage());
- return null;
+ return 0;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
index 191eab2e..4a5815a9 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
@@ -163,13 +163,13 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
String ver =performanceHeder.getEventType();
hql.append(" and a.eventType like '%"+ver+"%'");
}
- if(null!=performanceHeder.getCreateTime() && null!=performanceHeder.getUpdateTime()) {
- hql.append(" and a.createTime between :startTime and :endTime ");
+ if(null!=performanceHeder.getStartEpochMicrosec() && null!=performanceHeder.getLastEpochMicroSec()) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime ");
}
}
Query query = session.createQuery(hql.toString());
- if(null!=performanceHeder.getCreateTime() && null!=performanceHeder.getUpdateTime()) {
- query.setDate("startTime",performanceHeder.getCreateTime()).setDate("endTime",performanceHeder.getUpdateTime());
+ if(null!=performanceHeder.getStartEpochMicrosec() && null!=performanceHeder.getLastEpochMicroSec()) {
+ query.setString("startTime",performanceHeder.getStartEpochMicrosec()).setString("endTime",performanceHeder.getLastEpochMicroSec());
}
long q=(long)query.uniqueResult();
session.flush();
@@ -261,14 +261,14 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
String ver =performanceHeder.getEventType();
hql.append(" and a.eventType like '%"+ver+"%'");
}
- if(null!=performanceHeder.getCreateTime() && null!=performanceHeder.getUpdateTime()) {
- hql.append(" and a.createTime between :startTime and :endTime ");
+ if(null!=performanceHeder.getStartEpochMicrosec() && null!=performanceHeder.getLastEpochMicroSec()) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime ");
}
}
logger.info("PerformanceHeaderServiceImpl queryPerformanceHeader: performanceHeder={}", performanceHeder);
Query query = session.createQuery(hql.toString());
- if(null!=performanceHeder.getCreateTime() && null!=performanceHeder.getUpdateTime()) {
- query.setDate("startTime",performanceHeder.getCreateTime()).setDate("endTime",performanceHeder.getUpdateTime());
+ if(null!=performanceHeder.getStartEpochMicrosec() && null!=performanceHeder.getLastEpochMicroSec()) {
+ query.setString("startTime",performanceHeder.getStartEpochMicrosec()).setString("endTime",performanceHeder.getLastEpochMicroSec());
}
query.setFirstResult(offset);
query.setMaxResults(pageSize);
@@ -306,7 +306,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
@Override
public List<String> queryAllSourceId() {
try(Session session = getSession()) {
- Query query = session.createQuery("select a.sourceId from PerformanceHeader a");
+ Query query = session.createQuery("select distinct a.sourceId from PerformanceHeader a");
return query.list();
} catch (Exception e) {
logger.error("exception occurred while performing PerformanceHeaderServiceImpl queryAllSourceId. Details:" + e.getMessage());
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
index c11f1608..858bf8b7 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
@@ -18,7 +18,10 @@ package org.onap.usecaseui.server.service.impl;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.transaction.Transactional;
@@ -29,6 +32,7 @@ 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.onap.usecaseui.server.util.UuiCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -105,16 +109,16 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
String ver=performanceInformation.getSourceId();
hql.append(" and a.sourceId = '"+ver+"'");
}
- if(null!=performanceInformation.getCreateTime()) {
- Date ver =performanceInformation.getCreateTime();
- hql.append(" and a.createTime > '%"+ver+"%'");
- }
- if(null!=performanceInformation.getUpdateTime()) {
- Date ver =performanceInformation.getUpdateTime();
- hql.append(" and a.updateTime like '%"+ver+"%'");
+ if(null!=performanceInformation.getStartEpochMicrosec() || performanceInformation.getLastEpochMicroSec()!= null) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime");
}
}
- long q=(long)session.createQuery(hql.toString()).uniqueResult();
+ Query query = session.createQuery(hql.toString());
+ if(null!=performanceInformation.getStartEpochMicrosec() || performanceInformation.getLastEpochMicroSec()!= null) {
+ query.setString("startTime",performanceInformation.getStartEpochMicrosec());
+ query.setString("endTime",performanceInformation.getLastEpochMicroSec());
+ }
+ long q=(long) query.uniqueResult();
session.flush();
return (int)q;
} catch (Exception e) {
@@ -148,17 +152,16 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
String ver=performanceInformation.getSourceId();
hql.append(" and a.sourceId = '"+ver+"'");
}
- if(null!=performanceInformation.getCreateTime()) {
- Date ver =performanceInformation.getCreateTime();
- hql.append(" and a.createTime > '%"+ver+"%'");
- }
- if(null!=performanceInformation.getUpdateTime()) {
- Date ver =performanceInformation.getUpdateTime();
- hql.append(" and a.updateTime like '%"+ver+"%'");
+ if(null!=performanceInformation.getStartEpochMicrosec() || performanceInformation.getLastEpochMicroSec()!= null) {
+ hql.append(" and a.startEpochMicrosec between :startTime and :endTime");
}
}
logger.info("PerformanceInformationServiceImpl queryPerformanceInformation: performanceInformation={}", performanceInformation);
Query query = session.createQuery(hql.toString());
+ if(null!=performanceInformation.getStartEpochMicrosec() || performanceInformation.getLastEpochMicroSec()!= null) {
+ query.setString("startTime",performanceInformation.getStartEpochMicrosec());
+ query.setString("endTime",performanceInformation.getLastEpochMicroSec());
+ }
query.setFirstResult(offset);
query.setMaxResults(pageSize);
List<PerformanceInformation> list= query.list();
@@ -269,4 +272,36 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
return null;
}
}
+
+ @Override
+ public String queryMaxValueByBetweenDate(String sourceId, String name, String startTime, String endTime) {
+ try(Session session = getSession()) {
+ String hql = "select max(a.value) from PerformanceInformation a where 1=1 ";
+ if (sourceId != null && !"".equals(sourceId)){
+ hql += " and a.sourceId = :resourceId";
+ }
+ if (name != null && !"".equals(name)){
+ hql += " and a.name = :name ";
+ }
+ if (startTime != null && !"".equals(startTime) && endTime != null && !"".equals(endTime)){
+ hql += " and a.startEpochMicrosec between :startTime and :endTime ";
+ }
+ Query query = session.createQuery(hql);
+ if (sourceId != null && !"".equals(sourceId)){
+ query.setString("resourceId",sourceId);
+ }
+ if (name != null && !"".equals(name)){
+ query.setString("name",name);
+ }
+ if (startTime != null && !"".equals(startTime) && endTime != null && !"".equals(endTime)){
+ query.setString("startTime", startTime).setString("endTime", endTime);
+ }
+ String num=(String) query.uniqueResult();
+ return UuiCommonUtil.isNotNullOrEmpty(num)?num:0+"";
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl queryMaxValueByBetweenDate. Details:" + e.getMessage());
+ return 0+"";
+ }
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java b/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java
index 0d294d1a..fa582eef 100755
--- a/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java
@@ -25,6 +25,7 @@ import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
+import java.util.TimeZone;
public class DateUtils {
@@ -179,5 +180,143 @@ public class DateUtils {
public static Date now() throws ParseException {
return new SimpleDateFormat(Constant.DATE_FORMAT).parse(dateToString(new Date()));
}
+
+ public static String getYearMonthDayHourMinuteSecond(long timeMillis) {
+ Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
+ calendar.setTimeInMillis(timeMillis);
+ int year=calendar.get(Calendar.YEAR);
+ int month=calendar.get(Calendar.MONTH) + 1;
+ String mToMonth=null;
+ if (String.valueOf(month).length()==1) {
+ mToMonth="0"+month;
+ } else {
+ mToMonth=String.valueOf(month);
+ }
+
+ int day=calendar.get(Calendar.DAY_OF_MONTH);
+ String dToDay=null;
+ if (String.valueOf(day).length()==1) {
+ dToDay="0"+day;
+ } else {
+ dToDay=String.valueOf(day);
+ }
+
+ int hour=calendar.get(Calendar.HOUR_OF_DAY);
+ String hToHour=null;
+ if (String.valueOf(hour).length()==1) {
+ hToHour="0"+hour;
+ } else {
+ hToHour=String.valueOf(hour);
+ }
+
+ int minute=calendar.get(Calendar.MINUTE);
+ String mToMinute=null;
+ if (String.valueOf(minute).length()==1) {
+ mToMinute="0"+minute;
+ } else {
+ mToMinute=String.valueOf(minute);
+ }
+
+ int second=calendar.get(Calendar.SECOND);
+ String sToSecond=null;
+ if (String.valueOf(second).length()==1) {
+ sToSecond="0"+second;
+ } else {
+ sToSecond=String.valueOf(second);
+ }
+ return year+ "-" +mToMonth+ "-" +dToDay+ " "+hToHour+ ":" +mToMinute+ ":" +sToSecond;
+ }
+
+
+ /**
+ *
+ * getResultDate
+ *
+ * @Auther YYY
+ * @Date 2018/5/19/ 11:56:07
+ * @Title: getResultDate
+ * @Description:
+ * @param timeMillis
+ * @param format
+ * @return
+ */
+ public static String getResultDate(long timeMillis,String format){
+ Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
+ calendar.setTimeInMillis(timeMillis);
+ int year=calendar.get(Calendar.YEAR);
+
+ int month=calendar.get(Calendar.MONTH) + 1;
+ String mToMonth=null;
+ if (String.valueOf(month).length()==1) {
+ mToMonth="0"+month;
+ } else {
+ mToMonth=String.valueOf(month);
+ }
+
+ int day=calendar.get(Calendar.DAY_OF_MONTH);
+ String dToDay=null;
+ if (String.valueOf(day).length()==1) {
+ dToDay="0"+day;
+ } else {
+ dToDay=String.valueOf(day);
+ }
+
+ int hour=calendar.get(Calendar.HOUR_OF_DAY);
+ String hToHour=null;
+ if (String.valueOf(hour).length()==1) {
+ hToHour="0"+hour;
+ } else {
+ hToHour=String.valueOf(hour);
+ }
+
+ int minute=calendar.get(Calendar.MINUTE);
+ String mToMinute=null;
+ if (String.valueOf(minute).length()==1) {
+ mToMinute="0"+minute;
+ } else {
+ mToMinute=String.valueOf(minute);
+ }
+
+ int second=calendar.get(Calendar.SECOND);
+ String sToSecond=null;
+ if (String.valueOf(second).length()==1) {
+ sToSecond="0"+second;
+ } else {
+ sToSecond=String.valueOf(second);
+ }
+ if("month".equals(format)){
+ return year+ "-" +mToMonth;
+ }else if("day".equals(format)){
+ return year+ "-" +mToMonth+ "-" +dToDay;
+ }else if("minute".equals(format)){
+ return year+ "-" +mToMonth+ "-" +dToDay+ " "+hToHour+":"+mToMinute+":00";
+ }else{
+ return year+ "-" +mToMonth+ "-" +dToDay+ " "+hToHour+":00:00";
+ }
+ }
+
+ /**
+ *
+ * MonthOfDay
+ *
+ * @Auther YYY
+ * @Date 2018/5/22 2:36:29
+ * @Title: MonthOfDay
+ * @Description:
+ * @param date
+ * @param format
+ * @return
+ * @throws ParseException
+ */
+ public static int MonthOfDay(String date,String format){
+ Calendar cal = Calendar.getInstance();
+ SimpleDateFormat sdf = new SimpleDateFormat(format);
+ try {
+ cal.setTime(sdf.parse(date));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
index 0870053b..040417ef 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
@@ -77,8 +77,8 @@ public class DmaapSubscriber implements Runnable {
public void subscribe(String topic) {
try {
List<String> respList = getDMaaPData(topic);
- if (respList.size() <= 0 || respList == null) {
- logger.info("response content is :"+respList);
+ logger.info("response content is :"+respList);
+ if (!UuiCommonUtil.isNotNullOrEmpty(respList)) {
return;
}
ObjectMapper objMapper = new ObjectMapper();
@@ -118,6 +118,7 @@ public class DmaapSubscriber implements Runnable {
try {
p.load(inputStream);
this.url = p.getProperty("dmaap.url") + System.getenv("MR_ADDR");
+ //this.url = p.getProperty("dmaap.url");
this.alarmTopic = p.getProperty("dmaap.alarmTopic");
this.performanceTopic = p.getProperty("dmaap.performanceTopic");
this.consumerGroup = p.getProperty("dmaap.consumerGroup");
@@ -172,9 +173,9 @@ public class DmaapSubscriber implements Runnable {
if (k2.equals("priority"))
alarm_header.setPriority(v2.toString());
if (k2.equals("startEpochMicrosec"))
- alarm_header.setStartEpochMicrosec(v2.toString());
+ alarm_header.setStartEpochMicrosec(v2.toString().substring(0, 13));
if (k2.equals("lastEpochMicrosec"))
- alarm_header.setLastEpochMicroSec(v2.toString());
+ alarm_header.setLastEpochMicroSec(v2.toString().substring(0, 13));
if (k2.equals("sequence"))
alarm_header.setSequence(v2.toString());
});
@@ -200,7 +201,7 @@ public class DmaapSubscriber implements Runnable {
try {
List<Map<String, Object>> m = (List<Map<String, Object>>) v3;
m.forEach(i -> {
- alarm_informations.add(new AlarmsInformation(i.get("name").toString(), i.get("value").toString(), alarm_header.getSourceId(), new Date(), null,alarm_header.getId()));
+ alarm_informations.add(new AlarmsInformation(i.get("name").toString(), i.get("value").toString(), alarm_header.getSourceId(),alarm_header.getStartEpochMicrosec(),alarm_header.getLastEpochMicroSec(),alarm_header.getId()));
});
} catch (Exception e) {
e.printStackTrace();
@@ -211,10 +212,6 @@ public class DmaapSubscriber implements Runnable {
}
});
if (alarm_header.getEventName() != null){
- alarm_informations.forEach(ai -> {
- ai.setCreateTime(alarm_header.getCreateTime());
- ai.setUpdateTime(new Date());
- });
Long l = System.currentTimeMillis();
Timestamp date_get = new Timestamp(l);
@@ -225,7 +222,6 @@ public class DmaapSubscriber implements Runnable {
alarmsInformationService.saveAlarmsInformation(information));
} else {
- alarm_header.setCreateTime(new Date());
alarm_header.setStatus("active");
alarmsHeaderService.saveAlarmsHeader(alarm_header);
if(alarm_informations.size() > 0) {
@@ -268,9 +264,9 @@ public class DmaapSubscriber implements Runnable {
if (k2.equals("priority"))
performance_header.setPriority(v2.toString());
if (k2.equals("startEpochMicrosec"))
- performance_header.setStartEpochMicrosec(v2.toString());
+ performance_header.setStartEpochMicrosec(v2.toString().substring(0, 13));
if (k2.equals("lastEpochMicrosec"))
- performance_header.setLastEpochMicroSec(v2.toString());
+ performance_header.setLastEpochMicroSec(v2.toString().substring(0, 13));
if (k2.equals("sequence"))
performance_header.setSequence(v2.toString());
});
@@ -288,23 +284,7 @@ public class DmaapSubscriber implements Runnable {
if (k.equals("arrayOfFields")){
List<Map<String,String>> arrayOfFields = (List<Map<String, String>>) v;
arrayOfFields.forEach( fields -> {
- if (fields.get("name").equals("StartTime")){
-
- try {
- String type = performance_header.getEventType();
- performance_informations.add(new PerformanceInformation(fields.get("name"), fields.get("value"), performance_header.getSourceId(), null, DateUtils.now(),performance_header.getId()));
- performance_header.setCreateTime(DateUtils.stringToDate(fields.get("value").replaceAll(Constant.RegEX_DATE_FORMAT, " ")));
- performance_header.setUpdateTime(DateUtils.now());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }else{
- try {
- performance_informations.add(new PerformanceInformation(fields.get("name"), fields.get("value"), performance_header.getSourceId(), null, DateUtils.now(), performance_header.getId()));
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
+ performance_informations.add(new PerformanceInformation(fields.get("name"), fields.get("value"), performance_header.getSourceId(), performance_header.getStartEpochMicrosec(),performance_header.getLastEpochMicroSec(),performance_header.getId()));
} );
}
});
@@ -317,7 +297,6 @@ public class DmaapSubscriber implements Runnable {
});
performanceHeaderService.savePerformanceHeader(performance_header);
performance_informations.forEach(ai -> {
- ai.setCreateTime(performance_header.getCreateTime());
performanceInformationService.savePerformanceInformation(ai);
});
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
index f9a1e814..ae9233be 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
@@ -113,4 +113,14 @@ public class UuiCommonUtil {
}
return wholeStr;
}
+
+ public static boolean checkNumber(String num,String format){
+ boolean result = false;
+ if(isNotNullOrEmpty(num)){
+ if(num.matches(format)){
+ result = true;
+ }
+ }
+ return result;
+ }
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java
index 4f7571be..2b8afa39 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java
@@ -81,8 +81,6 @@ public class AlarmsHeaderTest {
ah.getVfStatus();
ah.getAlarmInterfaceA();
ah.getStatus();
- ah.getCreateTime();
- ah.getUpdateTime();
}
@Test
@@ -112,7 +110,7 @@ public class AlarmsHeaderTest {
ah.setVfStatus("");
ah.setAlarmInterfaceA("");
ah.setStatus("");
- ah.setCreateTime(DateUtils.now());
- ah.setUpdateTime(DateUtils.now());
+ ah.setStartEpochMicrosec(DateUtils.now().getTime()+"");
+ ah.setLastEpochMicroSec(DateUtils.now().getTime()+"");
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsInformationTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsInformationTest.java
index 469b4778..6f7274c6 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsInformationTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsInformationTest.java
@@ -52,12 +52,12 @@ public class AlarmsInformationTest implements Serializable {
@Test
public void testGetAlarmsInformation() throws Exception {
- AlarmsInformation ai = new AlarmsInformation("name", "value", "eventId", DateUtils.now(), DateUtils.now(),"headerId");
+ AlarmsInformation ai = new AlarmsInformation("name", "value", "eventId","","","headerId");
ai.getName();
ai.getValue();
ai.getSourceId();
- ai.getCreateTime();
- ai.getUpdateTime();
+ ai.getStartEpochMicroSec();
+ ai.getLastEpochMicroSec();
ai.getId();
ai.toString();
}
@@ -68,8 +68,8 @@ public class AlarmsInformationTest implements Serializable {
ai.setName("");
ai.setValue("");
ai.setSourceId("");
- ai.setCreateTime(DateUtils.now());
- ai.setUpdateTime(DateUtils.now());
+ ai.setStartEpochMicroSec("");;
+ ai.setLastEpochMicroSec("");;
ai.setId(1);
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
index e78c01f2..7710aacc 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
@@ -73,8 +73,6 @@ public class PerformanceHeaderTest implements Serializable {
ph.getSequence();
ph.getMeasurementsForVfScalingVersion();
ph.getMeasurementInterval();
- ph.getCreateTime();
- ph.getUpdateTime();
}
@Test
@@ -97,7 +95,5 @@ public class PerformanceHeaderTest implements Serializable {
ph.setSequence("");
ph.setMeasurementsForVfScalingVersion("");
ph.setMeasurementInterval("");
- ph.setCreateTime(DateUtils.now());
- ph.setUpdateTime(DateUtils.now());
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceInformationTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceInformationTest.java
index 64315854..245272f2 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceInformationTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceInformationTest.java
@@ -52,12 +52,12 @@ public class PerformanceInformationTest implements Serializable {
@Test
public void testGetPerformanceInformation() throws Exception {
- PerformanceInformation pi = new PerformanceInformation("name", "value", "eventId", DateUtils.now(), DateUtils.now(),"headerId");
+ PerformanceInformation pi = new PerformanceInformation("name", "value", "eventId","","","headerId");
pi.getName();
pi.getValue();
pi.getSourceId();
- pi.getCreateTime();
- pi.getUpdateTime();
+ pi.getStartEpochMicrosec();
+ pi.getLastEpochMicroSec();
pi.getId();
}
@@ -67,8 +67,8 @@ public class PerformanceInformationTest implements Serializable {
pi.setName("");
pi.setValue("");
pi.setSourceId("");
- pi.setCreateTime(DateUtils.now());
- pi.setUpdateTime(DateUtils.now());
+ pi.setStartEpochMicrosec("");;
+ pi.setLastEpochMicroSec("");;
pi.setId(1);
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
index 03959f27..ecda5354 100755
--- a/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
@@ -101,7 +101,7 @@ public class AlarmControllerTest {
@Test
public void testGenDiagram() throws Exception {
try {
- controller.genDiagram("sourceId", "startTime", "endTime");
+ controller.diagram("sourceId", "startTime", "endTime","format");
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
index 615123f9..7302ee93 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
@@ -187,8 +187,6 @@ public class AlarmsHeaderServiceImplTest {
ah.setSpecificProblem("especially");
ah.setAlarmInterfaceA("cs");
ah.setStatus("1");
- ah.setCreateTime(DateUtils.now());
- ah.setUpdateTime(DateUtils.now());
ah.setVfStatus("1");
ah.setEventSourceType("q");
alarmsHeaderServiceImpl.getAllCount(ah, 1, 1);
@@ -223,8 +221,6 @@ public class AlarmsHeaderServiceImplTest {
ah.setSpecificProblem("especially");
ah.setAlarmInterfaceA("cs");
ah.setStatus("1");
- ah.setCreateTime(DateUtils.now());
- ah.setUpdateTime(DateUtils.now());
ah.setVfStatus("1");
ah.setEventSourceType("q");
alarmsHeaderServiceImpl.queryAlarmsHeader(ah, 1, 1);
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java
index 0743a863..9233f0d9 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java
@@ -168,8 +168,8 @@ public class AlarmsInformationServiceImplTest {
ai.setName("");
ai.setValue("");
ai.setSourceId("");
- ai.setCreateTime(DateUtils.now());
- ai.setUpdateTime(DateUtils.now());
+ ai.setStartEpochMicroSec("");;
+ ai.setLastEpochMicroSec("");;
alarmsInformationServiceImpl.getAllCount(ai, 1, 1);
} catch (Exception e) {
e.printStackTrace();
@@ -183,8 +183,8 @@ public class AlarmsInformationServiceImplTest {
ai.setName("");
ai.setValue("");
ai.setSourceId("");
- ai.setCreateTime(DateUtils.now());
- ai.setUpdateTime(DateUtils.now());
+ ai.setStartEpochMicroSec("");;
+ ai.setLastEpochMicroSec("");;
alarmsInformationServiceImpl.queryAlarmsInformation(ai, 1, 1);
} catch (Exception e) {
e.printStackTrace();
@@ -204,7 +204,7 @@ public class AlarmsInformationServiceImplTest {
@Test
public void testQueryDateBetween() throws Exception {
try {
- alarmsInformationServiceImpl.queryDateBetween("sourceId", "startTime", "endTime");
+ alarmsInformationServiceImpl.queryDateBetween("sourceId", "startTime", "endTime", "level");
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java
index 314e2cb9..78dbf941 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java
@@ -182,8 +182,8 @@ public class PerformanceHeaderServiceImplTest {
ph.setMeasurementsForVfScalingVersion("");
ph.setMeasurementInterval("");
ph.setEventType("");
- ph.setCreateTime(DateUtils.now());
- ph.setUpdateTime(DateUtils.now());
+ ph.setStartEpochMicrosec("");;
+ ph.setLastEpochMicroSec("");;
performanceHeaderServiceImpl.getAllCount(ph, 1, 1);
} catch (Exception e) {
e.printStackTrace();
@@ -211,8 +211,8 @@ public class PerformanceHeaderServiceImplTest {
ph.setMeasurementsForVfScalingVersion("");
ph.setMeasurementInterval("");
ph.setEventType("");
- ph.setCreateTime(DateUtils.now());
- ph.setUpdateTime(DateUtils.now());
+ ph.setStartEpochMicrosec("");;
+ ph.setLastEpochMicroSec("");;
performanceHeaderServiceImpl.queryPerformanceHeader(ph, 1, 1);
} catch (Exception e) {
e.printStackTrace();
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java
index ebbc38e0..24e9e0d3 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java
@@ -168,8 +168,8 @@ public class PerformanceInformationServiceImplTest {
pi.setName("");
pi.setValue("");
pi.setSourceId("");
- pi.setCreateTime(DateUtils.now());
- pi.setUpdateTime(DateUtils.now());
+ pi.setStartEpochMicrosec("");;
+ pi.setLastEpochMicroSec("");;
performanceInformationServiceImpl.getAllCount(pi, 1, 1);
} catch (Exception e) {
e.printStackTrace();
@@ -183,8 +183,8 @@ public class PerformanceInformationServiceImplTest {
pi.setName("");
pi.setValue("");
pi.setSourceId("");
- pi.setCreateTime(DateUtils.now());
- pi.setUpdateTime(DateUtils.now());
+ pi.setStartEpochMicrosec("");;
+ pi.setLastEpochMicroSec("");;
performanceInformationServiceImpl.queryPerformanceInformation(pi, 1, 1);
} catch (Exception e) {
e.printStackTrace();
diff --git a/standalone/src/main/assembly/bin/run.sh b/standalone/src/main/assembly/bin/run.sh
index d90e777e..08d659cf 100644
--- a/standalone/src/main/assembly/bin/run.sh
+++ b/standalone/src/main/assembly/bin/run.sh
@@ -22,10 +22,14 @@ echo @RUNHOME@ $RUNHOME
echo "Starting mysql"
service mysql start
sleep 10
+echo "run.sh 1"
SCRIPT="/home/uui/resources/bin/initDB.sh"
+echo "run.sh 2"
chmod 755 $SCRIPT
+echo "run.sh 3"
$SCRIPT root root 3306 127.0.0.1
+echo "run.sh 4"
echo @JAVA_HOME@ $JAVA_HOME
JAVA="$JAVA_HOME/bin/java"
diff --git a/standalone/src/main/assembly/resources/bin/initDB.sh b/standalone/src/main/assembly/resources/bin/initDB.sh
index 6683960c..b9504926 100644
--- a/standalone/src/main/assembly/resources/bin/initDB.sh
+++ b/standalone/src/main/assembly/resources/bin/initDB.sh
@@ -15,15 +15,21 @@
# limitations under the License.
#
+echo "initDB.sh 1"
DIRNAME=`dirname $0`
+echo "initDB.sh 2"
HOME=`cd $DIRNAME/; pwd`
+echo "initDB.sh 3"
user=$1
password=$2
port=$3
host=$4
+echo "initDB.sh 4"
echo "start create usecase-ui db"
sql_path=$HOME/../
+echo "initDB.sh 5"
mysql -u$user -p$password -P$port -h$host <$sql_path/dbscripts/mysql/usecase-ui-createdb.sql
+echo "initDB.sh 6"
sql_result=$?
if [ $sql_result != 0 ] ; then
echo "failed to create usecase-ui database"
diff --git a/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql b/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
index 1acf5833..2730887d 100644
--- a/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
+++ b/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
@@ -17,93 +17,102 @@
use uui;
SET FOREIGN_KEY_CHECKS=0;
+
-- ----------------------------
--- Table structure for alarms_additionalinformation
+-- Table structure for `alarms_additionalinformation`
-- ----------------------------
DROP TABLE IF EXISTS `alarms_additionalinformation`;
CREATE TABLE `alarms_additionalinformation` (
- `name` varchar(500),
- `value` varchar(500),
- `eventId` varchar(500),
- `createTime` datetime,
- `updateTime` datetime,
- `id` int(10) NOT NULL auto_increment,
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `headerId` varchar(100) NOT NULL,
+ `name` varchar(500) DEFAULT NULL,
+ `value` varchar(500) DEFAULT NULL,
+ `sourceId` varchar(500) DEFAULT NULL,
+ `startEpochMicrosec` varchar(500) DEFAULT NULL,
+ `lastEpochMicroSec` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER TABLE `alarms_additionalinformation` ADD INDEX `alarms_additionalinformation_index` (`headerId`, `sourceId`);
+
-- ----------------------------
--- Table structure for alarms_commoneventheader
+-- Table structure for `alarms_commoneventheader`
-- ----------------------------
DROP TABLE IF EXISTS `alarms_commoneventheader`;
CREATE TABLE `alarms_commoneventheader` (
- `version` varchar(500),
- `eventName` varchar(500),
- `domain` varchar(500),
- `eventId` varchar(500),
- `eventType` varchar(500),
+ `id` varchar(100) NOT NULL,
+ `version` varchar(500) DEFAULT NULL,
+ `eventName` varchar(500) DEFAULT NULL,
+ `domain` varchar(500) DEFAULT NULL,
+ `eventId` varchar(500) DEFAULT NULL,
+ `eventType` varchar(500) DEFAULT NULL,
`nfcNamingCode` varchar(500) DEFAULT NULL,
`nfNamingCode` varchar(500) DEFAULT NULL,
- `sourceId` varchar(500),
- `sourceName` varchar(500),
- `reportingEntityId` varchar(500),
- `reportingEntityName` varchar(500),
- `priority` varchar(50),
- `startEpochMicrosec` varchar(500),
- `lastEpochMicroSec` varchar(500),
- `sequence` varchar(500),
- `faultFieldsVersion` varchar(500),
- `eventServrity` varchar(500),
- `eventSourceType` varchar(500),
- `eventCategory` varchar(500),
- `alarmCondition` varchar(500),
- `specificProblem` varchar(500),
- `vfStatus` varchar(500),
- `alarmInterfaceA` varchar(500),
- `status` varchar(50),
- `createTime` datetime,
- `updateTime` datetime,
- `id` int(10) NOT NULL auto_increment,
+ `sourceId` varchar(500) DEFAULT NULL,
+ `sourceName` varchar(500) DEFAULT NULL,
+ `reportingEntityId` varchar(500) DEFAULT NULL,
+ `reportingEntityName` varchar(500) DEFAULT NULL,
+ `priority` varchar(50) DEFAULT NULL,
+ `startEpochMicrosec` varchar(500) DEFAULT NULL,
+ `lastEpochMicroSec` varchar(500) DEFAULT NULL,
+ `startEpochMicrosecCleared` varchar(255) DEFAULT NULL,
+ `lastEpochMicroSecCleared` varchar(255) DEFAULT NULL,
+ `sequence` varchar(500) DEFAULT NULL,
+ `faultFieldsVersion` varchar(500) DEFAULT NULL,
+ `eventServrity` varchar(500) DEFAULT NULL,
+ `eventSourceType` varchar(500) DEFAULT NULL,
+ `eventCategory` varchar(500) DEFAULT NULL,
+ `alarmCondition` varchar(500) DEFAULT NULL,
+ `specificProblem` varchar(500) DEFAULT NULL,
+ `vfStatus` varchar(500) DEFAULT NULL,
+ `alarmInterfaceA` varchar(500) DEFAULT NULL,
+ `status` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER TABLE `alarms_commoneventheader` ADD INDEX `alarms_commoneventheader_index` (`sourceId`);
+
-- ----------------------------
--- Table structure for performance_additionalinformation
+-- Table structure for `performance_additionalinformation`
-- ----------------------------
DROP TABLE IF EXISTS `performance_additionalinformation`;
CREATE TABLE `performance_additionalinformation` (
- `name` varchar(500),
- `value` varchar(500),
- `eventId` varchar(500),
- `createTime` datetime,
- `updateTime` datetime,
- `id` int(10) NOT NULL auto_increment,
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `headerId` varchar(100) NOT NULL,
+ `name` varchar(500) DEFAULT NULL,
+ `value` varchar(500) DEFAULT NULL,
+ `sourceId` varchar(500) DEFAULT NULL,
+ `startEpochMicrosec` varchar(500) DEFAULT NULL,
+ `lastEpochMicroSec` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER TABLE `performance_additionalinformation` ADD INDEX `performance_additionalinformation_index` (`headerId`, `sourceId`);
+
-- ----------------------------
--- Table structure for performance_commoneventheader
+-- Table structure for `performance_commoneventheader`
-- ----------------------------
DROP TABLE IF EXISTS `performance_commoneventheader`;
CREATE TABLE `performance_commoneventheader` (
- `version` varchar(500),
- `eventName` varchar(500),
- `domain` varchar(500),
- `eventId` varchar(500),
- `eventType` varchar(500),
+ `id` varchar(100) NOT NULL,
+ `version` varchar(500) DEFAULT NULL,
+ `eventName` varchar(500) DEFAULT NULL,
+ `domain` varchar(500) DEFAULT NULL,
+ `eventId` varchar(500) DEFAULT NULL,
+ `eventType` varchar(500) DEFAULT NULL,
`nfcNamingCode` varchar(500) DEFAULT NULL,
`nfNamingCode` varchar(500) DEFAULT NULL,
- `sourceId` varchar(500),
- `sourceName` varchar(500),
- `reportingEntityId` varchar(500),
- `reportingEntityName` varchar(500),
- `priority` varchar(50),
- `startEpochMicrosec` varchar(500),
- `lastEpochMicroSec` varchar(500),
- `sequence` varchar(500),
- `measurementsForVfScalingVersion` varchar(500),
- `measurementInterval` varchar(500),
- `createTime` datetime,
- `updateTime` datetime,
- `id` int(10) NOT NULL auto_increment,
+ `sourceId` varchar(500) DEFAULT NULL,
+ `sourceName` varchar(500) DEFAULT NULL,
+ `reportingEntityId` varchar(500) DEFAULT NULL,
+ `reportingEntityName` varchar(500) DEFAULT NULL,
+ `priority` varchar(50) DEFAULT NULL,
+ `startEpochMicrosec` varchar(500) DEFAULT NULL,
+ `lastEpochMicroSec` varchar(500) DEFAULT NULL,
+ `sequence` varchar(500) DEFAULT NULL,
+ `measurementsForVfScalingVersion` varchar(500) DEFAULT NULL,
+ `measurementInterval` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER TABLE `performance_commoneventheader` ADD INDEX `performance_commoneventheader_index` (`sourceId`);
+