Package commonj.sdo

Examples of commonj.sdo.DataObject


            DAS das = DAS.FACTORY.createDAS(mapping, conn);
            Command select = das.createCommand("SELECT logSeqNo, accountNumber, actionType, amount FROM acctLog where id = ?");

            select.setParameter(1, customerID);

            DataObject root = select.executeQuery();
            accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));

            select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber  FROM stockLog where id = ?");
            select.setParameter(1, customerID);
            root = select.executeQuery();
            accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry"));

            conn.close();

            return accountLog;
        } catch (Exception e) {
View Full Code Here


    }

    public final void testTransform() {
        String xml = new DataObject2String().transform(dataObject, context);
        Assert.assertTrue(xml.indexOf("<city>San Jose</city>") != -1);
        DataObject po = new String2DataObject().transform(xml, reversedContext);
        Assert.assertTrue(po instanceof PurchaseOrderType);
        PurchaseOrderType orderType = (PurchaseOrderType)po;
        Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
    }
View Full Code Here

    public final void testXML() {
        String xml =
            "<foo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
            + "xmlns:ipo=\"http://www.example.com/IPO\" xsi:type=\"ipo:USAddress\"/>";
        DataObject dataObject = new String2DataObject().transform(xml, reversedContext);
        context.setSourceDataType(new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, null));
        xml = new DataObject2String().transform(dataObject, context);
        Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\""));
    }
View Full Code Here

            int event = reader.next();
            if (event == XMLStreamConstants.START_ELEMENT) {
                break;
            }
        }
        DataObject d = new XMLStreamReader2DataObject().transform(reader, reversedContext);
        assertNotNull(d);
        assertTrue(EqualityHelper.INSTANCE.equal(dataObject, d));
    }
View Full Code Here

        Node node = new DataObject2Node().transform(dataObject, context);
        Assert.assertNotNull(node);
        Element element = (Element) node;
        Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespaceURI());
        Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
        DataObject po = new Node2DataObject(new DefaultExtensionPointRegistry()).transform(node, reversedContext);
        Assert.assertTrue(po instanceof PurchaseOrderType);
        PurchaseOrderType orderType = (PurchaseOrderType)po;
        Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
    }
View Full Code Here

    public Object copy(Object arg, DataType dataType, DataType targetDataType, Operation operation, Operation targetOperation) {
        HelperContext context = SDOContextHelper.getHelperContext(operation);
        CopyHelper copyHelper = context.getCopyHelper();
        if (arg instanceof XMLDocument) {
            XMLDocument document = (XMLDocument)arg;
            DataObject dataObject = copyHelper.copy(document.getRootObject());
            return context.getXMLHelper().createDocument(dataObject,
                                                         document.getRootElementURI(),
                                                         document.getRootElementName());
        } else if (arg instanceof DataObject) {
            return context.getCopyHelper().copy((DataObject)arg);
View Full Code Here

        xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
        ElementInfo element = new ElementInfo(new QName("http://www.example.com/wrapper", "op"), null);
        Operation op = new OperationImpl();
        WrapperInfo wrapperInfo = new WrapperInfo(SDODataBinding.NAME, element, null, null, null);
        op.setWrapper(wrapperInfo);
        DataObject wrapper = (DataObject) handler.create(op, true);
        assertNotNull(wrapper);
    }
View Full Code Here

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml"));
        commandGroup.setConnection(getConnection());

        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();

        assertEquals(5, root.getList("CUSTOMER").size());

    }
View Full Code Here

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml"));

        Command read = commandGroup.getCommand("order by id with ?");
        read.setParameterValue(1, new Integer(1));
        DataObject root = read.executeQuery();

        assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT"));

    }  
View Full Code Here

    public void testReadWithConnectionProperties() throws Exception {

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml"));

        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();

        assertEquals(5, root.getList("CUSTOMER").size());

    }
View Full Code Here

TOP

Related Classes of commonj.sdo.DataObject

Copyright © 2018 www.massapicom. 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.