018d5b95a68873828f656a23c6e54a047c3575d4
[dcaegen2/services.git] /
1 /*\r
2 * ============LICENSE_START=======================================================\r
3 * ONAP : DataLake\r
4 * ================================================================================\r
5 * Copyright 2019 China Mobile\r
6 *=================================================================================\r
7 * Licensed under the Apache License, Version 2.0 (the "License");\r
8 * you may not use this file except in compliance with the License.\r
9 * You may obtain a copy of the License at\r
10 *\r
11 *     http://www.apache.org/licenses/LICENSE-2.0\r
12 *\r
13 * Unless required by applicable law or agreed to in writing, software\r
14 * distributed under the License is distributed on an "AS IS" BASIS,\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 * See the License for the specific language governing permissions and\r
17 * limitations under the License.\r
18 * ============LICENSE_END=========================================================\r
19 */\r
20 package org.onap.datalake.feeder.repository;\r
21 \r
22 import org.onap.datalake.feeder.domain.Topic;\r
23 import org.springframework.beans.factory.annotation.Autowired;\r
24 import org.springframework.data.couchbase.core.CouchbaseTemplate;\r
25 /*\r
26 import org.springframework.data.mongodb.MongoDbFactory;\r
27 import org.springframework.data.mongodb.core.MongoTemplate;\r
28 import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;\r
29 import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;\r
30 import org.springframework.data.mongodb.core.convert.MappingMongoConverter;\r
31 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;\r
32 import org.springframework.data.mongodb.core.query.Criteria;\r
33 import org.springframework.data.mongodb.core.query.Query;\r
34 import org.springframework.data.mongodb.core.query.Update;  \r
35 \r
36 import com.mongodb.WriteResult;\r
37 import com.mongodb.client.result.UpdateResult;\r
38 */\r
39 import java.util.List;\r
40 \r
41 /**\r
42  * @author Guobiao Mo\r
43  *\r
44  */\r
45 public class TopicRepositoryImpl implements TopicRepositoryCustom {\r
46 \r
47     @Autowired\r
48     CouchbaseTemplate template;\r
49     \r
50     @Override\r
51     public long updateTopic(String topic, Boolean state) {\r
52 /*\r
53         Query query = new Query(Criteria.where("id").is(topic));\r
54         Update update = new Update();\r
55         update.set("state", state);\r
56 \r
57         UpdateResult result = mongoTemplate.updateFirst(query, update, Topic.class);\r
58 \r
59         if(result!=null)\r
60             return result.getModifiedCount();\r
61         else\r
62   */          return 0L;\r
63         \r
64         \r
65         \r
66     }\r
67 }\r