ee3806c8c03c62c9e252505bad459c572f6d7f21
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openo.nfvo.resmanagement.service.dao.impl;
18
19 import java.util.List;
20 import java.util.Map;
21
22 import org.openo.nfvo.resmanagement.service.dao.inf.VmDao;
23 import org.openo.nfvo.resmanagement.service.entity.VmEntity;
24 import org.openo.nfvo.resmanagement.service.mapper.VmMapper;
25
26 /**
27  * <br>
28  * <p>
29  * </p>
30  * 
31  * @author
32  * @version NFVO 0.5 Oct 28, 2016
33  */
34 public class VmDaoImpl extends AbstractDao implements VmDao {
35
36     /**
37      * <br>
38      * 
39      * @param id
40      * @return
41      * @since NFVO 0.5
42      */
43     @Override
44     public VmEntity getVm(String id) {
45         return getMapperManager(VmMapper.class).selectByPrimaryKey(id);
46     }
47
48     /**
49      * <br>
50      * 
51      * @param condition
52      * @return
53      * @since NFVO 0.5
54      */
55     @Override
56     public List<VmEntity> getVms(Map<String, Object> condition) {
57         return getMapperManager(VmMapper.class).getVms(condition);
58     }
59
60     /**
61      * <br>
62      * 
63      * @param vmEntity
64      * @return
65      * @since NFVO 0.5
66      */
67     @Override
68     public int addVm(VmEntity vmEntity) {
69         return getMapperManager(VmMapper.class).insert(vmEntity);
70     }
71
72     /**
73      * <br>
74      * 
75      * @param id
76      * @return
77      * @since NFVO 0.5
78      */
79     @Override
80     public int deleteVmById(String id) {
81         return getMapperManager(VmMapper.class).deleteByPrimaryKey(id);
82     }
83
84     /**
85      * <br>
86      * 
87      * @param vmEntity
88      * @return
89      * @since NFVO 0.5
90      */
91     @Override
92     public int updateVm(VmEntity vmEntity) {
93         return getMapperManager(VmMapper.class).updateByPrimaryKeySelective(vmEntity);
94     }
95
96     /**
97      * <br>
98      * 
99      * @param vnfInstanceId
100      * @return
101      * @since NFVO 0.5
102      */
103     @Override
104     public int deleteVmByVnfId(String vnfInstanceId) {
105         return getMapperManager(VmMapper.class).deleteByVnfId(vnfInstanceId);
106     }
107
108 }