2 * ============LICENSE_START====================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
22 package org.onap.aaf.auth.service.mapper;
24 import java.util.Collection;
25 import java.util.List;
27 import org.onap.aaf.auth.dao.Bytification;
28 import org.onap.aaf.auth.dao.cass.ApprovalDAO;
29 import org.onap.aaf.auth.dao.cass.CertDAO;
30 import org.onap.aaf.auth.dao.cass.CredDAO;
31 import org.onap.aaf.auth.dao.cass.DelegateDAO;
32 import org.onap.aaf.auth.dao.cass.FutureDAO;
33 import org.onap.aaf.auth.dao.cass.HistoryDAO;
34 import org.onap.aaf.auth.dao.cass.Namespace;
35 import org.onap.aaf.auth.dao.cass.PermDAO;
36 import org.onap.aaf.auth.dao.cass.RoleDAO;
37 import org.onap.aaf.auth.dao.cass.UserRoleDAO;
38 import org.onap.aaf.auth.env.AuthzTrans;
39 import org.onap.aaf.auth.layer.Result;
40 import org.onap.aaf.auth.service.MayChange;
41 import org.onap.aaf.misc.rosetta.Marshal;
43 public interface Mapper<
59 PERMS,PERM_KEY,PERM_REQ,
60 ROLES,ROLE,ROLE_REQ,ROLE_PERM_REQ,
61 USERS,USER_ROLE_REQ,USER_ROLES,
70 public Class<?> getClass(API api);
71 public<A> Marshal<A> getMarshal(API api);
72 public<A> A newInstance(API api);
74 public Result<PermDAO.Data> permkey(AuthzTrans trans, PERMKEY from);
75 public Result<PermDAO.Data> perm(AuthzTrans trans, REQUEST from);
76 public Result<RoleDAO.Data> role(AuthzTrans trans, REQUEST from);
77 public Result<Namespace> ns(AuthzTrans trans, REQUEST from);
78 public Result<CredDAO.Data> cred(AuthzTrans trans, REQUEST from, boolean requiresPass);
79 public Result<USERS> cred(List<CredDAO.Data> lcred, USERS to);
80 public Result<CERTS> cert(List<CertDAO.Data> lcert, CERTS to);
81 public Result<DelegateDAO.Data> delegate(AuthzTrans trans, REQUEST from);
82 public Result<DELGS> delegate(List<DelegateDAO.Data> lDelg);
83 public Result<APPROVALS> approvals(List<ApprovalDAO.Data> lAppr);
84 public Result<List<ApprovalDAO.Data>> approvals(APPROVALS apprs);
85 public Result<List<PermDAO.Data>> perms(AuthzTrans trans, PERMS perms);
87 public Result<UserRoleDAO.Data> userRole(AuthzTrans trans, REQUEST from);
88 public Result<PermDAO.Data> permFromRPRequest(AuthzTrans trans, REQUEST from);
89 public REQUEST ungrantRequest(AuthzTrans trans, String role, String type, String instance, String action);
90 public Result<RoleDAO.Data> roleFromRPRequest(AuthzTrans trans, REQUEST from);
93 * Check Requests of varying sorts for Future fields set
95 public Result<FutureDAO.Data> future(AuthzTrans trans, String table, REQUEST from, Bytification content, boolean enableApproval, Memo memo, MayChange mc);
97 public Result<NSS> nss(AuthzTrans trans, Namespace from, NSS to);
99 // Note: Prevalidate if NS given is allowed to be seen before calling
100 public Result<NSS> nss(AuthzTrans trans, Collection<Namespace> from, NSS to);
101 // public Result<NSS> ns_attrib(AuthzTrans trans, Set<String> from, NSS to);
102 public Result<PERMS> perms(AuthzTrans trans, List<PermDAO.Data> from, PERMS to, boolean filter);
103 public Result<PERMS> perms(AuthzTrans trans, List<PermDAO.Data> from, PERMS to, String[] scopes, boolean filter);
104 public Result<ROLES> roles(AuthzTrans trans, List<RoleDAO.Data> from, ROLES roles, boolean filter);
105 // Note: Prevalidate if NS given is allowed to be seen before calling
106 public Result<USERS> users(AuthzTrans trans, Collection<UserRoleDAO.Data> from, USERS to);
107 public Result<USERROLES> userRoles(AuthzTrans trans, Collection<UserRoleDAO.Data> from, USERROLES to);
108 public Result<KEYS> keys(Collection<String> from);
110 public Result<HISTORY> history(AuthzTrans trans, List<HistoryDAO.Data> history, final int sort);
112 public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, String... detail);
115 * A Memo Creator... Use to avoid creating superfluous Strings until needed.
117 public static interface Memo {