summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java/org/onap
diff options
context:
space:
mode:
authorkaixiliu <liukaixi@chinamobile.com>2023-04-23 14:24:41 +0800
committerkaixiliu <liukaixi@chinamobile.com>2023-04-23 14:24:51 +0800
commit57ab57ac7d3ee30e8f5ef682ba83a940e0f1d94e (patch)
treea326da42c8d2561835f02befa92c8b172c2d2a25 /intentanalysis/src/main/java/org/onap
parentf6ffce939662d1f03eb616009ff28e6e3bf45164 (diff)
add intent report controller5.2.1
Issue-ID: USECASEUI-785 Signed-off-by: kaixiliu <liukaixi@chinamobile.com> Change-Id: Ia1cf17ceaeb83f0849b6b7902a713b5d12f94d95
Diffstat (limited to 'intentanalysis/src/main/java/org/onap')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java5
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java30
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java72
3 files changed, 106 insertions, 1 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java
index 17ab1b8..52e391c 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java
@@ -23,11 +23,14 @@ import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState;
@Data
public class FulfilmentInfo {
+ private String fulfillmentId;
- private FulfilmentStatus fulfilmentStatus;
+ private FulfilmentStatus fulfillmentStatus;
private NotFulfilledState notFulfilledState;
private String notFulfilledReason;
+ private String achieveValue;
+
}
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
new file mode 100644
index 0000000..016fb66
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class IntentReport {
+ private String intentReportId;
+ private String intentReference;
+ private List<FulfilmentInfo> fulfillmentInfos;
+ private List<String> objectInstance;
+ private Date reportTime;
+}
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
new file mode 100644
index 0000000..4d7369f
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java
@@ -0,0 +1,72 @@
+/*
+ * 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.controller;
+
+import lombok.extern.log4j.Log4j2;
+import org.onap.usecaseui.intentanalysis.bean.enums.FulfilmentStatus;
+import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import static org.onap.usecaseui.intentanalysis.common.ResponseConsts.RSEPONSE_SUCCESS;
+
+@Log4j2
+@RestController
+@RequestMapping("/intentReport")
+public class IntentReportController {
+
+ @GetMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ServiceResult getIntentById(
+ @PathVariable("intentId") String intentId) {
+ // test connection with ui,real log
+ 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()));
+ FulfilmentInfo fu1= new FulfilmentInfo();
+ fu1.setFulfillmentId("fulfilmentInfo1");
+ fu1.setFulfillmentStatus(FulfilmentStatus.FULFILLED);
+ FulfilmentInfo fu2= new FulfilmentInfo();
+ fu2.setFulfillmentId("fulfilmentInfo2");
+ fu2.setFulfillmentStatus(FulfilmentStatus.NOT_FULFILLED);
+ fu2.setNotFulfilledState(NotFulfilledState.DEGRADED);
+ fu2.setNotFulfilledReason("not fulfilled Reason");
+ List<FulfilmentInfo> list = new ArrayList<>();
+ list.add(fu1);
+ list.add(fu2);
+ report.setFulfillmentInfos(list);
+
+ return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "get report success"),
+ report);
+
+ }
+
+}