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 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;
31 import java.io.IOException;
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
38 * @author nilanjana.maity
42 public class TransactionServiceImpl implements TransactionService {
45 public void checkTransaction(TransactionObj trnObj) {
46 /* Need to implement the method */
50 public void getAllTransactionObjs(DMaaPContext dmaapContext)
51 throws ConfigDbException, IOException {
56 * LOG.info("configReader : "+configReader.toString());
58 * final JSONObject result = new JSONObject (); final JSONArray
59 * transactionIds = new JSONArray (); result.put ( "transactionIds",
62 * DMaaPTransactionObjDB<DMaaPTransactionObj> transDb =
63 * configReader.getfTranDb();
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);
74 public void getTransactionObj(DMaaPContext dmaapContext,
75 String transactionId) throws ConfigDbException, JSONException,
81 * ConfigurationReader configReader = dmaapContext.getConfigReader();
83 * DMaaPTransactionObj trnObj;
85 * trnObj = configReader.getfTranDb().loadTransactionObj(transactionId);
88 * if (null != trnObj) { trnObj.serialize(); JSONObject result =
89 * trnObj.asJsonObject(); DMaaPResponseBuilder.respondOk(dmaapContext,
91 * LOG.info("========== TransactionServiceImpl: getTransactionObj : "+
92 * result.toString()+"==========="); return; }
95 * "========== TransactionServiceImpl: getTransactionObj: Error : Transaction object does not exist. "