aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
index c443f9e..d4c0f88 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
@@ -27,6 +27,7 @@ import org.onap.usecaseui.intentanalysis.mapper.IntentReportFulfillmentInfoMappe
import org.onap.usecaseui.intentanalysis.mapper.IntentReportMapper;
import org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper;
import org.onap.usecaseui.intentanalysis.service.FulfillmentInfoService;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
import org.onap.usecaseui.intentanalysis.service.IntentReportService;
import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,9 @@ public class IntentReportServiceImpl implements IntentReportService {
@Autowired
private IntentReportMapper intentReportMapper;
+ @Autowired
+ private IntentInstanceService intentInstanceService;
+
@Override
@Transactional(rollbackFor = DataBaseException.class)
public ServiceResult getIntentReportByIntentId(String intentId) {
@@ -68,7 +72,7 @@ public class IntentReportServiceImpl implements IntentReportService {
fulfillmentInfo.setObjectInstances(getInstances(intentId));
IntentReport intentReport = new IntentReport();
intentReport.setIntentReportId(CommonUtil.getUUid());
- intentReport.setIntentReference("intentReference");
+ intentReport.setIntentReference(intentInstanceService.queryIntentInstanceId(intentId));
intentReport.setFulfillmentInfos(Collections.singletonList(fulfillmentInfo));
intentReport.setReportTime(CommonUtil.getTime());
@@ -77,6 +81,11 @@ public class IntentReportServiceImpl implements IntentReportService {
intentReport);
}
+ /**
+ * Generate intention reports on a regular basis and save them in the database
+ *
+ * @param intentId intentId
+ */
@Override
@Transactional(rollbackFor = DataBaseException.class)
public void saveIntentReportByIntentId(String intentId) {
@@ -87,11 +96,20 @@ public class IntentReportServiceImpl implements IntentReportService {
}
IntentReport intentReport = new IntentReport();
intentReport.setIntentReportId(CommonUtil.getUUid());
- intentReport.setIntentReference("intentReference");
+ intentReport.setIntentReference(intentInstanceService.queryIntentInstanceId(intentId));
intentReport.setReportTime(CommonUtil.getTime());
saveIntentReport(intentReport, fulfillmentInfo);
}
+ @Override
+ public List<String> getIntentReportIds(String intentReference) {
+ List<String> intentReportIds = intentReportMapper.getIntentReportIds(intentReference);
+ if (CollectionUtils.isEmpty(intentReportIds)) {
+ log.error("get intentReportId is empty,intentReference is {}", intentReference);
+ }
+ return intentReportIds;
+ }
+
private FulfillmentInfo getFulfillmentInfo(String intentId) {
FulfillmentInfo fulfillmentInfo = fulfillmentInfoService.getFulfillmentInfo(intentId);
log.info("fulfillmentInfo is {}", fulfillmentInfo);