KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > tools > migration > TableToMigrate


1 package org.jahia.tools.migration;
2
3 import org.w3c.dom.Element JavaDoc;
4
5 /**
6  * This class stores all information about how to migrate a DB table
7  *
8  * @author PELTIER Olivier
9  * @version 1.0
10  */

11 public class TableToMigrate {
12
13     // Strings to get parameters from xml Element
14
private static final String JavaDoc TABLE_NAME = "name";
15     private static final String JavaDoc TABLE_COLUMN = "column";
16     private static final String JavaDoc TABLE_DB_CRITERIA = "db_criteria";
17     private static final String JavaDoc TABLE_LDAP_CRITERIA = "ldap_criteria";
18     private static final String JavaDoc TABLE_CURRENT_LDAP = "current_ldap_attribute";
19     private static final String JavaDoc TABLE_NEW_LDAP = "new_ldap_attribute";
20     private static final String JavaDoc TABLE_DB_PREFIX = "db_prefix";
21
22     // the DB table name
23
private String JavaDoc tableName;
24     
25     // the DB table column to update
26
private String JavaDoc columnName;
27     
28     // the criteria to use while searching data to migrate into the DB
29
private String JavaDoc dbCriteria;
30     
31     // the criteria to use while searching the new value for data in LDAP
32
private String JavaDoc ldapCriteria;
33     
34     // the actual LDAP attribute used as key for users
35
private String JavaDoc currentAttr;
36     
37     // the new attribute to use
38
private String JavaDoc newAttr;
39     
40     // the prefix to add to the new value gotten from LDAP
41
private String JavaDoc dbPrefix;
42     
43     /**
44      * Constructor.
45      *
46      * @param element Element.
47      */

48     public TableToMigrate(Element JavaDoc element) {
49         try {
50             tableName = XMLUtility.getElementValue(TABLE_NAME, element);
51             columnName = XMLUtility.getElementValue(TABLE_COLUMN, element);
52             dbCriteria = XMLUtility.getElementValue(TABLE_DB_CRITERIA, element);
53             ldapCriteria = XMLUtility.getElementValue(TABLE_LDAP_CRITERIA, element);
54             currentAttr = XMLUtility.getElementValue(TABLE_CURRENT_LDAP, element);
55             newAttr = XMLUtility.getElementValue(TABLE_NEW_LDAP, element);
56             dbPrefix = XMLUtility.getElementValue(TABLE_DB_PREFIX, element);
57         } catch (Exception JavaDoc e) {}
58     }
59     
60     /**
61      * Get the target table name.
62      *
63      * @return String.
64      */

65     public String JavaDoc getTableName() {
66         return tableName;
67     }
68
69     /**
70      * Get the target column name.
71      *
72      * @return String.
73      */

74     public String JavaDoc getColumnName() {
75         return columnName;
76     }
77     
78     /**
79      * Get the DB criteria.
80      *
81      * @return String.
82      */

83     public String JavaDoc getDbCriteria() {
84         return dbCriteria;
85     }
86     
87     /**
88      * Get the LDAP criteria.
89      *
90      * @return String.
91      */

92     public String JavaDoc getLdapCriteria() {
93         return ldapCriteria;
94     }
95
96     /**
97      * Get the LDAP current attribute use as key.
98      *
99      * @return String.
100      */

101     public String JavaDoc getCurrentAttr() {
102         return currentAttr;
103     }
104     
105     /**
106      * Get the LDAP new attribute to use as key.
107      *
108      * @return String.
109      */

110     public String JavaDoc getNewAttr() {
111         return newAttr;
112     }
113     
114     /**
115      * Get the DB prefix to complete values retrieved from LDAP.
116      *
117      * @return String.
118      */

119     public String JavaDoc getDbPrefix() {
120         return dbPrefix;
121     }
122 }
Popular Tags