Batch work and client
[aaf/authz.git] / auth / auth-batch / src / main / java / org / onap / aaf / auth / batch / approvalsets / DataView.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 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  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21 package org.onap.aaf.auth.batch.approvalsets;
22
23 import java.util.List;
24
25 import org.onap.aaf.auth.dao.cass.ApprovalDAO;
26 import org.onap.aaf.auth.dao.cass.FutureDAO;
27 import org.onap.aaf.auth.dao.cass.NsDAO;
28 import org.onap.aaf.auth.dao.cass.RoleDAO;
29 import org.onap.aaf.auth.dao.cass.UserRoleDAO;
30 import org.onap.aaf.auth.env.AuthzTrans;
31 import org.onap.aaf.auth.layer.Result;
32
33 /**
34  * I have become convinced that Data for Apps is modeled by abstract access methods against multiple data
35  * sources.  With the insistence of JUnits, it becomes much more paramount to create a model which can 
36  *   1) be easily loaded from Disk "Test Data" without resorting to complex "mokito" schemes
37  *   2) tested in Memory
38  *   3) combined for REAL time by running Cached Memory
39  *   4) Streamable in
40  *      a) Binary
41  *      b) CSV
42  *      c) JSON
43  *      d) XML
44  *   5) persisted Globally through a store like Cassandra
45  *   
46  * But in the end, it looks like:
47  *   1) Data Structures
48  *   2) Find the Data Structures by various means, accounting for 
49  *      a) Multiple Responses
50  *      b) Errors from the deepest level, made available through the call stack
51  *   3) 
52  *     
53  * @author jonathan.gathman
54  *
55  */
56 public interface DataView {
57         // Reads
58         public Result<NsDAO.Data> ns(final AuthzTrans trans, final String id);
59         public Result<RoleDAO.Data> roleByName(final AuthzTrans trans, final String name);
60         public Result<List<UserRoleDAO.Data>> ursByRole(final AuthzTrans trans, final String role);
61         public Result<List<UserRoleDAO.Data>> ursByUser(final AuthzTrans trans, final String user);
62
63         // Inserts
64         public Result<ApprovalDAO.Data> insert(final AuthzTrans trans, final ApprovalDAO.Data add);
65         public Result<FutureDAO.Data> insert(final AuthzTrans trans, final FutureDAO.Data add);
66         
67         // Deletes
68         public Result<ApprovalDAO.Data> delete(final AuthzTrans trans, final ApprovalDAO.Data add);
69         public Result<FutureDAO.Data> delete(final AuthzTrans trans, final FutureDAO.Data add);
70         
71         // Clear any buffers
72         public void flush();
73 }