diff options
author | kaixiliu <liukaixi@chinamobile.com> | 2023-05-16 10:21:45 +0800 |
---|---|---|
committer | kaixiliu <liukaixi@chinamobile.com> | 2023-05-16 10:27:08 +0800 |
commit | 9ecd6e7fb953fa581f7900c11f6b85856073da24 (patch) | |
tree | b06ca73733d1cf58c68ca76971fd76ec5f002779 /intentanalysis/src/main/java/org | |
parent | 649af3826678c25a3bd21ee84adb14ed9fe775a8 (diff) |
Modify the intent report model and create a table
Issue-ID: USECASEUI-812
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
Change-Id: I33221660b76dd54306fb447d29d60fc5faeb0617
Diffstat (limited to 'intentanalysis/src/main/java/org')
7 files changed, 70 insertions, 11 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentInfo.java index dbd908e..ea899b2 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentInfo.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentInfo.java @@ -20,6 +20,8 @@ import lombok.Data; import org.onap.usecaseui.intentanalysis.bean.enums.FulfillmentStatus; import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState; +import java.util.List; + @Data public class FulfillmentInfo { @@ -33,4 +35,5 @@ public class FulfillmentInfo { private String achieveValue; + private List<String> objectInstances; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentOperation.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentOperation.java new file mode 100644 index 0000000..58a5623 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfillmentOperation.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2023 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.intentanalysis.bean.models; + +import lombok.Data; + +@Data +public class FulfillmentOperation extends FulfillmentInfo { + //Assurance or modifyBW + private String operation; +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java index 5dfc7a8..69ad2f4 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java @@ -25,6 +25,5 @@ public class IntentReport { private String intentReportId; private String intentReference; private List<FulfillmentInfo> fulfillmentInfos; - private List<String> objectInstance; - private Date reportTime; + private String reportTime; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java new file mode 100644 index 0000000..ee3bd4e --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2023 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.intentanalysis.bean.models; + +import lombok.Data; + +@Data +public class IntentReportFulfillmentInfo extends FulfillmentInfo{ + // This id is the intentReportId of the associated intentReport + private String intentReportId; +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java index a4dbb45..c9e82a6 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; @@ -47,18 +48,20 @@ public class IntentReportController { IntentReport report = new IntentReport(); report.setIntentReportId("12345"); report.setIntentReference("intentReort"); - report.setObjectInstance(Arrays.asList("instance1", "instance2", "instance3")); //report.setFulfillmentInfos(); - LocalDateTime now = LocalDateTime.now(); - report.setReportTime(Date.from( now.atZone( ZoneId.systemDefault()).toInstant())); + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); + report.setReportTime(dateFormat.format(date)); FulfillmentInfo fu1= new FulfillmentInfo(); fu1.setFulfillmentId("fulfillmentInfo1"); fu1.setFulfillmentStatus(FulfillmentStatus.FULFILLED); + fu1.setObjectInstances(Arrays.asList("instance1", "instance2", "instance3")); FulfillmentInfo fu2= new FulfillmentInfo(); fu2.setFulfillmentId("fulfillmentInfo2"); fu2.setFulfillmentStatus(FulfillmentStatus.NOT_FULFILLED); fu2.setNotFulfilledState(NotFulfilledState.DEGRADED); fu2.setNotFulfilledReason("not fulfilled Reason"); + fu2.setObjectInstances(Arrays.asList("instance1", "instance2")); List<FulfillmentInfo> list = new ArrayList<>(); list.add(fu1); list.add(fu2); diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ComponentNotificationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ComponentNotificationService.java index 29d7ab9..e10618f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ComponentNotificationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ComponentNotificationService.java @@ -15,8 +15,8 @@ */ package org.onap.usecaseui.intentanalysis.service; -import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel; +import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentOperation; public interface ComponentNotificationService { - void callBack(NotificationEventModel eventModel); + void callBack(FulfillmentOperation eventModel); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ComponentNotificationServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ComponentNotificationServiceImpl.java index ea492e1..59c4f45 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ComponentNotificationServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ComponentNotificationServiceImpl.java @@ -16,18 +16,22 @@ package org.onap.usecaseui.intentanalysis.service.impl; import lombok.extern.slf4j.Slf4j; -import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel; +import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentOperation; import org.onap.usecaseui.intentanalysis.service.ComponentNotificationService; import org.springframework.stereotype.Service; + @Slf4j @Service -public class ComponentNotificationServiceImpl implements ComponentNotificationService { +public class ComponentNotificationServiceImpl implements ComponentNotificationService { + /** - * transform NoticationEventModel to fulfillment + * Generate a new FulfillmentInfo based on third-party FulfillmentOperation + * and save it in the database + * * @param eventModel */ @Override - public void callBack(NotificationEventModel eventModel) { + public void callBack(FulfillmentOperation eventModel) { log.info("callBack begin"); } } |