You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by pn...@apache.org on 2003/05/02 13:54:51 UTC
cvs commit: jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav ProppatchRequest.java
pnever 2003/05/02 04:54:51
Modified: proposals/wvcm/src/org/apache/wvcm/store/webdav
ProppatchRequest.java
Log:
Fixed bug and added handling for datatypes others than String
Revision Changes Path
1.2 +40 -8 jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/ProppatchRequest.java
Index: ProppatchRequest.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/ProppatchRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProppatchRequest.java 30 Apr 2003 16:28:14 -0000 1.1
+++ ProppatchRequest.java 2 May 2003 11:54:50 -0000 1.2
@@ -99,10 +99,18 @@
while( i.hasNext() ) {
PropertyUpdate propupd = (PropertyUpdate)i.next();
Element pElm = null;
- if( propupd.pname instanceof AttributeName )
+ if( propupd.pname instanceof AttributeName ) {
pElm = new Element( propupd.pname.getString(), Namespace.getNamespace(((AttributeName)propupd.pname).getNamespace()) );
- else if( propupd.pname instanceof PropertyName )
- pElm = new Element( propupd.pname.getString(), dnsp );
+ }
+ else if( propupd.pname instanceof PropertyName ) {
+ String webdavname = Properties.webdavNameForPropertyName(propupd.pname);
+ if( webdavname != null ) {
+ pElm = new Element( webdavname, dnsp );
+ }
+ else {
+ // TODO: handle non-WebDAV properties
+ }
+ }
if( pElm != null ) {
if( propupd.remove ){
@@ -113,8 +121,32 @@
if( propupd.value instanceof String ) {
pElm.addContent( new Text((String)propupd.value) );
}
+ else if( propupd.value instanceof Integer ) {
+ pElm.addContent( new Text(((Integer)propupd.value).toString()) );
+ }
+ else if( propupd.value instanceof Boolean ) {
+ pElm.addContent( new Text(((Boolean)propupd.value).toString()) );
+ }
+ else if( propupd.value instanceof Locale ) {
+ pElm.addContent( new Text(((Locale)propupd.value).toString()) );
+ }
+ else if( propupd.value instanceof Resource ) {
+ Element hrefElm = new Element( "href", dnsp );
+ hrefElm.addContent( new Text(((Resource)propupd.value).location().string()) );
+ pElm.addContent( hrefElm );
+ }
+ else if( propupd.value instanceof List ) {
+ // assuming list of Resource instances
+ Iterator j = ((List)propupd.value).iterator();
+ while( j.hasNext() ) {
+ Resource r = (Resource)propupd.value;
+ Element hrefElm = new Element( "href", dnsp );
+ hrefElm.addContent( new Text(r.location().string()) );
+ pElm.addContent( hrefElm );
+ }
+ }
else {
- // TODO: handle datatypes other than String
+ throw new UnsupportedOperationException("Property value of type '"+propupd.value.getClass().getName()+"' not supported");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org