Package org.apache.turbine.om

Examples of org.apache.turbine.om.NumberKey


        {
            String[] ss = pp.getStrings(getKey());
            NumberKey[] ival = new NumberKey[ss.length];
            for (int i=0; i<ss.length; i++)
            {
                ival[i] = new NumberKey(ss[i]);
            }
            setTestValue(ival);
        }
        else
        {
            setTestValue( new NumberKey(pp.getString(getKey())) );
        }
    }
View Full Code Here


                                   -1,
                                   -1,
                                   -1,
                                   -1,
                                   null);
        je.setPrimaryKey((ObjectKey) new NumberKey(oid));
        return scheduleQueue.getJob(je);
    }
View Full Code Here

            Object object = parameters.get(convert(name));
            if (object != null)
            {
                value = ((String[])object)[0];
            }               
            return new NumberKey(value);
        }
        catch ( ClassCastException e )
        {
            return null;
        }
View Full Code Here

           
            if (keyGen.isPriorToInsert())
            {
                if ( pk.getType() instanceof Number )
                {
                    id = new NumberKey( tableMap.getIdGenerator()
                        .getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
                }
                else
                {
                    id = new StringKey( tableMap.getIdGenerator()
                        .getIdAsString(dbCon.getConnection(), keyInfo) );
                }
                criteria.add( pk.getFullyQualifiedName(), id );
            }
        }

        // Set up Village for the insert.
        TableDataSet tds = null;
        try
        {
            tds = new TableDataSet(dbCon.getConnection(), tableName );
            Record rec = tds.addRecord();
            insertOrUpdateRecord(rec, tableName, criteria);
        }
        finally
        {
            if (tds != null) tds.close();
        }

        // If the primary key column is auto-incremented, get the id
        // now.
        if ((keyGen != null) && (keyGen.isPostInsert()))
        {
            if ( pk.getType() instanceof Number )
            {
                id = new NumberKey( tableMap.getIdGenerator()
                    .getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
            }
            else
            {
                id = new StringKey( tableMap.getIdGenerator()
View Full Code Here

            if (columnNames[i].equals(OBJECT_DATA_COLUMN))
                objectDataPosition = i+1;
        }

        ((Persistent)obj).setPrimaryKey(
            new NumberKey(row.getValue(idPosition).asBigDecimal()) );

        // Restore the Permanent Storage Hashtable.  First the
        // Hashtable is restored, then any explicit table columns
        // which should be included in the Hashtable are added.
        byte[] objectData = (byte[])row.getValue(objectDataPosition).asBytes();
View Full Code Here

        Constraint constraint = (Constraint)paramMap.get("minValue");
        if ( constraint != null )
        {
            String param = constraint.getValue();
            minValue = new NumberKey(param);
            minValueMessage = constraint.getMessage();
        }

        constraint = (Constraint)paramMap.get("maxValue");
        if ( constraint != null )
        {
            String param = constraint.getValue();
            maxValue = new NumberKey(param);
            maxValueMessage = constraint.getMessage();
        }
    }
View Full Code Here

     * testValue did not pass the validation tests.
     */
    protected void doAssertValidity(String testValue)
        throws ValidationException
    {
        NumberKey nk = null;
        try
        {
            nk = new NumberKey(testValue);
        }
        catch (RuntimeException e)
        {
            message = invalidNumberMessage;
            throw new ValidationException(invalidNumberMessage);
        }       
        if ( minValue != null && nk.compareTo(minValue) < 0 )
        {       
            message = minValueMessage;
            throw new ValidationException(minValueMessage);
        }
        if ( maxValue != null && nk.compareTo(maxValue) > 0 )
        {
            message = maxValueMessage;
            throw new ValidationException(maxValueMessage);
        }
    }
View Full Code Here

           
            if (keyGen.isPriorToInsert())
            {
                if ( pk.getType() instanceof Number )
                {
                    id = new NumberKey( tableMap.getIdGenerator()
                        .getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
                }
                else
                {
                    id = new StringKey( tableMap.getIdGenerator()
                        .getIdAsString(dbCon.getConnection(), keyInfo) );
                }
                criteria.add( pk.getFullyQualifiedName(), id );
            }
        }

        // Set up Village for the insert.
        TableDataSet tds = null;
        try
        {
            tds = new TableDataSet(dbCon.getConnection(), tableName );
            Record rec = tds.addRecord();
            insertOrUpdateRecord(rec, tableName, criteria);
        }
        finally
        {
            if (tds != null) tds.close();
        }

        // If the primary key column is auto-incremented, get the id
        // now.
        if ((keyGen != null) && (keyGen.isPostInsert()))
        {
            if ( pk.getType() instanceof Number )
            {
                id = new NumberKey( tableMap.getIdGenerator()
                    .getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
            }
            else
            {
                id = new StringKey( tableMap.getIdGenerator()
View Full Code Here

            Object object = parameters.get(convert(name));
            if (object != null)
            {
                value = ((String[])object)[0];
            }               
            return new NumberKey(value);
        }
        catch ( ClassCastException e )
        {
            return null;
        }
View Full Code Here

    public NumberKeyField(XmlField field, Group group)
        throws Exception
    {
        super(field, group);

        onError = new NumberKey();

        NumberKey tmpMinValue = null;
        String tmpMinValueMessage = null;
        boolean tmpMinValueForce = false;
        NumberKey tmpMaxValue = null;
        String tmpMaxValueMessage = null;
        boolean tmpMaxValueForce = false;
        for (int i=0; i<field.getRules().size(); i++)
        {
            Rule rule = (Rule)field.getRules().get(i);

            if ( rule.getMinValue() != null )
            {
                tmpMinValue = new NumberKey(rule.getMinValue());
                tmpMinValueMessage = rule.getMessage();
                tmpMinValueForce = "force".equals(rule.getAction());
            }

            if ( rule.getMaxValue() != null )
            {
                tmpMaxValue = new NumberKey(rule.getMaxValue());
                tmpMaxValueMessage = rule.getMessage();
                tmpMaxValueForce = "force".equals(rule.getAction());
            }
        } 
        minValue = tmpMinValue;
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.NumberKey

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.