2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.transactionrecorder;
28 import org.onap.appc.domainmodel.lcm.RequestStatus;
29 import org.onap.appc.exceptions.APPCException;
30 import org.onap.appc.domainmodel.lcm.TransactionRecord;
31 import org.onap.appc.transactionrecorder.objects.TransactionConstants;
33 import java.util.List;
37 * Interface to persist and query LCM requests
39 public interface TransactionRecorder {
41 * Stores transaction record to appc database by calling APPC Dao layer.
42 * @param record Transaction record data.
44 void store(TransactionRecord record) throws APPCException;
47 * This method is called when a particular row in transactions needs to be updated
48 * @param key This is TransactionId which uniquely identifies the record.
49 * @param updateColumns Map containing names of updated columns and their values.
50 * @throws APPCException
52 void update(String key, Map<TransactionConstants.TRANSACTION_ATTRIBUTES, String> updateColumns) throws APPCException;
55 * Marks all records in Transactions table in non-terminal state as ABORTED. This method is to be called during
58 * @param appcInstanceId
60 void markTransactionsAborted(String appcInstanceId);
63 * Fetch list of Transactions which are in non-terminal state i.e. ACCEPTED or RECEIVED for particular TargetId.
64 * @param record Transactions object from which TargetId and StartTime is extracted to fetch list of in progress
65 * requests which APPC received before the current request.
66 * @return List of Transactions in non terminal state.
67 * @throws APPCException
69 List<TransactionRecord> getInProgressRequests(TransactionRecord record) throws APPCException;
72 * Checks whether the incoming request is duplicate.
73 * @param record Transaction object from which RequestId, SubRequestId, OriginatorId is extracted to check duplicate request.
75 * @throws APPCException
77 Boolean isTransactionDuplicate(TransactionRecord record) throws APPCException;
80 * Retrieves {@link RequestStatus} from transaction table based on the passed parameters.
81 * @param requestId: RequestId of the request to search (Required)
82 * @param subrequestId: Sub-requestId (Optional)
83 * @param originatorId: Originator Id who sent the request(Optional)
84 * @param vnfId: VNFId to search (Required)
85 * @return list of RequestStatus'es
87 List<RequestStatus> getRecords(String requestId, String subrequestId, String originatorId, String vnfId)
91 * Count of all requests which are currently in non-terminal state.
92 * @return Count of all request in state RECEIVED and ACCEPTED.
94 Integer getInProgressRequestsCount() throws APPCException;
98 * @param appcInstanceId
100 void setAppcInstanceId(String appcInstanceId);