Package commonj.sdo

Examples of commonj.sdo.Sequence


     */
    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


             * 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);

        } catch (Exception e) {
            System.out.println("Sorry, exception caught when creating DataObject : " + e.toString());
            e.printStackTrace();
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(sequence)) {
                Sequence currentSequence = sequence;
                SDOSequence originalSequence = (SDOSequence)((SDOChangeSummary)cs).getOriginalSequences().get(this);

                // both sequences are either null or set
                if ((null == originalSequence) && (null != currentSequence)) {
                    throw SDOException.oldSequenceNotFound();
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(sequence)) {
                Sequence currentSequence = sequence;
                SDOSequence originalSequence = (SDOSequence)((SDOChangeSummary)cs).getOriginalSequences().get(this);

                // both sequences are either null or set
                if ((null == originalSequence) && (null != currentSequence)) {
                    throw SDOException.oldSequenceNotFound();
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

        // 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(sequence)) {
                Sequence currentSequence = sequence;
                SDOSequence originalSequence = (SDOSequence)((SDOChangeSummary)cs).getOriginalSequences().get(this);

                // both sequences are either null or set
                if ((null == originalSequence) && (null != currentSequence)) {
                    throw SDOException.oldSequenceNotFound();
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

                                            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

        // 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(sequence)) {
                Sequence currentSequence = sequence;
                SDOSequence originalSequence = (SDOSequence)((SDOChangeSummary)cs).getOriginalSequences().get(this);

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

            if (convertValue) {
                DataHelper dataHelper = ((SDODataObject)lastDataObject).getType().getHelperContext().getDataHelper();
                value =  dataHelper.convert(lastProperty.getType(), value);
            }
           
            Sequence seq = lastDataObject.getSequence();
            if (seq != null) {
                seq.setValue(numInLastProperty, value);
            } else {
                objects.set(numInLastProperty, value);
            }
        }
    }
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.