Onboarding upload control
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-software-product-lib / openecomp-sdc-vendor-software-product-api / src / main / java / org / openecomp / sdc / vendorsoftwareproduct / dao / VspUploadStatusRecordDao.java
1 /*
2  * -
3  *  ============LICENSE_START=======================================================
4  *  Copyright (C) 2022 Nordix Foundation.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
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  *
18  *  SPDX-License-Identifier: Apache-2.0
19  *  ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.sdc.vendorsoftwareproduct.dao;
23
24 import java.util.List;
25 import java.util.Optional;
26 import java.util.UUID;
27 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspUploadStatusRecord;
28
29 /**
30  * Data Access Object for the package upload process status record.
31  */
32 public interface VspUploadStatusRecordDao {
33
34     /**
35      * Creates an upload status record.
36      *
37      * @param vspUploadStatusRecord the upload status record to create
38      */
39     void create(final VspUploadStatusRecord vspUploadStatusRecord);
40
41     /**
42      * Updates an upload status record.
43      *
44      * @param vspUploadStatusRecord the upload status record to update
45      */
46     void update(final VspUploadStatusRecord vspUploadStatusRecord);
47
48     /**
49      * Finds all upload status record by Vendor Software Product id and its version id.
50      *
51      * @param vspId        the Vendor Software Product id
52      * @param vspVersionId the Vendor Software Product version id
53      * @return a list with all the status record found that matches the criteria
54      */
55     List<VspUploadStatusRecord> findAllByVspIdAndVersionId(final String vspId, final String vspVersionId);
56
57     /**
58      * Finds all upload status record by Vendor Software Product id and its version id.
59      *
60      * @param vspId        the Vendor Software Product id
61      * @param vspVersionId the Vendor Software Product version id
62      * @return a list with all the status record found that matches the criteria
63      */
64     Optional<VspUploadStatusRecord> findByVspIdAndVersionIdAndLockId(final String vspId, final String vspVersionId, final UUID lockId);
65
66     /**
67      * Finds all uploads in progress by Vendor Software Product id and its version id.
68      *
69      * @param vspId        the Vendor Software Product id
70      * @param vspVersionId the Vendor Software Product version id
71      * @return a list with all the status record found that matches the criteria
72      */
73     List<VspUploadStatusRecord> findAllInProgress(final String vspId, final String vspVersionId);
74
75     /**
76      * Finds the latest upload status record for the Vendor Software Product id and its version id.
77      *
78      * @param vspId        the Vendor Software Product id
79      * @param vspVersionId the Vendor Software Product version id
80      * @return the latest upload status record that matches the criteria
81      */
82     Optional<VspUploadStatusRecord> findLatest(final String vspId, final String vspVersionId);
83
84 }