2 * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
19 import org.apache.commons.collections.CollectionUtils;
20 import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
21 import org.onap.usecaseui.intentanalysis.bean.models.Condition;
22 import org.onap.usecaseui.intentanalysis.bean.models.Context;
23 import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
24 import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
25 import org.onap.usecaseui.intentanalysis.bean.models.Intent;
26 import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
27 import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
28 import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
29 import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
30 import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
31 import org.onap.usecaseui.intentanalysis.service.IntentService;
32 import org.onap.usecaseui.intentanalysis.util.CommonUtil;
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.stereotype.Component;
36 import java.util.ArrayList;
37 import java.util.List;
40 public class CLLBusinessActuationModule extends ActuationModule {
42 IntentProcessService processService;
44 IntentService intentService;
46 IntentInterfaceService intentInterfaceService;
50 public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
51 processService.setIntentRole(IntentHandler, null);
52 processService.intentProcess(intentGoalBean);
56 public void directOperation(IntentGoalBean intentGoalBean) {
61 public void interactWithIntentHandle() {
66 public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
67 //toNextIntentHandler(intentGoalBean, intentHandler);
68 intentHandler.receiveIntentAsOwner(intentGoalBean);
72 public void saveIntentToDb(Intent intent){ //ownerid parent intent id
73 List<Context> intentContexts = intent.getIntentContexts();
74 if (CollectionUtils.isEmpty(intentContexts)) {
75 intentContexts = new ArrayList<>();
77 //ownerId intentId="" show relatioship beteween intent
78 Context ownerIdContext = new Context();
79 ownerIdContext.setContextId(CommonUtil.getUUid());
80 ownerIdContext.setContextName("ownerId");
81 List<Condition> idConditionList = new ArrayList<>();
82 Condition idCondition = new Condition();
83 idCondition.setConditionValue(intent.getIntentId());
84 idCondition.setOperator(OperatorType.EQUALTO);
85 idCondition.setConditionName("intentId");
86 idCondition.setConditionId(CommonUtil.getUUid());
88 idConditionList.add(idCondition);
89 ownerIdContext.setContextConditions(idConditionList);
91 intentContexts.add(ownerIdContext);
92 intent.setIntentContexts(intentContexts);
93 intentService.createIntent(intent);
97 public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){