Package org.apache.torque.om

Examples of org.apache.torque.om.NumberKey


            {
                try
                {
                    if (pk.getType() instanceof Number)
                    {
                        id = new NumberKey(
                                keyGen.getIdAsBigDecimal(con, keyInfo));
                    }
                    else
                    {
                        id = new StringKey(keyGen.getIdAsString(con, keyInfo));
                    }
                }
                catch (Exception e)
                {
                    throwTorqueException(e);
                }
                criteria.add(pk.getFullyQualifiedName(), id);
            }
        }

        // Use Village to perform the insert.
        TableDataSet tds = null;
        try
        {
            tds = new TableDataSet(con, tableName);
            Record rec = tds.addRecord();
            BasePeer.insertOrUpdateRecord(rec, tableName, criteria);
        }
        catch (Exception e)
        {
            throwTorqueException(e);
        }
        finally
        {
            if (tds != null)
            {
                try
                {
                    tds.close();
                }
                catch (Exception e)
                {
                    throwTorqueException(e);
                }
            }
        }

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


        {
            if (pk != null && keyGen != null)
            {
                if (pk.getType() instanceof Number)
                {
                    id = new NumberKey(
                            keyGen.getIdAsBigDecimal(con, keyInfo));
                }
                else
                {
                    id = new StringKey(keyGen.getIdAsString(con, keyInfo));
View Full Code Here

     * @return A NumberKey, or <code>null</code> if unparsable.
     * @deprecated no replacement
     */
    public NumberKey getNumberKey(String name)
    {
        NumberKey result = null;
        try
        {
            String value = getString(name);
            if (StringUtils.isNotEmpty(value))
            {
                result = new NumberKey(value);
            }
        }
        catch (ClassCastException e)
        {
            log.error("Parameter ("
View Full Code Here

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

        constraint = (Constraint) paramMap.get(MAX_VALUE_RULE_NAME);
        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.
     */
    public void assertValidity(String testValue)
            throws ValidationException
    {
        NumberKey nk = null;
        try
        {
            nk = new NumberKey(testValue);
        }
        catch (RuntimeException e)
        {
            errorMessage = invalidNumberMessage;
            throw new ValidationException(invalidNumberMessage);
        }
        if (minValue != null && nk.compareTo(minValue) < 0)
        {
            errorMessage = minValueMessage;
            throw new ValidationException(minValueMessage);
        }
        if (maxValue != null && nk.compareTo(maxValue) > 0)
        {
            errorMessage = maxValueMessage;
            throw new ValidationException(maxValueMessage);
        }
    }
View Full Code Here

        if (prop == null)
        {
            return;
        }

        defaultValue = new NumberKey(prop);
    }
View Full Code Here

            NumberKey[] values = new NumberKey[inputs.length];
            for (int i = 0; i < inputs.length; i++)
            {
                if (StringUtils.isNotEmpty(inputs[i]))
                {
                    values[i] = new NumberKey(
                            canonicalizeDecimalInput(inputs[i]));
                }
                else
                {
                    values[i] = null;
                }
            }
            setTestValue(values);
        }
        else
        {
            String val = parser.getString(getKey());
            if (StringUtils.isNotEmpty(val))
            {
                BigDecimal bd = canonicalizeDecimalInput(val);
                setTestValue(new NumberKey(bd));
            }
            else
            {
                setTestValue(null);
            }
View Full Code Here

    {
        Hashtable permData = (Hashtable) user.getPermStorage().clone();
        Criteria criteria = new Criteria();
        if ( !user.isNew() )
        {
            criteria.add(USER_ID, new NumberKey(user.getUserId()));
        }

        for (int i=1; i < columnNames.length; i++ )
        {
            if ( permData.containsKey(columnNames[i]) )
View Full Code Here

        user.setPassword(encrypted);
        Criteria criteria = TurbineUserPeer.buildCriteria(user);
        try
        {

            NumberKey key = (NumberKey)TurbineUserPeer.doInsert(criteria);

            ((BaseJetspeedUser)user).setUserId(key.toString());

        }
        catch(Exception e)
        {
            String message = "Failed to create account '" + user.getUserName() + "'";
View Full Code Here

        user.setPassword(encrypted);
        Criteria criteria = TurbineUserPeer.buildCriteria(user);
        try
        {

            NumberKey key = (NumberKey)TurbineUserPeer.doInsert(criteria);

            ((BaseJetspeedUser)user).setUserId(key.toString());

        }
        catch(Exception e)
        {
            String message = "Failed to create account '" + user.getUserName() + "'";
View Full Code Here

TOP

Related Classes of org.apache.torque.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.