KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ra > userdatasource > UserDataSourceVO


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13 package org.ejbca.core.model.ra.userdatasource;
14
15 import java.io.Serializable JavaDoc;
16 import java.util.Set JavaDoc;
17
18 import org.ejbca.core.model.ra.UserDataVO;
19 import org.ejbca.util.dn.DNFieldExtractor;
20
21
22 /**
23  * UserDataSourceVO is a value object returned from the fetch method
24  * of a user data source.
25  *
26  * Contains two things one is the UserDataVO and the other is
27  * a set of contants indicating which fields that should be modifyable by the RA.
28  *
29  *
30  * @author Philip Vendil
31  * @version $Id: UserDataSourceVO.java,v 1.2 2006/12/02 11:17:57 anatom Exp $
32  */

33
34 public class UserDataSourceVO implements Serializable JavaDoc {
35
36     /**
37      * Constants used in isModifyable sets.
38      */

39     public static final int ISMODIFYABLE_USERNAME = 101;
40     public static final int ISMODIFYABLE_PASSWORD = 102;
41     public static final int ISMODIFYABLE_CAID = 103;
42     public static final int ISMODIFYABLE_EMAILDATA = 104;
43     public static final int ISMODIFYABLE_TYPE = 105;
44     public static final int ISMODIFYABLE_ENDENTITYPROFILE = 106;
45     public static final int ISMODIFYABLE_CERTIFICATEPROFILE = 107;
46     public static final int ISMODIFYABLE_TOKENTYPE = 108;
47     public static final int ISMODIFYABLE_HARDTOKENISSUER = 109;
48
49     public static final int[] AVAILABLEMODIFYABLEFIELDS = {
50         ISMODIFYABLE_USERNAME , ISMODIFYABLE_PASSWORD , ISMODIFYABLE_CAID , ISMODIFYABLE_EMAILDATA ,
51         ISMODIFYABLE_TYPE , ISMODIFYABLE_ENDENTITYPROFILE , ISMODIFYABLE_CERTIFICATEPROFILE , ISMODIFYABLE_TOKENTYPE , ISMODIFYABLE_HARDTOKENISSUER,
52         DNFieldExtractor.UID , DNFieldExtractor.CN , DNFieldExtractor.SN ,
53         DNFieldExtractor.GIVENNAME , DNFieldExtractor.INITIALS , DNFieldExtractor.SURNAME , DNFieldExtractor.T ,
54         DNFieldExtractor.OU , DNFieldExtractor.O , DNFieldExtractor.L , DNFieldExtractor.ST ,
55         DNFieldExtractor.DC , DNFieldExtractor.C , DNFieldExtractor.UNSTRUCTUREDADDRESS , DNFieldExtractor.UNSTRUCTUREDNAME ,
56         DNFieldExtractor.DNSNAME , DNFieldExtractor.IPADDRESS ,
57         DNFieldExtractor.DIRECTORYNAME, DNFieldExtractor.URI ,
58         DNFieldExtractor.UPN , DNFieldExtractor.GUID ,
59         DNFieldExtractor.DATEOFBIRTH , DNFieldExtractor.PLACEOFBIRTH , DNFieldExtractor.GENDER , DNFieldExtractor.COUNTRYOFCITIZENSHIP ,
60         DNFieldExtractor.COUNTRYOFRESIDENCE
61     };
62
63     private UserDataVO userDataVO = null;
64     private Set JavaDoc isModifyableSet = null;
65     
66     /**
67      * Constuctor that should be used from the User Data Source Implementations
68      * @param userDataVO
69      */

70     public UserDataSourceVO(UserDataVO userDataVO) {
71         super();
72         this.userDataVO = userDataVO;
73     }
74     
75     /**
76      * Method that should be used bu BaseUserDataSource only.
77      * @param isModifyableSet
78      */

79     void setIsModifyableSet(Set JavaDoc isModifyableSet){
80         this.isModifyableSet = isModifyableSet;
81     }
82     
83     /**
84      * Method that returns the users userdatavo.
85      */

86     public UserDataVO getUserDataVO(){
87         return userDataVO;
88     }
89     
90     /**
91      * Method used to check if a field can be modifyable by the RA.
92      *
93      * @param field constaining one of the UserDataSourceVO.ISMODIFYABLE_ or
94      * DNFieldExtractor constants defined in the AVAILABLEMODIFYABLEFIELDS array.
95      * @return true if the field should be modifyable.
96      */

97     public boolean isFieldModifyable(int field){
98         return isModifyableSet.contains(new Integer JavaDoc(field));
99     }
100
101 }
102
Popular Tags