1 23 24 31 package org.enhydra.dods.trans; 32 33 import java.util.ArrayList ; 34 35 39 public class Referrer { 40 41 44 protected ArrayList refAttr = new ArrayList (); 45 46 49 protected String name = null; 50 51 54 protected String pckg = null; 55 56 59 protected boolean do_secure = DefaultTagValues.DO_SECURITY; 60 61 67 public Referrer(String pckg, String name) { 68 this.name = name; 69 this.pckg = pckg; 70 } 71 72 78 public void addAttribute(String name, String do_name, boolean isSecure) { 79 refAttr.add(new RefAttr(name, do_name, isSecure)); 80 } 81 82 87 public void addAttribute(RefAttr attr) { 88 refAttr.add(attr); 89 } 90 91 96 public int size() { 97 return refAttr.size(); 98 } 99 100 105 public String name() { 106 return name; 107 } 108 109 114 public void secure(boolean is_secure) { 115 do_secure = is_secure; 116 } 117 118 123 public boolean isSecure() { 124 return do_secure; 125 } 126 127 132 public String pckg() { 133 return pckg; 134 } 135 136 141 public ArrayList referrerAttributes() { 142 return refAttr; 143 } 144 145 152 public RefAttr attribute(int index) { 153 return (RefAttr) refAttr.get(index); 154 } 155 156 163 public String attributeName(int index) { 164 return ((RefAttr) refAttr.get(index)).name(); 165 } 166 167 174 public String attributeDoName(int index) { 175 return ((RefAttr) refAttr.get(index)).doName(); 176 } 177 178 185 public boolean attributeSecurity(int index) { 186 return ((RefAttr) refAttr.get(index)).isSecure(); 187 } 188 189 194 public String toString() { 195 StringBuffer ret = new StringBuffer ("name=").append(name).append(" package=").append(pckg).append(" attributes: "); 196 197 for (int i = 0; i < refAttr.size(); i++) { 198 ret.append(refAttr.get(i)).append(" "); 199 } 200 return ret.toString(); 201 } 202 203 public static void main(String [] args) { 204 Referrer referrer = new Referrer("package0.package1", "Person"); 205 206 referrer.addAttribute("Manager", "package0.package1.Manager", false); 207 referrer.addAttribute("Employee", "package0.package1.Employee", false); 208 System.out.println("Refferer: \n" + referrer); 209 } 210 211 214 public class RefAttr { 215 216 219 protected String name = null; 220 221 224 protected String do_name = null; 225 226 229 protected boolean do_secure = DefaultTagValues.DO_SECURITY; 230 231 238 public RefAttr(String name, String do_name, boolean isSecure) { 239 this.name = name; 240 this.do_name = do_name; 241 this.do_secure = isSecure; 242 } 243 244 249 public String name() { 250 return name; 251 } 252 253 258 public String doName() { 259 return do_name; 260 } 261 262 267 public boolean isSecure() { 268 return do_secure; 269 } 270 271 276 public String toString() { 277 return new StringBuffer ("name=").append(name).append(" do_name=").append(do_name).toString(); 278 } 279 } 280 } 281 | Popular Tags |