001: package migration.modules.ldap;
002:
003: import java.util.Hashtable;
004: import java.util.Vector;
005: import java.util.Enumeration;
006: import java.util.Locale;
007: import java.util.ResourceBundle;
008:
009: public class Element {
010: public int type;
011: public String pcdata;
012: static public final int ATTRIBUTE_I = 1;
013: static public final int PRIVILEGE_I = 2;
014: static public final int VALUE_I = 3;
015: static public final int READPERM_I = 4;
016: static public final int WRITEPERM_I = 5;
017: static public final int CHOICELST_I = 6;
018: static public final int ALLOWLST_I = 7;
019: static public final int DENYLST_I = 8;
020: static public final String NAME = "name";
021: static public final String COMPONENT_E = "iwt:Component";
022: static public final String ATT_E = "iwt:Att";
023: static public final String PRIV_E = "iwt:Priv";
024: static public final String WRITEPERM = "Wperm";
025: static public final String WRITEPERMN = "iwt:Wperm";
026: static public final String READPERM = "Rperm";
027: static public final String READPERMN = "iwt:Rperm";
028: static public final String DESC = "desc";
029: static public final String TYPE = "type";
030: static public final String USERCONFIGURABLE = "userConfigurable";
031: static public final String REMOTEFLAG = "remFlg";
032: static public final String INDEX = "idx";
033: static public final String VERSION = "ver";
034: static public final String RESOURCEBUNDLE = "resB";
035: static public final String VALUE = "val";
036: static public final String ATTVALUE = "attval";
037: static public final String VALUELIST = "Val";
038: static public final String VALUELISTN = "iwt:Val";
039: static public final String CHOICEVALUE = "CVal";
040: static public final String CHOICEVALUEN = "iwt:CVal";
041: static public final String DENYLIST = "Dlst";
042: static public final String DENYLISTN = "iwt:Dlst";
043: static public final String ALLOWLIST = "Alst";
044: static public final String ALLOWLISTN = "iwt:Alst";
045: static public final String ACVALUE = "acval";
046: static public Hashtable mapper = new Hashtable();
047: static public Hashtable revmapper = new Hashtable();
048: static public final String ATTPREFIX = "-at";
049: static public final String PRIVPREFIX = "-pv";
050: protected static ResourceBundle bundle = null;
051: final static Vector admin_owner;
052:
053: static {
054: if (mapper == null)
055: mapper = new Hashtable();
056: mapper.put(NAME, "");
057: mapper.put(WRITEPERM, "-wp-");
058: mapper.put(READPERM, "-rp-");
059: mapper.put(DESC, "-dsc-");
060: mapper.put(TYPE, "-tp-");
061: mapper.put(USERCONFIGURABLE, "-of-");
062: mapper.put(INDEX, "-cat-");
063: mapper.put(RESOURCEBUNDLE, "-rb-");
064: mapper.put(ATTVALUE, "");
065: mapper.put(CHOICEVALUE, "-cv-");
066: mapper.put(DENYLIST, "-de-");
067: mapper.put(ALLOWLIST, "-al-");
068: mapper.put(ACVALUE, "-ac-");
069: mapper.put(REMOTEFLAG, "-rf-");
070:
071: revmapper.put("-wp-", WRITEPERM);
072: revmapper.put("-rp-", READPERM);
073: revmapper.put("-dsc-", DESC);
074: revmapper.put("-tp-", TYPE);
075: revmapper.put("-of-", USERCONFIGURABLE);
076: revmapper.put("-rf-", REMOTEFLAG);
077: revmapper.put("-cat-", INDEX);
078: revmapper.put("-rb-", RESOURCEBUNDLE);
079: revmapper.put("-cv-", CHOICEVALUE);
080: revmapper.put("-de-", DENYLIST);
081: revmapper.put("-al-", ALLOWLIST);
082: revmapper.put("-ac-", ACVALUE);
083: Locale locale = Locale.getDefault();
084: bundle = ResourceBundle.getBundle("psMigrationLdap", locale);
085: admin_owner = new Vector();
086: admin_owner.addElement("ADMIN");
087: admin_owner.addElement("OWNER");
088:
089: }
090:
091: public String toXML() {
092: return ("Element");
093: }
094:
095: String constructXMLElement(String el, Vector stuff) {
096: StringBuffer ret = new StringBuffer(200).append("");
097: if (stuff == null)
098: return ret.toString();
099: int numElems = stuff.size();
100: for (int i = 0; i < numElems; i++) {
101: ret.append(" <").append(el).append(">").append(
102: stuff.elementAt(i)).append("</").append(el).append(
103: ">\n");
104: }
105: return ret.toString();
106: }
107:
108: String hashToXML(Hashtable tab) {
109: StringBuffer ret = new StringBuffer(200).append("");
110: if (tab == null)
111: return ret.toString();
112: Enumeration keys = tab.keys();
113: while (keys.hasMoreElements()) {
114: String key = (String) keys.nextElement();
115: ret.append(" ").append(key).append("=\"");
116: ret.append(tab.get(key)).append("\"\n");
117: }
118: return ret.toString();
119: }
120:
121: void populate_vector(Enumeration en, Vector v) {
122: while (en.hasMoreElements())
123: v.addElement(en.nextElement());
124: }
125: }
|