Examples of XUpdateQueryService


Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                "<address type=\"home\">34 S. Colon St.</address>" +
                "<address type=\"work\">9967 W. Shrimp Ave.</address>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.update(xupdate);
        assertEquals(1, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "xupdatedoc");
        assertNotNull(doc);
        assertEquals(updatedDocument, doc);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                System.out.println("ERROR : Collection not found!");
                return false;
            }

            // To run XUpdate commands we use the XUpdateQueryService
            XUpdateQueryService service = null;           
            service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

           
            long result = 0;

            // See if we're updating one document or the whole collection.
            if (name == null) {
                result = service.update(commands.toString());
            }
            else {
                result = service.updateResource(name, commands.toString());
            }
               

            System.out.println(result + " documents updated");
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

          + "   <xu:update select=\"/person/phone[@type = 'work']\">"
          + "       480-300-3003"
          + "   </xu:update>"
          + "</xu:modifications>";

      XUpdateQueryService service = (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
      long count = service.update(xupdate);
      System.out.println(count + " entries updated.");
    }
    catch (XMLDBException e) {
      System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage());
    }
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                "<last>Smith</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.updateResource("doc1", query);
        assertEquals(1, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
        assertNotNull(doc);
        assertEquals(updatedDocument, doc);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                "<last>Benton</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.update(query);
        assertEquals(6, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
        assertNotNull(doc);
        assertEquals(updatedDocument1, doc);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                "<last>Smith</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.updateResource("doc1", query);
        assertEquals(1, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
        assertNotNull(doc);
        assertEquals(updatedDocument, doc);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                "</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
        long count = service.update(query);
        // Bug #30878 fixed: was 6 should be 2. The old code would cause multiple updates.
        assertEquals(2, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
        assertNotNull(doc);
        XMLAssert.assertXMLEqual(updatedDocument1, doc);

        doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc2");
        assertNotNull(doc);
        XMLAssert.assertXMLEqual(updatedDocument2, doc);

        // test the second query should update 2 docs
        count = service.update(query2);
        assertEquals(2,count);

        // check the second doc to make sure its correct
        doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc2");
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.