1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
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
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=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package org.onap.dmaap.dmf.mr.service.impl;
24 import java.io.IOException;
26 import org.springframework.stereotype.Service;
28 import com.att.aft.dme2.internal.jettison.json.JSONException;
29 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
30 import org.onap.dmaap.dmf.mr.service.TransactionService;
31 import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
32 import com.att.nsa.configs.ConfigDbException;
35 * Once the transaction rest gateway will be using that time it will provide all
36 * the transaction details like fetching all the transactional objects or get
37 * any particular transaction object details
39 * @author nilanjana.maity
43 public class TransactionServiceImpl implements TransactionService {
46 public void checkTransaction(TransactionObj trnObj) {
47 /* Need to implement the method */
51 public void getAllTransactionObjs(DMaaPContext dmaapContext)
52 throws ConfigDbException, IOException {
57 * LOG.info("configReader : "+configReader.toString());
59 * final JSONObject result = new JSONObject (); final JSONArray
60 * transactionIds = new JSONArray (); result.put ( "transactionIds",
63 * DMaaPTransactionObjDB<DMaaPTransactionObj> transDb =
64 * configReader.getfTranDb();
66 * for (String transactionId : transDb.loadAllTransactionObjs()) {
67 * transactionIds.put (transactionId); } LOG.info(
68 * "========== TransactionServiceImpl: getAllTransactionObjs: Transaction objects are : "
69 * + transactionIds.toString()+"===========");
70 * DMaaPResponseBuilder.respondOk(dmaapContext, result);
75 public void getTransactionObj(DMaaPContext dmaapContext,
76 String transactionId) throws ConfigDbException, JSONException,
82 * ConfigurationReader configReader = dmaapContext.getConfigReader();
84 * DMaaPTransactionObj trnObj;
86 * trnObj = configReader.getfTranDb().loadTransactionObj(transactionId);
89 * if (null != trnObj) { trnObj.serialize(); JSONObject result =
90 * trnObj.asJsonObject(); DMaaPResponseBuilder.respondOk(dmaapContext,
92 * LOG.info("========== TransactionServiceImpl: getTransactionObj : "+
93 * result.toString()+"==========="); return; }
96 * "========== TransactionServiceImpl: getTransactionObj: Error : Transaction object does not exist. "