Package org.exolab.castor.persist.spi

Examples of org.exolab.castor.persist.spi.Complex


            if ( notNull ) {
                if ( _engine._fields[i].columns.length == 1 ) {
                    if ( !res.contains( temp[0] ) )
                        res.add( temp[0] );
                } else {
                    Complex com = new Complex( _engine._fields[i].columns.length, temp );
                    if ( !res.contains( com ) )
                        res.add( com );
                }
            }
            return res;
View Full Code Here


        try {
            if ( _lastIdentity == null ) {
                if ( ! _rs.next() )
                    return null;
                _lastIdentity = SQLTypes.getObject( _rs, 1, _sqlTypes[ 0 ] );
                return new Complex( _lastIdentity );
            }

            while ( _lastIdentity.equals( identity ) ) {
                if ( ! _rs.next() ) {
                    _lastIdentity = null;
                    return null;
                }
                _lastIdentity = SQLTypes.getObject( _rs, 1, _sqlTypes[ 0 ] );
            }
            return new Complex( _lastIdentity );
        } catch ( SQLException except ) {
            _lastIdentity = null;
            throw new PersistenceException( Messages.format( "persist.nested", except ) );
        }
    }
View Full Code Here

        try {
            int count = 1;
            selectStatement = conn.prepareStatement( select );
            if ( leftType.length > 1 ) {
                Complex left = (Complex) leftValue;
                for ( int i=0; i < left.size(); i++ ) {
                    selectStatement.setObject( count, idToSQL( i, left.get(i)), leftType[i] );
                    count++;
                }
            } else {
                selectStatement.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
                count++;
            }
            if ( rightType.length > 1 ) {
                Complex right = (Complex) rightValue;
                for ( int i=0; i < right.size(); i++ ) {
                    selectStatement.setObject( count, ridToSQL( i, right.get(i) ), rightType[i] );
                    count++;
                }
            } else {
                selectStatement.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
            }
                        count = 1;
            rset = selectStatement.executeQuery();

            insertStatement = conn.prepareStatement( insert );
            if ( ! rset.next() ) {
                if ( leftType.length > 1 ) {
                    Complex left = (Complex) leftValue;
                    for ( int i=0; i < left.size(); i++ ) {
                        insertStatement.setObject( count, idToSQL( i, left.get(i)), leftType[i] );
                        count++;
                    }
                } else {
                    insertStatement.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
                                        count++;
                                }
                if ( rightType.length > 1 ) {
                    Complex right = (Complex) rightValue;
                    for ( int i=0; i < right.size(); i++ ) {
                        insertStatement.setObject( count, ridToSQL( i, right.get(i) ), rightType[i] );
                                        count++;
                    }
                } else {
                    insertStatement.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
                }
View Full Code Here

        PreparedStatement stmt = null;
        try {
            int count = 1;
            stmt = conn.prepareStatement( deleteAll );
            if ( leftType.length > 1 ) {
                Complex left = (Complex) leftValue;
                for ( int i=0; i < left.size(); i++ ) {
                    stmt.setObject( count, idToSQL( i, left.get(i) ), leftType[i] );
                count++;
            }
            } else {
                stmt.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
            }
View Full Code Here

        PreparedStatement stmt = null;
        try {
            int count = 1;
            stmt = conn.prepareStatement( delete );
            if ( leftType.length > 1 ) {
                Complex left = (Complex) leftValue;
                for ( int i=0; i < left.size(); i++ ) {
                    stmt.setObject( count, idToSQL( i, left.get(i) ), leftType[i] );
                count++;
            }
            } else {
                stmt.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
                count++;
            }
            if ( rightType.length > 1 ) {
                Complex right = (Complex) rightValue;
                for ( int i=0; i < right.size(); i++ ) {
                    stmt.setObject( count, ridToSQL( i, right.get(i) ), rightType[i] );
                    count++;
                }
            } else {
                stmt.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
            }
View Full Code Here

            return _ids[0].isDefault( identity );

        if ( identity == null )
            return true;

        Complex c = (Complex) identity;
        for ( int i = 0; i < c.size(); i++ ) {
            if ( !_ids[i].isDefault( c.get(i) ) )
                return false;
        }
        return true;
    }
View Full Code Here

        if ( _ids.length == 1 ) {
            return _ids[0].getValue( o, loader );
        } else if ( _ids.length == 2 ) {
            temp = _ids[0].getValue( o, loader );
            return temp==null? null: new Complex( temp, _ids[1].getValue( o, loader ) );
        } else {
        Object[] osIds = new Object[_ids.length];
        for ( int i=0; i<osIds.length; i++ ) {
            osIds[i] = _ids[i].getValue( o, loader );
        }
            if ( osIds[0] == null )
                return null;
            else
                return new Complex( osIds );
        }
    }
View Full Code Here

    public void setIdentity( TransactionContext tx, Object object, Object identity )
            throws PersistenceException {

        if ( _ids.length > 1 ) {
            if ( identity instanceof Complex ) {
                Complex com = (Complex) identity;
                if ( com.size() != _ids.length )
                    throw new PersistenceException( "Complex size mismatched!" );

                for ( int i=0; i<_ids.length; i++ ) {
                    _ids[i].setValue( object, com.get(i), tx.getClassLoader() );
                }
            }
        } else {
            if ( identity instanceof Complex )
                throw new PersistenceException( "Complex type not accepted!" );
View Full Code Here

TOP

Related Classes of org.exolab.castor.persist.spi.Complex

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.