DMAAP-MR - Merge MR repos
[dmaap/messagerouter/messageservice.git] / src / main / java / org / onap / dmaap / dmf / mr / service / impl / TransactionServiceImpl.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  org.onap.dmaap
4  *  ================================================================================
5  *  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  *  ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *        http://www.apache.org/licenses/LICENSE-2.0
11 *  
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *  ============LICENSE_END=========================================================
18  *  
19  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
20  *  
21  *******************************************************************************/
22 package org.onap.dmaap.dmf.mr.service.impl;
23
24 import com.att.aft.dme2.internal.jettison.json.JSONException;
25 import com.att.nsa.configs.ConfigDbException;
26 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
27 import org.onap.dmaap.dmf.mr.service.TransactionService;
28 import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
29 import org.springframework.stereotype.Service;
30
31 import java.io.IOException;
32
33 /**
34  * Once the transaction rest gateway will be using that time it will provide all
35  * the transaction details like fetching all the transactional objects or get
36  * any particular transaction object details
37  * 
38  * @author nilanjana.maity
39  *
40  */
41 @Service
42 public class TransactionServiceImpl implements TransactionService {
43
44         @Override
45         public void checkTransaction(TransactionObj trnObj) {
46                 /* Need to implement the method */
47         }
48
49         @Override
50         public void getAllTransactionObjs(DMaaPContext dmaapContext)
51                         throws ConfigDbException, IOException {
52
53                 /*
54                 
55                  * 
56                  * LOG.info("configReader : "+configReader.toString());
57                  * 
58                  * final JSONObject result = new JSONObject (); final JSONArray
59                  * transactionIds = new JSONArray (); result.put ( "transactionIds",
60                  * transactionIds );
61                  * 
62                  * DMaaPTransactionObjDB<DMaaPTransactionObj> transDb =
63                  * configReader.getfTranDb();
64                  * 
65                  * for (String transactionId : transDb.loadAllTransactionObjs()) {
66                  * transactionIds.put (transactionId); } LOG.info(
67                  * "========== TransactionServiceImpl: getAllTransactionObjs: Transaction objects are : "
68                  * + transactionIds.toString()+"===========");
69                  * DMaaPResponseBuilder.respondOk(dmaapContext, result);
70                  */
71         }
72
73         @Override
74         public void getTransactionObj(DMaaPContext dmaapContext,
75                         String transactionId) throws ConfigDbException, JSONException,
76                         IOException {
77
78                 /*
79                  
80                  * 
81                  * ConfigurationReader configReader = dmaapContext.getConfigReader();
82                  * 
83                  * DMaaPTransactionObj trnObj;
84                  * 
85                  * trnObj = configReader.getfTranDb().loadTransactionObj(transactionId);
86                  * 
87                  * 
88                  * if (null != trnObj) { trnObj.serialize(); JSONObject result =
89                  * trnObj.asJsonObject(); DMaaPResponseBuilder.respondOk(dmaapContext,
90                  * result);
91                  * LOG.info("========== TransactionServiceImpl: getTransactionObj : "+
92                  * result.toString()+"==========="); return; }
93                  * 
94                  * } LOG.info(
95                  * "========== TransactionServiceImpl: getTransactionObj: Error : Transaction object does not exist. "
96                  * +"===========");
97                  */
98         }
99 }