Package commonj.sdo

Examples of commonj.sdo.Sequence


     * @param dataObj3
     */
    private void sequenceMultiValueOneMember(final DataObject dataObj1, final DataObject dataObj2, final DataObject dataObj3) {
        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());

        final Sequence sequence = dataObj1.getSequence();
       
        sequence.add("ContainMany", dataObj2);
        sequence.add("ContainMany", dataObj3);
        sequence.add("ContainMany", dataObj1);
    }
View Full Code Here


       
        addList.clear();
        addList.add(dataObj3);
        dataObj2.setList("ContainMany", addList);

        final Sequence sequence = dataObj3.getSequence();

        sequence.add("ContainMany", dataObj1);
    }
View Full Code Here

        doFromApiAndRefTyp.getList("aFloat").add(new Float(0));

        getAndCompareProperties("aString", doFromXmlAndRefTyp, doFromApiAndDynTyp, doFromApiAndRefTyp);
        getAndCompareProperties("aBoolean", doFromXmlAndRefTyp, doFromApiAndDynTyp, doFromApiAndRefTyp);
        getAndCompareProperties("aFloat", doFromXmlAndRefTyp, doFromApiAndDynTyp, doFromApiAndRefTyp);
        Sequence seqFromXmlAndRefTyp = doFromXmlAndRefTyp.getSequence();
        Sequence seqFromApiAndDynTyp = doFromApiAndDynTyp.getSequence();
        Sequence seqFromApiAndRefTyp = doFromApiAndRefTyp.getSequence();
        compareSequencesIgnoringWhitespace(SDO_FROM_XML_AND_REF, SDO_FROM_API_AND_DYN, seqFromXmlAndRefTyp,
                seqFromApiAndDynTyp);
        compareSequencesIgnoringWhitespace(SDO_FROM_XML_AND_REF, SDO_FROM_API_AND_REF, seqFromXmlAndRefTyp,
                seqFromApiAndRefTyp);
    }
View Full Code Here

     */
    public void testSequencedType() throws IOException {
        Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "MixedQuote");
        DataObject quote = DataFactory.INSTANCE.create(quoteType);

        Sequence sequence = quote.getSequence();

        sequence.add("\n  ");

        quote.setString("symbol", "fbnt");

        sequence.add("\n  ");

        quote.setString("companyName", "FlyByNightTechnology");

        sequence.add("\n  some text\n  ");

        DataObject child = quote.createDataObject("quotes");
        child.setBigDecimal("price", new BigDecimal("2000.0"));

        sequence.add("\n  more text\n  ");

        // quote.setBigDecimal("price", new BigDecimal("1000.0"));
        sequence.add("price", new BigDecimal("1000.0"));

        sequence.add("\n");

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "mixedStockQuote", baos);

        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA)));
View Full Code Here

        List<Property> properties = wrapperDO.getInstanceProperties();
        List<Object> elements = new ArrayList<Object>();
        Type type = wrapperDO.getType();
        if (type.isSequenced()) {
            // Add values in the sequence
            Sequence sequence = wrapperDO.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                // Skip mixed text
                if (sequence.getProperty(i) != null) {
                    elements.add(sequence.getValue(i));
                }
            }
        } else {
            for (Property p : properties) {
                Object child = wrapperDO.get(p);
View Full Code Here

            "using the Sequence.getProperty(int) and Sequence.getValue(int) methods.\n" +
            "The model for this document is \"mixed\", i.e.\n" +
            "letter.getType().isMixed() returns \"true\".\n" +
            "Let's take a look at the Properties in this sequence.");
       
        Sequence letterSequence = letter.getSequence();

        for (int i = 0; i < letterSequence.size(); i++) {
            Property prop = letterSequence.getProperty(i);                                
            if (prop == null) {
                String text = (String) letterSequence.getValue(i);
                System.out.println("Unstructured text (" + text + ")");
            } else {
                System.out.println("Property: " + prop.getName() + " Value : " + letterSequence.getValue(i));
            }
        }
       
        commentary("The values of the modeled Properties are still accessible through the DataObject\n" +
            "getter and setter methods,  but only through the Sequence API can we get to the untructured\n" +
View Full Code Here

        List<Property> properties = wrapperDO.getInstanceProperties();
        List<Object> elements = new ArrayList<Object>();
        Type type = wrapperDO.getType();
        if (type.isSequenced()) {
            // Add values in the sequence
            Sequence sequence = wrapperDO.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                // Skip mixed text
                if (sequence.getProperty(i) != null) {
                    elements.add(sequence.getValue(i));
                }
            }
        } else {
            for (Property p : properties) {
                Object child = wrapperDO.get(p);
View Full Code Here

          lineBreak();
        }

      }
      decrementIndent();
      Sequence seq = dataObject.getSequence();

      commentary(
          "The Property/Value pairs of a Sequence can be accessed via the getProperty(int) and getValue(int)\n"
              + "accessor methods of the Sequence interface.  The size() method of the Sequence tells us how many there are.\n"
              + "If the getProperty(int) method returns null,  then the value is text.  These text values may be encountered\n"
              + "when the DataObject's type is 'mixed' (dataObject.getType().isMixed() == true). A typical example of this\n"
              + "is when the data graph represents a form letter.",
     
          "Inspecting the Property/Value pairs of another Sequence");
     
      incrementIndent();
      indent();
      buf.append("Sequence: {\n");
     
      incrementIndent();
      for (int i = 0; i < seq.size(); i++) {
        Property p = seq.getProperty(i);
        if (p == null) {
          indent();
          buf.append("text: ").append(seq.getValue(i));
          lineBreak();
        } else if(!xsdHelper.isAttribute(p)){
          printPropertyValuePair(p, seq.getValue(i));
       }
      }
      decrementIndent();
     
      indent();
View Full Code Here

            "using the Sequence.getProperty(int) and Sequence.getValue(int) methods.\n" +
            "The model for this document is \"mixed\", i.e.\n" +
            "letter.getType().isMixed() returns \"true\".\n" +
            "Let's take a look at the Properties in this sequence.");
       
        Sequence letterSequence = letter.getSequence();

        for (int i = 0; i < letterSequence.size(); i++) {
            Property prop = letterSequence.getProperty(i);                                
            if (prop == null) {
                String text = (String) letterSequence.getValue(i);
                System.out.println("Unstructured text (" + text + ")");
            } else {
                System.out.println("Property: " + prop.getName() + " Value : " + letterSequence.getValue(i));
            }
        }
       
        commentary("The values of the modeled Properties are still accessible through the DataObject\n" +
            "getter and setter methods,  but only through the Sequence API can we get to the unstructured\n" +
View Full Code Here

         * There are currently more elegant means to perform this task using the xPath support
         */
        List nameList = shipTo.getList("name");
        DataObject name = (DataObject) nameList.get(0);
        // access the contents of the name DataObject
        Sequence s = name.getSequence();
        String actualName = (String) s.getValue(0);
        System.out.println("Name being shipped to: " + actualName);

    }
View Full Code Here

TOP

Related Classes of commonj.sdo.Sequence

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.