1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.authz.service.mapper;
\r
25 import java.util.Collection;
\r
26 import java.util.List;
\r
28 import org.onap.aaf.authz.env.AuthzTrans;
\r
29 import org.onap.aaf.authz.layer.Result;
\r
30 import org.onap.aaf.authz.service.MayChange;
\r
31 import org.onap.aaf.dao.Bytification;
\r
32 import org.onap.aaf.dao.aaf.cass.ApprovalDAO;
\r
33 import org.onap.aaf.dao.aaf.cass.CertDAO;
\r
34 import org.onap.aaf.dao.aaf.cass.CredDAO;
\r
35 import org.onap.aaf.dao.aaf.cass.DelegateDAO;
\r
36 import org.onap.aaf.dao.aaf.cass.FutureDAO;
\r
37 import org.onap.aaf.dao.aaf.cass.HistoryDAO;
\r
38 import org.onap.aaf.dao.aaf.cass.Namespace;
\r
39 import org.onap.aaf.dao.aaf.cass.PermDAO;
\r
40 import org.onap.aaf.dao.aaf.cass.RoleDAO;
\r
41 import org.onap.aaf.dao.aaf.cass.UserRoleDAO;
\r
43 import org.onap.aaf.rosetta.Marshal;
\r
45 public interface Mapper<
\r
60 enum API{NSS,NS_REQ,
\r
61 PERMS,PERM_KEY,PERM_REQ,
\r
62 ROLES,ROLE,ROLE_REQ,ROLE_PERM_REQ,
\r
63 USERS,USER_ROLE_REQ,USER_ROLES,
\r
72 public Class<?> getClass(API api);
\r
73 public<A> Marshal<A> getMarshal(API api);
\r
74 public<A> A newInstance(API api);
\r
76 public Result<PermDAO.Data> permkey(AuthzTrans trans, PERMKEY from);
\r
77 public Result<PermDAO.Data> perm(AuthzTrans trans, REQUEST from);
\r
78 public Result<RoleDAO.Data> role(AuthzTrans trans, REQUEST from);
\r
79 public Result<Namespace> ns(AuthzTrans trans, REQUEST from);
\r
80 public Result<CredDAO.Data> cred(AuthzTrans trans, REQUEST from, boolean requiresPass);
\r
81 public Result<USERS> cred(List<CredDAO.Data> lcred, USERS to);
\r
82 public Result<CERTS> cert(List<CertDAO.Data> lcert, CERTS to);
\r
83 public Result<DelegateDAO.Data> delegate(AuthzTrans trans, REQUEST from);
\r
84 public Result<DELGS> delegate(List<DelegateDAO.Data> lDelg);
\r
85 public Result<APPROVALS> approvals(List<ApprovalDAO.Data> lAppr);
\r
86 public Result<List<ApprovalDAO.Data>> approvals(APPROVALS apprs);
\r
87 public Result<List<PermDAO.Data>> perms(AuthzTrans trans, PERMS perms);
\r
89 public Result<UserRoleDAO.Data> userRole(AuthzTrans trans, REQUEST from);
\r
90 public Result<PermDAO.Data> permFromRPRequest(AuthzTrans trans, REQUEST from);
\r
91 public Result<RoleDAO.Data> roleFromRPRequest(AuthzTrans trans, REQUEST from);
\r
94 * Check Requests of varying sorts for Future fields set
\r
96 public Result<FutureDAO.Data> future(AuthzTrans trans, String table, REQUEST from, Bytification content, boolean enableApproval, Memo memo, MayChange mc);
\r
98 public Result<NSS> nss(AuthzTrans trans, Namespace from, NSS to);
\r
100 // Note: Prevalidate if NS given is allowed to be seen before calling
\r
101 public Result<NSS> nss(AuthzTrans trans, Collection<Namespace> from, NSS to);
\r
102 // public Result<NSS> ns_attrib(AuthzTrans trans, Set<String> from, NSS to);
\r
103 public Result<PERMS> perms(AuthzTrans trans, List<PermDAO.Data> from, PERMS to, boolean filter);
\r
104 public Result<ROLES> roles(AuthzTrans trans, List<RoleDAO.Data> from, ROLES roles, boolean filter);
\r
105 // Note: Prevalidate if NS given is allowed to be seen before calling
\r
106 public Result<USERS> users(AuthzTrans trans, Collection<UserRoleDAO.Data> from, USERS to);
\r
107 public Result<USERROLES> userRoles(AuthzTrans trans, Collection<UserRoleDAO.Data> from, USERROLES to);
\r
108 public Result<KEYS> keys(Collection<String> from);
\r
110 public Result<HISTORY> history(AuthzTrans trans, List<HistoryDAO.Data> history, final int sort);
\r
112 public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, String... detail);
\r
115 * A Memo Creator... Use to avoid creating superfluous Strings until needed.
\r
117 public static interface Memo {
\r
118 public String get();
\r