+++ /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.bean.models;
-
-import lombok.Data;
-
-@Data
-public class IntentReportFulfillmentInfo extends FulfillmentInfo{
- // This id is the intentReportId of the associated intentReport
- private String intentReportId;
-}
+++ /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.bean.models;
-
-import lombok.Data;
-
-@Data
-public class State {
-
- private String stateId;
-
- private String stateName;
-
- private String condition;
-
- private Boolean isSatisfied;
-
-}
@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();
+ for (Map.Entry<IntentGoalBean, IntentManagementFunction> next : linkedIntentMap.entrySet()) {
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.updateIntentOwnerHandlerContext(newIdIntent, this, handler);
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());
+ new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), handler);
// TODO: 2023/3/27 isParallel status need deal before distribution
boolean isParallel = false;
if (!isParallel) {
}
log.debug("Try to get record of intent CREATE event from DB.");
IntentEventRecord record = intentEventRecordService.getIntentEventRecordByIntentId(
- newIdIntent.getIntentId(), intentGoalType.toString());
+ newIdIntent.getIntentId(), intentGoalType.toString());
if (record != null) {
isPublish = true;
log.debug("Successfully got Intent Event Record from DB.");
//define process just send probe interface
// intent-Distribution-update
boolean isAcceptupdate = intentInterfaceService.updateInterface(originIntent,
- next.getKey(), next.getValue());
+ next.getKey(), handler);
} else {
// actuationModule.deleteIntentToDb(next.getKey().getIntent());
// intent-Distribution-delete
boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent,
- next.getKey(), next.getValue());
+ next.getKey(), handler);
}
}
return false;
*/
package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
-
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
@Autowired
IntentInterfaceService intentInterfaceService;
-
- @Override
- public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
- }
-
@Override
public void directOperation(IntentGoalBean intentGoalBean) {
}
- @Override
- public void interactWithIntentHandle() {
-
- }
-
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
//toNextIntentHandler(intentGoalBean, intentHandler);
intentHandler.receiveIntentAsOwner(intentGoalBean);
}
-
@Override
public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
@Autowired
IntentContextService intentContextService;
- @Override
- public void determineUltimateGoal() {
- }
-
@Override
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
// db filter imf supportArea;
return (IntentManagementFunction) applicationContext.getBean(imfRegInfo.getHandleName());
}
-
- @Override
- public void decideSuitableAction() {
- }
-
-
public boolean needDecompostion(IntentGoalBean intentGoalBean) {
//different expectationType need decompostion ExpectationType>1 or objtype>1
if (intentGoalBean.getIntentGoalType().equals(IntentGoalType.CREATE)) {
return sortList;
}
- @Override
- public void interactWithTemplateDb() {
- }
-
@Override
public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
log.info("CLLBusinessIntentManagementFunction investigation create process start");
}
}
- if (false == bFindIntent) {
+ if (!bFindIntent) {
intentContextService.deleteSubIntentContext(originIntent, intent.getIntentId());
IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
intentMap.put(subIntentGoalBean, intentHandlerInfo);
*/
package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
-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.intentModule.KnowledgeModule;
import org.onap.usecaseui.intentanalysis.service.IntentService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CLLBusinessKnowledgeModule extends KnowledgeModule {
- private static Logger LOGGER = LoggerFactory.getLogger(CLLBusinessKnowledgeModule.class);
-
@Autowired
IntentService intentService;
@Override
public IntentGoalBean intentCognition(Intent intent) {
List<String> intendIdList = intentResolution(intent);
- getSystemStatus();
return determineDetectionGoal(intent, intendIdList);
}
public boolean recieveDeleteIntent() {
return true;
}
-
- void intentReportResolution() {
- }
-
- /**
- * query the implementation of intent requirements in the system
- */
- void getSystemStatus() {
- }
-
-
- void interactWithIntentOwner() {
- }
-
- /**
- * Determine add, delete, modify according to theobject,target and context of the expectation
- */
- public IntentGoalBean determineDetectionGoal(Intent intent, List<String> intentIdList) {
- int size = intentIdList.size();
- if (size == 0) {
- return new IntentGoalBean(intent, IntentGoalType.CREATE);
- } else {
- return new IntentGoalBean(intent, IntentGoalType.UPDATE);
- }
- }
-
}
@Autowired
private PolicyService policyService;
- @Override
- public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
-
- }
-
@Override
public void directOperation(IntentGoalBean intentGoalBean) {
Intent intent = intentGoalBean.getIntent();
List<String> cllIds = getCLLId(intent);
+ if (CollectionUtils.isEmpty(cllIds)) {
+ log.info("get cllId is empty");
+ return;
+ }
cllIds.forEach(cllId -> {
String bandwidth = getBandwidth(cllId);
IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
});
}
- @Override
- public void interactWithIntentHandle() {
-
- }
-
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
directOperation(intentGoalBean);
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
+
@Component
public class CLLAssuranceDecisionModule extends DecisionModule {
- @Override
- public void determineUltimateGoal() {
-
- }
-
@Override
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
return null;
}
-
- @Override
- public void decideSuitableAction() {
-
- }
-
- @Override
- public void interactWithTemplateDb() {
-
- }
-
@Override
public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
return null;
@Autowired
private IntentService intentService;
- @Override
- public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
-
- }
-
@Override
public void directOperation(IntentGoalBean intentGoalBean) {
Intent intent = intentGoalBean.getIntent();
}
}
- @Override
- public void interactWithIntentHandle() {
-
- }
-
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
this.directOperation(intentGoalBean);
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
+
@Component
public class CLLDeliveryDecisionModule extends DecisionModule {
- @Override
- public void determineUltimateGoal() {
-
- }
-
@Override
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
return null;
}
-
- @Override
- public void decideSuitableAction() {
-
- }
-
- @Override
- public void interactWithTemplateDb() {
-
- }
-
@Override
public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
return null;
}
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();
+ for (Map.Entry<IntentGoalBean, IntentManagementFunction> next : linkedIntentMap.entrySet()) {
IntentGoalBean newIntentGoalBean = next.getKey();
IntentGoalType intentGoalType = newIntentGoalBean.getIntentGoalType();
if (intentGoalType == IntentGoalType.CREATE) {
new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), next.getValue());
originIntent.setIntentGenerateType(IntentGenerateType.USERINPUT);
//save user input intent
- intentService.createIntent(originIntent);
+ actuationModule.saveIntentToDb(originIntent);
return isAcceptCreate;
} else if (intentGoalType == IntentGoalType.UPDATE) {
log.info("formatIntentInputIMF UPDATE");
Intent subIntent = newIntentGoalBean.getIntent();
updateIntentInfo(originIntent, subIntent);
//update userInput intent
- intentService.updateIntent(originIntent);
+ actuationModule.updateIntentToDb(originIntent);
// intent-Distribution and operate |update cllBusiness intent
boolean isAcceptUpdate = intentInterfaceService.updateInterface(originIntent,
new IntentGoalBean(subIntent, IntentGoalType.UPDATE), next.getValue());
} else {
//deal with userInput intent
- intentService.deleteIntent(originIntent.getIntentId());
+ actuationModule.deleteIntentToDb(originIntent);
// intent-Distribution-delete
boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent, next.getKey(), next.getValue());
}
@Autowired
IntentService intentService;
- @Override
- public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
- log.info("do nothing");
- }
-
@Override
public void directOperation(IntentGoalBean intentGoalBean) {
}
- @Override
- public void interactWithIntentHandle() {
- }
-
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
}
-
-
public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
}
-
}
@Autowired
public IntentService intentService;
- @Override
- public void determineUltimateGoal() {
- }
-
@Override
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
// if intentName contain cll return
}
}
-
- @Override
- public void decideSuitableAction() {
- }
-
- @Override
- public void interactWithTemplateDb() {
- }
-
@Override
public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
log.info("FormatIntentInputMgt investigation create process start");
if (expectationNameList.size() > 1) {
List<String> cllList = expectationNameList.stream().filter(x -> StringUtils.containsIgnoreCase(x, "cll")).collect(Collectors.toList());
List<String> slicingList = expectationNameList.stream().filter(x -> StringUtils.containsIgnoreCase(x, "slicing")).collect(Collectors.toList());
- if (cllList.size() > 0 && slicingList.size() > 0) {
- return true;
- }
+ return cllList.size() > 0 && slicingList.size() > 0;
}
return false;
}
*/
package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule;
-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.intentModule.KnowledgeModule;
@Override
public IntentGoalBean intentCognition(Intent intent) {
List<String> intendIdList = intentResolution(intent);
- getSystemStatus();
return determineDetectionGoal(intent, intendIdList);
}
public boolean recieveDeleteIntent() {
return false;
}
-
- public void getSystemStatus() {
- }
-
- public IntentGoalBean determineDetectionGoal(Intent intent, List<String> intentIdList) {
- int size = intentIdList.size();
- if (size == 0) {
- return new IntentGoalBean(intent, IntentGoalType.CREATE);
- } else {
- return new IntentGoalBean(intent, IntentGoalType.UPDATE);
- }
- }
}
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule;
-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.service.IntentService;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.Map;
-
public abstract class ActuationModule {
@Autowired
IntentInterfaceService intentInterfaceService;
@Autowired
IntentService intentService;
- //send to the next level intent handler
- public abstract void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler);
-
//Direct operation
public abstract void directOperation(IntentGoalBean intentGoalBean);
- public abstract void interactWithIntentHandle();
-
//Save intent information to the intent instance database
public void saveIntentToDb(Intent intent) {
intentService.createIntent(intent);
intentService.deleteIntent(intent.getIntentId());
}
- public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
- IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
- return false;
- }
-
//determine if the intent is to be processed directly or sent to the next-level processor
public abstract void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler);
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule;
-
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGenerateType;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
+
@Slf4j
public abstract class DecisionModule {
- public abstract void determineUltimateGoal();
-
// find intentManageFunction
public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean);
return newIntent;
}
- public abstract void decideSuitableAction();
-
- public abstract void interactWithTemplateDb();
-
public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean);
public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean);
}
return context;
}
-
-
}
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.springframework.beans.factory.annotation.Autowired;
public abstract boolean recieveDeleteIntent();
- public List<String> intentResolution(Intent intent) {
+ protected List<String> intentResolution(Intent intent) {
//db contain original intent
List<Intent> sameNameIntentList = intentService.getIntentByName(intent.getIntentName());
List<String> intentIdList = new ArrayList<>();
return intentIdList;
}
- public List<Intent> filterIntent(List<Intent> list) {
+ /**
+ * Determine add, delete, modify according to theobject,target and context of the expectation
+ */
+ protected IntentGoalBean determineDetectionGoal(Intent intent, List<String> intentIdList) {
+ int size = intentIdList.size();
+ if (size == 0) {
+ return new IntentGoalBean(intent, IntentGoalType.CREATE);
+ } else {
+ return new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ }
+ }
+
+ private List<Intent> filterIntent(List<Intent> list) {
List<Intent> fiterList = new ArrayList<>();
for (Intent intent : list) {
//filter the intent which save first time in controller
break;
}
}
- if (equals == true) {
+ if (equals) {
break;
}
}
achieve_value varchar(255)
);
-create table if not exists state(
- state_id varchar(255) primary key,
- state_name varchar(255),
- is_satisfied boolean,
- condition varchar(255),
- expectation_id varchar(255)
-);
-
create table if not exists condition(
condition_id varchar(255) primary key,
condition_name varchar(255),
+++ /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.bean.models;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class StateTest {
- @Before
- public void before() throws Exception {
- }
-
- @After
- public void after() throws Exception {
- }
-
- @Test
- public void testGetStateTest() {
- State test = new State();
- test.getStateId();
- test.getStateName();
- test.getCondition();
- test.getIsSatisfied();
-
- }
-
- @Test
- public void testSetStateTest() {
- State test = new State();
- test.setStateId("");
- test.setStateName("");
- test.setCondition("");
- test.setIsSatisfied(true);
- }
-}