summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAPICall.java11
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAuthConfig.java33
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java17
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAuthConfig.java33
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java37
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/AssuranceIntentManagementFunction.java6
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceActuationModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceDecisionModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceKnowledgeModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/CCVPNInstance.java15
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java20
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java8
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/DeliveryManagementFunction.java15
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryActuationModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryDecisionModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryKnowledgeModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java84
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java34
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java14
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java92
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java69
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java14
27 files changed, 309 insertions, 231 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAPICall.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAPICall.java
index ead4d2c..db89ed6 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAPICall.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAPICall.java
@@ -18,8 +18,19 @@ package org.onap.usecaseui.intentanalysis.adapters.aai.apicall;
import com.alibaba.fastjson.JSONObject;
import retrofit2.Call;
import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
public interface AAIAPICall {
@GET("/aai/v24/network/network-routes")
Call<JSONObject> queryNetworkRoute();
+
+ @Headers({
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Content-Type: application/json",
+ "Accept: application/json"
+ })
+ @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}")
+ Call<JSONObject> getInstanceInfo(@Path("resource-service-id") String resourceServiceId);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAuthConfig.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAuthConfig.java
new file mode 100644
index 0000000..7e85e40
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/aai/apicall/AAIAuthConfig.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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.aai.apicall;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+@Getter
+@Setter
+public class AAIAuthConfig {
+
+ @Value("${rest.aai.username}")
+ private String userName;
+
+ @Value("${rest.aai.password}")
+ private String password;
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
index 11fae26..cd07292 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
@@ -22,26 +22,19 @@ import retrofit2.http.*;
public interface SOAPICall {
@Headers({
- "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
- "Accept: application/json"
+ "Accept: application/json",
+ "Content-Type: application/json"
})
@POST("/so/infra/serviceIntent/v1/create")
Call<JSONObject> createIntentInstance(@Body RequestBody body);
@Headers({
- "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
- "Accept: application/json"
+ "Accept: application/json",
+ "Content-Type: application/json"
})
@HTTP(method="DELETE", path="/so/infra/serviceIntent/v1/delete", hasBody = true)
Call<JSONObject> deleteIntentInstance(@Body RequestBody body);
- @Headers({
- "X-TransactionId: 9999",
- "X-FromAppId: MSO",
- "Authorization: Basic QUFJOkFBSQ==",
- "Accept: application/json"
- })
- @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}")
- Call<JSONObject> getInstanceInfo(@Path("resource-service-id") String resourceServiceId);
+
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAuthConfig.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAuthConfig.java
new file mode 100644
index 0000000..042be41
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAuthConfig.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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.apicall;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+@Getter
+@Setter
+public class SOAuthConfig {
+
+ @Value("${rest.so.username}")
+ private String userName;
+
+ @Value("${rest.so.password}")
+ private String password;
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
index 7f34584..e4e1f60 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
@@ -18,11 +18,18 @@ package org.onap.usecaseui.intentanalysis.adapters.so.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAPICall;
+import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAuthConfig;
+import org.onap.usecaseui.intentanalysis.adapters.policy.apicall.PolicyAPICall;
+import org.onap.usecaseui.intentanalysis.adapters.policy.apicall.PolicyAuthConfig;
import org.onap.usecaseui.intentanalysis.adapters.so.SOService;
import org.onap.usecaseui.intentanalysis.adapters.so.apicall.SOAPICall;
+import org.onap.usecaseui.intentanalysis.adapters.so.apicall.SOAuthConfig;
import org.onap.usecaseui.intentanalysis.bean.models.CCVPNInstance;
+import org.onap.usecaseui.intentanalysis.util.RestfulServices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import retrofit2.Response;
import java.io.IOException;
import java.util.ArrayList;
@@ -37,6 +44,30 @@ public class SOServiceImpl implements SOService {
private SOAPICall soapiCall;
+ private AAIAPICall aaiapiCall;
+
+ @Autowired
+ SOAuthConfig soAuthConfig;
+
+ @Autowired
+ AAIAuthConfig aaiAuthConfig;
+
+ public SOAPICall getSoApiCall() {
+ if (null == soapiCall) {
+ this.soapiCall = RestfulServices.create(SOAPICall.class, soAuthConfig.getUserName(),
+ soAuthConfig.getPassword());
+ }
+ return this.soapiCall;
+ }
+
+ public AAIAPICall getAaiApiCall() {
+ if (null == aaiapiCall) {
+ this.aaiapiCall = RestfulServices.create(AAIAPICall.class, aaiAuthConfig.getUserName(),
+ aaiAuthConfig.getPassword());
+ }
+ return this.aaiapiCall;
+ }
+
@Override
public int createCCVPNInstance(CCVPNInstance ccvpnInstance) {
try{
@@ -81,7 +112,7 @@ public class SOServiceImpl implements SOService {
Map<String, Object> params = paramsSetUp(ccvpnInstance);
params.put("additionalProperties",additionalPropertiesSetUp(ccvpnInstance));
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
- Response<JSONObject> response = soapiCall.createIntentInstance(requestBody).execute();
+ Response<JSONObject> response = getSoApiCall().createIntentInstance(requestBody).execute();
if (response.isSuccessful()) {
return response.body().getString("jobId");
}
@@ -98,14 +129,14 @@ public class SOServiceImpl implements SOService {
additionalProperties.put("enableSdnc", "true");
params.put("additionalProperties", additionalProperties);
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
- soapiCall.deleteIntentInstance(requestBody).execute();
+ getSoApiCall().deleteIntentInstance(requestBody).execute();
}
private int getCreateStatus(CCVPNInstance ccvpnInstance) throws IOException {
if (ccvpnInstance == null || ccvpnInstance.getResourceInstanceId() == null) {
return -1;
}
- Response<JSONObject> response = soapiCall.getInstanceInfo(ccvpnInstance.getResourceInstanceId()).execute();
+ Response<JSONObject> response = getAaiApiCall().getInstanceInfo(ccvpnInstance.getResourceInstanceId()).execute();
logger.debug(response.toString());
if (response.isSuccessful()) {
String status = response.body().getString("orchestration-status");
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/AssuranceIntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/AssuranceIntentManagementFunction.java
new file mode 100644
index 0000000..b4d0e57
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/AssuranceIntentManagementFunction.java
@@ -0,0 +1,6 @@
+package org.onap.usecaseui.intentanalysis.assuranceIntentmgt;
+
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+
+public class AssuranceIntentManagementFunction extends IntentManagementFunction {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceActuationModule.java
new file mode 100644
index 0000000..2f0961a
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceActuationModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.assuranceIntentmgt.assurancemodule;
+
+public class AssuranceActuationModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceDecisionModule.java
new file mode 100644
index 0000000..7965f7e
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceDecisionModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.assuranceIntentmgt.assurancemodule;
+
+public class AssuranceDecisionModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceKnowledgeModule.java
new file mode 100644
index 0000000..3e2e3d6
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/assuranceIntentmgt/assurancemodule/AssuranceKnowledgeModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.assuranceIntentmgt.assurancemodule;
+
+public class AssuranceKnowledgeModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/CCVPNInstance.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/CCVPNInstance.java
index b5d73f1..468725d 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/CCVPNInstance.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/CCVPNInstance.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
index acd580f..d2a5c53 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
@@ -20,7 +20,6 @@ import org.apache.commons.lang.StringUtils;
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.IntentHandleService;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
@@ -35,12 +34,10 @@ import java.util.Map;
import java.util.stream.Collectors;
@Service
-public class CLLBusinessActuationModule implements ActuationModule {
+public class CLLBusinessActuationModule extends ActuationModule {
@Autowired
IntentProcessService processService;
@Autowired
- IntentHandleService intentHandleService;
- @Autowired
IntentService intentService;
@Autowired
IntentInterfaceService intentInterfaceService;
@@ -73,19 +70,4 @@ public class CLLBusinessActuationModule implements ActuationModule {
}
}
-
- @Override
- public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) {
- for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : intentMap.entrySet()) {
- IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
- if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
- return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
- return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
- return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue());
- }
- }
- return false;
- }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java
index 3313af5..564429b 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
@Log4j2
@Service
-public class CLLBusinessDecisionModule implements DecisionModule {
+public class CLLBusinessDecisionModule extends DecisionModule {
@Autowired
private ImfRegInfoService imfRegInfoService;
@Autowired
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java
index c7d0872..d93f3f5 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java
@@ -34,7 +34,7 @@ import java.util.List;
import java.util.stream.Collectors;
@Service
-public class CLLBusinessKnowledgeModule implements KnowledgeModule {
+public class CLLBusinessKnowledgeModule extends KnowledgeModule {
private static Logger LOGGER = LoggerFactory.getLogger(CLLBusinessKnowledgeModule.class);
@Autowired
@@ -44,7 +44,7 @@ public class CLLBusinessKnowledgeModule implements KnowledgeModule {
@Override
public IntentGoalBean intentCognition(Intent intent) {
- List<String> intendIdList = intentDetectionService.intentResolution(intent);
+ List<String> intendIdList = intentResolution(intent);
getSystemStatus();
return determineDetectionGoal(intent, intendIdList);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
index bb5e085..4983298 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
@@ -19,7 +19,8 @@ package org.onap.usecaseui.intentanalysis.controller;
import java.util.List;
-import org.onap.usecaseui.intentanalysis.intentBaseService.IntentHandleService;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -38,7 +39,7 @@ public class IntentController {
private IntentService intentService;
@Autowired
- private IntentHandleService intentHandleService;
+ private IntentProcessService processService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Intent>> getIntentList() {
@@ -70,7 +71,8 @@ public class IntentController {
@PostMapping(value="/handleIntent",produces = MediaType.APPLICATION_JSON_VALUE)
public void handleIntent(@RequestBody Intent intent) {
- intentHandleService.handleOriginalIntent(intent);
+ processService.setIntentRole(new FormatIntentInputManagementFunction(), null);
+ processService.intentProcess(intent);
}
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/DeliveryManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/DeliveryManagementFunction.java
new file mode 100644
index 0000000..b30da14
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/DeliveryManagementFunction.java
@@ -0,0 +1,15 @@
+package org.onap.usecaseui.intentanalysis.deliveryIntentmgt;
+
+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 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;
+
+public class DeliveryManagementFunction extends IntentManagementFunction {
+ private ActuationModule actuationModule = new CLLBusinessActuationModule();
+ private DecisionModule decisoinModule = new CLLBusinessDecisionModule();
+ private KnowledgeModule knowledgeModule = new CLLBusinessKnowledgeModule();
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryActuationModule.java
new file mode 100644
index 0000000..82e4b9b
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryActuationModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.deliveryIntentmgt.deliverymodule;
+
+public class DeliveryActuationModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryDecisionModule.java
new file mode 100644
index 0000000..44aed5e
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryDecisionModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.deliveryIntentmgt.deliverymodule;
+
+public class DeliveryDecisionModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryKnowledgeModule.java
new file mode 100644
index 0000000..47b30f9
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/deliveryIntentmgt/deliverymodule/DeliveryKnowledgeModule.java
@@ -0,0 +1,4 @@
+package org.onap.usecaseui.intentanalysis.deliveryIntentmgt.deliverymodule;
+
+public class DeliveryKnowledgeModule {
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
index e556356..936bf0e 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
@@ -22,7 +22,7 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.Actuatio
import java.util.List;
import java.util.Map;
-public class FormatIntentInputActuationModule implements ActuationModule {
+public class FormatIntentInputActuationModule extends ActuationModule {
@Override
public void sendToIntentHandler(IntentManagementFunction IntentHandler) {
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
index af29747..ac116fd 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-public class FormatIntentInputDecisionModule implements DecisionModule {
+public class FormatIntentInputDecisionModule extends DecisionModule {
@Autowired
ApplicationContext applicationContext;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java
index d6952f4..4fa9ee2 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java
@@ -24,13 +24,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
-public class FormatIntentInputKnowledgeModule implements KnowledgeModule {
+public class FormatIntentInputKnowledgeModule extends KnowledgeModule {
@Autowired
IntentDetectionService intentDetectionService;
@Override
public IntentGoalBean intentCognition(Intent intent) {
- List<String> intendIdList = intentDetectionService.intentResolution(intent);
+ List<String> intendIdList = intentResolution(intent);
getSystemStatus();
return determineDetectionGoal(intent, intendIdList);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java
deleted file mode 100644
index 1f18c52..0000000
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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;
-
-import lombok.extern.slf4j.Slf4j;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
-import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
-import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
-import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
-import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-@Slf4j
-@Service
-public class IntentHandleService {
- @Autowired
- private IntentProcessService processService;
- @Autowired
- private ImfRegInfoService imfRegInfoService;
- @Autowired
- private ApplicationContext applicationContext;
-
- /**
- * Process the original intent and find the corresponding IntentManagementFunction
- *
- * @param intent todo
- */
- public void handleOriginalIntent(Intent intent) {
- IntentManagementFunction intentOwner = getOriginalIMF(intent);
- handleIntent(intent, intentOwner);
- }
-
- public void handleIntent(Intent intent, IntentManagementFunction intentOwner) {
- processService.setIntentRole(intentOwner, null);
- processService.intentProcess(intent);
- }
-
- public IntentManagementFunction selectIntentManagementFunction(Intent intent) {
- //select the IntentManagementFunctionRegInfo Based on the IMFRegistry information.
- //Only internalFunction support.
- //and based on the IntentManagementFunctionRegInfo, get the right IntentManagementFunction bean.
- //if no IntentManagementFunction selected, that means this intent is not supported by this system.
- return null;
- }
-
- public IntentManagementFunctionRegInfo selectIntentManagementFunctionRegInfo(Intent intent) {
- //select the IntentManagementFunctionRegInfo Based on the IMFRegistry information.
- //Both internalFunction and externalFunction support.
- //This is used to get he IntentManagementFunction for a subIntent decomposition.
- return null;
- }
-
- public IntentManagementFunction getOriginalIMF(Intent intent) {
- //select IntentManagementFunction based on intent name
- String intentName = intent.getIntentName();
- List<IntentManagementFunctionRegInfo> imfRegInfoList = imfRegInfoService.getImfRegInfoList();
- List<IntentManagementFunctionRegInfo> list = imfRegInfoList.stream().filter(x -> x.getSupportArea().contains(intentName)).collect(Collectors.toList());
- if (!Optional.ofNullable(list).isPresent()) {
- String msg = String.format("Intent name %s doesn't exist IntentManagementFunction in database.", intent.getIntentName());
- log.error(msg);
- throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
- }
- return (IntentManagementFunction) applicationContext.getBean(list.get(0).getHandleName());
- }
-}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
index 8f753e4..e9ee3f7 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
@@ -15,19 +15,41 @@
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
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.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
-public interface ActuationModule {
+public abstract class ActuationModule {
+ @Autowired
+ IntentInterfaceService intentInterfaceService;
+
//actuationModel & knownledgeModel interact
- void sendToIntentHandler(IntentManagementFunction IntentHandler);
- void sendToNonIntentHandler();//直接操作
- void interactWithIntentHandle();
+ public abstract void sendToIntentHandler(IntentManagementFunction IntentHandler);
+
+ public abstract void sendToNonIntentHandler();//直接操作
+
+ public abstract void interactWithIntentHandle();
+
//Save intent information to the intent instance database
- void saveIntentToDb(List<Map<IntentGoalBean,IntentManagementFunction>> intentMapList);
- boolean distrubuteIntentToHandler(Map<IntentGoalBean,IntentManagementFunction> intentMap);
+ public abstract void saveIntentToDb(List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList);
+ public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) {
+ for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : intentMap.entrySet()) {
+ IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
+ if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
+ return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue());
+ } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
+ return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue());
+ } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
+ return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue());
+ }
+ }
+ return false;
+ }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java
index 113d50d..a89656b 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java
@@ -22,18 +22,18 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunct
import java.util.List;
import java.util.Map;
-public interface DecisionModule {
- void determineUltimateGoal();
+public abstract class DecisionModule {
+ public abstract void determineUltimateGoal();
// find intentManageFunction
- IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean);
+ public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean);
- void intentDefinition();
+ public abstract void intentDefinition();
- void decideSuitableAction();
+ public abstract void decideSuitableAction();
- public void interactWithTemplateDb();
+ public abstract void interactWithTemplateDb();
- public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean);
+ public abstract List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
index 818b812..133ce37 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
@@ -15,15 +15,93 @@
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
-public interface KnowledgeModule {
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public abstract class KnowledgeModule {
+ @Autowired
+ IntentService intentService;
//Parse, decompose, orchestrate the original intent
- IntentGoalBean intentCognition(Intent intent);
+ public abstract IntentGoalBean intentCognition(Intent intent);
// in distribution, ask permission from imf
- boolean recieveCreateIntent();// ֿд
- boolean recieveUpdateIntent();
- boolean recieveDeleteIntent();
+ public abstract boolean recieveCreateIntent();
+ public abstract boolean recieveUpdateIntent();
+ public abstract boolean recieveDeleteIntent();
+
+ public List<String> intentResolution(Intent intent) {
+ //db contain original intent
+ List<Intent> sameNameIntentList = intentService.getIntentByName(intent.getIntentName());
+ List<String> intentIdList = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(sameNameIntentList)) {
+ //remove context.condition ownerName = formatIntentInputManagementFunction
+ List<Intent> filterIntentList = filterIntent(sameNameIntentList);
+ List<Expectation> expectationList = intent.getIntentExpectations();
+ for (Intent dbIntent : filterIntentList) {
+ String intentId = dbIntent.getIntentId();
+ int count = 0;
+ for (Expectation expectation : expectationList) {//original expectations
+ //Determine if there is the same ObjectType
+ List<Expectation> sameObjTypeList = dbIntent.getIntentExpectations().stream()
+ .filter(x -> x.getExpectationObject().getObjectType().equals(expectation.getExpectationObject().getObjectType()))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(sameObjTypeList)) {
+ //Determine the targetName of the Expectation which hava same ObjectType
+ List<String> targetNameList = expectation.getExpectationTargets()
+ .stream().map(ExpectationTarget::getTargetName).collect(Collectors.toList());
+ for (Expectation dbExpectation : sameObjTypeList) {
+ List<String> dbTargetNameList = dbExpectation.getExpectationTargets()
+ .stream().map(ExpectationTarget::getTargetName).collect(Collectors.toList());
+ //todo name compare need ai
+ if (dbTargetNameList.containsAll(targetNameList)) {
+ count++;
+ break;
+ }
+ }
+ }
+ if (count == expectationList.size()) {
+ intentIdList.add(intentId);
+ break;
+ }
+ }
+ }
+ }
+ return intentIdList;
+ }
+
+ public List<Intent> filterIntent(List<Intent> list) {
+ //// condition ownerName = foramtIntentInput
+ List<Intent> fiterList = new ArrayList<>();
+ for (Intent intent : list) {
+ List<Context> ownerInfo = intent.getIntentContexts().stream().filter(x ->
+ StringUtils.equalsIgnoreCase(x.getContextName(), "ownerInfo")).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(ownerInfo)) {
+ for (Context context : ownerInfo) {
+ List<Condition> contextConditions = context.getContextConditions();
+ boolean equals = false;
+ for (Condition condition : contextConditions) {
+ String conditionstr = "ownerName = formatIntentInputManagementFunction";
+ String concatStr = condition.getConditionName() + condition.getOperator() + condition.getConditionValue();
+ if (StringUtils.equalsIgnoreCase(concatStr.trim(), conditionstr.trim())) {
+ fiterList.add(intent);
+ equals = true;
+ break;
+ }
+ }
+ if (equals==true) {
+ break;
+ }
+ }
+ }
+ }
+ list.removeAll(fiterList);
+ return list;
+ }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
index 3273925..389f7ce 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
@@ -51,73 +51,4 @@ public class IntentDetectionService {
return ownerKnowledgeModule.intentCognition(intent);
}
-
- public List<String> intentResolution(Intent intent) {
- //db contain original intent
- List<Intent> sameNameIntentList = intentService.getIntentByName(intent.getIntentName());
- List<String> intentIdList = new ArrayList<>();
- if (CollectionUtils.isNotEmpty(sameNameIntentList)) {
- //remove context.condition ownerName = formatIntentInputManagementFunction
- List<Intent> filterIntentList = filterIntent(sameNameIntentList);
- List<Expectation> expectationList = intent.getIntentExpectations();
- for (Intent dbIntent : filterIntentList) {
- String intentId = dbIntent.getIntentId();
- int count = 0;
- for (Expectation expectation : expectationList) {//original expectations
- //Determine if there is the same ObjectType
- List<Expectation> sameObjTypeList = dbIntent.getIntentExpectations().stream()
- .filter(x -> x.getExpectationObject().getObjectType().equals(expectation.getExpectationObject().getObjectType()))
- .collect(Collectors.toList());
- if (CollectionUtils.isNotEmpty(sameObjTypeList)) {
- //Determine the targetName of the Expectation which hava same ObjectType
- List<String> targetNameList = expectation.getExpectationTargets()
- .stream().map(ExpectationTarget::getTargetName).collect(Collectors.toList());
- for (Expectation dbExpectation : sameObjTypeList) {
- List<String> dbTargetNameList = dbExpectation.getExpectationTargets()
- .stream().map(ExpectationTarget::getTargetName).collect(Collectors.toList());
- //todo name compare need ai
- if (dbTargetNameList.containsAll(targetNameList)) {
- count++;
- break;
- }
- }
- }
- if (count == expectationList.size()) {
- intentIdList.add(intentId);
- break;
- }
- }
- }
- }
- return intentIdList;
- }
-
- public List<Intent> filterIntent(List<Intent> list) {
- //// condition ownerName = foramtIntentInput
- List<Intent> fiterList = new ArrayList<>();
- for (Intent intent : list) {
- List<Context> ownerInfo = intent.getIntentContexts().stream().filter(x ->
- StringUtils.equalsIgnoreCase(x.getContextName(), "ownerInfo")).collect(Collectors.toList());
- if (CollectionUtils.isNotEmpty(ownerInfo)) {
- for (Context context : ownerInfo) {
- List<Condition> contextConditions = context.getContextConditions();
- boolean equals = false;
- for (Condition condition : contextConditions) {
- String conditionstr = "ownerName = formatIntentInputManagementFunction";
- String concatStr = condition.getConditionName() + condition.getOperator() + condition.getConditionValue();
- if (StringUtils.equalsIgnoreCase(concatStr.trim(), conditionstr.trim())) {
- fiterList.add(intent);
- equals = true;
- break;
- }
- }
- if (equals==true) {
- break;
- }
- }
- }
- }
- list.removeAll(fiterList);
- return list;
- }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java
index d803718..9e6c921 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java
@@ -51,19 +51,5 @@ public class IntentDistributionService {
return false;
}
- public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) {
-
- for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : intentMap.entrySet()) {
- IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
- if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
- return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
- return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
- return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue());
- }
- }
- return false;
- }
}