diff options
Diffstat (limited to 'intentanalysis')
18 files changed, 81 insertions, 286 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java index b883662..ee1fc49 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java @@ -15,8 +15,6 @@ */ package org.onap.usecaseui.intentanalysis.bean.models; -import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; import lombok.Data; import java.util.ArrayList; @@ -25,6 +23,7 @@ import java.util.List; @Data public class Expectation { + private String expectationId; private String expectationName; @@ -33,23 +32,4 @@ public class Expectation { List<State> stateList; - public ExpectationPo transferToExpectationPo() { - ExpectationPo expectationPo = new ExpectationPo(); - expectationPo.setExpectationPoId(this.expectationId); - expectationPo.setExpectationPoName(this.expectationName); - expectationPo.setTargetMOI(this.targetMOI); - expectationPo.setStatePoList(getStatePoList()); - return expectationPo; - } - - private List<StatePo> getStatePoList() { - List<StatePo> statePoList = new ArrayList<>(); - if (null == this.stateList) { - return statePoList; - } - for (State state : this.stateList) { - statePoList.add(state.transferToStatePo()); - } - return statePoList; - } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java index f2a98ce..69138e4 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java @@ -16,8 +16,6 @@ package org.onap.usecaseui.intentanalysis.bean.models; -import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; -import org.onap.usecaseui.intentanalysis.bean.po.IntentPo; import lombok.Data; import java.util.ArrayList; @@ -32,22 +30,4 @@ public class Intent { private List<Expectation> expectationList; - public IntentPo transferToIntentPo() { - IntentPo intentPo = new IntentPo(); - intentPo.setIntentPoId(this.intentId); - intentPo.setIntentPoName(this.intentName); - intentPo.setExpectationPoList(getExpectationPoList()); - return intentPo; - } - - private List<ExpectationPo> getExpectationPoList() { - List<ExpectationPo> expectationPoList = new ArrayList<>(); - if (null == this.expectationList) { - return expectationPoList; - } - for (Expectation expectation : this.expectationList) { - expectationPoList.add(expectation.transferToExpectationPo()); - } - return expectationPoList; - } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java index e39b954..fba8cf4 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java @@ -16,11 +16,11 @@ package org.onap.usecaseui.intentanalysis.bean.models; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; import lombok.Data; @Data public class State { + private String stateId; private String stateName; @@ -29,12 +29,4 @@ public class State { private Boolean isSatisfied; - public StatePo transferToStatePo() { - StatePo statePo = new StatePo(); - statePo.setStatePoId(this.stateId); - statePo.setStatePoName(this.stateName); - statePo.setCondition(this.condition); - statePo.setIsSatisfied(this.isSatisfied); - return statePo; - } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java deleted file mode 100644 index 00e4b56..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.po; - -import org.onap.usecaseui.intentanalysis.bean.models.Expectation; -import org.onap.usecaseui.intentanalysis.bean.models.State; -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; - -@Data -public class ExpectationPo { - - private String expectationPoId; - - private String expectationPoName; - - private String targetMOI; - - private String intentPoId; - - List<StatePo> statePoList; - - public Expectation transferToExpectation() { - Expectation expectation = new Expectation(); - expectation.setExpectationId(this.expectationPoId); - expectation.setExpectationName(this.expectationPoName); - expectation.setTargetMOI(this.targetMOI); - expectation.setStateList(getStateList()); - return expectation; - } - - private List<State> getStateList() { - List<State> stateList = new ArrayList<>(); - if (null == this.statePoList) { - return stateList; - } - for (StatePo statePo : this.statePoList) { - stateList.add(statePo.transferToState()); - } - return stateList; - } -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java deleted file mode 100644 index 844ff6d..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.po; - -import org.onap.usecaseui.intentanalysis.bean.models.Expectation; -import org.onap.usecaseui.intentanalysis.bean.models.Intent; -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; - -@Data -public class IntentPo { - - private String intentPoId; - - private String intentPoName; - - private List<ExpectationPo> expectationPoList; - - public Intent transferToIntent() { - Intent intent = new Intent(); - intent.setIntentId(this.intentPoId); - intent.setIntentName(this.intentPoName); - - intent.setExpectationList(getExpectationList()); - return intent; - } - - private List<Expectation> getExpectationList() { - List<Expectation> expectationList = new ArrayList<>(); - if (null == this.expectationPoList ) { - return expectationList; - } - for (ExpectationPo expectationPo : this.expectationPoList) { - expectationList.add(expectationPo.transferToExpectation()); - } - return expectationList; - } -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java deleted file mode 100644 index 5b334cc..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.po; - -import org.onap.usecaseui.intentanalysis.bean.models.State; -import lombok.Data; - -@Data -public class StatePo { - - private String statePoId; - - private String statePoName; - - private String condition; - - private String expectationPoId; - - private Boolean isSatisfied; - - public State transferToState() { - State state = new State(); - state.setStateId(this.statePoId); - state.setStateName(this.statePoName); - state.setIsSatisfied(this.isSatisfied); - state.setCondition(this.condition); - return state; - } -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentManagementFunction.java index ec41f3f..550051e 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentManagementFunction.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentManagementFunction.java @@ -20,8 +20,10 @@ import lombok.Data; 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.context.annotation.Configuration; @Data +@Configuration public class IntentManagementFunction { private ActuationModule actuationModule; private DecisionModule decisionModule; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java index bcca440..c05a344 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java @@ -16,18 +16,19 @@ package org.onap.usecaseui.intentanalysis.mapper; import org.apache.ibatis.annotations.Mapper; -import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; +import org.apache.ibatis.annotations.Param; +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; import java.util.List; @Mapper public interface ExpectationMapper { - void insertExpectation(List<ExpectationPo> expectation); + void insertExpectation(@Param(value = "expectationList") List<Expectation> expectationList, @Param(value = "intentId") String intentId); - List<ExpectationPo> selectExpectationByIntentId(String intentId); + List<Expectation> selectExpectationByIntentId(String intentId); void deleteExpectationByIntentId(String intentId); - void updateExpectation(List<ExpectationPo> expectation); + void updateExpectation(List<Expectation> expectation); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java index 4de598a..e3bd6f3 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java @@ -17,20 +17,20 @@ package org.onap.usecaseui.intentanalysis.mapper; import org.apache.ibatis.annotations.Mapper; -import org.onap.usecaseui.intentanalysis.bean.po.IntentPo; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; import java.util.List; @Mapper public interface IntentMapper { - void insertIntent(IntentPo intentPo); + void insertIntent(Intent intent); - void updateIntent(IntentPo intentPo); + void updateIntent(Intent intent); - IntentPo selectIntentById(String intentId); + Intent selectIntentById(String intentId); - List<IntentPo> selectIntents(); + List<Intent> selectIntents(); void deleteIntentById(String intentId); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java index b1b1416..ab7e47b 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java @@ -17,15 +17,16 @@ package org.onap.usecaseui.intentanalysis.mapper; import org.apache.ibatis.annotations.Mapper; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import org.apache.ibatis.annotations.Param; +import org.onap.usecaseui.intentanalysis.bean.models.State; import java.util.List; @Mapper public interface StateMapper { - void insertState(List<StatePo> state); + void insertState(@Param(value = "stateList") List<State> state, @Param(value = "expectationId") String expectationId); - List<StatePo> selectStateByExpectation(String expectationId); + List<State> selectStateByExpectation(String expectationId); void deleteStateByExpectationId(String expectationId); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java index bcdc89e..8d0759f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java @@ -17,17 +17,17 @@ package org.onap.usecaseui.intentanalysis.service; -import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; import java.util.List; public interface ExpectationService { - void createExpectationList(List<ExpectationPo> expectationPoList, String intentId); + void createExpectationList(List<Expectation> expectationList, String intentId); void deleteExpectationListById(String intentId); - void updateExpectationListById(List<ExpectationPo> expectationPoList, String intentId); + void updateExpectationListById(List<Expectation> expectationList, String intentId); - List<ExpectationPo> getExpectationListByIntentId(String intentId); + List<Expectation> getExpectationListByIntentId(String intentId); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java index 237c54a..187f964 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java @@ -16,17 +16,17 @@ package org.onap.usecaseui.intentanalysis.service; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import org.onap.usecaseui.intentanalysis.bean.models.State; import java.util.List; public interface StateService { - void createStateList(List<StatePo> statePoList, String expectationId); + void createStateList(List<State> stateList, String expectationId); void deleteStateListByExpectationId(String expectationId); - void updateStateListByExpectationId(List<StatePo> statePoList, String expectationId); + void updateStateListByExpectationId(List<State> stateList, String expectationId); - List<StatePo> getStateListByExpectationId(String expectationId); + List<State> getStateListByExpectationId(String expectationId); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java index 98e5364..5f21f58 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java @@ -17,8 +17,8 @@ package org.onap.usecaseui.intentanalysis.service.impl; -import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +import org.onap.usecaseui.intentanalysis.bean.models.State; import org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper; import org.onap.usecaseui.intentanalysis.service.ExpectationService; import org.onap.usecaseui.intentanalysis.service.StateService; @@ -41,43 +41,42 @@ public class ExpectationServiceImpl implements ExpectationService { private StateService stateService; @Override - public void createExpectationList(List<ExpectationPo> expectationPoList, String intentId) { - for (ExpectationPo expectationPo : expectationPoList) { - if (null != expectationPo) { - expectationPo.setIntentPoId(intentId); - stateService.createStateList(expectationPo.getStatePoList(), expectationPo.getExpectationPoId()); + public void createExpectationList(List<Expectation> expectationList, String intentId) { + for (Expectation expectation : expectationList) { + if (null != expectation) { + stateService.createStateList(expectation.getStateList(), expectation.getExpectationId()); } } - expectationMapper.insertExpectation(expectationPoList); + expectationMapper.insertExpectation(expectationList, intentId); } @Override - public List<ExpectationPo> getExpectationListByIntentId(String intentId) { - List<ExpectationPo> expectationList = expectationMapper.selectExpectationByIntentId(intentId); - for (ExpectationPo expectation : expectationList) { - List<StatePo> stateList = stateService.getStateListByExpectationId(expectation.getExpectationPoId()); - expectation.setStatePoList(stateList); + public List<Expectation> getExpectationListByIntentId(String intentId) { + List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId); + for (Expectation expectation : expectationList) { + List<State> stateList = stateService.getStateListByExpectationId(expectation.getExpectationId()); + expectation.setStateList(stateList); } return expectationList; } @Override public void deleteExpectationListById(String intentId) { - List<ExpectationPo> expectationList = expectationMapper.selectExpectationByIntentId(intentId); + List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId); expectationMapper.deleteExpectationByIntentId(intentId); - for (ExpectationPo expectation : expectationList) { - stateService.deleteStateListByExpectationId(expectation.getExpectationPoId()); + for (Expectation expectation : expectationList) { + stateService.deleteStateListByExpectationId(expectation.getExpectationId()); } } @Override - public void updateExpectationListById(List<ExpectationPo> expectationPoList, String intentId) { - List<ExpectationPo> expectationList = expectationMapper.selectExpectationByIntentId(intentId); - if (expectationList == null) { + public void updateExpectationListById(List<Expectation> expectationList, String intentId) { + List<Expectation> expectationDBList = expectationMapper.selectExpectationByIntentId(intentId); + if (expectationDBList == null) { LOGGER.error("Intent ID {} doesn't exist in database.", intentId); throw new IllegalArgumentException("This intent ID doesn't exist in database."); } - expectationMapper.updateExpectation(expectationPoList); + expectationMapper.updateExpectation(expectationDBList); LOGGER.info("Expectations are successfully updated."); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java index 29a7480..7372510 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java @@ -18,7 +18,6 @@ package org.onap.usecaseui.intentanalysis.service.impl; import org.onap.usecaseui.intentanalysis.bean.models.Intent; -import org.onap.usecaseui.intentanalysis.bean.po.IntentPo; import org.onap.usecaseui.intentanalysis.mapper.IntentMapper; import org.onap.usecaseui.intentanalysis.service.ExpectationService; import org.onap.usecaseui.intentanalysis.service.IntentService; @@ -43,26 +42,22 @@ public class IntentServiceImpl implements IntentService { @Override public List<Intent> getIntentList() { - List<Intent> intentList = new ArrayList<>(); - List<IntentPo> intentPoList = intentMapper.selectIntents(); - if (intentPoList == null || intentPoList.size() <= 0) { - return intentList; + List<Intent> intentList = intentMapper.selectIntents(); + if (intentList == null || intentList.size() <= 0) { + return new ArrayList<>(); } - for (IntentPo intentPo : intentPoList) { - if (intentPo != null) { - intentPo.setExpectationPoList(expectationService.getExpectationListByIntentId(intentPo.getIntentPoId())); - intentList.add(intentPo.transferToIntent()); - } + for (Intent intent : intentList) { + intent.setExpectationList(expectationService.getExpectationListByIntentId(intent.getIntentId())); } return intentList; } @Override public Intent getIntentById(String intentId) { - IntentPo intentPo = intentMapper.selectIntentById(intentId); - if (intentPo != null) { - intentPo.setExpectationPoList(expectationService.getExpectationListByIntentId(intentPo.getIntentPoId())); - return intentPo.transferToIntent(); + Intent intent = intentMapper.selectIntentById(intentId); + if (intent != null) { + intent.setExpectationList(expectationService.getExpectationListByIntentId(intent.getIntentId())); + return intent; } else { String msg = "Intent Id requested doesn't exist in the intent database"; LOGGER.error(msg); @@ -73,10 +68,9 @@ public class IntentServiceImpl implements IntentService { @Transactional(rollbackFor = RuntimeException.class) @Override public Intent createIntent(Intent intent) { - IntentPo intentPo = intent.transferToIntentPo(); - intentMapper.insertIntent(intentPo); + intentMapper.insertIntent(intent); // saving expectation list into expectation table - expectationService.createExpectationList(intentPo.getExpectationPoList(), intentPo.getIntentPoId()); + expectationService.createExpectationList(intent.getExpectationList(), intent.getIntentId()); LOGGER.info("Intent was successfully created."); return intent; } @@ -84,18 +78,19 @@ public class IntentServiceImpl implements IntentService { @Override public Intent updateIntent(Intent intent) { String intentId = intent.getIntentId(); - IntentPo intentPo = intentMapper.selectIntentById(intentId); - if (intentPo == null) { + Intent intentDB = intentMapper.selectIntentById(intentId); + if (intentDB == null) { LOGGER.error("intent id {} not exists in db.", intentId); } - intentMapper.updateIntent(intentPo); + intentMapper.updateIntent(intentDB); LOGGER.info("update intent successfully."); - return intentMapper.selectIntentById(intentId).transferToIntent(); + return intentMapper.selectIntentById(intentId); } @Override public void deleteIntentById(String intentId) { intentMapper.deleteIntentById(intentId); expectationService.deleteExpectationListById(intentId); + LOGGER.info("intent has been deleted successfully."); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java index c907ff8..134e84a 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java @@ -17,7 +17,7 @@ package org.onap.usecaseui.intentanalysis.service.impl; -import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import org.onap.usecaseui.intentanalysis.bean.models.State; import org.onap.usecaseui.intentanalysis.mapper.StateMapper; import org.onap.usecaseui.intentanalysis.service.StateService; import org.springframework.beans.factory.annotation.Autowired; @@ -32,16 +32,13 @@ public class StateServiceImpl implements StateService { private StateMapper stateMapper; @Override - public void createStateList(List<StatePo> stateList, String expectationId) { - for (StatePo state : stateList) { - state.setStatePoId(expectationId); - } - stateMapper.insertState(stateList); + public void createStateList(List<State> stateList, String expectationId) { + stateMapper.insertState(stateList, expectationId); } @Override - public List<StatePo> getStateListByExpectationId(String expectationId) { - List<StatePo> stateList = stateMapper.selectStateByExpectation(expectationId); + public List<State> getStateListByExpectationId(String expectationId) { + List<State> stateList = stateMapper.selectStateByExpectation(expectationId); return stateList; } @@ -51,6 +48,7 @@ public class StateServiceImpl implements StateService { } @Override - public void updateStateListByExpectationId(List<StatePo> statePoList, String expectationId){ - }; + public void updateStateListByExpectationId(List<State> stateList, String expectationId){ + + } } diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml index 5c5ac06..720bdd5 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml @@ -2,10 +2,10 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="org.onap.usecaseui.server.mapper.ExpectationMapper"> +<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper"> - <select id="selectExpectationByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo"> + <select id="selectExpectationByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation"> select expectation_id expectationId, expectation_name expectationName, target_moi targetMOI, intent_id intentId from expectation @@ -15,8 +15,8 @@ <insert id="insertExpectation"> insert into expectation(expectation_id, expectation_name, target_moi, intent_id) values - <foreach collection="list" index="index" item="item" separator=","> - (#{item.expectationId}, #{item.expectationName}, #{item.targetMOI}, #{item.intentId}) + <foreach collection="expectationList" index="index" item="item" separator=","> + (#{item.expectationId}, #{item.expectationName}, #{item.targetMOI}, #{intentId}) </foreach> </insert> diff --git a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml index c814bfe..335ba6d 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml @@ -2,14 +2,14 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="org.onap.usecaseui.server.mapper.IntentMapper"> +<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.IntentMapper"> - <select id="selectIntentById" resultType="org.onap.usecaseui.intentanalysis.bean.po.IntentPo"> + <select id="selectIntentById" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent"> select intent_id intentId, intent_name intentName from intent where intent_id = #{intentId} </select> - <select id="selectIntents" resultType="org.onap.usecaseui.intentanalysis.bean.po.IntentPo"> + <select id="selectIntents" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent"> select intent_id intentId, intent_name intentName from intent </select> @@ -18,7 +18,7 @@ values(#{intentId}, #{intentName}) </insert> - <update id="updateIntent" parameterType="org.onap.usecaseui.intentanalysis.bean.po.IntentPo"> + <update id="updateIntent" parameterType="org.onap.usecaseui.intentanalysis.bean.models.Intent"> update intent <trim prefix="set" suffixOverrides=","> <if test="intentId != null">intent_id = #{intentId},</if> diff --git a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml index 987c75f..4850870 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="org.onap.usecaseui.server.mapper.StateMapper"> +<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.StateMapper"> - <select id="selectStateByExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.po.StatePo"> + <select id="selectStateByExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.models.State"> select state_id stateId, state_name stateName, expectation_id expectationId, is_satisfied isSatisfied, condition from state @@ -14,8 +14,8 @@ <insert id="insertState" parameterType="java.util.ArrayList"> insert into state(state_id, state_name, expectation_id, is_satisfied, condition) values - <foreach collection="list" index="index" item="item" separator=","> - (#{item.stateId}, #{item.stateName}, #{item.expectationId}, #{item.isSatisfied}, #{item.condition}) + <foreach collection="stateList" index="index" item="item" separator=","> + (#{item.stateId}, #{item.stateName}, #{expectationId}, #{item.isSatisfied}, #{item.condition}) </foreach> </insert> |