Package org.apache.torque.om

Examples of org.apache.torque.om.StringKey


        if (prop == null)
        {
            return;
        }

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


        if (prop == null)
        {
            return;
        }

        emptyValue = new StringKey(prop);
    }
View Full Code Here

            String[] ss = parser.getStrings(getKey());
            StringKey[] ival = new StringKey[ss.length];
            for (int i = 0; i < ss.length; i++)
            {
                ival[i] = (StringUtils.isNotEmpty(ss[i]))
                        ? new StringKey(ss[i]) : (StringKey) getEmptyValue();
            }
            setTestValue(ival);
        }
        else
        {
            String val = parser.getString(getKey());
            setTestValue((StringUtils.isNotEmpty(val))
                    ? new StringKey(val) : (StringKey) getEmptyValue());
        }
    }
View Full Code Here

            attr = attribs.get(attrName);
            if (attr != null && attr.get() != null)
            {
                try
                {
                    setPrimaryKey(new StringKey(attr.get().toString()));
                }
                catch (Exception ex)
                {
                    log.error("Exception caught:", ex);
                }
View Full Code Here

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

     * test boolean values
     * @throws Exception if the test fails
     */
    public void testBooleanValues() throws Exception
    {
        BooleanCheck bc = BooleanCheckPeer.retrieveByPK(new StringKey("t1"));
        assertTrue("BOOLEANINT should be true but is: "
                + bc.getBintValue(), bc.getBintValue());
        assertTrue("BOOLEANCHAR should be true but is: "
                + bc.getBcharValue(), bc.getBcharValue());
        bc = BooleanCheckPeer.retrieveByPK(new StringKey("f1"));
        assertFalse("BOOLEANINT should be false but is: "
                + bc.getBintValue(), bc.getBintValue());
        assertFalse("BOOLEANCHAR should be false but is: "
                + bc.getBcharValue(), bc.getBcharValue());
    }
View Full Code Here

        bitTest.setId("f1");
        bitTest.setBitValue(false);
        bitTest.save();

        // read data
        bitTest = BitTestPeer.retrieveByPK(new StringKey("t1"));
        assertTrue("BIT should be true but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());

        bitTest = BitTestPeer.retrieveByPK(new StringKey("f1"));
        assertFalse("BIT should be false but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());

        // query data
        criteria.clear();
View Full Code Here

                    id = new NumberKey(
                            keyGen.getIdAsBigDecimal(con, keyInfo));
                }
                else
                {
                    id = new StringKey(keyGen.getIdAsString(con, keyInfo));
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

                        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));
                }
            }
            catch (Exception e)
            {
                throwTorqueException(e);
View Full Code Here

                    id = new NumberKey(
                            keyGen.getIdAsBigDecimal(con, keyInfo));
                }
                else
                {
                    id = new StringKey(keyGen.getIdAsString(con, keyInfo));
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.torque.om.StringKey

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.