1 7 8 package org.apache.jetspeed.xml.api.jcm; 9 10 14 import org.exolab.castor.mapping.AccessMode; 15 import org.exolab.castor.mapping.ClassDescriptor; 16 import org.exolab.castor.mapping.FieldDescriptor; 17 import org.exolab.castor.xml.*; 18 import org.exolab.castor.xml.FieldValidator; 19 import org.exolab.castor.xml.TypeValidator; 20 import org.exolab.castor.xml.XMLFieldDescriptor; 21 import org.exolab.castor.xml.handlers.*; 22 import org.exolab.castor.xml.util.XMLFieldDescriptorImpl; 23 import org.exolab.castor.xml.validators.*; 24 25 29 public class ImageDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { 30 31 32 36 private java.lang.String nsPrefix; 37 38 private java.lang.String nsURI; 39 40 private java.lang.String xmlName; 41 42 private org.exolab.castor.xml.XMLFieldDescriptor identity; 43 44 45 49 public ImageDescriptor() { 50 super(); 51 nsURI = "http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"; 52 xmlName = "image"; 53 XMLFieldDescriptorImpl desc = null; 54 XMLFieldHandler handler = null; 55 FieldValidator fieldValidator = null; 56 58 60 desc = new XMLFieldDescriptorImpl(java.lang.String .class, "_title", "title", NodeType.Element); 62 desc.setImmutable(true); 63 handler = (new XMLFieldHandler() { 64 public Object getValue( Object object ) 65 throws IllegalStateException 66 { 67 Image target = (Image) object; 68 return target.getTitle(); 69 } 70 public void setValue( Object object, Object value) 71 throws IllegalStateException , IllegalArgumentException 72 { 73 try { 74 Image target = (Image) object; 75 target.setTitle( (java.lang.String ) value); 76 } 77 catch (Exception ex) { 78 throw new IllegalStateException (ex.toString()); 79 } 80 } 81 public Object newInstance( Object parent ) { 82 return null; 83 } 84 } ); 85 desc.setHandler(handler); 86 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 87 desc.setRequired(true); 88 desc.setMultivalued(false); 89 addFieldDescriptor(desc); 90 91 fieldValidator = new FieldValidator(); 93 fieldValidator.setMinOccurs(1); 94 { StringValidator sv = new StringValidator(); 96 sv.setWhiteSpace("preserve"); 97 fieldValidator.setValidator(sv); 98 } 99 desc.setValidator(fieldValidator); 100 101 desc = new XMLFieldDescriptorImpl(java.lang.String .class, "_url", "url", NodeType.Element); 103 desc.setImmutable(true); 104 handler = (new XMLFieldHandler() { 105 public Object getValue( Object object ) 106 throws IllegalStateException 107 { 108 Image target = (Image) object; 109 return target.getUrl(); 110 } 111 public void setValue( Object object, Object value) 112 throws IllegalStateException , IllegalArgumentException 113 { 114 try { 115 Image target = (Image) object; 116 target.setUrl( (java.lang.String ) value); 117 } 118 catch (Exception ex) { 119 throw new IllegalStateException (ex.toString()); 120 } 121 } 122 public Object newInstance( Object parent ) { 123 return null; 124 } 125 } ); 126 desc.setHandler(handler); 127 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 128 desc.setRequired(true); 129 desc.setMultivalued(false); 130 addFieldDescriptor(desc); 131 132 fieldValidator = new FieldValidator(); 134 fieldValidator.setMinOccurs(1); 135 { StringValidator sv = new StringValidator(); 137 sv.setWhiteSpace("preserve"); 138 fieldValidator.setValidator(sv); 139 } 140 desc.setValidator(fieldValidator); 141 142 desc = new XMLFieldDescriptorImpl(java.lang.String .class, "_link", "link", NodeType.Element); 144 desc.setImmutable(true); 145 handler = (new XMLFieldHandler() { 146 public Object getValue( Object object ) 147 throws IllegalStateException 148 { 149 Image target = (Image) object; 150 return target.getLink(); 151 } 152 public void setValue( Object object, Object value) 153 throws IllegalStateException , IllegalArgumentException 154 { 155 try { 156 Image target = (Image) object; 157 target.setLink( (java.lang.String ) value); 158 } 159 catch (Exception ex) { 160 throw new IllegalStateException (ex.toString()); 161 } 162 } 163 public Object newInstance( Object parent ) { 164 return null; 165 } 166 } ); 167 desc.setHandler(handler); 168 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 169 desc.setRequired(true); 170 desc.setMultivalued(false); 171 addFieldDescriptor(desc); 172 173 fieldValidator = new FieldValidator(); 175 fieldValidator.setMinOccurs(1); 176 { StringValidator sv = new StringValidator(); 178 sv.setWhiteSpace("preserve"); 179 fieldValidator.setValidator(sv); 180 } 181 desc.setValidator(fieldValidator); 182 183 desc = new XMLFieldDescriptorImpl(java.lang.String .class, "_description", "description", NodeType.Element); 185 desc.setImmutable(true); 186 handler = (new XMLFieldHandler() { 187 public Object getValue( Object object ) 188 throws IllegalStateException 189 { 190 Image target = (Image) object; 191 return target.getDescription(); 192 } 193 public void setValue( Object object, Object value) 194 throws IllegalStateException , IllegalArgumentException 195 { 196 try { 197 Image target = (Image) object; 198 target.setDescription( (java.lang.String ) value); 199 } 200 catch (Exception ex) { 201 throw new IllegalStateException (ex.toString()); 202 } 203 } 204 public Object newInstance( Object parent ) { 205 return null; 206 } 207 } ); 208 desc.setHandler(handler); 209 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 210 desc.setMultivalued(false); 211 addFieldDescriptor(desc); 212 213 fieldValidator = new FieldValidator(); 215 { StringValidator sv = new StringValidator(); 217 sv.setWhiteSpace("preserve"); 218 fieldValidator.setValidator(sv); 219 } 220 desc.setValidator(fieldValidator); 221 222 desc = new XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", NodeType.Element); 224 handler = (new XMLFieldHandler() { 225 public Object getValue( Object object ) 226 throws IllegalStateException 227 { 228 Image target = (Image) object; 229 if(!target.hasWidth()) 230 return null; 231 return new Integer (target.getWidth()); 232 } 233 public void setValue( Object object, Object value) 234 throws IllegalStateException , IllegalArgumentException 235 { 236 try { 237 Image target = (Image) object; 238 if (value == null) { 240 target.deleteWidth(); 241 return; 242 } 243 target.setWidth( ((Integer )value).intValue()); 244 } 245 catch (Exception ex) { 246 throw new IllegalStateException (ex.toString()); 247 } 248 } 249 public Object newInstance( Object parent ) { 250 return null; 251 } 252 } ); 253 desc.setHandler(handler); 254 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 255 desc.setMultivalued(false); 256 addFieldDescriptor(desc); 257 258 fieldValidator = new FieldValidator(); 260 { IntegerValidator iv = new IntegerValidator(); 262 fieldValidator.setValidator(iv); 263 } 264 desc.setValidator(fieldValidator); 265 266 desc = new XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", NodeType.Element); 268 handler = (new XMLFieldHandler() { 269 public Object getValue( Object object ) 270 throws IllegalStateException 271 { 272 Image target = (Image) object; 273 if(!target.hasHeight()) 274 return null; 275 return new Integer (target.getHeight()); 276 } 277 public void setValue( Object object, Object value) 278 throws IllegalStateException , IllegalArgumentException 279 { 280 try { 281 Image target = (Image) object; 282 if (value == null) { 284 target.deleteHeight(); 285 return; 286 } 287 target.setHeight( ((Integer )value).intValue()); 288 } 289 catch (Exception ex) { 290 throw new IllegalStateException (ex.toString()); 291 } 292 } 293 public Object newInstance( Object parent ) { 294 return null; 295 } 296 } ); 297 desc.setHandler(handler); 298 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 299 desc.setMultivalued(false); 300 addFieldDescriptor(desc); 301 302 fieldValidator = new FieldValidator(); 304 { IntegerValidator iv = new IntegerValidator(); 306 fieldValidator.setValidator(iv); 307 } 308 desc.setValidator(fieldValidator); 309 310 } 312 313 317 319 public org.exolab.castor.mapping.AccessMode getAccessMode() 320 { 321 return null; 322 } 324 326 public org.exolab.castor.mapping.ClassDescriptor getExtends() 327 { 328 return null; 329 } 331 333 public org.exolab.castor.mapping.FieldDescriptor getIdentity() 334 { 335 return identity; 336 } 338 340 public java.lang.Class getJavaClass() 341 { 342 return org.apache.jetspeed.xml.api.jcm.Image.class; 343 } 345 347 public java.lang.String getNameSpacePrefix() 348 { 349 return nsPrefix; 350 } 352 354 public java.lang.String getNameSpaceURI() 355 { 356 return nsURI; 357 } 359 361 public org.exolab.castor.xml.TypeValidator getValidator() 362 { 363 return this; 364 } 366 368 public java.lang.String getXMLName() 369 { 370 return xmlName; 371 } 373 } 374 | Popular Tags |