CreateCallable assuranceCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
FutureTask<String> futureTask = new FutureTask<>(assuranceCallable);
executor.submit(futureTask);
+ log.info(futureTask.get());
} catch (Exception ex) {
- ex.printStackTrace();
+ log.error("exception is {}", ex.getMessage());
}
}
import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
import java.util.List;
+import java.util.stream.Collectors;
@Slf4j
@Component
public class CLLAssuranceActuationModule extends ActuationModule {
private String getBandwidth(String cllId) {
List<Intent> deliveryIntentList = intentService.getIntentByName("CLL Delivery Intent");
+ if (CollectionUtils.isEmpty(deliveryIntentList)) {
+ log.info("get CLL Delivery Intent from the database is empty");
+ return null;
+ }
for (Intent deliveryIntent : deliveryIntentList) {
List<Expectation> deliveryExpectationList = deliveryIntent.getIntentExpectations();
+ if (CollectionUtils.isEmpty(deliveryExpectationList)) {
+ log.info("expectation is empty,intentId is {}", deliveryIntent.getIntentId());
+ continue;
+ }
for (Expectation deliveryExpectation : deliveryExpectationList) {
- if (StringUtils.equalsIgnoreCase(cllId, deliveryExpectation.getExpectationObject().getObjectInstance())) {
- List<ExpectationTarget> deliveryTargetList = deliveryExpectation.getExpectationTargets();
- for (ExpectationTarget deliveryTarget : deliveryTargetList) {
- if (StringUtils.equalsIgnoreCase("bandwidth", deliveryTarget.getTargetName())) {
- List<Condition> deliveryConditionList = deliveryTarget.getTargetConditions();
- for (Condition deliveryCondition : deliveryConditionList) {
- if (StringUtils.equalsIgnoreCase("condition of the cll service bandwidth", deliveryCondition.getConditionName())) {
- return deliveryCondition.getConditionValue();
- }
- }
- }
- }
+ ExpectationObject expectationObject = deliveryExpectation.getExpectationObject();
+ if (expectationObject == null) {
+ log.info("expectationObject is empty,expectationId is {}", deliveryExpectation.getExpectationId());
+ continue;
+ }
+ String objectInstance = expectationObject.getObjectInstance();
+ if (!StringUtils.equalsIgnoreCase(cllId, objectInstance)) {
+ log.info("cllId and objectInstance are not equal,cllId is {},objectInstance is {}", cllId, objectInstance);
+ continue;
+ }
+ List<ExpectationTarget> deliveryTargetList = deliveryExpectation.getExpectationTargets();
+ List<ExpectationTarget> bandwidth = deliveryTargetList.stream()
+ .filter(target -> StringUtils.equalsIgnoreCase("bandwidth", target.getTargetName()))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(bandwidth)) {
+ log.info("bandwidth target is empty,expectation is {}", deliveryExpectation.getExpectationId());
+ continue;
+ }
+ List<Condition> deliveryConditionList = bandwidth.get(0).getTargetConditions();
+ List<Condition> collect = deliveryConditionList.stream()
+ .filter(condition -> StringUtils.equalsIgnoreCase("condition of the cll service bandwidth", condition.getConditionName()))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(collect)) {
+ log.info("condition of the cll service bandwidth is empty,targetId is {}", bandwidth.get(0).getTargetId());
+ continue;
}
+ return collect.get(0).getConditionValue();
}
}
return null;
CreateCallable deliveryCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
FutureTask<String> futureTask = new FutureTask<>(deliveryCallable);
executor.submit(futureTask);
+ log.info(futureTask.get());
} catch (Exception ex) {
- ex.printStackTrace();
+ log.error("exception is {}", ex.getMessage());
}
}
}
ExpectationObject expectationObject = expectationObjectService.getExpectationObject(expectationId);
expectationObject.setObjectInstance((String) params.get("name"));
expectationObjectService.updateExpectationObject(expectationObject, expectationId);
+ } else if (StringUtils.equalsIgnoreCase("delete", intentGoalBean.getIntentGoalType().name())) {
+ String instanceId = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
+ soService.deleteIntentInstance(instanceId);
} else {
String instanceId = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
soService.deleteIntentInstance(instanceId);
* response error
*/
public static final int RESPONSE_ERROR = 500;
+
+ /**
+ * empty param
+ */
+ public static final int EMPTY_PARAM = 10006;
}
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
List<Expectation> selectIntentExpectationList(@Param(value = "intentId") String intentId);
Expectation selectIntentExpectation(@Param(value = "expectationId") String expectationId);
+
+ String getIntentIdByExpectationId(@Param(value = "expectationId") String expectationId,
+ @Param(value = "expectationType") ExpectationType expectationType);
}
import org.apache.ibatis.annotations.Param;
import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import java.util.List;
@Mapper
public interface ExpectationObjectMapper {
@Param(value = "expectationId") String expectationId);
int deleteExpectationObject(@Param(value = "expectationId") String expectationId);
+
+ List<String> getExpectationIdByObjectInstance(@Param(value = "objectInstance") String objectInstance);
+
+ List<String> getAllObjectInstances();
}
--- /dev/null
+/*
+ * 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.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentInfo;
+
+@Mapper
+public interface IntentReportFulfillmentInfoMapper {
+ int insertIntentReportFulfillment(@Param(value = "fulfillmentInfo") FulfillmentInfo fulfillmentInfo,@Param(value = "parentId") String parentId);
+}
--- /dev/null
+/*
+ * 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.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentReport;
+
+@Mapper
+public interface IntentReportMapper {
+ int insertIntentReport(@Param(value = "intentReport") IntentReport intentReport);
+}
--- /dev/null
+/*
+ * 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.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ObjectInstanceMapper {
+ int insertObjectInstanceList(@Param(value = "objectInstances") List<String> objectInstances,
+ @Param(value = "parentId") String parentId);
+
+ List<String> getObjectInstances(@Param(value = "parentId") String parentId);
+}
--- /dev/null
+/*
+ * 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.service;
+
+import org.onap.usecaseui.intentanalysis.bean.models.IntentReport;
+
+public interface IntentReportService {
+ IntentReport getIntentReportByIntentId(String intentId);
+}
package org.onap.usecaseui.intentanalysis.service.impl;
import lombok.extern.slf4j.Slf4j;
-import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentOperation;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
+import org.onap.usecaseui.intentanalysis.exception.CommonException;
+import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.mapper.*;
import org.onap.usecaseui.intentanalysis.service.ComponentNotificationService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.stream.Collectors;
@Slf4j
@Service
public class ComponentNotificationServiceImpl implements ComponentNotificationService {
+ @Autowired
+ private ExpectationObjectMapper expectationObjectMapper;
+
+ @Autowired
+ private ExpectationMapper expectationMapper;
+
+ @Autowired
+ private ContextMapper contextMapper;
+
+ @Autowired
+ private ConditionMapper conditionMapper;
+
+ @Autowired
+ private FulfillmentInfoMapper fulfillmentInfoMapper;
+
+ @Autowired
+ private ObjectInstanceMapper objectInstanceMapper;
+
/**
* Generate a new FulfillmentInfo based on third-party FulfillmentOperation
* and save it in the database
*
- * @param eventModel
+ * @param eventModel param
*/
@Override
public void callBack(FulfillmentOperation eventModel) {
- log.info("callBack begin");
+ if (eventModel == null) {
+ String msg = "The obtained fulfillmentInfo is null";
+ throw new CommonException(msg, ResponseConsts.EMPTY_PARAM);
+ }
+ String operation = eventModel.getOperation();
+ List<String> objectInstances = eventModel.getObjectInstances();
+ if (CollectionUtils.isEmpty(objectInstances) || StringUtils.isEmpty(operation)) {
+ String msg = "The obtained objectInstances or operation are empty";
+ throw new CommonException(msg, ResponseConsts.EMPTY_PARAM);
+ }
+ log.info("Get objectInstances is {}", objectInstances);
+ List<String> expectationIds = expectationObjectMapper.getExpectationIdByObjectInstance(objectInstances.get(0));
+ if (CollectionUtils.isEmpty(expectationIds)) {
+ String msg = "Get expectationId is null from database";
+ log.error(msg);
+ return;
+ }
+ log.info("ExpectationId is {}", expectationIds);
+ String intentId = null;
+ for (String expectationId : expectationIds) {
+ // TODO
+ ExpectationType expectationType = getExpectationType(operation);
+ intentId = expectationMapper.getIntentIdByExpectationId(expectationId, expectationType);
+ if (StringUtils.isNotEmpty(intentId)) {
+ break;
+ }
+ }
+ log.error("The intentId is {}", intentId);
+
+ if (StringUtils.isEmpty(intentId)) {
+ String msg = "Get intentId is null from database";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+
+ String parentByIntentId = findParentByIntentId(findParentByIntentId(intentId));
+ log.info("The parentByIntentId is {}", parentByIntentId);
+
+ saveFulfillmentInfo(parentByIntentId, eventModel);
+ }
+
+ private void saveFulfillmentInfo(String intentId, FulfillmentOperation eventModel) {
+ FulfillmentInfo fulfillmentInfo = fulfillmentInfoMapper.selectFulfillmentInfo(intentId);
+ if (fulfillmentInfo != null) {
+ fulfillmentInfoMapper.deleteFulfillmentInfo(intentId);
+ }
+ FulfillmentInfo newInfo = new FulfillmentInfo();
+ BeanUtils.copyProperties(eventModel, newInfo);
+ int num = fulfillmentInfoMapper.insertFulfillmentInfo(newInfo, intentId);
+ FulfillmentInfo fulfillmentInfo1 = fulfillmentInfoMapper.selectFulfillmentInfo(intentId);
+ if (num < 1) {
+ String msg = "Failed to insert fulfillmentInfo to database.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ int objectInstanceNum = objectInstanceMapper.insertObjectInstanceList(eventModel.getObjectInstances(), intentId);
+ if (objectInstanceNum < 1) {
+ String msg = "Failed to insert objectInstances to database.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ }
+
+ public String findParentByIntentId(String intentId) {
+ List<Context> contexts = contextMapper.selectContextList(intentId);
+ if (CollectionUtils.isEmpty(contexts)) {
+ log.error("Get context is empty,intentId is {}", intentId);
+ String msg = "Get Contexts is empty from database";
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ List<Context> collect = contexts.stream()
+ .filter(context -> "parentIntent info".equalsIgnoreCase(context.getContextName()))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(collect) || collect.size() != 1) {
+ log.error("This intent has not parent intent,intentId is {}", intentId);
+ String msg = "Get Context is empty from database";
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ Context context = collect.get(0);
+ List<Condition> conditions = conditionMapper.selectConditionList(context.getContextId());
+ if (CollectionUtils.isEmpty(conditions) || StringUtils.isEmpty(conditions.get(0).getConditionValue())) {
+ log.error("");
+ String msg = "Get conditions is empty from database";
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ return conditions.get(0).getConditionValue();
+ }
+
+ private ExpectationType getExpectationType(String operation) {
+ if (operation.contains("Assurance")) {
+ return ExpectationType.ASSURANCE;
+ }
+ return ExpectationType.DELIVERY;
}
}
--- /dev/null
+/*
+ * 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.service.impl;
+
+import lombok.extern.slf4j.Slf4j;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentInfo;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentReport;
+import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
+import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.mapper.IntentReportFulfillmentInfoMapper;
+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.IntentReportService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collections;
+import java.util.List;
+
+@Service
+@Slf4j
+public class IntentReportServiceImpl implements IntentReportService {
+
+ @Autowired
+ private FulfillmentInfoService fulfillmentInfoService;
+
+ @Autowired
+ private ObjectInstanceMapper objectInstanceMapper;
+
+ @Autowired
+ private IntentReportFulfillmentInfoMapper intentReportFulfillmentInfoMapper;
+
+ @Autowired
+ private IntentReportMapper intentReportMapper;
+
+ @Override
+ public IntentReport getIntentReportByIntentId(String intentId) {
+ FulfillmentInfo fulfillmentInfo = fulfillmentInfoService.getFulfillmentInfo(intentId);
+ System.out.println(fulfillmentInfo);
+ if (fulfillmentInfo == null) {
+ log.error("get fulfillmentInfo is failed,intentId is {}", intentId);
+ String msg = "get fulfillmentInfo is failed";
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ fulfillmentInfo.setFulfillmentId(intentId);
+ List<String> objectInstances = objectInstanceMapper.getObjectInstances(intentId);
+ if (CollectionUtils.isEmpty(objectInstances)) {
+ log.error("get objectInstance is failed,intentId is {}", intentId);
+ String msg = "get objectInstance is failed";
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ String uUid = CommonUtil.getUUid();
+ fulfillmentInfo.setObjectInstances(objectInstances);
+ IntentReport intentReport = new IntentReport();
+ intentReport.setIntentReportId(uUid);
+ intentReport.setIntentReference("intentReference");
+ intentReport.setFulfillmentInfos(Collections.singletonList(fulfillmentInfo));
+ intentReport.setReportTime(CommonUtil.getTime());
+
+ int num = intentReportMapper.insertIntentReport(intentReport);
+ if (num < 1) {
+ String msg = "Failed to insert intent report to database.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ int fulfillmentNum = intentReportFulfillmentInfoMapper.insertIntentReportFulfillment(fulfillmentInfo, uUid);
+ if (fulfillmentNum < 1) {
+ String msg = "Failed to insert fulfillmentInfo to database.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ return intentReport;
+ }
+}
*/
package org.onap.usecaseui.intentanalysis.util;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.UUID;
public class CommonUtil {
public static String getUUid() {
return UUID.randomUUID().toString().trim().replaceAll("-", "");
}
+
+ public static String getTime() {
+ Date date = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
+ String format = dateFormat.format(date);
+ return format;
+ }
}
where expectation_id = #{expectationId}
</delete>
+ <select id="getIntentIdByExpectationId" resultType="java.lang.String">
+ select intent_id
+ from expectation
+ where expectation_id = #{expectationId}
+ and expectation_type = #{expectationType}
+ </select>
</mapper>
delete from expectation_object
where expectation_id = #{expectationId}
</delete>
+
+ <select id="getExpectationIdByObjectInstance" resultType="java.lang.String">
+ select expectation_id
+ from expectation_object
+ where object_instance = #{objectInstance}
+ </select>
+
+ <select id="getAllObjectInstances" resultType="java.lang.String">
+ select object_instance
+ from expectation_object
+ </select>
</mapper>
<insert id="insertFulfillmentInfo">
- insert into fulfillment_info(fulfillment_info_id, fulfillment_info_status, not_fulfilled_state, not_fulfilled_reason)
- values (#{parentId}, #{fulfillmentInfo.fulfillmentStatus}, #{fulfillmentInfo.notFulfilledState}, #{fulfillmentInfo.notFulfilledReason})
+ insert into fulfillment_info(fulfillment_info_id, fulfillment_info_status, not_fulfilled_state, not_fulfilled_reason,achieve_value)
+ values (#{parentId}, #{fulfillmentInfo.fulfillmentStatus}, #{fulfillmentInfo.notFulfilledState}, #{fulfillmentInfo.notFulfilledReason},#{fulfillmentInfo.achieveValue})
</insert>
<select id="selectFulfillmentInfo" resultType="org.onap.usecaseui.intentanalysis.bean.models.FulfillmentInfo">
- select fulfillment_info_status fulfillmentStatus, not_fulfilled_state notFulfilledState,
- not_fulfilled_reason notFulfilledReason
+ select fulfillment_info_id fulfillmentId, fulfillment_info_status fulfillmentStatus, not_fulfilled_state notFulfilledState,
+ not_fulfilled_reason notFulfilledReason, achieve_value achieveValue
from fulfillment_info
where fulfillment_info_id = #{parentId}
</select>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.IntentReportFulfillmentInfoMapper">
+
+ <insert id="insertIntentReportFulfillment">
+ insert into intent_report_fulfillment_info(parent_id,fulfillment_info_id, fulfillment_info_status, not_fulfilled_state, not_fulfilled_reason,achieve_value)
+ values (#{parentId},#{fulfillmentInfo.fulfillmentId}, #{fulfillmentInfo.fulfillmentStatus}, #{fulfillmentInfo.notFulfilledState}, #{fulfillmentInfo.notFulfilledReason},#{fulfillmentInfo.achieveValue})
+ </insert>
+</mapper>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.IntentReportMapper">
+
+ <insert id="insertIntentReport">
+ insert into intent_report(intent_report_id, intent_reference,report_time)
+ values (#{intentReport.intentReportId},#{intentReport.intentReference},to_timestamp(#{intentReport.reportTime},'yyyy-MM-dd HH24:mi:ss'))
+ </insert>
+</mapper>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper">
+
+ <insert id="insertObjectInstanceList">
+ insert into object_instance(parent_id, object_instance)
+ values
+ <foreach collection="objectInstances" index="index" item="item" separator=",">
+ (#{parentId}, #{item})
+ </foreach>
+ </insert>
+
+ <select id="getObjectInstances" resultType="java.lang.String">
+ select object_instance from object_instance where parent_id = #{parentId}
+ </select>
+</mapper>
fulfillment_info_id varchar(255) primary key,
fulfillment_info_status varchar(255),
not_fulfilled_state varchar(255),
- not_fulfilled_reason varchar(255)
+ not_fulfilled_reason varchar(255),
+ achieve_value varchar(255)
);
create table if not exists condition
operateType varchar (225),
parent_id varchar(255)
);
+
+create table if not exists intent_report(
+ intent_report_id varchar(255) primary key,
+ intent_reference varchar(255),
+ report_time varchar(255)
+ );
+
+create table if not exists intent_report_fulfillment_info(
+ parent_id varchar(255),
+ fulfillment_info_id varchar(255),
+ fulfillment_info_status varchar(255),
+ not_fulfilled_state varchar(255),
+ not_fulfilled_reason varchar(255),
+ achieve_value varchar(255)
+ );
+
+create table if not exists object_instance(
+ parent_id varchar(255),
+ object_instance varchar(255)
+ );
\ No newline at end of file