2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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 * ============LICENSE_END=========================================================
24 package org.onap.appc.transactionrecorder;
27 import org.onap.appc.domainmodel.lcm.RequestStatus;
28 import org.onap.appc.exceptions.APPCException;
29 import org.onap.appc.domainmodel.lcm.TransactionRecord;
30 import org.onap.appc.transactionrecorder.objects.TransactionConstants;
32 import java.util.List;
36 * Interface to persist and query LCM requests
38 public interface TransactionRecorder {
40 * Stores transaction record to appc database by calling APPC Dao layer.
41 * @param record Transaction record data.
43 void store(TransactionRecord record) throws APPCException;
46 * This method is called when a particular row in transactions needs to be updated
47 * @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, String requestId, Map<TransactionConstants.TRANSACTION_ATTRIBUTES, String> updateColumns)
56 * Marks all records in Transactions table in non-terminal state as ABORTED. This method is to be called during
59 * @param appcInstanceId
61 void markTransactionsAborted(String appcInstanceId);
64 * Fetch list of Transactions which are in non-terminal state i.e. ACCEPTED or RECEIVED for particular TargetId.
65 * @param record Transactions object from which TargetId and StartTime is extracted to fetch list of in progress
66 * requests which APPC received before the current request.
67 * @param interval Number of hours - Time window to consider requests as being in progress
68 * @return List of Transactions in non terminal state.
69 * @throws APPCException
71 List<TransactionRecord> getInProgressRequests(TransactionRecord record, int interval) throws APPCException;
74 * Checks whether the incoming request is duplicate.
75 * @param record Transaction object from which RequestId, SubRequestId, OriginatorId is extracted to check duplicate request.
77 * @throws APPCException
79 Boolean isTransactionDuplicate(TransactionRecord record) throws APPCException;
82 * Retrieves {@link RequestStatus} from transaction table based on the passed parameters.
83 * @param requestId: RequestId of the request to search (Required)
84 * @param subrequestId: Sub-requestId (Optional)
85 * @param originatorId: Originator Id who sent the request(Optional)
86 * @param vnfId: VNFId to search (Required)
87 * @return list of RequestStatus'es
89 List<RequestStatus> getRecords(String requestId, String subrequestId, String originatorId, String vnfId)
93 * Count of all requests which are currently in non-terminal state.
94 * @return Count of all request in state RECEIVED and ACCEPTED.
96 Integer getInProgressRequestsCount() throws APPCException;
100 * @param appcInstanceId
102 void setAppcInstanceId(String appcInstanceId);