--- /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.enums;
+
+public enum ConditionParentType {
+ CONDITION(0, "condition"),
+ CONTEXT(1,"context"),
+ EXPECTATION_TARGET(2, "expectation_target");
+
+ private int index;
+
+ private String desc;
+
+ ConditionParentType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
--- /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.enums;
+
+import lombok.Getter;
+
+@Getter
+public enum OperatorType {
+ OR(0,"or"),
+ GATHERTHAN(1,"gather than"),
+ EQUALTO(2,"equal to"),
+ LESSTHAN(3,"less than"),
+ NOTEQUALTO(4,"not euqal to"),
+ ONEOF(5,"one of"),
+ SOMEOF(6,"some of"),
+ MAXIMUMVALUE(7,"maximum value"),
+ MINIMUMVALUE(8,"minimum value"),
+ MEDIAN(9,"median"),
+ CREDIBILITY(10,"credibility"),
+ AND(11,"and");
+
+
+ private int index;
+
+ private String desc;
+
+ OperatorType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
--- /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;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+
+import java.util.List;
+
+@Data
+public class Condition {
+ private String conditionId;
+
+ private String conditionName;
+
+ private OperatorType operator;
+
+ private String conditionValue;
+
+ private List<Condition> conditionList;
+}
package org.onap.usecaseui.intentanalysis.bean.models;
import lombok.Data;
-import org.onap.usecaseui.intentanalysis.bean.enums.ContextType;
+
+import java.util.List;
@Data
private String contextName;
- private ContextType contextType;
-
- private String contextCondition;
+ private List<Condition> contextConditions;
}
private String targetName;
- private String targetCondition;
+ private List<Condition> targetConditions;
private List<Context> targetContexts;
public class IntentManagementFunctionRegInfo {
private String id;
private String description;
- private List<SupportArea> supportArea; //ͨ¹ýintentname cll ͨ¹ýintentName
- private String supportModel; // expectation expectationtarget targetCondition value
- private List<SupportInterface> supportInterfaces; //
+ private List<SupportArea> supportArea;
+ private String supportModel;
+ private List<SupportInterface> supportInterfaces;
private String handleName;
private IntentFunctionType intentFunctionType;//out or in
-
}
package org.onap.usecaseui.intentanalysis.controller;
import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
-import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IntentFunctionManageService;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IMFRegInfoService;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/intentFunctionManage")
-public class IntentFunctionManageController {
+public class IMFRegInfoController {
@Resource(name = "intentFunctionManageService")
- IntentFunctionManageService intentFunctionManageService;
+ IMFRegInfoService IMFRegInfoService;
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity createIntentManage(@RequestBody IntentManagementFunctionRegInfo intentManage) {
- return ResponseEntity.ok(intentFunctionManageService.createFunctionManage(intentManage));
+ return ResponseEntity.ok(IMFRegInfoService.createFunctionManage(intentManage));
}
@DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity deleteIntentManage(@PathVariable(value = "id") String id) {
- return ResponseEntity.ok(intentFunctionManageService.deleteFunctionManage(id));
+ return ResponseEntity.ok(IMFRegInfoService.deleteFunctionManage(id));
}
@PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateIntentManageById(
@PathVariable(value = "id") String id, @RequestBody IntentManagementFunctionRegInfo intentManage) {
- return ResponseEntity.ok(intentFunctionManageService.updateIntentManageById(id, intentManage));
+ return ResponseEntity.ok(IMFRegInfoService.updateIntentManageById(id, intentManage));
}
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<IntentManagementFunctionRegInfo>> getIntentManageByID() {
- return ResponseEntity.ok(intentFunctionManageService.getIntentManage());
+ return ResponseEntity.ok(IMFRegInfoService.getIntentManage());
}
}
import java.util.List;
-public interface IntentFunctionManageService {
+public interface IMFRegInfoService {
int createFunctionManage(IntentManagementFunctionRegInfo intentManage) ;
int deleteFunctionManage(String id);
import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
-import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IntentFunctionManageService;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IMFRegInfoService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.mapper.IMFRegInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("intentFunctionManageService")
-public class IntentFunctionManageServiceImpl implements IntentFunctionManageService {
+public class IMFRegInfoServiceImpl implements IMFRegInfoService {
@Autowired
private ApplicationContext applicationContext;
+
+ @Autowired
+ private IMFRegInfoMapper imfRegInfoMapper;
@Override
public int createFunctionManage(IntentManagementFunctionRegInfo intentManage) {
return 0;
--- /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.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+
+import java.util.List;
+
+@Mapper
+public interface ConditionMapper {
+
+ void insertConditionList(@Param(value = "conditionList") List<Condition> conditionList);
+
+ void insertConditionParentList(@Param(value = "conditionList") List<Condition> conditionList,
+ @Param(value = "parentType") ConditionParentType conditionParentType,
+ @Param(value = "parentId") String parentId);
+
+ List<Condition> selectConditionByParentId(String parentId);
+}
--- /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.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
+
+@Mapper
+public interface IMFRegInfoMapper {
+ void insertIMFRegInfoRegInfo(@Param(value = "fulfilmentInfo") IntentManagementFunctionRegInfo imfregInfo);
+}
--- /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.service;
+
+import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.springframework.stereotype.Service;
+
+
+import java.util.List;
+
+
+public interface ConditionService {
+
+ void createConditionList(List<Condition> cnditionList, ConditionParentType conditionParentType, String parentId);
+
+ void insertCondition(Condition condition, String parentId);
+
+ void deleteConditionListByParentId(String parentId);
+
+ void deleteConditionById(String conditionId);
+
+ void updateConditionListByParentId(List<Condition> conditionList, String parentId);
+
+ List<Condition> getConditionListByParentId(String parentId);
+
+}
--- /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.service.impl;
+
+import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.mapper.ConditionMapper;
+import org.onap.usecaseui.intentanalysis.service.ConditionService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+@Service
+public class ConditionServiceImpl implements ConditionService {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class);
+
+ @Autowired
+ private ConditionMapper conditionMapper;
+
+ @Autowired
+ private ConditionService conditionService;
+
+ @Override
+ public void createConditionList(List<Condition> conditionList, ConditionParentType conditionParentType, String parentId) {
+ conditionMapper.insertConditionList(conditionList);
+ conditionMapper.insertConditionParentList(conditionList,conditionParentType,parentId);
+ }
+
+ @Override
+ public void insertCondition(Condition condition, String parentId) {
+
+ }
+
+ @Override
+ public void deleteConditionListByParentId(String parentId) {
+
+ }
+
+ @Override
+ public void deleteConditionById(String conditionId) {
+
+ }
+
+ @Override
+ public void updateConditionListByParentId(List<Condition> conditionList, String parentId) {
+
+ }
+
+ @Override
+ public List<Condition> getConditionListByParentId(String parentId) {
+ return conditionMapper.selectConditionByParentId(parentId);
+ }
+}
package org.onap.usecaseui.intentanalysis.service.impl;
-import java.util.ArrayList;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType;
import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
import org.onap.usecaseui.intentanalysis.bean.models.Context;
import org.onap.usecaseui.intentanalysis.mapper.ContextMapper;
+import org.onap.usecaseui.intentanalysis.service.ConditionService;
import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
@Service
public class ContextServiceImpl implements ContextService {
- private static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class);
+ static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class);
+ private ConditionParentType conditionParentType;
@Autowired
private ContextMapper contextMapper;
@Autowired
private ContextService contextService;
+ @Autowired
+ private ConditionService conditionService;
+
@Override
public void createContextList(List<Context> contextList, ContextParentType contextParentType, String parentId) {
contextMapper.insertContextList(contextList);
+
+ for (Context context: contextList) {
+ conditionService.createConditionList(context.getContextConditions(),conditionParentType.CONTEXT,context.getContextId());
+ }
+
contextMapper.insertContextParentList(contextList, contextParentType, parentId);
}
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
+import org.onap.usecaseui.intentanalysis.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
import org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper;
-import org.onap.usecaseui.intentanalysis.service.ContextService;
-import org.onap.usecaseui.intentanalysis.service.ExpectationService;
-import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
-import org.onap.usecaseui.intentanalysis.service.ExpectationTargetService;
-import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService;
@Service
@Autowired
private ContextService contextService;
+
@Autowired
private FulfilmentInfoService fulfilmentInfoService;
import java.util.ArrayList;
import java.util.List;
+
+import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType;
+import org.onap.usecaseui.intentanalysis.service.ConditionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
private ContextParentType contextParentType;
+ private ConditionParentType conditionParentType;
@Autowired
private ExpectationTargetMapper expectationTargetMapper;
@Autowired
private ExpectationTargetService expectationTargetService;
+
@Autowired
private FulfilmentInfoService fulfilmentInfoService;
@Autowired
private ContextService contextService;
+ @Autowired
+ private ConditionService conditionService;
@Override
public void createTarget(ExpectationTarget expectationTarget, String expectationId) {
expectationTargetMapper.insertExpectationTarget(expectationTarget, expectationId);
expectationTarget.getTargetId());
fulfilmentInfoService.createFulfilmentInfo(expectationTarget.getTargetFulfilmentInfo(),
expectationTarget.getTargetId());
+ conditionService.createConditionList(expectationTarget.getTargetConditions(),conditionParentType.EXPECTATION_TARGET,expectationId);
}
@Override