incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r1096005 - in /incubator/isis/trunk/runtimes/dflt/objectstores/sql: impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/ impl/src/main/java/org/apache/isi...
Date Fri, 22 Apr 2011 19:42:29 GMT
Author: kevin
Date: Fri Apr 22 19:42:29 2011
New Revision: 1096005

URL: http://svn.apache.org/viewvc?rev=1096005&view=rev
Log:
Created binary numeric type value mapper, to replace string conversions. 

Added:
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java
  (with props)
Modified:
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/Results.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcConnector.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcResults.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/installer/JdbcFieldMappingFactoryInstaller.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SimpleClassTwo.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SqlDataClass.java
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/mysql.properties
    incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/postgresql.properties

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/Results.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/Results.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/Results.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/Results.java
Fri Apr 22 19:42:29 2011
@@ -17,16 +17,12 @@
  *  under the License.
  */
 
-
 package org.apache.isis.runtimes.dflt.objectstores.sql;
 
 import java.sql.Time;
 import java.util.Calendar;
 import java.util.Date;
 
-
-
-
 public interface Results {
 
     void close();
@@ -39,6 +35,12 @@ public interface Results {
 
     String getString(String columnName);
 
+    Float getFloat(String columnName);
+
+    Object getShort(String columnName);
+
+    Object getBoolean(String columnName);
+
     boolean next();
 
     Date getJavaDateOnly(String dateColumn);
@@ -53,4 +55,6 @@ public interface Results {
 
     Object getObject(String column);
 
+    Object getAsType(String columnName, Class<?> clazz);
+
 }

Added: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java?rev=1096005&view=auto
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java
(added)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java
Fri Apr 22 19:42:29 2011
@@ -0,0 +1,119 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.sql.jdbc;
+
+import org.apache.isis.core.commons.exceptions.IsisApplicationException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.runtimes.dflt.objectstores.sql.Results;
+import org.apache.isis.runtimes.dflt.objectstores.sql.mapping.FieldMapping;
+import org.apache.isis.runtimes.dflt.objectstores.sql.mapping.FieldMappingFactory;
+import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public class JdbcBinaryValueMapper extends AbstractJdbcFieldMapping {
+
+    public static class Factory implements FieldMappingFactory {
+        private final String type;
+
+        public Factory(final String type) {
+            this.type = type;
+        }
+
+        @Override
+        public FieldMapping createFieldMapping(final ObjectAssociation field) {
+            return new JdbcBinaryValueMapper(field, type);
+        }
+    }
+
+    private final String type;
+
+    public JdbcBinaryValueMapper(ObjectAssociation field, String type) {
+        super(field);
+        this.type = type;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#columnType()
+     */
+    @Override
+    protected String columnType() {
+        return type;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#preparedStatementObject(org.apache
+     * .isis.core.metamodel.adapter.ObjectAdapter)
+     */
+    @Override
+    protected Object preparedStatementObject(ObjectAdapter value) {
+        Object o = value.getObject();
+        return o;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#setFromDBColumn(org.apache.isis.
+     * runtimes.dflt.objectstores.sql.Results, java.lang.String,
+     * org.apache.isis.core.metamodel.spec.feature.ObjectAssociation)
+     */
+    @Override
+    protected ObjectAdapter setFromDBColumn(Results results, String columnName, ObjectAssociation
field) {
+        ObjectAdapter restoredValue;
+
+        Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
+        Object resultObject = results.getObject(columnName);
+
+        if (resultObject.getClass() != correspondingClass) {
+            if (checkIfIsClass(correspondingClass, Integer.class, int.class)) {
+                resultObject = results.getInt(columnName);
+            } else if (checkIfIsClass(correspondingClass, Double.class, double.class)) {
+                resultObject = results.getDouble(columnName);
+            } else if (checkIfIsClass(correspondingClass, Float.class, float.class)) {
+                resultObject = results.getFloat(columnName);
+            } else if (checkIfIsClass(correspondingClass, short.class, Short.class)) {
+                resultObject = results.getShort(columnName);
+            } else if (checkIfIsClass(correspondingClass, long.class, Long.class)) {
+                resultObject = results.getLong(columnName);
+            } else if (checkIfIsClass(correspondingClass, boolean.class, Boolean.class))
{
+                resultObject = results.getBoolean(columnName);
+            } else {
+                throw new IsisApplicationException("Unhandled type: " + correspondingClass.getCanonicalName());
+            }
+        }
+
+        restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(resultObject);
+
+        return restoredValue;
+
+    }
+
+    private boolean checkIfIsClass(Class expected, Class couldBe1, Class couldBe2) {
+        return (expected == couldBe1 || expected == couldBe2);
+    }
+}
\ No newline at end of file

Propchange: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcBinaryValueMapper.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcConnector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcConnector.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcConnector.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcConnector.java
Fri Apr 22 19:42:29 2011
@@ -184,12 +184,12 @@ public class JdbcConnector extends Abstr
         TYPE_DATETIME = dataTypes.getString(baseName + "datetime", "DATETIME");
         TYPE_DATE = dataTypes.getString(baseName + "date", "DATE");
         TYPE_TIME = dataTypes.getString(baseName + "time", "TIME");
-        TYPE_DOUBLE = dataTypes.getString(baseName + "double", "FLOAT");
+        TYPE_DOUBLE = dataTypes.getString(baseName + "double", "DOUBLE");
         TYPE_FLOAT = dataTypes.getString(baseName + "float", "FLOAT");
         TYPE_SHORT = dataTypes.getString(baseName + "short", "INT");
-        TYPE_LONG = dataTypes.getString(baseName + "long", "INT");
+        TYPE_LONG = dataTypes.getString(baseName + "long", "BIGINT");
         TYPE_INT = dataTypes.getString(baseName + "int", "INT");
-        TYPE_BOOLEAN = dataTypes.getString(baseName + "boolean", "CHAR(1)");
+        TYPE_BOOLEAN = dataTypes.getString(baseName + "boolean", "BOOLEAN"); // CHAR(1)
         TYPE_PK = dataTypes.getString(baseName + "primarykey", "INTEGER");
         TYPE_STRING = dataTypes.getString(baseName + "string", "VARCHAR(65)");
         TYPE_PASSWORD = dataTypes.getString(baseName + "password", "VARCHAR(12)");

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcResults.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcResults.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcResults.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/JdbcResults.java
Fri Apr 22 19:42:29 2011
@@ -23,6 +23,7 @@ import java.sql.CallableStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Calendar;
+import java.util.HashMap;
 
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
@@ -176,4 +177,42 @@ public class JdbcResults implements Resu
             throw new SqlObjectStoreException(e);
         }
     }
+
+    @Override
+    public Object getAsType(String columnName, Class<?> clazz) {
+        try {
+            HashMap<String, Class<?>> map = new HashMap<String, Class<?>>();
+            map.put("FLOAT", float.class);
+            return set.getObject(columnName, map);
+        } catch (SQLException e) {
+            throw new SqlObjectStoreException(e);
+        }
+    }
+
+    @Override
+    public Float getFloat(String columnName) {
+        try {
+            return set.getFloat(columnName);
+        } catch (SQLException e) {
+            throw new SqlObjectStoreException(e);
+        }
+    }
+
+    @Override
+    public Short getShort(String columnName) {
+        try {
+            return set.getShort(columnName);
+        } catch (SQLException e) {
+            throw new SqlObjectStoreException(e);
+        }
+    }
+
+    @Override
+    public Boolean getBoolean(String columnName) {
+        try {
+            return set.getBoolean(columnName);
+        } catch (SQLException e) {
+            throw new SqlObjectStoreException(e);
+        }
+    }
 }

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/installer/JdbcFieldMappingFactoryInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/installer/JdbcFieldMappingFactoryInstaller.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/installer/JdbcFieldMappingFactoryInstaller.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/installer/JdbcFieldMappingFactoryInstaller.java
Fri Apr 22 19:42:29 2011
@@ -29,6 +29,7 @@ import org.apache.isis.applib.value.Time
 import org.apache.isis.applib.value.TimeStamp;
 import org.apache.isis.runtimes.dflt.objectstores.sql.FieldMappingFactoryInstaller;
 import org.apache.isis.runtimes.dflt.objectstores.sql.FieldMappingLookup;
+import org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.JdbcBinaryValueMapper;
 import org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.JdbcColorValueMapper;
 import org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.JdbcConnector;
 import org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.JdbcDateMapper;
@@ -44,12 +45,12 @@ public class JdbcFieldMappingFactoryInst
 
     @Override
     public void load(FieldMappingLookup lookup) {
-        lookup.addFieldMappingFactory(boolean.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_BOOLEAN()));
-        lookup.addFieldMappingFactory(short.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_SHORT()));
-        lookup.addFieldMappingFactory(int.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_INT()));
-        lookup.addFieldMappingFactory(long.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_LONG()));
-        lookup.addFieldMappingFactory(float.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_FLOAT()));
-        lookup.addFieldMappingFactory(double.class, new JdbcGeneralValueMapper.Factory(JdbcConnector.TYPE_DOUBLE()));
+        lookup.addFieldMappingFactory(boolean.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_BOOLEAN()));
+        lookup.addFieldMappingFactory(short.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_SHORT()));
+        lookup.addFieldMappingFactory(int.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_INT()));
+        lookup.addFieldMappingFactory(long.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_LONG()));
+        lookup.addFieldMappingFactory(Float.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_FLOAT()));
+        lookup.addFieldMappingFactory(double.class, new JdbcBinaryValueMapper.Factory(JdbcConnector.TYPE_DOUBLE()));
         lookup.addFieldMappingFactory(char.class, new JdbcGeneralValueMapper.Factory("CHAR(2)"));
 
         lookup.addFieldMappingFactory(Money.class, new JdbcMoneyValueMapper.Factory("FLOAT",
"VARCHAR(3)"));

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
Fri Apr 22 19:42:29 2011
@@ -106,6 +106,13 @@ public abstract class SqlIntegrationTest
     private static final Percentage percentage = new Percentage(42);
     private static final Money money = new Money(99.99, "ZAR");
 
+    // Standard values
+    private static final int intValue = Integer.MIN_VALUE;
+    private static final short shortValue = Short.MAX_VALUE;
+    private static final long longValue = Long.MAX_VALUE;
+    private static final double doubleValue = Double.MAX_VALUE;
+    private static final float floatValue = Float.MIN_VALUE;
+
     // Collection mapper tests
     private static final List<String> stringList1 = Arrays.asList("Baking", "Bakery",
"Canned", "Dairy");
     private static final List<String> stringList2 = Arrays.asList("Fridge", "Deli",
"Fresh Produce", "Frozen",
@@ -226,7 +233,7 @@ public abstract class SqlIntegrationTest
         sqlDataClass.setString("Test String");
         sqlDataClass.setDate(applibDate);
         sqlDataClass.setSqlDate(sqlDate);
-        sqlDataClass.setMoney(money); // TODO: Money is broken
+        sqlDataClass.setMoney(money);
         sqlDataClass.setDateTime(dateTime);
         sqlDataClass.setTimeStamp(timeStamp);
         sqlDataClass.setTime(time);
@@ -235,9 +242,18 @@ public abstract class SqlIntegrationTest
         sqlDataClass.setPassword(password);
         sqlDataClass.setPercentage(percentage);
 
+        // standard value types
+        sqlDataClass.setIntValue(intValue);
+        sqlDataClass.setShortValue(shortValue);
+        sqlDataClass.setLongValue(longValue);
+        sqlDataClass.setDoubleValue(doubleValue);
+        sqlDataClass.setFloatValue(floatValue);
+
         // Setup SimpleClassTwo
         simpleClassTwoA = factory.newSimpleClassTwo();
         simpleClassTwoA.setText("A");
+        simpleClassTwoA.setIntValue(999);
+        simpleClassTwoA.setBooleanValue(true);
         // simpleClassTwoB = factory.newSimpleClassTwo();
         // simpleClassTwoB.setString("A");
 
@@ -480,8 +496,7 @@ public abstract class SqlIntegrationTest
      */
     public void testPassword() {
         SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
-        assertTrue("Password " + password.toString() + " is not equal to " + sqlDataClass.getPassword().toString(),
-            password.equals(sqlDataClass.getPassword()));
+        assertEquals(password, sqlDataClass.getPassword());
     }
 
     /**
@@ -489,8 +504,16 @@ public abstract class SqlIntegrationTest
      */
     public void testPercentage() {
         SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
-        assertTrue("Percentage " + percentage.toString() + " is not equal to "
-            + sqlDataClass.getPercentage().toString(), percentage.equals(sqlDataClass.getPercentage()));
+        assertEquals(percentage, sqlDataClass.getPercentage());
+    }
+
+    public void testStandardValueTypes() {
+        SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+        assertEquals(shortValue, sqlDataClass.getShortValue());
+        assertEquals(intValue, sqlDataClass.getIntValue());
+        assertEquals(longValue, sqlDataClass.getLongValue());
+        assertEquals(doubleValue, sqlDataClass.getDoubleValue());
+        assertEquals(floatValue, sqlDataClass.getFloatValue());
     }
 
     /**
@@ -573,6 +596,8 @@ public abstract class SqlIntegrationTest
             SimpleClassTwo a = simpleClass.getSimpleClassTwoA();
             factory.resolve(a);
             assertEquals(simpleClassTwoA.getText(), a.getText());
+            assertEquals(simpleClassTwoA.getIntValue(), a.getIntValue());
+            assertEquals(simpleClassTwoA.getBooleanValue(), a.getBooleanValue());
         }
     }
 
@@ -592,6 +617,8 @@ public abstract class SqlIntegrationTest
 
         SimpleClassTwo simpleClass = classes.get(0);
         simpleClass.setText("XXX");
+        simpleClass.setBooleanValue(false);
+        simpleClassTwoA.setBooleanValue(false);
     }
 
     public void testUpdate2() {
@@ -601,6 +628,7 @@ public abstract class SqlIntegrationTest
 
         SimpleClassTwo simpleClass = classes.get(0);
         assertEquals("XXX", simpleClass.getText());
+        assertEquals(simpleClassTwoA.getBooleanValue(), simpleClass.getBooleanValue());
     }
 
     // Last "test" - Set the Singleton state to 0 to invoke a clean shutdown.

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SimpleClassTwo.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SimpleClassTwo.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SimpleClassTwo.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SimpleClassTwo.java
Fri Apr 22 19:42:29 2011
@@ -46,15 +46,28 @@ public class SimpleClassTwo extends Abst
 
     // }}
 
-    // {{ Value
-    private int integer;
+    // {{ IntValue
+    private int intValue;
 
-    public int getValue() {
-        return integer;
+    public int getIntValue() {
+        return intValue;
     }
 
-    public void setValue(final int integer) {
-        this.integer = integer;
+    public void setIntValue(final int value) {
+        this.intValue = value;
+    }
+
+    // }}
+
+    // {{ BooleanValue
+    private boolean booleanValue;
+
+    public boolean getBooleanValue() {
+        return booleanValue;
+    }
+
+    public void setBooleanValue(final boolean value) {
+        this.booleanValue = value;
     }
     // }}
 

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SqlDataClass.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SqlDataClass.java?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SqlDataClass.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/testsystem/dataclasses/SqlDataClass.java
Fri Apr 22 19:42:29 2011
@@ -25,9 +25,9 @@ import java.util.List;
 import org.apache.isis.applib.AbstractDomainObject;
 import org.apache.isis.applib.annotation.MemberOrder;
 import org.apache.isis.applib.value.Color;
+import org.apache.isis.applib.value.Date;
 import org.apache.isis.applib.value.DateTime;
 import org.apache.isis.applib.value.Image;
-import org.apache.isis.applib.value.Date;
 import org.apache.isis.applib.value.Money;
 import org.apache.isis.applib.value.Password;
 import org.apache.isis.applib.value.Percentage;
@@ -36,275 +36,341 @@ import org.apache.isis.applib.value.Time
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestCommon;
 
 /**
- * The SqlDataClass is a test class used in the sql-persistor integration tests.
- * It's properties are stored and retrieved using the persistor, to confirm
- * accurate persistence behaviour.
+ * The SqlDataClass is a test class used in the sql-persistor integration tests. It's properties
are stored and
+ * retrieved using the persistor, to confirm accurate persistence behaviour.
  * 
- * Each property here requires an equivalent test in
- * {@link SqlIntegrationTestCommon}
+ * Each property here requires an equivalent test in {@link SqlIntegrationTestCommon}
  * 
  * @author Kevin Meyer
  * 
  */
 
 public class SqlDataClass extends AbstractDomainObject {
-	public String title() {
-		return string;
-	}
-
-	// Isis Date Type
-	// {{ Date
-	private Date date;
-
-	public Date getDate() {
-		return date;
-	}
-
-	public void setDate(final Date date) {
-		this.date = date;
-	}
-
-	// }}
-
-	// {{ String type
-	private String string;
-
-	public String getString() {
-		return string;
-	}
-
-	public void setString(final String string) {
-		this.string = string;
-	}
-
-	// }}
-
-	// SQL Date Type
-	// {{ SqlDate
-	/**/
-	private java.sql.Date sqlDate;
-
-	@MemberOrder(sequence = "1")
-	public java.sql.Date getSqlDate() {
-		return sqlDate;
-	}
-
-	public void setSqlDate(final java.sql.Date sqlDate) {
-		this.sqlDate = sqlDate;
-	}
-	/**/
-
-	// }}
-
-	// {{ Money
-	private Money money;
-
-	@MemberOrder(sequence = "1")
-	public Money getMoney() {
-		return money;
-	}
-
-	public void setMoney(final Money money) {
-		this.money = money;
-	}
-
-	// }}
-
-	// {{ DateTime
-	private DateTime dateTime;
-
-	@MemberOrder(sequence = "1")
-	public DateTime getDateTime() {
-		return dateTime;
-	}
-
-	public void setDateTime(final DateTime dateTime) {
-		this.dateTime = dateTime;
-	}
-
-	// }}
-
-	// {{ TimeStamp
-	private TimeStamp timeStamp;
-
-	@MemberOrder(sequence = "1")
-	public TimeStamp getTimeStamp() {
-		return timeStamp;
-	}
-
-	public void setTimeStamp(final TimeStamp timeStamp) {
-		this.timeStamp = timeStamp;
-	}
-
-	// }}
-
-	// Color, Image, Password, Percentage, Time
-	// {{ Time
-	private Time time;
-
-	@MemberOrder(sequence = "1")
-	public Time getTime() {
-		return time;
-	}
-
-	public void setTime(final Time time) {
-		this.time = time;
-	}
-
-	// }}
-
-	// {{ Color
-	private Color color;
-
-	@MemberOrder(sequence = "1")
-	public Color getColor() {
-		return color;
-	}
-
-	public void setColor(final Color color) {
-		this.color = color;
-	}
-
-	// }}
-
-	// {{ Image
-	private Image image;
-
-	@MemberOrder(sequence = "1")
-	public Image getImage() {
-		return image;
-	}
-
-	public void setImage(final Image image) {
-		this.image = image;
-	}
-
-	// }}
-
-	// {{ Password
-	private Password password;
-
-	@MemberOrder(sequence = "1")
-	public Password getPassword() {
-		return password;
-	}
-
-	public void setPassword(final Password password) {
-		this.password = password;
-	}
-
-	// }}
-
-	// {{ Percentage
-	private Percentage percentage;
-
-	@MemberOrder(sequence = "1")
-	public Percentage getPercentage() {
-		return percentage;
-	}
-
-	public void setPercentage(final Percentage percentage) {
-		this.percentage = percentage;
-	}
-
-	// }}
-
-	// {{ SimpleClasses
-	public List<SimpleClass> simpleClasses1 = new ArrayList<SimpleClass>();
-
-	@MemberOrder(sequence = "1")
-	public List<SimpleClass> getSimpleClasses1() {
-		return simpleClasses1;
-	}
-
-	public void setSimpleClasses1(final List<SimpleClass> simpleClasses) {
-		this.simpleClasses1 = simpleClasses;
-	}
-
-	public void addToSimpleClasses1(final SimpleClass simpleClass) {
-		// check for no-op
-		if (simpleClass == null || getSimpleClasses1().contains(simpleClass)) {
-			return;
-		}
-		// associate new
-		getSimpleClasses1().add(simpleClass);
-		// additional business logic
-		onAddToSimpleClasses1(simpleClass);
-	}
-
-	public void removeFromSimpleClasses1(final SimpleClass simpleClass) {
-		// check for no-op
-		if (simpleClass == null || !getSimpleClasses1().contains(simpleClass)) {
-			return;
-		}
-		// dissociate existing
-		getSimpleClasses1().remove(simpleClass);
-		// additional business logic
-		onRemoveFromSimpleClasses1(simpleClass);
-	}
-
-	protected void onAddToSimpleClasses1(final SimpleClass simpleClass) {
-	}
-
-	protected void onRemoveFromSimpleClasses1(final SimpleClass simpleClass) {
-	}
-
-	// }}
-
-	// {{ SimpleClasses2
-	/**/
-	private List<SimpleClass> simpleClasses2 = new ArrayList<SimpleClass>();
-
-	@MemberOrder(sequence = "1")
-	public List<SimpleClass> getSimpleClasses2() {
-		return simpleClasses2;
-	}
-
-	public void setSimpleClasses2(final List<SimpleClass> simpleClasses) {
-		this.simpleClasses2 = simpleClasses;
-	}
-
-	public void addToSimpleClasses2(final SimpleClass simpleClass) {
-		// check for no-op
-		if (simpleClass == null || getSimpleClasses2().contains(simpleClass)) {
-			return;
-		}
-		// associate new
-		getSimpleClasses2().add(simpleClass);
-		// additional business logic
-		onAddToSimpleClasses2(simpleClass);
-	}
-
-	public void removeFromSimpleClasses2(final SimpleClass simpleClass) {
-		// check for no-op
-		if (simpleClass == null || !getSimpleClasses2().contains(simpleClass)) {
-			return;
-		}
-		// dissociate existing
-		getSimpleClasses2().remove(simpleClass);
-		// additional business logic
-		onRemoveFromSimpleClasses2(simpleClass);
-	}
-
-	protected void onAddToSimpleClasses2(final SimpleClass simpleClass) {
-	}
-
-	protected void onRemoveFromSimpleClasses2(final SimpleClass simpleClass) {
-	}
-
-	/**/
-	// }}
-
-	// {{ SimpleClassTwo
-	private SimpleClassTwo simplyClassTwo;
-
-	public SimpleClassTwo getSimpleClassTwo() {
-		return simplyClassTwo;
-	}
-
-	public void setSimpleClassTwo(final SimpleClassTwo simpleClassTwo) {
-		this.simplyClassTwo = simpleClassTwo;
-	}
-	// }}
+    public String title() {
+        return string;
+    }
+
+    // Isis Date Type
+    // {{ Date
+    private Date date;
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(final Date date) {
+        this.date = date;
+    }
+
+    // }}
+
+    // {{ String type
+    private String string;
+
+    public String getString() {
+        return string;
+    }
+
+    public void setString(final String string) {
+        this.string = string;
+    }
+
+    // }}
+
+    // SQL Date Type
+    // {{ SqlDate
+    /**/
+    private java.sql.Date sqlDate;
+
+    @MemberOrder(sequence = "1")
+    public java.sql.Date getSqlDate() {
+        return sqlDate;
+    }
+
+    public void setSqlDate(final java.sql.Date sqlDate) {
+        this.sqlDate = sqlDate;
+    }
+
+    /**/
+
+    // }}
+
+    // {{ Money
+    private Money money;
+
+    @MemberOrder(sequence = "1")
+    public Money getMoney() {
+        return money;
+    }
+
+    public void setMoney(final Money money) {
+        this.money = money;
+    }
+
+    // }}
+
+    // {{ DateTime
+    private DateTime dateTime;
+
+    @MemberOrder(sequence = "1")
+    public DateTime getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(final DateTime dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    // }}
+
+    // {{ TimeStamp
+    private TimeStamp timeStamp;
+
+    @MemberOrder(sequence = "1")
+    public TimeStamp getTimeStamp() {
+        return timeStamp;
+    }
+
+    public void setTimeStamp(final TimeStamp timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
+    // }}
+
+    // Color, Image, Password, Percentage, Time
+    // {{ Time
+    private Time time;
+
+    @MemberOrder(sequence = "1")
+    public Time getTime() {
+        return time;
+    }
+
+    public void setTime(final Time time) {
+        this.time = time;
+    }
+
+    // }}
+
+    // {{ Color
+    private Color color;
+
+    @MemberOrder(sequence = "1")
+    public Color getColor() {
+        return color;
+    }
+
+    public void setColor(final Color color) {
+        this.color = color;
+    }
+
+    // }}
+
+    // {{ Image
+    private Image image;
+
+    @MemberOrder(sequence = "1")
+    public Image getImage() {
+        return image;
+    }
+
+    public void setImage(final Image image) {
+        this.image = image;
+    }
+
+    // }}
+
+    // {{ Password
+    private Password password;
+
+    @MemberOrder(sequence = "1")
+    public Password getPassword() {
+        return password;
+    }
+
+    public void setPassword(final Password password) {
+        this.password = password;
+    }
+
+    // }}
+
+    // {{ Percentage
+    private Percentage percentage;
+
+    @MemberOrder(sequence = "1")
+    public Percentage getPercentage() {
+        return percentage;
+    }
+
+    public void setPercentage(final Percentage percentage) {
+        this.percentage = percentage;
+    }
+
+    // }}
+
+    // Basic value types
+    // {{ IntValue
+    private int intValue;
+
+    public int getIntValue() {
+        return intValue;
+    }
+
+    public void setIntValue(final int value) {
+        this.intValue = value;
+    }
+
+    // }}
+
+    // {{ ShortValue
+    private short shortValue;
+
+    public short getShortValue() {
+        return shortValue;
+    }
+
+    public void setShortValue(final short value) {
+        this.shortValue = value;
+    }
+
+    // }}
+
+    // {{ LongValue
+    private long longValue;
+
+    public long getLongValue() {
+        return longValue;
+    }
+
+    public void setLongValue(final long value) {
+        this.longValue = value;
+    }
+
+    // }}
+
+    // {{ FloatValue
+    private Float floatValue;
+
+    public Float getFloatValue() {
+        return floatValue;
+    }
+
+    public void setFloatValue(final Float value) {
+        this.floatValue = value;
+    }
+
+    // }}
+
+    // {{ DoubleValue
+    private double doubleValue;
+
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    public void setDoubleValue(final double value) {
+        this.doubleValue = value;
+    }
+
+    // }}
+
+    // References to other entities
+    // {{ SimpleClasses
+    public List<SimpleClass> simpleClasses1 = new ArrayList<SimpleClass>();
+
+    @MemberOrder(sequence = "1")
+    public List<SimpleClass> getSimpleClasses1() {
+        return simpleClasses1;
+    }
+
+    public void setSimpleClasses1(final List<SimpleClass> simpleClasses) {
+        this.simpleClasses1 = simpleClasses;
+    }
+
+    public void addToSimpleClasses1(final SimpleClass simpleClass) {
+        // check for no-op
+        if (simpleClass == null || getSimpleClasses1().contains(simpleClass)) {
+            return;
+        }
+        // associate new
+        getSimpleClasses1().add(simpleClass);
+        // additional business logic
+        onAddToSimpleClasses1(simpleClass);
+    }
+
+    public void removeFromSimpleClasses1(final SimpleClass simpleClass) {
+        // check for no-op
+        if (simpleClass == null || !getSimpleClasses1().contains(simpleClass)) {
+            return;
+        }
+        // dissociate existing
+        getSimpleClasses1().remove(simpleClass);
+        // additional business logic
+        onRemoveFromSimpleClasses1(simpleClass);
+    }
+
+    protected void onAddToSimpleClasses1(final SimpleClass simpleClass) {
+    }
+
+    protected void onRemoveFromSimpleClasses1(final SimpleClass simpleClass) {
+    }
+
+    // }}
+
+    // {{ SimpleClasses2
+    /**/
+    private List<SimpleClass> simpleClasses2 = new ArrayList<SimpleClass>();
+
+    @MemberOrder(sequence = "1")
+    public List<SimpleClass> getSimpleClasses2() {
+        return simpleClasses2;
+    }
+
+    public void setSimpleClasses2(final List<SimpleClass> simpleClasses) {
+        this.simpleClasses2 = simpleClasses;
+    }
+
+    public void addToSimpleClasses2(final SimpleClass simpleClass) {
+        // check for no-op
+        if (simpleClass == null || getSimpleClasses2().contains(simpleClass)) {
+            return;
+        }
+        // associate new
+        getSimpleClasses2().add(simpleClass);
+        // additional business logic
+        onAddToSimpleClasses2(simpleClass);
+    }
+
+    public void removeFromSimpleClasses2(final SimpleClass simpleClass) {
+        // check for no-op
+        if (simpleClass == null || !getSimpleClasses2().contains(simpleClass)) {
+            return;
+        }
+        // dissociate existing
+        getSimpleClasses2().remove(simpleClass);
+        // additional business logic
+        onRemoveFromSimpleClasses2(simpleClass);
+    }
+
+    protected void onAddToSimpleClasses2(final SimpleClass simpleClass) {
+    }
+
+    protected void onRemoveFromSimpleClasses2(final SimpleClass simpleClass) {
+    }
+
+    /**/
+    // }}
+
+    // {{ SimpleClassTwo
+    private SimpleClassTwo simplyClassTwo;
+
+    public SimpleClassTwo getSimpleClassTwo() {
+        return simplyClassTwo;
+    }
+
+    public void setSimpleClassTwo(final SimpleClassTwo simpleClassTwo) {
+        this.simplyClassTwo = simpleClassTwo;
+    }
+    // }}
 }
 // Copyright (c) Kevin Meyer, www.kmz.co.za.

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/mysql.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/mysql.properties?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/mysql.properties
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/mysql.properties
Fri Apr 22 19:42:29 2011
@@ -7,3 +7,5 @@ isis.persistor.sql.jdbc.connection=jdbc:
 #true&serverTimezone=GMT
 isis.persistor.sql.jdbc.user=nof
 isis.persistor.sql.jdbc.password=
+
+#isis.persistor.sql.datatypes.double=DOUBLE PRECISION
\ No newline at end of file

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/postgresql.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/postgresql.properties?rev=1096005&r1=1096004&r2=1096005&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/postgresql.properties
(original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/sql/tests-served/src/test/config/postgresql.properties
Fri Apr 22 19:42:29 2011
@@ -7,4 +7,5 @@ isis.persistor.sql.jdbc.user=nof
 isis.persistor.sql.jdbc.password=
 
 isis.persistor.sql.datatypes.timestamp=TIMESTAMP
-isis.persistor.sql.datatypes.datetime=TIMESTAMP
\ No newline at end of file
+isis.persistor.sql.datatypes.datetime=TIMESTAMP
+isis.persistor.sql.datatypes.double=FLOAT
\ No newline at end of file



Mime
View raw message