Package commonj.sdo

Examples of commonj.sdo.Sequence


         * 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


        // swap sequences (may be UC2(DataObject and sequence change) or UC4 (sequence change only)
        if (getType().isSequenced()) {// assume sequence is !null
            // perform sequence.isDirty check independent of a dataObject.isDirty check
            if (((SDOChangeSummary)cs).isDirty((SDOSequence)sequence)) {
                Sequence currentSequence = sequence;
                Sequence originalSequence = (Sequence)((SDOChangeSummary)cs).getOriginalSequences().get(this);

                // both sequences are either null or set
                if ((null == originalSequence) && (null != currentSequence)) {
                    throw SDOException.oldSequenceNotFound();
                } else {
View Full Code Here

            if (convertValue) {
              value =  DataHelper.INSTANCE.convert(lastProperty.getType(), value);
            }
           
            Sequence seq = lastDataObject.getSequence();
            if (seq != null) {
                seq.setValue(numInLastProperty, value);
            } else {
                objects.set(numInLastProperty, value);
            }
        }
    }
View Full Code Here

                                            nextCS.pauseLogging();
                                            boolean wasSet = nextModifiedDO.isSet(nextProp);

                                            Object existingValue = nextModifiedDO.get(nextProp);
                                            // grab index of nextProp's Setting for use during setting below
                                            Sequence nextModifiedDOSequence = nextModifiedDO.getSequence();
                                            int settingIdx = -1;
                                            if (nextModifiedDOSequence != null) {
                                                settingIdx = ((SDOSequence)nextModifiedDOSequence).getIndexForProperty(nextProp);
                                            }
                                            value._setContainmentPropertyName(null);
View Full Code Here

     */
    public static void printSequence(DataObject letter) {
        // Access the Sequence of the FormLetter
        System.out.println("The type is for letter dataObject is mixed " + XSDHelper.INSTANCE.isMixed(letter.getType()));
       
        Sequence letterSequence = letter.getSequence();
        // Print out all the settings that contain unstructured text
        System.out.println("Unstructured text:");
        for (int i = 0; i < letterSequence.size(); i++) {

            /*
             * Please note that the following line is a correction to the 2.0 specification which incorrectly calls:
             *
             * String propertyName = ((Property) letterSequence.getProperty(i)).getName();
             *
             * According to the SDO API sequence.getProperty will return null if the content is mixed, in this case
             * we want to print it out as unstructured text        
             */
            Property prop = letterSequence.getProperty(i);                                
            if (prop == null) {
                String text = (String) letterSequence.getValue(i);
                System.out.println("\t(" + text + ")");
            }
          
        }

        /*
         * Please note that the following line is a correction to the 2.0 Specification which incorrectly uses letterDataObject variable rather than
         * simply letter
         */
        // Verify that the lastName property of the DataObject has the same
        // value as the lastName property for the Sequence.
        String dataObjectLastName = letter.getString("lastName");
        for (int i = 0; i < letterSequence.size(); i++) {

            /*
             * The following line has been corrected from the 2.0 specification
             * According to the SDO API sequence.getProperty will return null if the content is mixed.
             * We want to check that the content is not mixed, and then check that it it is the property which
             * we are looking for
             */
            Property property = letterSequence.getProperty(i);
           
            if ( (property != null) && ("lastName".equals(property.getName()))) {
                String sequenceLastName = (String) letterSequence.getValue(i);
                if (dataObjectLastName == sequenceLastName)
                    System.out.println("Last Name property matches");
                break;
            }
        }
View Full Code Here

   
    DataObject quote = factory.create("http://www.example.com/mixed", "MixedQuote");

    assertTrue(quote.getType().isSequenced());
   
    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.save(quote, "http://www.example.com/mixed", "mixedStockQuote", baos);
    assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXED_XML)));
  }
View Full Code Here

   
    DataObject quote = factory.create("http://www.example.com/mixed", "MixedOpenQuote");

    assertTrue(quote.getType().isSequenced());
   
    Sequence sequence = quote.getSequence();

    sequence.add("\n  ");

    Type definedGlobalType = types.getType("http://www.example.com/open", null);
   
    Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
    quote.setString(definedSymbolProperty, "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.save(quote, "http://www.example.com/mixed", "mixedOpenStockQuote", baos);
    assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXEDOPEN_XML)));
  }
View Full Code Here

            // of the XMLDocument is a DataGraph
            DataObject dataObjectRepresentingDataGraph = XMLHelper.INSTANCE.load(
                    ClassLoader.getSystemResourceAsStream(SdoSampleConstants.COMPANY_DATAGRAPH_XML)).getRootObject();
                                             
            // Obtain the company DataObject from the DataObject representing the datagraph
            Sequence mySeq = (Sequence) dataObjectRepresentingDataGraph.getSequence("any");
            company = (DataObject) mySeq.getValue(0);

            System.out.println("Obtained DataObject representing datagraph");
            System.out.println(dataObjectRepresentingDataGraph);
            System.out.println("Obtained root DataObject from datagraph");
            System.out.println(company);           
View Full Code Here

                }
            }
        }
       
        if (type.isSequenced()) {
            Sequence sequence = dataObject.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                Property property = sequence.getProperty(i);
                Object value = sequence.getValue(i);
                if (property == null) {
                    // property == null for text in mixed content
                    elementList.add(new NameValuePair(ELEMENT_TEXT, value));
                } else {
                    addProperty(elementList, property, value);
View Full Code Here

  }
 
  public String getInstanceClassName()
  {
    EStructuralFeature javaClassFeature = JavaPackageImpl.eINSTANCE.getDocumentRoot_JavaClass();
    Sequence anyAttribute = getAnyAttribute();
    int count = anyAttribute.size();
    for (int i = 0; i < count; i++)
    {
      EStructuralFeature eFeature = (EStructuralFeature)anyAttribute.getProperty(i);
      if (eFeature == javaClassFeature)
      {
        return (String)anyAttribute.getValue(i);
      }
    }
    return null;
  }
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.