From: Wolfgang M. M. <wol...@us...> - 2004-04-30 09:08:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23766/src/org/exist/xupdate Modified Files: Append.java XUpdateProcessor.java Log Message: XUpdate: added missing support for optional child attribute in xupdate:append. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** XUpdateProcessor.java 2 Feb 2004 15:30:38 -0000 1.20 --- XUpdateProcessor.java 30 Apr 2004 09:08:12 -0000 1.21 *************** *** 231,237 **** // start a new modification section ! if (localName.equals("append")) ! modification = new Append(broker, documentSet, select); ! else if (localName.equals("update")) modification = new Update(broker, documentSet, select); else if (localName.equals("insert-before")) --- 231,238 ---- // start a new modification section ! if (localName.equals("append")) { ! String child = atts.getValue("child"); ! modification = new Append(broker, documentSet, select, child); ! } else if (localName.equals("update")) modification = new Update(broker, documentSet, select); else if (localName.equals("insert-before")) Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Append.java 14 Apr 2004 12:17:23 -0000 1.12 --- Append.java 30 Apr 2004 09:08:12 -0000 1.13 *************** *** 19,28 **** public class Append extends Modification { /** * Constructor for Append. * @param selectStmt */ ! public Append(DBBroker broker, DocumentSet docs, String selectStmt) { super(broker, docs, selectStmt); } --- 19,34 ---- public class Append extends Modification { + private int child; + /** * Constructor for Append. * @param selectStmt */ ! public Append(DBBroker broker, DocumentSet docs, String selectStmt, String childAttr) { super(broker, docs, selectStmt); + if(childAttr == null || childAttr.equals("last()")) + child = -1; + else + child = Integer.parseInt(childAttr); } *************** *** 49,53 **** if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); ! node.appendChildren(children); doc.clearIndexListener(); doc.setLastModified(System.currentTimeMillis()); --- 55,59 ---- if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); ! node.appendChildren(children, child); doc.clearIndexListener(); doc.setLastModified(System.currentTimeMillis()); |