7328f0990acb38e0184e84cb8f6942fd14b91dfa
[aaf/authz.git] / auth / auth-certman / src / main / java / org / onap / aaf / auth / cm / mapper / Mapper.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
22 package org.onap.aaf.auth.cm.mapper;
23
24 import java.io.IOException;
25 import java.util.List;
26
27 import org.onap.aaf.auth.cm.data.CertDrop;
28 import org.onap.aaf.auth.cm.data.CertRenew;
29 import org.onap.aaf.auth.cm.data.CertReq;
30 import org.onap.aaf.auth.cm.data.CertResp;
31 import org.onap.aaf.auth.dao.cass.ArtiDAO;
32 import org.onap.aaf.auth.dao.cass.CertDAO;
33 import org.onap.aaf.auth.env.AuthzTrans;
34 import org.onap.aaf.auth.layer.Result;
35
36 public interface Mapper<REQ,CERT,ARTIFACTS,ERROR>
37 {
38     public enum API{ERROR,VOID,CERT,CERT_REQ,CERT_RENEW,CERT_DROP,ARTIFACTS};
39     
40     public Class<?> getClass(API api);
41     public<A> A newInstance(API api);
42
43     public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, String... detail);
44     
45     public Result<CERT> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException;
46     public Result<CERT> toCert(AuthzTrans trans, Result<List<CertDAO.Data>> in);
47
48     public Result<CertReq> toReq(AuthzTrans trans, REQ req);
49     public Result<CertRenew> toRenew(AuthzTrans trans, REQ req);
50     public Result<CertDrop>  toDrop(AuthzTrans trans, REQ req);
51     
52     public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, ARTIFACTS arti);
53     public Result<ARTIFACTS> fromArtifacts(Result<List<ArtiDAO.Data>> readArtifactsByMachine);
54 }