import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@MapperScan("org.onap.usecaseui.intentanalysis.mapper")
@SpringBootApplication
@EnableTransactionManagement
+@EnableAsync
public class IntentAnalysisApplication {
public static void main(String[] args) {
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.eventAndPublish.event.IntentCreateEvent;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.springframework.context.ApplicationContext;
actuationModule.fulfillIntent(intentGoalBean, handler);
//update origin intent if need
actuationModule.updateIntentOperationInfo(originalIntent, intentGoalBean);
+
+ String intentStatus = "success";
+ IntentCreateEvent intentCreateEvent = new IntentCreateEvent(this, originalIntent, intentGoalBean, handler, intentStatus);
+ applicationContext.publishEvent(intentCreateEvent);
return intentGoalBean.getIntent().getIntentName() +" Intent operate finished";
}
}
import lombok.Data;
-import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessActuationModule;
-import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessDecisionModule;
-import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessKnowledgeModule;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentEventRecord;
+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.intentEventRecord.IntentEventRecordService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+@Slf4j
@Data
@Component("CLLBusinessIntentManagementFunction")
public class CLLBusinessIntentManagementFunction extends IntentManagementFunction {
- @Resource(name= "CLLBusinessActuationModule")
+ @Resource(name = "CLLBusinessActuationModule")
public void setActuationModule(ActuationModule actuationModule) {
- this.actuationModule=actuationModule;
+ this.actuationModule = actuationModule;
}
- @Resource(name= "CLLBusinessKnowledgeModule")
+
+ @Resource(name = "CLLBusinessKnowledgeModule")
public void setKnowledgeModule(KnowledgeModule knowledgeModule) {
- this.knowledgeModule=knowledgeModule;
+ this.knowledgeModule = knowledgeModule;
}
- @Resource(name= "CLLBusinessDecisionModule")
+
+ @Resource(name = "CLLBusinessDecisionModule")
public void setDecisionModule(DecisionModule decisionModule) {
- this.decisionModule=decisionModule;
+ this.decisionModule = decisionModule;
+ }
+
+ @Autowired
+ public IntentContextService intentContextService;
+ @Autowired
+ IntentInterfaceService intentInterfaceService;
+ @Autowired
+ ApplicationContext applicationContext;
+ @Autowired
+ ContextService contextService;
+ @Autowired
+ IntentService intentService;
+ @Autowired
+ IntentEventRecordService intentEventRecordService;
+
+ @Resource(name = "intentTaskExecutor")
+ ThreadPoolTaskExecutor executor;
+
+ @Override
+ public void receiveIntentAsOwner(IntentGoalBean intentGoalBean) {
+ IntentGoalBean originIntentGoalBean = detection(intentGoalBean);
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> linkedMap = investigation(originIntentGoalBean);
+ implementIntent(intentGoalBean.getIntent(), linkedMap);
+ if (intentGoalBean.getIntentGoalType() == IntentGoalType.DELETE) {
+ List<Context> parentInfo = intentGoalBean.getIntent().getIntentContexts().stream().filter(a ->
+ StringUtils.equalsIgnoreCase(a.getContextName(), "parentIntent info")).collect(Collectors.toList());
+
+ String userInputId = parentInfo.get(0).getContextConditions().get(0).getConditionValue();
+ intentService.deleteIntent(intentGoalBean.getIntent().getIntentId());
+ intentService.deleteIntent(userInputId);
+ }
+ }
+
+ @Override
+ public void receiveIntentAsHandler(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ ActuationModule actuationModule = handler.getActuationModule();
+ IntentGoalType type = intentGoalBean.getIntentGoalType();
+ if (type == IntentGoalType.CREATE) {
+ actuationModule.saveIntentToDb(intentGoalBean.getIntent());
+ } else if (type == IntentGoalType.UPDATE) {
+ actuationModule.updateIntentToDb(intentGoalBean.getIntent());
+ } else if (type == IntentGoalType.DELETE) {
+ actuationModule.deleteIntentToDb(intentGoalBean.getIntent());
+ }
+ //update origin intent if need
+ actuationModule.updateIntentOperationInfo(originalIntent, intentGoalBean);
+ handler.receiveIntentAsOwner(intentGoalBean);
+
+ }
+
+ public IntentGoalBean detection(IntentGoalBean intentGoalBean) {
+ Intent originIntent = intentGoalBean.getIntent();
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ //return knowledgeModule.intentCognition(originIntent);
+ return intentGoalBean;
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ return new IntentGoalBean(intentGoalBean.getIntent(), IntentGoalType.UPDATE);
+ } else {
+ return new IntentGoalBean(intentGoalBean.getIntent(), IntentGoalType.DELETE);
+ }
+ }
+
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigation(IntentGoalBean intentGoalBean) {
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ return decisionModule.investigationCreateProcess(intentGoalBean);
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ return decisionModule.investigationUpdateProcess(intentGoalBean);
+ } else {
+ return decisionModule.investigationDeleteProcess(intentGoalBean);
+ }
+ }
+
+ @SneakyThrows
+ public boolean implementIntent(Intent originIntent, LinkedHashMap<IntentGoalBean, IntentManagementFunction> linkedIntentMap) {
+ Iterator<Map.Entry<IntentGoalBean, IntentManagementFunction>> iterator = linkedIntentMap.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<IntentGoalBean, IntentManagementFunction> next = iterator.next();
+ IntentGoalBean newIntentGoalBean = next.getKey();
+ IntentGoalType intentGoalType = newIntentGoalBean.getIntentGoalType();
+ IntentManagementFunction handler = next.getValue();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ Intent newIdIntent = decisionModule.intentObjectDefine(originIntent, next.getKey().getIntent());
+ intentContextService.updateIntentOwnerHandlerContext(newIdIntent, this, next.getValue());
+ intentContextService.updateParentIntentContext(originIntent, newIdIntent);
+ intentContextService.updateChindIntentContext(originIntent, newIdIntent);
+ contextService.updateContextList(originIntent.getIntentContexts(), originIntent.getIntentId());
+ //intent-Distribution-create
+ boolean isAcceptCreate = intentInterfaceService.createInterface(originIntent,
+ new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), next.getValue());
+ // TODO: 2023/3/27 isParallel status need deal before distribution
+ boolean isParallel = false;
+ if (!isParallel) {
+ //Block and regularly query whether the event is published
+ boolean isPublish = false;
+ while (isPublish) {
+ Thread.sleep(1000);
+ IntentEventRecord record = intentEventRecordService.getIntentEventRecordByntentId(newIdIntent.getIntentId(), "create");
+ if (null != record) {
+ isPublish = true;
+ }
+ }
+ }
+ // return isAcceptCreate;
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ //define process just send probe interface
+ // intent-Distribution-update
+ boolean isAcceptupdate = intentInterfaceService.updateInterface(originIntent,
+ next.getKey(), next.getValue());
+ } else {
+ // actuationModule.deleteIntentToDb(next.getKey().getIntent());
+ // intent-Distribution-delete
+ boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent,
+ next.getKey(), next.getValue());
+ }
+ }
+ return false;
}
}
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- toNextIntentHandler(intentGoalBean, intentHandler);
+ //toNextIntentHandler(intentGoalBean, intentHandler);
+ intentHandler.receiveIntentAsOwner(intentGoalBean);
}
@Override
@Override
public boolean recieveCreateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveUpdateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveDeleteIntent() {
- return false;
+ return true;
}
void intentReportResolution() {
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt;
import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.onap.usecaseui.intentanalysis.Thread.CreateCallable;
+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.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.concurrent.FutureTask;
+
+@Slf4j
@Data
@Component("CLLAssuranceIntentManagementFunction")
public class CLLAssuranceIntentManagementFunction extends IntentManagementFunction {
public void setDecisionModule(DecisionModule decisionModule) {
this.decisionModule = decisionModule;
}
+
+ @Autowired
+ ApplicationContext applicationContext;
+ @Resource(name = "intentTaskExecutor")
+ ThreadPoolTaskExecutor executor;
+
+ @Override
+ public void receiveIntentAsOwner(IntentGoalBean intentGoalBean) {
+ }
+
+ @Override
+ public void receiveIntentAsHandler(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ //ask knowledgeModole of handler imf for permision and operate
+ try {
+ log.debug("cllAssurance Intent {} begin time:{}", intentGoalBean.getIntentGoalType(), LocalDateTime.now());
+ log.debug(Thread.currentThread().getName());
+ CreateCallable createCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
+ FutureTask<String> futureTask = new FutureTask<>(createCallable);
+ executor.submit(futureTask);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
}
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
-import java.util.List;
-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.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
@Override
public boolean recieveCreateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveUpdateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveDeleteIntent() {
- return false;
+ return true;
}
/**
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt;
import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.onap.usecaseui.intentanalysis.Thread.CreateCallable;
+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.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.concurrent.FutureTask;
+
+@Slf4j
@Data
@Component("CLLDeliveryIntentManagementFunction")
public class CLLDeliveryIntentManagementFunction extends IntentManagementFunction {
public void setDecisionModule(DecisionModule decisionModule) {
this.decisionModule = decisionModule;
}
+
+ @Autowired
+ ApplicationContext applicationContext;
+ @Resource(name = "intentTaskExecutor")
+ ThreadPoolTaskExecutor executor;
+
+ @Override
+ public void receiveIntentAsOwner(IntentGoalBean intentGoalBean) {
+ }
+
+ @Override
+ public void receiveIntentAsHandler(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ //ask knowledgeModole of handler imf for permision and operate
+ try {
+ log.debug("cllDelivery Intent create begin time:" + LocalDateTime.now());
+ CreateCallable createCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
+ FutureTask<String> futureTask = new FutureTask<>(createCallable);
+ executor.submit(futureTask);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
}
*/
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule;
-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.DecisionModule;
@Override
public boolean recieveCreateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveUpdateIntent() {
- return false;
+ return true;
}
@Override
public boolean recieveDeleteIntent() {
- return false;
+ return true;
}
}
package org.onap.usecaseui.intentanalysis.formatintentinputMgt;
import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGenerateType;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+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.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.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.util.*;
+@Slf4j
@Data
@Component("formatIntentInputManagementFunction")
public class FormatIntentInputManagementFunction extends IntentManagementFunction {
+ @Autowired
+ public IntentContextService intentContextService;
- @Resource(name= "formatIntentInputKnowledgeModule")
+ @Resource(name = "formatIntentInputKnowledgeModule")
public void setKnowledgeModule(KnowledgeModule knowledgeModule) {
- this.knowledgeModule=knowledgeModule;
+ this.knowledgeModule = knowledgeModule;
}
- @Resource(name= "formatIntentInputActuationModule")
+
+ @Resource(name = "formatIntentInputActuationModule")
public void setActuationModule(ActuationModule actuationModule) {
- this.actuationModule=actuationModule;
+ this.actuationModule = actuationModule;
}
- @Resource(name= "formatIntentInputDecisionModule")
+
+ @Resource(name = "formatIntentInputDecisionModule")
public void setDecisionModule(DecisionModule decisionModule) {
- this.decisionModule=decisionModule;
+ this.decisionModule = decisionModule;
+ }
+
+ @Autowired
+ IntentInterfaceService intentInterfaceService;
+ @Autowired
+ ApplicationContext applicationContext;
+ @Autowired
+ IntentService intentService;
+
+ @Override
+ public void receiveIntentAsOwner(IntentGoalBean intentGoalBean) {
+
+ IntentGoalBean originIntentGoalBean = detection(intentGoalBean);
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> linkedMap = investigation(originIntentGoalBean);
+ implementIntent(intentGoalBean.getIntent(), linkedMap);
+ }
+
+ @Override
+ public void receiveIntentAsHandler(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ }
+
+ public IntentGoalBean detection(IntentGoalBean intentGoalBean) {
+ Intent originIntent = intentGoalBean.getIntent();
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ return knowledgeModule.intentCognition(originIntent);
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ return new IntentGoalBean(intentGoalBean.getIntent(), IntentGoalType.UPDATE);
+ } else {
+ return new IntentGoalBean(intentGoalBean.getIntent(), IntentGoalType.DELETE);
+ }
+ }
+
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigation(IntentGoalBean intentGoalBean) {
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ return decisionModule.investigationCreateProcess(intentGoalBean);
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ return decisionModule.investigationUpdateProcess(intentGoalBean);
+ } else {
+ return decisionModule.investigationDeleteProcess(intentGoalBean);
+ }
+ }
+
+ public boolean implementIntent(Intent originIntent, LinkedHashMap<IntentGoalBean, IntentManagementFunction> linkedIntentMap) {
+ Iterator<Map.Entry<IntentGoalBean, IntentManagementFunction>> iterator = linkedIntentMap.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<IntentGoalBean, IntentManagementFunction> next = iterator.next();
+ IntentGoalBean newIntentGoalBean = next.getKey();
+ IntentGoalType intentGoalType = newIntentGoalBean.getIntentGoalType();
+ if (intentGoalType == IntentGoalType.CREATE) {
+ Intent newIdIntent = decisionModule.intentObjectDefine(originIntent, next.getKey().getIntent());
+ intentContextService.updateIntentOwnerHandlerContext(newIdIntent, this, next.getValue());
+ intentContextService.updateParentIntentContext(originIntent, newIdIntent);
+ intentContextService.updateChindIntentContext(originIntent, newIdIntent);
+ //intent-Distribution-create
+ boolean isAcceptCreate = intentInterfaceService.createInterface(originIntent,
+ new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), next.getValue());
+ originIntent.setIntentGenerateType(IntentGenerateType.USERINPUT);
+ //save user input intent
+ intentService.createIntent(originIntent);
+ return isAcceptCreate;
+ } else if (intentGoalType == IntentGoalType.UPDATE) {
+ log.info("formatIntentInputIMF UPDATE");
+ //update cllBusinessIntent's expectation
+ Intent subIntent = newIntentGoalBean.getIntent();
+ updateIntentInfo(originIntent, subIntent);
+ // intent-Distribution and operate |update cllBusiness intent
+ boolean isAcceptUpdate = intentInterfaceService.updateInterface(originIntent,
+ new IntentGoalBean(subIntent, IntentGoalType.UPDATE), next.getValue());
+ //update userInput intent
+ intentService.updateIntent(originIntent);
+ } else {
+ // intent-Distribution-delete
+ boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent, next.getKey(), next.getValue());
+ }
+ }
+ return true;
+ }
+
+ 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();
+
+ List<Expectation> changeList = new ArrayList<>();
+ if (newIntentExpectationNum != oldIntentExpectationNum) {
+ if (newIntentExpectationNum < oldIntentExpectationNum) {
+
+ for (Expectation oldExpectation : intentExpectationList) {//search
+ boolean bFindExpectation = false;
+ for (Expectation newExpectation : originIntentExpectationList) {//param
+ if (oldExpectation.getExpectationName().equals(newExpectation.getExpectationName())) {
+ bFindExpectation = true;
+ break;
+ }
+ }
+ if (bFindExpectation) {
+ changeList.add(oldExpectation);
+ }
+ }
+ }
+ }
+ intent.setIntentExpectations(changeList);
}
}
List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
for (Intent intent : subIntentList) {
IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
- UpdateIntentInfo(intentGoalBean.getIntent(), intent);
+ // UpdateIntentInfo(intentGoalBean.getIntent(), intent);//new process move to defineProcess
IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
intentMap.put(subIntentGoalBean, intentHandlerInfo);
}
import lombok.Data;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
protected ActuationModule actuationModule;
protected DecisionModule decisionModule;
protected KnowledgeModule knowledgeModule;
+
+ public void receiveIntentAsOwner(IntentGoalBean intentGoalBean){};
+ public void receiveIntentAsHandler(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler){};
}
@Autowired
ApplicationContext applicationContext;
+ public void updateIntentContext(Intent newIdIntent,Intent originIntent,IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){
+ updateIntentOwnerHandlerContext(newIdIntent, intentOwner, intentHandler);
+ updateParentIntentContext(originIntent, newIdIntent);
+ updateChindIntentContext(originIntent, newIdIntent);
+ }
+
public void updateChindIntentContext(Intent originIntent, Intent intent){
List<Context> contextList = intent.getIntentContexts();
if (CollectionUtils.isEmpty(contextList)) {
public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
- return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue());
+ return intentInterfaceService.createInterface(entry.getKey(), entry.getValue());
} else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
- return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue());
+ return intentInterfaceService.updateInterface(entry.getKey(), entry.getValue());
} else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
- return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue());
+ return intentInterfaceService.deleteInterface(entry.getKey(), entry.getValue());
}
return false;
}
// find intentManageFunction
public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean);
- public Intent intentDefinition(Intent originIntent, Intent intent) {
+ public Intent intentObjectDefine(Intent originIntent, Intent intent) {
log.debug("definition create process start to define intent:" + intent.getIntentName());
Intent newIntent = new Intent();
newIntent.setIntentId(CommonUtil.getUUid());
IntentGoalBean newIntentGoalBean = entry.getKey();
if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.CREATE){
- Intent newIdIntent = intentDecisionModule.intentDefinition(originIntent, entry.getKey().getIntent());
+ Intent newIdIntent = intentDecisionModule.intentObjectDefine(originIntent, entry.getKey().getIntent());
intentContextService.updateIntentOwnerHandlerContext(newIdIntent, intentOwner, intentHandler);
intentContextService.updateParentIntentContext(originIntent, newIdIntent);
intentContextService.updateChindIntentContext(originIntent, newIdIntent);
package org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
public interface IntentInterfaceService {
- public boolean createInterface(Intent intent, IntentManagementFunction imf);
+ public boolean createInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
+ public boolean createInterface(Intent originalIntent,IntentGoalBean intentGoalBean, IntentManagementFunction imf);
- public boolean updateInterface(Intent intent, IntentManagementFunction imf);
+ public boolean updateInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
+ public boolean updateInterface(Intent originalIntent,IntentGoalBean intentGoalBean, IntentManagementFunction imf);
+
+ public boolean deleteInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
+ public boolean deleteInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction imf);
- public boolean deleteInterface(Intent intent, IntentManagementFunction imf);
}
package org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.impl;
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.intentinterfaceservice.IntentInterfaceService;
import org.springframework.stereotype.Service;
+import java.time.LocalDateTime;
+
@Service
public class IntentInterfaceServiceImpl implements IntentInterfaceService {
@Override
- public boolean createInterface(Intent intent, IntentManagementFunction imf) {
- //ask knowledgeModole of handler imf for permision
- imf.getKnowledgeModule().recieveCreateIntent();
+ public boolean createInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf) {
return false;
}
@Override
- public boolean updateInterface(Intent intent, IntentManagementFunction imf) {
- imf.getKnowledgeModule().recieveUpdateIntent();
- return false;
+ public boolean createInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ //ask knowledgeModole of handler imf for permision
+ boolean receive = handler.getKnowledgeModule().recieveCreateIntent();
+ LocalDateTime now = LocalDateTime.now();
+ if (receive) {
+ handler.receiveIntentAsHandler(originalIntent, intentGoalBean, handler);
+ }
+ return receive;
+
}
@Override
- public boolean deleteInterface(Intent intent, IntentManagementFunction imf) {
- imf.getKnowledgeModule().recieveDeleteIntent();
+ public boolean updateInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf) {
return false;
}
+
+ @Override
+ public boolean updateInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ boolean receive = handler.getKnowledgeModule().recieveUpdateIntent();
+ if (receive) {
+ handler.receiveIntentAsHandler(originalIntent, intentGoalBean, handler);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean deleteInterface(IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ handler.getKnowledgeModule().recieveDeleteIntent();
+ return true;
+ }
+
+ @Override
+ public boolean deleteInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
+ boolean receive = handler.getKnowledgeModule().recieveDeleteIntent();
+ if (receive) {
+ handler.receiveIntentAsHandler(originalIntent, intentGoalBean, handler);
+ }
+ return true;
+ }
}
support_interfaces varchar(255),
handle_name varchar(255),
intent_function_type varchar(255)
+ );
+
+create table if not exists intent_Event_Record(
+ id varchar(255) DEFAULT uuid_generate_v4 (),
+ intentId varchar(255),
+ intentName varchar(255),
+ intentStatus varchar (225),
+ operateType varchar (225)
);
\ No newline at end of file
handle_name varchar(255),
intent_function_type varchar(255)
);
+
+create table if not exists intent_Event_Record(
+ id varchar(255) DEFAULT random_uuid(),
+ intentId varchar(255),
+ intentName varchar(255),
+ intentStatus varchar (225),
+ operateType varchar (225)
+ );