eb116490e1975cd033d8875447210201df6b6f27
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / aaf / marshal / CertMarshal.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.cadi.aaf.marshal;
23
24 import javax.xml.datatype.XMLGregorianCalendar;
25
26 import org.onap.aaf.misc.rosetta.marshal.FieldDateTime;
27 import org.onap.aaf.misc.rosetta.marshal.FieldHexBinary;
28 import org.onap.aaf.misc.rosetta.marshal.FieldString;
29 import org.onap.aaf.misc.rosetta.marshal.ObjMarshal;
30
31 import aaf.v2_0.Certs.Cert;
32
33 public class CertMarshal extends ObjMarshal<Cert> {
34     public CertMarshal() {
35         add(new FieldHexBinary<Cert>("fingerprint") {
36             @Override
37             protected byte[] data(Cert t) {
38                 return t.getFingerprint();
39             }
40         });
41
42         add(new FieldString<Cert>("id") {
43             @Override
44             protected String data(Cert t) {
45                 return t.getId();
46             }
47         });
48
49         add(new FieldString<Cert>("x500") {
50             @Override
51             protected String data(Cert t) {
52                 return t.getX500();
53             }
54         });
55         
56         add(new FieldDateTime<Cert>("expires") {
57             @Override
58             protected XMLGregorianCalendar data(Cert t) {
59                 return t.getExpires();
60             }
61         });
62
63
64     }
65 }