import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
import org.onap.usecaseui.intentanalysis.bean.models.Condition;
import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
processService.setIntentRole(IntentHandler, null);
- processService.intentProcess(intent);
+ processService.intentProcess(intentGoalBean);
}
@Override
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- toNextIntentHandler(intentGoalBean.getIntent(),intentHandler);
+ toNextIntentHandler(intentGoalBean, intentHandler);
}
@Override
intent.setIntentContexts(intentContexts);
intentService.createIntent(intent);
}
+
+ @Override
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
+ }
}
import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
@Autowired
IntentService intentService;
+ @Autowired
+ IntentContextService intentContextService;
+
@Override
public void determineUltimateGoal() {
}
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
boolean needDecompostion = needDecompostion(intentGoalBean);
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
if (needDecompostion) {
return intentMap;
}
- @Override
- public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){
- Intent subIntent = intentGoalBean.getIntent();
- if (subIntent.getIntentName().contains("delivery")){
- List<Expectation> deliveryIntentExpectationList = intentGoalBean.getIntent().getIntentExpectations();
- List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
- ExpectationObject deliveryExpectationObject = deliveryIntentExpectationList.get(0).getExpectationObject();
- String objectInstance = deliveryExpectationObject.getObjectInstance();
+ @Override
+ //format is
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ //get cll-delivery cll-assurance intent
+ Intent originIntent = intentGoalBean.getIntent();
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ boolean bFindIntent = false;
for (Expectation originExpectation : originIntentExpectationList) {
- ExpectationObject originExpectationObject = originExpectation.getExpectationObject();
- originExpectationObject.setObjectInstance(objectInstance);
+ if (intent.getIntentName().equals(originExpectation.getExpectationName())){
+ bFindIntent = true;
+ }
+ }
+
+ if (false == bFindIntent){
+ intentContextService.deleteSubIntentContext(originIntent, intent.getIntentId());
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }else{
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
}
}
+ return intentMap;
}
@Override
- public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){
-
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
}
-
}
@Component
public class CLLAssuranceActuationModule extends ActuationModule {
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
}
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
directOperation();
}
+
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
+ }
}
}
- @Override
- public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){
-
- }
-
@Override
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
return null;
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
return null;
}
@Override
- public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){
- List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
-
- String instanceId = "";
- for (Expectation expectation : originIntentExpectationList) {
- if (expectation.getExpectationName().contains("assurance")){
- instanceId = expectation.getExpectationObject().getObjectInstance();
- break;
- }
- }
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ return null;
+ }
- for (Expectation expectation : intent.getIntentExpectations()) {
- expectation.getExpectationObject().setObjectInstance(instanceId);
- }
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ return null;
}
}
*/
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule;
+import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CLLDeliveryActuationModule extends ActuationModule {
+ @Autowired
+ IntentService intentService;
+
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
}
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
this.directOperation();
}
+
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+ Intent subIntent = intentGoalBean.getIntent();
+ if (subIntent.getIntentName().contains("delivery")){
+ List<Expectation> deliveryIntentExpectationList = intentGoalBean.getIntent().getIntentExpectations();
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+ ExpectationObject deliveryExpectationObject = deliveryIntentExpectationList.get(0).getExpectationObject();
+ String objectInstance = deliveryExpectationObject.getObjectInstance();
+
+ for (Expectation originExpectation : originIntentExpectationList) {
+ ExpectationObject originExpectationObject = originExpectation.getExpectationObject();
+ originExpectationObject.setObjectInstance(objectInstance);
+ }
+ }
+ intentService.updateIntent(originIntent);
+ }
+
+
+
}
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
return null;
}
@Override
- public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){
-
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ return null;
}
@Override
- public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){
-
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ return null;
}
}
package org.onap.usecaseui.intentanalysis.controller;
+import io.swagger.models.auth.In;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Intent> createIntent(@RequestBody Intent intent) {
- return ResponseEntity.ok(intentService.createIntent(intent));
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ return ResponseEntity.ok(intentService.createIntent(newIntentGoalBean.getIntent()));
}
@PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Intent> updateIntentById(
@PathVariable(INTENT_ID) String intentId,
@RequestBody Intent intent) {
- return ResponseEntity.ok(intentService.updateIntent(intent));
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ return ResponseEntity.ok(intentService.updateIntent(newIntentGoalBean.getIntent()));
}
@DeleteMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public void removeIntentById(@PathVariable(INTENT_ID) String intentId) {
- intentService.deleteIntent(intentId);
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+ Intent intent = intentService.getIntent(intentId);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ processService.intentProcess(intentGoalBean);
}
@PostMapping(value = "/handleIntent", produces = MediaType.APPLICATION_JSON_VALUE)
public void handleIntent(@RequestBody Intent intent) {
processService.setIntentRole(formatIntentInputManagementFunction, null);
//save original intent
- intentService.createIntent(intent);
- processService.intentProcess(intent);
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ intentService.createIntent(newIntentGoalBean.getIntent());
}
}
IntentProcessService processService;
@Autowired
IntentService intentService;
+
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
log.info("do nothing");
}
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
+
}
+
@Override
public void saveIntentToDb(Intent intent){
List<Context> intentContexts = intent.getIntentContexts();
intentService.createIntent(intent);
}
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
+ }
+
}
*/
package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule;
+import java.util.ArrayList;
import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@Autowired
ApplicationContext applicationContext;
+ @Autowired
+ public IntentContextService intentContextService;
+
+ @Autowired
+ public IntentService intentService;
+
@Override
public void determineUltimateGoal() {
}
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
boolean needDecompostion = needDecompostion(intentGoalBean);
if (needDecompostion) {
return null;
}
-
@Override
- public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){
+ //format is
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ //get format-cll intent
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ UpdateIntentInfo(intentGoalBean.getIntent(), intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
+ }
+
+ public void UpdateIntentInfo(Intent originIntent, Intent intent){
+
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+ List<Expectation> intentExpectationList = intent.getIntentExpectations();
+ int newIntentExpectationNum = originIntentExpectationList.size();
+ int oldIntentExpectationNum = intentExpectationList.size();
+
+ if (newIntentExpectationNum != oldIntentExpectationNum){
+ if (newIntentExpectationNum < oldIntentExpectationNum){
+ boolean bFindExpectation = false;
+ for (Expectation oldExpectation : intentExpectationList) {
+ for (Expectation newExpectation : originIntentExpectationList) {
+ if (oldExpectation.getExpectationName().equals(newExpectation.getExpectationName())){
+ bFindExpectation = true;
+ }
+ }
+ if (bFindExpectation == false){
+ intentExpectationList.remove(oldExpectation);
+ }
+ }
+ }
+ }
}
@Override
- public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){
-
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
}
+
}
--- /dev/null
+/*
+ * Copyright (C) 2022 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.intentBaseService.contextService;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+@Service
+public class IntentContextService {
+
+ @Autowired
+ private IntentService intentService;
+
+ @Autowired
+ ApplicationContext applicationContext;
+
+ public void updateChindIntentContext(Intent originIntent, Intent intent){
+ List<Context> contextList = intent.getIntentContexts();
+
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName(originIntent.getIntentName() + "id");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(originIntent.getIntentId());
+
+ Context context = new Context();
+ context.setContextName("parentIntent info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+ }
+
+ public void updateParentIntentContext(Intent originIntent, Intent intent){
+ List<Context> contextList = originIntent.getIntentContexts();
+
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName(intent.getIntentName() + "id");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(intent.getIntentId());
+
+ boolean isSubIntentInfoExist = false;
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")){
+ List<Condition> conditionList = context.getContextConditions();
+ conditionList.add(condition1);
+ isSubIntentInfoExist = true;
+ }
+ }
+
+ if (isSubIntentInfoExist != true){
+ Context context = new Context();
+ context.setContextName("subIntent info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+
+ }
+ }
+
+ public void updateIntentOwnerHandlerContext(Intent intent, IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){
+ List<Context> contextList = intent.getIntentContexts();
+
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName("owner class name");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(intentOwner.getClass().getName());
+
+ Context context = new Context();
+ context.setContextName("owner info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+
+ Condition condition2 = new Condition();
+ condition2.setConditionId(CommonUtil.getUUid());
+ condition2.setConditionName("handler class name");
+ condition2.setOperator(OperatorType.EQUALTO);
+ condition2.setConditionValue(intentHandler.getClass().getName());
+
+ Context context2 = new Context();
+ context2.setContextName("handler info");
+ context2.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList2 = new ArrayList<>();
+ conditionList2.add(condition2);
+ context2.setContextConditions(conditionList2);
+ contextList.add(context2);
+ }
+
+ public List<Intent> getSubIntentInfoFromContext(Intent originIntent){
+
+ List<Intent> subIntentList = new ArrayList<>();
+ List<Context> contextList = originIntent.getIntentContexts();
+
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")){
+ List<Condition> conditionList = context.getContextConditions();
+ for (Condition condition : conditionList) {
+ String subIntentId = condition.getConditionValue();
+ Intent subInent = intentService.getIntent(subIntentId);
+ subIntentList.add(subInent);
+ }
+ }
+ }
+
+ return subIntentList;
+ }
+
+ public IntentManagementFunction getHandlerInfo(Intent intent){
+ List<Context> contextList = intent.getIntentContexts();
+ IntentManagementFunction handler = new IntentManagementFunction();
+
+ for (Context context : contextList) {
+ if (context.getContextName().contains("handler info")) {
+ List<Condition> conditionList = context.getContextConditions();
+ String handlerClassName = conditionList.get(0).getConditionValue();
+ handler = (IntentManagementFunction) applicationContext
+ .getBean(CLLBusinessIntentManagementFunction.class.getSimpleName());
+ }
+ }
+ return handler;
+ }
+
+ public void deleteSubIntentContext(Intent intent, String deleteIntentId){
+ List<Context> contextList = intent.getIntentContexts();
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")) {
+ List<Condition> conditionList = context.getContextConditions();
+ for (Condition condition : conditionList) {
+ if (condition.getConditionValue() == deleteIntentId){
+ conditionList.remove(condition);
+ }
+ }
+ }
+ }
+ }
+
+}
IntentService intentService;
//send to the next level intent handler
- public abstract void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler);
+ public abstract void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler);
//Direct operation
public abstract void directOperation();
intentService.createIntent(intent);
}
+ //Update intent information to the intent instance database
+ public void updateIntentToDb(Intent intent) {
+ intentService.updateIntent(intent);
+ }
+
+ //Delete intent information to the intent instance database
+ public void deleteIntentToDb(Intent intent) {
+ intentService.deleteIntent(intent.getIntentId());
+ }
+
public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
//determine if the intent is to be processed directly or sent to the next-level processor
public abstract void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler);
+
+ public abstract void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean);
}
List<Expectation> originalExpectationList = intent.getIntentExpectations();
List<Expectation> newExpectationList = getNewExpectationList(originalExpectationList);
intent.setIntentExpectations(newExpectationList);
- updateIntentWithOriginIntent(originIntent, intent);
return intent;
}
- public abstract void updateIntentWithOriginIntent(Intent originIntent, Intent intent);
-
public abstract void decideSuitableAction();
public abstract void interactWithTemplateDb();
- public abstract void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean);
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean);
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean);
- public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean);
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean);
/**
* build new Intent with uuid
}
return context;
}
+
+
}
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
private IntentManagementFunction intentHandler;
private IntentManagementFunction intentOwner;
+ @Autowired
+ public IntentContextService intentContextService;
+
public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler) {
if (intentOwner != null) {
this.intentOwner = intentOwner;
public void definitionPorcess(Intent originIntent, Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
DecisionModule intentDecisionModule = intentOwner.getDecisionModule();
ActuationModule intentActuationModule = intentOwner.getActuationModule();
- Intent newIdIntent = intentDecisionModule.intentDefinition(originIntent, entry.getKey().getIntent());
- intentActuationModule.saveIntentToDb(newIdIntent);//id type
+
+ IntentGoalBean newIntentGoalBean = entry.getKey();
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.CREATE){
+ Intent newIdIntent = intentDecisionModule.intentDefinition(originIntent, entry.getKey().getIntent());
+ intentContextService.updateIntentOwnerHandlerContext(newIdIntent, intentOwner, intentHandler);
+ intentContextService.updateParentIntentContext(originIntent, newIdIntent);
+ intentContextService.updateChindIntentContext(originIntent, newIdIntent);
+ intentActuationModule.saveIntentToDb(newIdIntent);//id type
+ }
+
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ intentActuationModule.updateIntentToDb(newIntentGoalBean.getIntent());
+ }
+
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ intentActuationModule.deleteIntentToDb(newIntentGoalBean.getIntent());
+ }
+
}
}
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
}
}
- public IntentGoalBean detectionProcess(Intent intent) {
+ public IntentGoalBean detectionProcess(IntentGoalBean originIntentGoalBean) {
KnowledgeModule ownerKnowledgeModule = intentOwner.getKnowledgeModule();
- return ownerKnowledgeModule.intentCognition(intent);
+ if (originIntentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ return new IntentGoalBean(originIntentGoalBean.getIntent(), IntentGoalType.UPDATE);
+ }
+
+ if (originIntentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ return new IntentGoalBean(originIntentGoalBean.getIntent(), IntentGoalType.DELETE);
+ }
+
+ return ownerKnowledgeModule.intentCognition(originIntentGoalBean.getIntent());
+
}
}
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class IntentInvestigationService {
+
+ @Autowired
+ IntentContextService intentContextService;
+
private IntentManagementFunction intentHandler;
private IntentManagementFunction intentOwner;
public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){
- if (intentOwner!= null){
+ if (intentOwner != null){
this.intentOwner = intentOwner;
}
- if (intentHandler!= null){
+ if (intentHandler != null){
this.intentHandler= intentHandler;
}
}
- public LinkedHashMap<IntentGoalBean,IntentManagementFunction> investigationProcess(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean,IntentManagementFunction> investigationProcess(IntentGoalBean intentGoalBean) {
DecisionModule intentDecisionModule = intentOwner.getDecisionModule();
- return intentDecisionModule.findHandler(intentGoalBean);
+
+ if (intentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ return intentDecisionModule.investigationUpdateProcess(intentGoalBean);
+ }
+
+ if (intentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ return intentDecisionModule.investigationDeleteProcess(intentGoalBean);
+ }
+ return intentDecisionModule.investigationCreateProcess(intentGoalBean);
}
}
intentActuationModule.fulfillIntent(intentGoalBean, intentHandler);
//update origin intent if need
- intentDecisionModule.updateIntentInfo(originIntent, intentGoalBean);
+ intentActuationModule.updateIntentOperationInfo(originIntent, intentGoalBean);
}
}
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
}
}
- public void intentProcess(Intent intent) {
+ public IntentGoalBean intentProcess(IntentGoalBean originIntentGoalBean) {
+
intentDetectionService.setIntentRole(intentOwner, intentHandler);
- IntentGoalBean intentGoalBean = intentDetectionService.detectionProcess(intent);
+ IntentGoalBean newIntentGoalBean = intentDetectionService.detectionProcess(originIntentGoalBean);
+ //Èç¹ûÊÇupdate£¬Ö±½ÓÔÚinvestigationProcess»ñµÃintentÖж¨ÒåµÄhandlerµÄÐÅÏ¢£¬È»ºóÒ»¸öupdate »òÕßÁ½¸öupdate
//investigation process
intentInvestigationService.setIntentRole(intentOwner, intentHandler);
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap =
- intentInvestigationService.investigationProcess(intentGoalBean);
+ intentInvestigationService.investigationProcess(newIntentGoalBean);
Iterator<Map.Entry<IntentGoalBean, IntentManagementFunction>> iterator = intentMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<IntentGoalBean, IntentManagementFunction> next = iterator.next();
//definition process save subintent
intentDefinitionService.setIntentRole(intentOwner, intentHandler);
- intentDefinitionService.definitionPorcess(intent, next);
+ intentDefinitionService.definitionPorcess(originIntentGoalBean.getIntent(), next);
//distribution process
intentDistributionService.setIntentRole(intentOwner, intentHandler);
intentDistributionService.distributionProcess(next);
intentOperationService.setIntentRole(intentOwner, next.getValue());
- intentOperationService.operationProcess(intent, next.getKey());
+ intentOperationService.operationProcess(originIntentGoalBean.getIntent(), next.getKey());
}
+
+ return newIntentGoalBean;
}
+
}
+/*
+ *
+ * * Copyright (C) 2022 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.adapters.so;
import static org.mockito.ArgumentMatchers.any;
+/*
+ *
+ * * Copyright (C) 2022 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.cllBusinessIntentMgt.cllBusinessModule;
import org.junit.Assert;
}
@Test
public void testFindHandler(){
- formatIntentInputDecisionModule.findHandler(intentGoalBean);
+ formatIntentInputDecisionModule.investigationCreateProcess(intentGoalBean);
Assert.assertTrue(true);
}
}
\ No newline at end of file
import org.mockito.InjectMocks;
import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.springframework.boot.test.context.SpringBootTest;
@Test
public void testDetectionProcess() {
intentDetectionService.setIntentRole(intentOwner, null);
- intentDetectionService.detectionProcess(intent);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ intentDetectionService.detectionProcess(intentGoalBean);
Assert.assertTrue(true);
}
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
intentMap.put(intentGoalBean,cllBusinessIntentManagementFunction);
when(intentInvestigationService.investigationProcess(any())).thenReturn(intentMap);
- intentProcessService.intentProcess(intent);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ intentProcessService.intentProcess(intentGoalBean);
Assert.assertTrue(true);
}
}
\ No newline at end of file
+/*
+ *
+ * * Copyright (C) 2022 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 java.util.ArrayList;
+/*
+ *
+ * * Copyright (C) 2022 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 java.util.ArrayList;
+/*
+ *
+ * * Copyright (C) 2022 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 java.util.ArrayList;
+/*
+ *
+ * * Copyright (C) 2022 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 java.util.ArrayList;