You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2013/08/04 20:27:09 UTC

svn commit: r1510297 [2/2] - in /cayenne/main/trunk: framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ framework/cayenne-core-unpublished/src/mai...

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java Sun Aug  4 18:27:08 2013
@@ -21,7 +21,6 @@ package org.apache.cayenne.access;
 
 import java.sql.Types;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.cayenne.configuration.server.ServerRuntime;
@@ -58,8 +57,7 @@ public class DbLoaderTest extends Server
 
     @Override
     protected void setUpAfterInjection() throws Exception {
-        loader = new DbLoader(dataSourceFactory.getSharedDataSource()
-                .getConnection(), adapter, null);
+        loader = new DbLoader(dataSourceFactory.getSharedDataSource().getConnection(), adapter, null);
     }
 
     @Override
@@ -75,14 +73,12 @@ public class DbLoaderTest extends Server
 
         String tableLabel = adapter.tableTypeForTable();
         if (tableLabel != null) {
-            assertTrue("Missing type for table '" + tableLabel + "' - "
-                    + tableTypes, tableTypes.contains(tableLabel));
+            assertTrue("Missing type for table '" + tableLabel + "' - " + tableTypes, tableTypes.contains(tableLabel));
         }
 
         String viewLabel = adapter.tableTypeForView();
         if (viewLabel != null) {
-            assertTrue("Missing type for view '" + viewLabel + "' - "
-                    + tableTypes, tableTypes.contains(viewLabel));
+            assertTrue("Missing type for view '" + viewLabel + "' - " + tableTypes, tableTypes.contains(viewLabel));
         }
     }
 
@@ -90,8 +86,7 @@ public class DbLoaderTest extends Server
 
         String tableLabel = adapter.tableTypeForTable();
 
-        List<DbEntity> tables = loader.getTables(null, null, "%",
-                new String[] { tableLabel });
+        List<DbEntity> tables = loader.getTables(null, null, "%", new String[] { tableLabel });
 
         assertNotNull(tables);
 
@@ -104,8 +99,7 @@ public class DbLoaderTest extends Server
             }
         }
 
-        assertTrue("'ARTIST' is missing from the table list: " + tables,
-                foundArtist);
+        assertTrue("'ARTIST' is missing from the table list: " + tables, foundArtist);
     }
 
     public void testLoadWithMeaningfulPK() throws Exception {
@@ -115,11 +109,9 @@ public class DbLoaderTest extends Server
 
         loader.setCreatingMeaningfulPK(true);
 
-        List<DbEntity> testLoader = loader.getTables(null, null, "artist",
-                new String[] { tableLabel });
+        List<DbEntity> testLoader = loader.getTables(null, null, "artist", new String[] { tableLabel });
         if (testLoader.size() == 0) {
-            testLoader = loader.getTables(null, null, "ARTIST",
-                    new String[] { tableLabel });
+            testLoader = loader.getTables(null, null, "ARTIST", new String[] { tableLabel });
         }
 
         loader.loadDbEntities(map, testLoader);
@@ -138,19 +130,18 @@ public class DbLoaderTest extends Server
      */
     public void testLoad() throws Exception {
 
-        boolean supportsUnique = runtime.getDataDomain().getDataNodes()
-                .iterator().next().getAdapter().supportsUniqueConstraints();
+        boolean supportsUnique = runtime.getDataDomain().getDataNodes().iterator().next().getAdapter()
+                .supportsUniqueConstraints();
         boolean supportsLobs = accessStackAdapter.supportsLobs();
         boolean supportsFK = accessStackAdapter.supportsFKConstraints();
 
         DataMap map = new DataMap();
         map.setDefaultPackage("foo.x");
-        
+
         String tableLabel = adapter.tableTypeForTable();
 
         // *** TESTING THIS ***
-        loader.loadDbEntities(map,
-                loader.getTables(null, null, "%", new String[] { tableLabel }));
+        loader.loadDbEntities(map, loader.getTables(null, null, "%", new String[] { tableLabel }));
 
         assertDbEntities(map);
 
@@ -162,7 +153,7 @@ public class DbLoaderTest extends Server
         loader.loadDbRelationships(map);
 
         if (supportsFK) {
-            Collection<?> rels = getDbEntity(map, "ARTIST").getRelationships();
+            Collection<DbRelationship> rels = getDbEntity(map, "ARTIST").getRelationships();
             assertNotNull(rels);
             assertTrue(rels.size() > 0);
 
@@ -172,9 +163,7 @@ public class DbLoaderTest extends Server
 
             // find relationship to PAINTING_INFO
             DbRelationship oneToOne = null;
-            Iterator<?> it = rels.iterator();
-            while (it.hasNext()) {
-                DbRelationship rel = (DbRelationship) it.next();
+            for (DbRelationship rel : rels) {
                 if ("PAINTING_INFO".equalsIgnoreCase(rel.getTargetEntityName())) {
                     oneToOne = rel;
                     break;
@@ -182,10 +171,8 @@ public class DbLoaderTest extends Server
             }
 
             assertNotNull("No relationship to PAINTING_INFO", oneToOne);
-            assertFalse("Relationship to PAINTING_INFO must be to-one",
-                    oneToOne.isToMany());
-            assertTrue("Relationship to PAINTING_INFO must be to-one",
-                    oneToOne.isToDependentPK());
+            assertFalse("Relationship to PAINTING_INFO must be to-one", oneToOne.isToMany());
+            assertTrue("Relationship to PAINTING_INFO must be to-one", oneToOne.isToDependentPK());
 
             // test UNIQUE only if FK is supported...
             if (supportsUnique) {
@@ -224,9 +211,7 @@ public class DbLoaderTest extends Server
 
     private void assertDbEntities(DataMap map) {
         DbEntity dae = getDbEntity(map, "ARTIST");
-        assertNotNull(
-                "Null 'ARTIST' entity, other DbEntities: "
-                        + map.getDbEntityMap(), dae);
+        assertNotNull("Null 'ARTIST' entity, other DbEntities: " + map.getDbEntityMap(), dae);
         assertEquals("ARTIST", dae.getName().toUpperCase());
 
         if (accessStackAdapter.supportsCatalogs()) {
@@ -241,7 +226,7 @@ public class DbLoaderTest extends Server
 
         if (adapter.supportsGeneratedKeys()) {
             DbEntity bag = getDbEntity(map, "BAG");
-            DbAttribute id = (DbAttribute) bag.getAttribute("ID");
+            DbAttribute id = bag.getAttribute("ID");
             assertTrue(id.isPrimaryKey());
             assertTrue(id.isGenerated());
         }
@@ -255,10 +240,10 @@ public class DbLoaderTest extends Server
         ObjEntity ae = map.getObjEntity("Artist");
         assertNotNull(ae);
         assertEquals("Artist", ae.getName());
-        
+
         // assert primary key is not an attribute
         assertNull(ae.getAttribute("artistId"));
-        
+
         if (supportsLobs) {
             assertLobObjEntities(map);
         }
@@ -268,7 +253,7 @@ public class DbLoaderTest extends Server
             assertNotNull(rels1);
             assertTrue(rels1.size() > 0);
         }
-        
+
         assertEquals("foo.x.Artist", ae.getClassName());
     }
 
@@ -277,16 +262,14 @@ public class DbLoaderTest extends Server
         assertNotNull(blobEnt);
         DbAttribute blobAttr = getDbAttribute(blobEnt, "BLOB_COL");
         assertNotNull(blobAttr);
-        assertTrue(msgForTypeMismatch(Types.BLOB, blobAttr),
-                Types.BLOB == blobAttr.getType()
-                        || Types.LONGVARBINARY == blobAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.BLOB, blobAttr), Types.BLOB == blobAttr.getType()
+                || Types.LONGVARBINARY == blobAttr.getType());
         DbEntity clobEnt = getDbEntity(map, "CLOB_TEST");
         assertNotNull(clobEnt);
         DbAttribute clobAttr = getDbAttribute(clobEnt, "CLOB_COL");
         assertNotNull(clobAttr);
-        assertTrue(msgForTypeMismatch(Types.CLOB, clobAttr),
-                Types.CLOB == clobAttr.getType()
-                        || Types.LONGVARCHAR == clobAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.CLOB, clobAttr), Types.CLOB == clobAttr.getType()
+                || Types.LONGVARCHAR == clobAttr.getType());
     }
 
     private void assertLobObjEntities(DataMap map) {
@@ -315,18 +298,17 @@ public class DbLoaderTest extends Server
     }
 
     private DbAttribute getDbAttribute(DbEntity ent, String name) {
-        DbAttribute da = (DbAttribute) ent.getAttribute(name);
+        DbAttribute da = ent.getAttribute(name);
         // sometimes table names get converted to lowercase
         if (da == null) {
-            da = (DbAttribute) ent.getAttribute(name.toLowerCase());
+            da = ent.getAttribute(name.toLowerCase());
         }
 
         return da;
     }
 
     private DataMap originalMap() {
-        return runtime.getDataDomain().getDataNodes().iterator().next()
-                .getDataMaps().iterator().next();
+        return runtime.getDataDomain().getDataNodes().iterator().next().getDataMaps().iterator().next();
     }
 
     /**
@@ -343,29 +325,22 @@ public class DbLoaderTest extends Server
         DbAttribute smallintAttr = getDbAttribute(smallintTest, "SMALLINT_COL");
 
         // check decimal
-        assertTrue(msgForTypeMismatch(Types.DECIMAL, decimalAttr),
-                Types.DECIMAL == decimalAttr.getType()
-                        || Types.NUMERIC == decimalAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.DECIMAL, decimalAttr), Types.DECIMAL == decimalAttr.getType()
+                || Types.NUMERIC == decimalAttr.getType());
         assertEquals(2, decimalAttr.getScale());
 
         // check varchar
-        assertEquals(msgForTypeMismatch(Types.VARCHAR, varcharAttr),
-                Types.VARCHAR, varcharAttr.getType());
+        assertEquals(msgForTypeMismatch(Types.VARCHAR, varcharAttr), Types.VARCHAR, varcharAttr.getType());
         assertEquals(255, varcharAttr.getMaxLength());
         // check integer
-        assertEquals(msgForTypeMismatch(Types.INTEGER, integerAttr),
-                Types.INTEGER, integerAttr.getType());
+        assertEquals(msgForTypeMismatch(Types.INTEGER, integerAttr), Types.INTEGER, integerAttr.getType());
         // check float
-        assertTrue(
-                msgForTypeMismatch(Types.FLOAT, floatAttr),
-                Types.FLOAT == floatAttr.getType()
-                        || Types.DOUBLE == floatAttr.getType()
-                        || Types.REAL == floatAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.FLOAT, floatAttr), Types.FLOAT == floatAttr.getType()
+                || Types.DOUBLE == floatAttr.getType() || Types.REAL == floatAttr.getType());
 
         // check smallint
-        assertTrue(msgForTypeMismatch(Types.SMALLINT, smallintAttr),
-                Types.SMALLINT == smallintAttr.getType()
-                        || Types.INTEGER == smallintAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.SMALLINT, smallintAttr), Types.SMALLINT == smallintAttr.getType()
+                || Types.INTEGER == smallintAttr.getType());
     }
 
     public void checkAllDBEntities(DataMap map) {
@@ -373,13 +348,9 @@ public class DbLoaderTest extends Server
         for (DbEntity origEnt : originalMap().getDbEntities()) {
             DbEntity newEnt = map.getDbEntity(origEnt.getName());
             for (DbAttribute origAttr : origEnt.getAttributes()) {
-                DbAttribute newAttr = (DbAttribute) newEnt
-                        .getAttribute(origAttr.getName());
-                assertNotNull(
-                        "No matching DbAttribute for '" + origAttr.getName(),
-                        newAttr);
-                assertEquals(msgForTypeMismatch(origAttr, newAttr),
-                        origAttr.getType(), newAttr.getType());
+                DbAttribute newAttr = newEnt.getAttribute(origAttr.getName());
+                assertNotNull("No matching DbAttribute for '" + origAttr.getName(), newAttr);
+                assertEquals(msgForTypeMismatch(origAttr, newAttr), origAttr.getType(), newAttr.getType());
                 // length and precision doesn't have to be the same
                 // it must be greater or equal
                 assertTrue(origAttr.getMaxLength() <= newAttr.getMaxLength());
@@ -395,14 +366,12 @@ public class DbLoaderTest extends Server
     private String msgForTypeMismatch(int origType, DbAttribute newAttr) {
         String nt = TypesMapping.getSqlNameByType(newAttr.getType());
         String ot = TypesMapping.getSqlNameByType(origType);
-        return attrMismatch(newAttr.getName(), "expected type: <" + ot
-                + ">, but was <" + nt + ">");
+        return attrMismatch(newAttr.getName(), "expected type: <" + ot + ">, but was <" + nt + ">");
     }
 
     private String attrMismatch(String attrName, String msg) {
         StringBuffer buf = new StringBuffer();
-        buf.append("[Error loading attribute '").append(attrName).append("': ")
-                .append(msg).append("]");
+        buf.append("[Error loading attribute '").append(attrName).append("': ").append(msg).append("]");
         return buf.toString();
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/IdentityColumnsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/IdentityColumnsTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/IdentityColumnsTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/IdentityColumnsTest.java Sun Aug  4 18:27:08 2013
@@ -72,13 +72,12 @@ public class IdentityColumnsTest extends
     }
 
     /**
-     * Tests a bug casued by the ID Java type mismatch vs the default JDBC type of the ID
-     * column.
+     * Tests a bug casued by the ID Java type mismatch vs the default JDBC type
+     * of the ID column.
      */
     public void testCAY823() throws Exception {
 
-        GeneratedColumnTestEntity idObject = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity idObject = context.newObject(GeneratedColumnTestEntity.class);
 
         String name = "n_" + System.currentTimeMillis();
         idObject.setName(name);
@@ -99,35 +98,32 @@ public class IdentityColumnsTest extends
 
     public void testNewObject() throws Exception {
 
-        GeneratedColumnTestEntity idObject = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity idObject = context.newObject(GeneratedColumnTestEntity.class);
 
         String name = "n_" + System.currentTimeMillis();
         idObject.setName(name);
 
         idObject.getObjectContext().commitChanges();
 
-        // this will throw an exception if id wasn't generated one way or another
+        // this will throw an exception if id wasn't generated one way or
+        // another
         int id = Cayenne.intPKForObject(idObject);
         assertTrue(id >= 0);
 
         // make sure that id is the same as id in the DB
         context.invalidateObjects(idObject);
-        GeneratedColumnTestEntity object = Cayenne.objectForPK(
-                context,
-                GeneratedColumnTestEntity.class,
-                id);
+        GeneratedColumnTestEntity object = Cayenne.objectForPK(context, GeneratedColumnTestEntity.class, id);
         assertNotNull(object);
         assertEquals(name, object.getName());
     }
 
     public void testGeneratedJoinInFlattenedRelationship() throws Exception {
 
-        // before saving objects, let's manually access PKGenerator to get a base PK value
+        // before saving objects, let's manually access PKGenerator to get a
+        // base PK value
         // for comparison
-        DbEntity joinTableEntity = context.getEntityResolver().getDbEntity(
-                joinTable.getTableName());
-        DbAttribute pkAttribute = (DbAttribute) joinTableEntity.getAttribute("ID");
+        DbEntity joinTableEntity = context.getEntityResolver().getDbEntity(joinTable.getTableName());
+        DbAttribute pkAttribute = joinTableEntity.getAttribute("ID");
         Number pk = (Number) adapter.getPkGenerator().generatePk(node, pkAttribute);
 
         GeneratedF1 f1 = context.newObject(GeneratedF1.class);
@@ -140,13 +136,12 @@ public class IdentityColumnsTest extends
         assertTrue(id > 0);
 
         // this is a leap of faith that autoincrement-based IDs will not match
-        // PkGenertor provided ids... This sorta works though if pk generator has a 200
+        // PkGenertor provided ids... This sorta works though if pk generator
+        // has a 200
         // base value
         if (adapter.supportsGeneratedKeys()) {
-            assertFalse("Looks like auto-increment wasn't used for the join table. ID: "
-                    + id, id == pk.intValue() + 1);
-        }
-        else {
+            assertFalse("Looks like auto-increment wasn't used for the join table. ID: " + id, id == pk.intValue() + 1);
+        } else {
             assertEquals(id, pk.intValue() + 1);
         }
     }
@@ -177,13 +172,12 @@ public class IdentityColumnsTest extends
     }
 
     /**
-     * Tests that insert in two tables with identity pk does not generate a conflict. See
-     * CAY-341 for the original bug.
+     * Tests that insert in two tables with identity pk does not generate a
+     * conflict. See CAY-341 for the original bug.
      */
     public void testMultipleNewObjectsSeparateTables() throws Exception {
 
-        GeneratedColumnTestEntity idObject1 = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity idObject1 = context.newObject(GeneratedColumnTestEntity.class);
         idObject1.setName("o1");
 
         GeneratedColumnTest2 idObject2 = context.newObject(GeneratedColumnTest2.class);
@@ -194,16 +188,12 @@ public class IdentityColumnsTest extends
 
     public void testMultipleNewObjects() throws Exception {
 
-        String[] names = new String[] {
-                "n1_" + System.currentTimeMillis(), "n2_" + System.currentTimeMillis(),
-                "n3_" + System.currentTimeMillis()
-        };
+        String[] names = new String[] { "n1_" + System.currentTimeMillis(), "n2_" + System.currentTimeMillis(),
+                "n3_" + System.currentTimeMillis() };
 
         GeneratedColumnTestEntity[] idObjects = new GeneratedColumnTestEntity[] {
-                context.newObject(GeneratedColumnTestEntity.class),
-                context.newObject(GeneratedColumnTestEntity.class),
-                context.newObject(GeneratedColumnTestEntity.class)
-        };
+                context.newObject(GeneratedColumnTestEntity.class), context.newObject(GeneratedColumnTestEntity.class),
+                context.newObject(GeneratedColumnTestEntity.class) };
 
         for (int i = 0; i < idObjects.length; i++) {
             idObjects[i].setName(names[i]);
@@ -220,10 +210,7 @@ public class IdentityColumnsTest extends
         context.invalidateObjects(idObjects);
 
         for (int i = 0; i < ids.length; i++) {
-            GeneratedColumnTestEntity object = Cayenne.objectForPK(
-                    context,
-                    GeneratedColumnTestEntity.class,
-                    ids[i]);
+            GeneratedColumnTestEntity object = Cayenne.objectForPK(context, GeneratedColumnTestEntity.class, ids[i]);
             assertNotNull(object);
             assertEquals(names[i], object.getName());
         }
@@ -231,15 +218,15 @@ public class IdentityColumnsTest extends
 
     public void testCompoundPKWithGeneratedColumn() throws Exception {
         if (adapter.supportsGeneratedKeys()) {
-            // only works for generated keys, as the entity tested has one Cayenne
+            // only works for generated keys, as the entity tested has one
+            // Cayenne
             // auto-pk and one generated key
 
             String masterName = "m_" + System.currentTimeMillis();
             String depName1 = "dep1_" + System.currentTimeMillis();
             String depName2 = "dep2_" + System.currentTimeMillis();
 
-            GeneratedColumnCompMaster master = context
-                    .newObject(GeneratedColumnCompMaster.class);
+            GeneratedColumnCompMaster master = context.newObject(GeneratedColumnCompMaster.class);
             master.setName(masterName);
 
             GeneratedColumnCompKey dep1 = context.newObject(GeneratedColumnCompKey.class);
@@ -257,19 +244,16 @@ public class IdentityColumnsTest extends
             ObjectId id2 = dep2.getObjectId();
 
             // check propagated id
-            Number propagatedID2 = (Number) id2.getIdSnapshot().get(
-                    GeneratedColumnCompKey.PROPAGATED_PK_PK_COLUMN);
+            Number propagatedID2 = (Number) id2.getIdSnapshot().get(GeneratedColumnCompKey.PROPAGATED_PK_PK_COLUMN);
             assertNotNull(propagatedID2);
             assertEquals(masterId, propagatedID2.intValue());
 
             // check Cayenne-generated ID
-            Number cayenneGeneratedID2 = (Number) id2.getIdSnapshot().get(
-                    GeneratedColumnCompKey.AUTO_PK_PK_COLUMN);
+            Number cayenneGeneratedID2 = (Number) id2.getIdSnapshot().get(GeneratedColumnCompKey.AUTO_PK_PK_COLUMN);
             assertNotNull(cayenneGeneratedID2);
 
             // check DB-generated ID
-            Number dbGeneratedID2 = (Number) id2.getIdSnapshot().get(
-                    GeneratedColumnCompKey.GENERATED_COLUMN_PK_COLUMN);
+            Number dbGeneratedID2 = (Number) id2.getIdSnapshot().get(GeneratedColumnCompKey.GENERATED_COLUMN_PK_COLUMN);
             assertNotNull(dbGeneratedID2);
 
             context.invalidateObjects(master, dep1, dep2);
@@ -281,8 +265,7 @@ public class IdentityColumnsTest extends
 
     public void testUpdateDependentWithNewMaster() throws Exception {
 
-        GeneratedColumnTestEntity master1 = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity master1 = context.newObject(GeneratedColumnTestEntity.class);
         master1.setName("aaa");
 
         GeneratedColumnDep dependent = context.newObject(GeneratedColumnDep.class);
@@ -292,8 +275,7 @@ public class IdentityColumnsTest extends
         context.commitChanges();
 
         // change master
-        GeneratedColumnTestEntity master2 = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity master2 = context.newObject(GeneratedColumnTestEntity.class);
         master2.setName("bbb");
 
         // TESTING THIS
@@ -315,18 +297,17 @@ public class IdentityColumnsTest extends
 
     public void testGeneratedDefaultValue() throws Exception {
 
-        // fail("TODO: test insert with DEFAULT generated column...need custom SQL to
+        // fail("TODO: test insert with DEFAULT generated column...need custom
+        // SQL to
         // build such table");
     }
 
     public void testPropagateToDependent() throws Exception {
 
-        GeneratedColumnTestEntity idObject = context
-                .newObject(GeneratedColumnTestEntity.class);
+        GeneratedColumnTestEntity idObject = context.newObject(GeneratedColumnTestEntity.class);
         idObject.setName("aaa");
 
-        GeneratedColumnDep dependent = idObject.getObjectContext().newObject(
-                GeneratedColumnDep.class);
+        GeneratedColumnDep dependent = idObject.getObjectContext().newObject(GeneratedColumnDep.class);
         dependent.setName("aaa");
         dependent.setToMaster(idObject);
 

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java Sun Aug  4 18:27:08 2013
@@ -53,34 +53,27 @@ public class BatchActionLockingTest exte
 
     @Inject
     private Injector injector;
-    
+
     @Inject
     private AdhocObjectFactory objectFactory;
-    
+
     public void testRunAsIndividualQueriesSuccess() throws Exception {
         EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
 
         // test with adapter that supports keys...
         JdbcAdapter adapter = buildAdapter(true);
 
-        DbEntity dbEntity = resolver
-                .getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-
-        List<DbAttribute> qualifierAttributes = Arrays.asList((DbAttribute) dbEntity
-                .getAttribute("LOCKING_TEST_ID"), (DbAttribute) dbEntity
-                .getAttribute("NAME"));
+        DbEntity dbEntity = resolver.getObjEntity(SimpleLockingTestEntity.class).getDbEntity();
+
+        List<DbAttribute> qualifierAttributes = Arrays.asList(dbEntity.getAttribute("LOCKING_TEST_ID"),
+                dbEntity.getAttribute("NAME"));
 
         Collection<String> nullAttributeNames = Collections.singleton("NAME");
 
         Map<String, Object> qualifierSnapshot = new HashMap<String, Object>();
         qualifierSnapshot.put("LOCKING_TEST_ID", new Integer(1));
 
-        DeleteBatchQuery batchQuery = new DeleteBatchQuery(
-                dbEntity,
-                qualifierAttributes,
-                nullAttributeNames,
-                5);
+        DeleteBatchQuery batchQuery = new DeleteBatchQuery(dbEntity, qualifierAttributes, nullAttributeNames, 5);
         batchQuery.setUsingOptimisticLocking(true);
         batchQuery.add(qualifierSnapshot);
 
@@ -96,11 +89,7 @@ public class BatchActionLockingTest exte
         boolean generatesKeys = false;
 
         BatchAction action = new BatchAction(batchQuery, adapter, resolver);
-        action.runAsIndividualQueries(
-                mockConnection,
-                batchQueryBuilder,
-                new MockOperationObserver(),
-                generatesKeys);
+        action.runAsIndividualQueries(mockConnection, batchQueryBuilder, new MockOperationObserver(), generatesKeys);
         assertEquals(0, mockConnection.getNumberCommits());
         assertEquals(0, mockConnection.getNumberRollbacks());
     }
@@ -111,24 +100,17 @@ public class BatchActionLockingTest exte
         // test with adapter that supports keys...
         JdbcAdapter adapter = buildAdapter(true);
 
-        DbEntity dbEntity = resolver
-                .getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-
-        List<DbAttribute> qualifierAttributes = Arrays.asList((DbAttribute) dbEntity
-                .getAttribute("LOCKING_TEST_ID"), (DbAttribute) dbEntity
-                .getAttribute("NAME"));
+        DbEntity dbEntity = resolver.getObjEntity(SimpleLockingTestEntity.class).getDbEntity();
+
+        List<DbAttribute> qualifierAttributes = Arrays.asList(dbEntity.getAttribute("LOCKING_TEST_ID"),
+                dbEntity.getAttribute("NAME"));
 
         Collection<String> nullAttributeNames = Collections.singleton("NAME");
 
         Map<String, Object> qualifierSnapshot = new HashMap<String, Object>();
         qualifierSnapshot.put("LOCKING_TEST_ID", new Integer(1));
 
-        DeleteBatchQuery batchQuery = new DeleteBatchQuery(
-                dbEntity,
-                qualifierAttributes,
-                nullAttributeNames,
-                5);
+        DeleteBatchQuery batchQuery = new DeleteBatchQuery(dbEntity, qualifierAttributes, nullAttributeNames, 5);
         batchQuery.setUsingOptimisticLocking(true);
         batchQuery.add(qualifierSnapshot);
 
@@ -144,14 +126,9 @@ public class BatchActionLockingTest exte
         boolean generatesKeys = false;
         BatchAction action = new BatchAction(batchQuery, adapter, resolver);
         try {
-            action.runAsIndividualQueries(
-                    mockConnection,
-                    batchQueryBuilder,
-                    new MockOperationObserver(),
-                    generatesKeys);
+            action.runAsIndividualQueries(mockConnection, batchQueryBuilder, new MockOperationObserver(), generatesKeys);
             fail("No OptimisticLockingFailureException thrown.");
-        }
-        catch (OptimisticLockException e) {
+        } catch (OptimisticLockException e) {
         }
         assertEquals(0, mockConnection.getNumberCommits());
         assertEquals(0, mockConnection.getNumberRollbacks());

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SoftDeleteBatchQueryBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SoftDeleteBatchQueryBuilderTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SoftDeleteBatchQueryBuilderTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SoftDeleteBatchQueryBuilderTest.java Sun Aug  4 18:27:08 2013
@@ -69,7 +69,7 @@ public class SoftDeleteBatchQueryBuilder
     public void testCreateSqlString() throws Exception {
         DbEntity entity = context.getEntityResolver().getObjEntity(SoftTest.class).getDbEntity();
 
-        List<DbAttribute> idAttributes = Collections.singletonList((DbAttribute) entity.getAttribute("SOFT_TEST_ID"));
+        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("SOFT_TEST_ID"));
 
         DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
         DeleteBatchQueryBuilder builder = createBuilder();
@@ -81,8 +81,8 @@ public class SoftDeleteBatchQueryBuilder
     public void testCreateSqlStringWithNulls() throws Exception {
         DbEntity entity = context.getEntityResolver().getObjEntity(SoftTest.class).getDbEntity();
 
-        List<DbAttribute> idAttributes = Arrays.asList((DbAttribute) entity.getAttribute("SOFT_TEST_ID"),
-                (DbAttribute) entity.getAttribute("NAME"));
+        List<DbAttribute> idAttributes = Arrays
+                .asList(entity.getAttribute("SOFT_TEST_ID"), entity.getAttribute("NAME"));
 
         Collection<String> nullAttributes = Collections.singleton("NAME");
 
@@ -100,8 +100,7 @@ public class SoftDeleteBatchQueryBuilder
 
             entity.getDataMap().setQuotingSQLIdentifiers(true);
 
-            List<DbAttribute> idAttributes = Collections.singletonList((DbAttribute) entity
-                    .getAttribute("SOFT_TEST_ID"));
+            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("SOFT_TEST_ID"));
 
             DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
             JdbcAdapter adapter = (JdbcAdapter) this.adapter;

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java Sun Aug  4 18:27:08 2013
@@ -64,8 +64,7 @@ public class DeleteBatchQueryBuilderTest
         DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
                 .getDbEntity();
 
-        List<DbAttribute> idAttributes = Collections
-                .singletonList((DbAttribute) entity.getAttribute("LOCKING_TEST_ID"));
+        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
 
         DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
 
@@ -80,8 +79,8 @@ public class DeleteBatchQueryBuilderTest
         DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
                 .getDbEntity();
 
-        List<DbAttribute> idAttributes = Arrays.asList((DbAttribute) entity.getAttribute("LOCKING_TEST_ID"),
-                (DbAttribute) entity.getAttribute("NAME"));
+        List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
+                entity.getAttribute("NAME"));
 
         Collection<String> nullAttributes = Collections.singleton("NAME");
 
@@ -100,8 +99,7 @@ public class DeleteBatchQueryBuilderTest
         try {
 
             entity.getDataMap().setQuotingSQLIdentifiers(true);
-            List<DbAttribute> idAttributes = Collections.singletonList((DbAttribute) entity
-                    .getAttribute("LOCKING_TEST_ID"));
+            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
 
             DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
             JdbcAdapter adapter = (JdbcAdapter) this.adapter;
@@ -127,8 +125,8 @@ public class DeleteBatchQueryBuilderTest
 
             entity.getDataMap().setQuotingSQLIdentifiers(true);
 
-            List<DbAttribute> idAttributes = Arrays.asList((DbAttribute) entity.getAttribute("LOCKING_TEST_ID"),
-                    (DbAttribute) entity.getAttribute("NAME"));
+            List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
+                    entity.getAttribute("NAME"));
 
             Collection<String> nullAttributes = Collections.singleton("NAME");
 

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java Sun Aug  4 18:27:08 2013
@@ -45,7 +45,7 @@ public class JdbcPkGeneratorTest extends
 
         DbEntity artistEntity = node.getEntityResolver().getObjEntity(Artist.class).getDbEntity();
 
-        DbAttribute pkAttribute = (DbAttribute) artistEntity.getAttribute(Artist.ARTIST_ID_PK_COLUMN);
+        DbAttribute pkAttribute = artistEntity.getAttribute(Artist.ARTIST_ID_PK_COLUMN);
 
         JdbcPkGenerator pkGenerator = (JdbcPkGenerator) adapter.getPkGenerator();
 

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java Sun Aug  4 18:27:08 2013
@@ -58,9 +58,7 @@ public class DataMapTest extends TestCas
 
     public void testSerializabilityWithHessian() throws Exception {
         DataMap m1 = new DataMap("abc");
-        DataMap d1 = (DataMap) HessianUtil.cloneViaClientServerSerialization(
-                m1,
-                new EntityResolver());
+        DataMap d1 = (DataMap) HessianUtil.cloneViaClientServerSerialization(m1, new EntityResolver());
         assertEquals(m1.getName(), d1.getName());
 
         ObjEntity oe1 = new ObjEntity("oe1");
@@ -176,7 +174,8 @@ public class DataMapTest extends TestCas
     public void testAddEntityWithSameName() {
         DataMap map = new DataMap();
 
-        // Give them different class-names... we are only testing for the same entity name
+        // Give them different class-names... we are only testing for the same
+        // entity name
         // being a problem
         ObjEntity e1 = new ObjEntity("c");
         e1.setClassName("c1");
@@ -186,14 +185,14 @@ public class DataMapTest extends TestCas
         try {
             map.addObjEntity(e2);
             fail("Should not be able to add more than one entity with the same name");
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
         }
     }
 
     public void testRemoveThenAddNullClassName() {
         DataMap map = new DataMap();
-        // It should be possible to cleanly remove and then add the same entity again.
+        // It should be possible to cleanly remove and then add the same entity
+        // again.
         // Uncovered the need for this while testing modeller manually.
 
         ObjEntity e = new ObjEntity("f");
@@ -327,27 +326,21 @@ public class DataMapTest extends TestCas
         DataMap map = new DataMap();
 
         // create a twisty maze of intermingled relationships.
-        DbEntity e1 = (DbEntity) NamedObjectFactory.createObject(DbEntity.class, map);
+        DbEntity e1 = NamedObjectFactory.createObject(DbEntity.class, map);
         e1.setName("e1");
 
-        DbEntity e2 = (DbEntity) NamedObjectFactory.createObject(DbEntity.class, map);
+        DbEntity e2 = NamedObjectFactory.createObject(DbEntity.class, map);
         e2.setName("e2");
 
-        DbRelationship r1 = (DbRelationship) NamedObjectFactory.createObject(
-                DbRelationship.class,
-                e1);
+        DbRelationship r1 = NamedObjectFactory.createObject(DbRelationship.class, e1);
         r1.setName("r1");
         r1.setTargetEntity(e2);
 
-        DbRelationship r2 = (DbRelationship) NamedObjectFactory.createObject(
-                DbRelationship.class,
-                e2);
+        DbRelationship r2 = NamedObjectFactory.createObject(DbRelationship.class, e2);
         r2.setName("r2");
         r2.setTargetEntity(e1);
 
-        DbRelationship r3 = (DbRelationship) NamedObjectFactory.createObject(
-                DbRelationship.class,
-                e1);
+        DbRelationship r3 = NamedObjectFactory.createObject(DbRelationship.class, e1);
         r3.setName("r3");
         r3.setTargetEntity(e2);
 
@@ -374,19 +367,13 @@ public class DataMapTest extends TestCas
         checkProcedures(map, new String[0]);
 
         map.addProcedure(new Procedure("proc1"));
-        checkProcedures(map, new String[] {
-            "proc1"
-        });
+        checkProcedures(map, new String[] { "proc1" });
 
         map.addProcedure(new Procedure("proc2"));
-        checkProcedures(map, new String[] {
-                "proc1", "proc2"
-        });
+        checkProcedures(map, new String[] { "proc1", "proc2" });
 
         map.removeProcedure("proc2");
-        checkProcedures(map, new String[] {
-            "proc1"
-        });
+        checkProcedures(map, new String[] { "proc1" });
     }
 
     protected void checkProcedures(DataMap map, String[] expectedNames) throws Exception {
@@ -417,13 +404,11 @@ public class DataMapTest extends TestCas
 
         MapLoader loader = new MapLoader();
         try {
-            InputStream is = new ByteArrayInputStream(w.getBuffer().toString().getBytes(
-                    "UTF-8"));
+            InputStream is = new ByteArrayInputStream(w.getBuffer().toString().getBytes("UTF-8"));
             DataMap newMap = loader.loadDataMap(new InputSource(is));
             assertTrue(newMap.quotingSQLIdentifiers);
 
-        }
-        catch (UnsupportedEncodingException e) {
+        } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
 
@@ -434,13 +419,11 @@ public class DataMapTest extends TestCas
 
         assertFalse(map.quotingSQLIdentifiers);
         try {
-            InputStream is = new ByteArrayInputStream(w2.getBuffer().toString().getBytes(
-                    "UTF-8"));
+            InputStream is = new ByteArrayInputStream(w2.getBuffer().toString().getBytes("UTF-8"));
             DataMap newMap = loader.loadDataMap(new InputSource(is));
             assertFalse(newMap.quotingSQLIdentifiers);
 
-        }
-        catch (UnsupportedEncodingException e) {
+        } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
 

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbEntityTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbEntityTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbEntityTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbEntityTest.java Sun Aug  4 18:27:08 2013
@@ -51,14 +51,14 @@ public class DbEntityTest extends Server
         assertNotNull(d2.getPrimaryKeys());
         assertEquals(entity.getPrimaryKeys().size(), d2.getPrimaryKeys().size());
 
-        DbAttribute pk2 = (DbAttribute) d2.getAttribute(pk.getName());
+        DbAttribute pk2 = d2.getAttribute(pk.getName());
         assertNotNull(pk2);
         assertTrue(d2.getPrimaryKeys().contains(pk2));
 
         assertNotNull(d2.getGeneratedAttributes());
         assertEquals(entity.getGeneratedAttributes().size(), d2.getGeneratedAttributes().size());
 
-        DbAttribute generated2 = (DbAttribute) d2.getAttribute(generated.getName());
+        DbAttribute generated2 = d2.getAttribute(generated.getName());
         assertNotNull(generated2);
         assertTrue(d2.getGeneratedAttributes().contains(generated2));
     }
@@ -79,14 +79,14 @@ public class DbEntityTest extends Server
         assertNotNull(d2.getPrimaryKeys());
         assertEquals(entity.getPrimaryKeys().size(), d2.getPrimaryKeys().size());
 
-        DbAttribute pk2 = (DbAttribute) d2.getAttribute(pk.getName());
+        DbAttribute pk2 = d2.getAttribute(pk.getName());
         assertNotNull(pk2);
         assertTrue(d2.getPrimaryKeys().contains(pk2));
 
         assertNotNull(d2.getGeneratedAttributes());
         assertEquals(entity.getGeneratedAttributes().size(), d2.getGeneratedAttributes().size());
 
-        DbAttribute generated2 = (DbAttribute) d2.getAttribute(generated.getName());
+        DbAttribute generated2 = d2.getAttribute(generated.getName());
         assertNotNull(generated2);
         assertTrue(d2.getGeneratedAttributes().contains(generated2));
     }

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java Sun Aug  4 18:27:08 2013
@@ -49,17 +49,14 @@ public class DbRelationshipTest extends 
         Integer id = new Integer(44);
         map.put("GALLERY_ID", id);
 
-        DbRelationship dbRel = (DbRelationship) galleryEnt
-                .getRelationship("paintingArray");
-        Map<String, Object> targetMap = dbRel
-                .getReverseRelationship()
-                .srcFkSnapshotWithTargetSnapshot(map);
+        DbRelationship dbRel = galleryEnt.getRelationship("paintingArray");
+        Map<String, Object> targetMap = dbRel.getReverseRelationship().srcFkSnapshotWithTargetSnapshot(map);
         assertEquals(id, targetMap.get("GALLERY_ID"));
     }
 
     public void testGetReverseRelationship1() throws Exception {
         // start with "to many"
-        DbRelationship r1 = (DbRelationship) artistEnt.getRelationship("paintingArray");
+        DbRelationship r1 = artistEnt.getRelationship("paintingArray");
         DbRelationship r2 = r1.getReverseRelationship();
 
         assertNotNull(r2);
@@ -68,7 +65,7 @@ public class DbRelationshipTest extends 
 
     public void testGetReverseRelationship2() throws Exception {
         // start with "to one"
-        DbRelationship r1 = (DbRelationship) paintingEnt.getRelationship("toArtist");
+        DbRelationship r1 = paintingEnt.getRelationship("toArtist");
         DbRelationship r2 = r1.getReverseRelationship();
 
         assertNotNull(r2);

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java Sun Aug  4 18:27:08 2013
@@ -350,8 +350,8 @@ public class ObjEntityTest extends Serve
         ObjEntity ae = runtime.getDataDomain().getEntityResolver().getObjEntity("Artist");
         DbEntity dae = ae.getDbEntity();
 
-        assertNull(ae.getAttributeForDbAttribute((DbAttribute) dae.getAttribute("ARTIST_ID")));
-        assertNotNull(ae.getAttributeForDbAttribute((DbAttribute) dae.getAttribute("ARTIST_NAME")));
+        assertNull(ae.getAttributeForDbAttribute(dae.getAttribute("ARTIST_ID")));
+        assertNotNull(ae.getAttributeForDbAttribute(dae.getAttribute("ARTIST_NAME")));
     }
 
     public void testRelationshipForDbRelationship() throws Exception {
@@ -359,7 +359,7 @@ public class ObjEntityTest extends Serve
         DbEntity dae = ae.getDbEntity();
 
         assertNull(ae.getRelationshipForDbRelationship(new DbRelationship()));
-        assertNotNull(ae.getRelationshipForDbRelationship((DbRelationship) dae.getRelationship("paintingArray")));
+        assertNotNull(ae.getRelationshipForDbRelationship(dae.getRelationship("paintingArray")));
     }
 
     public void testReadOnly() throws Exception {

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/OracleUnitDbAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/OracleUnitDbAdapter.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/OracleUnitDbAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/OracleUnitDbAdapter.java Sun Aug  4 18:27:08 2013
@@ -59,22 +59,20 @@ public class OracleUnitDbAdapter extends
     }
 
     @Override
-    public void willDropTables(Connection conn, DataMap map, Collection tablesToDrop)
-            throws Exception {
+    public void willDropTables(Connection conn, DataMap map, Collection tablesToDrop) throws Exception {
         // avoid dropping constraints...
     }
 
     /**
-     * Oracle 8i does not support more then 1 "LONG xx" column per table PAINTING_INFO
-     * need to be fixed.
+     * Oracle 8i does not support more then 1 "LONG xx" column per table
+     * PAINTING_INFO need to be fixed.
      */
     @Override
     public void willCreateTables(Connection con, DataMap map) {
         DbEntity paintingInfo = map.getDbEntity("PAINTING_INFO");
 
         if (paintingInfo != null) {
-            DbAttribute textReview = (DbAttribute) paintingInfo
-                    .getAttribute("TEXT_REVIEW");
+            DbAttribute textReview = paintingInfo.getAttribute("TEXT_REVIEW");
             textReview.setType(Types.VARCHAR);
             textReview.setMaxLength(255);
         }
@@ -98,7 +96,8 @@ public class OracleUnitDbAdapter extends
 
     @Override
     public boolean supportsLobComparisons() {
-        // we can actually allow LOB comparisons with some Oracle trickery. E.g.:
+        // we can actually allow LOB comparisons with some Oracle trickery.
+        // E.g.:
         // DBMS_LOB.SUBSTR(CLOB_COLUMN, LENGTH('string') + 1, 1) = 'string'
         return false;
     }
@@ -110,8 +109,8 @@ public class OracleUnitDbAdapter extends
             List params = new ArrayList(proc.getCallParameters());
 
             proc.clearCallParameters();
-            proc.addCallParameter(new ProcedureParameter("result", OracleAdapter
-                    .getOracleCursorType(), ProcedureParameter.OUT_PARAMETER));
+            proc.addCallParameter(new ProcedureParameter("result", OracleAdapter.getOracleCursorType(),
+                    ProcedureParameter.OUT_PARAMETER));
             Iterator it = params.iterator();
             while (it.hasNext()) {
                 ProcedureParameter param = (ProcedureParameter) it.next();

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/SybaseUnitDbAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/SybaseUnitDbAdapter.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/SybaseUnitDbAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/java/org/apache/cayenne/unit/SybaseUnitDbAdapter.java Sun Aug  4 18:27:08 2013
@@ -29,7 +29,6 @@ import java.util.List;
 
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Procedure;
 
@@ -40,11 +39,11 @@ public class SybaseUnitDbAdapter extends
     public SybaseUnitDbAdapter(DbAdapter adapter) {
         super(adapter);
     }
-    
+
     public String getIdentifiersStartQuote() {
         return "[";
     }
-    
+
     public String getIdentifiersEndQuote() {
         return "]";
     }
@@ -71,43 +70,42 @@ public class SybaseUnitDbAdapter extends
         // Sybase does not support NULLable BIT columns...
         DbEntity e = map.getDbEntity("PRIMITIVES_TEST");
         if (e != null) {
-            ((DbAttribute) e.getAttribute("BOOLEAN_COLUMN")).setMandatory(true);
+            e.getAttribute("BOOLEAN_COLUMN").setMandatory(true);
         }
         DbEntity e1 = map.getDbEntity("INHERITANCE_SUB_ENTITY3");
         if (e1 != null) {
-            ((DbAttribute) e1.getAttribute("SUBENTITY_BOOL_ATTR")).setMandatory(true);
+            e1.getAttribute("SUBENTITY_BOOL_ATTR").setMandatory(true);
         }
         DbEntity e2 = map.getDbEntity("MT_TABLE_BOOL");
         if (e2 != null) {
-            ((DbAttribute) e2.getAttribute("BOOLEAN_COLUMN")).setMandatory(true);
+            e2.getAttribute("BOOLEAN_COLUMN").setMandatory(true);
         }
         DbEntity e3 = map.getDbEntity("QUALIFIED1");
         if (e3 != null) {
-            ((DbAttribute) e3.getAttribute("DELETED")).setMandatory(true);
+            e3.getAttribute("DELETED").setMandatory(true);
         }
 
         DbEntity e4 = map.getDbEntity("QUALIFIED2");
         if (e4 != null) {
-            ((DbAttribute) e4.getAttribute("DELETED")).setMandatory(true);
+            e4.getAttribute("DELETED").setMandatory(true);
         }
 
         DbEntity e5 = map.getDbEntity("Painting");
         if (e5 != null) {
             if (e5.getAttribute("NEWCOL2") != null) {
-                ((DbAttribute) e5.getAttribute("DELETED")).setMandatory(true);
+                e5.getAttribute("DELETED").setMandatory(true);
             }
         }
 
         DbEntity e6 = map.getDbEntity("SOFT_TEST");
         if (e6 != null) {
-            ((DbAttribute) e6.getAttribute("DELETED")).setMandatory(true);
+            e6.getAttribute("DELETED").setMandatory(true);
         }
 
     }
 
     @Override
-    public void willDropTables(Connection con, DataMap map, Collection tablesToDrop)
-            throws Exception {
+    public void willDropTables(Connection con, DataMap map, Collection tablesToDrop) throws Exception {
 
         Iterator it = tablesToDrop.iterator();
         while (it.hasNext()) {
@@ -134,20 +132,16 @@ public class SybaseUnitDbAdapter extends
         try {
             ResultSet rs = select.executeQuery("SELECT t0.name "
                     + "FROM sysobjects t0, sysconstraints t1, sysobjects t2 "
-                    + "WHERE t0.id = t1.constrid and t1.tableid = t2.id and t2.name = '"
-                    + tableName
-                    + "'");
+                    + "WHERE t0.id = t1.constrid and t1.tableid = t2.id and t2.name = '" + tableName + "'");
             try {
 
                 while (rs.next()) {
                     names.add(rs.getString("name"));
                 }
-            }
-            finally {
+            } finally {
                 rs.close();
             }
-        }
-        finally {
+        } finally {
             select.close();
         }
 

Modified: cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/main/java/org/apache/cayenne/wocompat/EOModelProcessor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/main/java/org/apache/cayenne/wocompat/EOModelProcessor.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/main/java/org/apache/cayenne/wocompat/EOModelProcessor.java (original)
+++ cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/main/java/org/apache/cayenne/wocompat/EOModelProcessor.java Sun Aug  4 18:27:08 2013
@@ -53,7 +53,7 @@ import org.apache.commons.logging.LogFac
  * Class for converting stored Apple EOModel mapping files to Cayenne DataMaps.
  */
 public class EOModelProcessor {
-    
+
     private static final Log logger = LogFactory.getLog(EOModelProcessor.class);
 
     protected Predicate prototypeChecker;
@@ -86,7 +86,8 @@ public class EOModelProcessor {
      * @since 3.2
      */
     // TODO: refactor EOModelHelper to provide a similar method without loading
-    // all entity files in memory... here we simply copied stuff from EOModelHelper
+    // all entity files in memory... here we simply copied stuff from
+    // EOModelHelper
     public Map loadModeIndex(URL url) throws Exception {
 
         String urlString = url.toExternalForm();
@@ -101,8 +102,7 @@ public class EOModelProcessor {
         try {
             plistParser.ReInit(in);
             return (Map) plistParser.propertyList();
-        }
-        finally {
+        } finally {
             in.close();
         }
     }
@@ -126,7 +126,8 @@ public class EOModelProcessor {
     /**
      * Performs EOModel loading.
      * 
-     * @param url URL of ".eomodeld" directory.
+     * @param url
+     *            URL of ".eomodeld" directory.
      */
     public DataMap loadEOModel(URL url) throws Exception {
         return loadEOModel(url, false);
@@ -135,9 +136,11 @@ public class EOModelProcessor {
     /**
      * Performs EOModel loading.
      * 
-     * @param url URL of ".eomodeld" directory.
-     * @param generateClientClass if true then loading of EOModel is java client classes
-     *            aware and the following processing will work with Java client class
+     * @param url
+     *            URL of ".eomodeld" directory.
+     * @param generateClientClass
+     *            if true then loading of EOModel is java client classes aware
+     *            and the following processing will work with Java client class
      *            settings of the EOModel.
      */
     public DataMap loadEOModel(URL url, boolean generateClientClass) throws Exception {
@@ -178,7 +181,8 @@ public class EOModelProcessor {
             makeRelationships(helper, dataMap.getObjEntity(name));
         }
 
-        // after all normal relationships are loaded, process flattened relationships
+        // after all normal relationships are loaded, process flattened
+        // relationships
         it = modelNames.iterator();
         while (it.hasNext()) {
             String name = (String) it.next();
@@ -214,8 +218,8 @@ public class EOModelProcessor {
 
     /**
      * Returns whether an Entity is an EOF EOPrototypes entity. According to EOF
-     * conventions EOPrototypes and EO[Adapter]Prototypes entities are considered to be
-     * prototypes.
+     * conventions EOPrototypes and EO[Adapter]Prototypes entities are
+     * considered to be prototypes.
      * 
      * @since 1.1
      */
@@ -224,8 +228,8 @@ public class EOModelProcessor {
     }
 
     /**
-     * Creates an returns new EOModelHelper to process EOModel. Exists mostly for the
-     * benefit of subclasses.
+     * Creates an returns new EOModelHelper to process EOModel. Exists mostly
+     * for the benefit of subclasses.
      */
     protected EOModelHelper makeHelper(URL url) throws Exception {
         return new EOModelHelper(url);
@@ -247,8 +251,7 @@ public class EOModelProcessor {
         AbstractQuery query;
         if (queryPlist.containsKey("hints")) { // just a predefined SQL query
             query = new EOSQLQuery(entity, queryPlist);
-        }
-        else {
+        } else {
             query = new EOQuery(entity, queryPlist);
         }
         query.setName(entity.qualifiedQueryName(queryName));
@@ -260,10 +263,7 @@ public class EOModelProcessor {
     /**
      * Creates and returns a new ObjEntity linked to a corresponding DbEntity.
      */
-    protected EOObjEntity makeEntity(
-            EOModelHelper helper,
-            String name,
-            boolean generateClientClass) {
+    protected EOObjEntity makeEntity(EOModelHelper helper, String name, boolean generateClientClass) {
 
         DataMap dataMap = helper.getDataMap();
         Map entityPlist = helper.entityPListMap(name);
@@ -288,7 +288,8 @@ public class EOModelProcessor {
         String dbEntityName = (String) entityPlist.get("externalName");
         if (dbEntityName != null) {
 
-            // ... if inheritance is involved and parent hierarchy uses the same DBEntity,
+            // ... if inheritance is involved and parent hierarchy uses the same
+            // DBEntity,
             // do not create a DbEntity...
             boolean createDbEntity = true;
             if (parent != null) {
@@ -336,8 +337,8 @@ public class EOModelProcessor {
     }
 
     /**
-     * Create ObjAttributes of the specified entity, as well as DbAttributes of the
-     * corresponding DbEntity.
+     * Create ObjAttributes of the specified entity, as well as DbAttributes of
+     * the corresponding DbEntity.
      */
     protected void makeAttributes(EOModelHelper helper, EOObjEntity objEntity) {
         Map entityPlistMap = helper.entityPListMap(objEntity.getName());
@@ -346,8 +347,7 @@ public class EOModelProcessor {
         List classProperties;
         if (objEntity.isServerOnly()) {
             classProperties = (List) entityPlistMap.get("classProperties");
-        }
-        else {
+        } else {
             classProperties = (List) entityPlistMap.get("clientClassProperties");
         }
 
@@ -381,8 +381,7 @@ public class EOModelProcessor {
                 continue;
             }
 
-            if (dbEntity.getName() != null
-                    && dbEntity.getName().equals(parentExternalName)) {
+            if (dbEntity.getName() != null && dbEntity.getName().equals(parentExternalName)) {
                 singleTableInheritance = true;
             }
 
@@ -424,18 +423,17 @@ public class EOModelProcessor {
                 // if inherited attribute, skip it for DbEntity...
                 if (!singleTableInheritance || dbEntity.getAttribute(dbAttrName) == null) {
 
-                    // create DbAttribute...since EOF allows the same column name for
-                    // more than one Java attribute, we need to check for name duplicates
+                    // create DbAttribute...since EOF allows the same column
+                    // name for
+                    // more than one Java attribute, we need to check for name
+                    // duplicates
                     int i = 0;
                     String dbAttributeBaseName = dbAttrName;
                     while (dbEntity.getAttribute(dbAttrName) != null) {
                         dbAttrName = dbAttributeBaseName + i++;
                     }
 
-                    dbAttr = new EODbAttribute(
-                            dbAttrName,
-                            TypesMapping.getSqlTypeByJava(javaType),
-                            dbEntity);
+                    dbAttr = new EODbAttribute(dbAttrName, TypesMapping.getSqlTypeByJava(javaType), dbEntity);
                     dbAttr.setEoAttributeName(attrName);
                     dbEntity.addAttribute(dbAttr);
 
@@ -453,7 +451,8 @@ public class EOModelProcessor {
                         dbAttr.setPrimaryKey(true);
 
                     Object allowsNull = attrMap.get("allowsNull");
-                    // TODO: Unclear that allowsNull should be inherited from EOPrototypes
+                    // TODO: Unclear that allowsNull should be inherited from
+                    // EOPrototypes
                     // if (null == allowsNull) allowsNull =
                     // prototypeAttrMap.get("allowsNull");;
 
@@ -468,12 +467,12 @@ public class EOModelProcessor {
                 // if entity is readOnly
                 String entityReadOnlyString = (String) entityPlistMap.get("isReadOnly");
                 String attributeReadOnlyString = (String) attrMap.get("isReadOnly");
-                if ("Y".equals(entityReadOnlyString)
-                        || "Y".equals(attributeReadOnlyString)) {
+                if ("Y".equals(entityReadOnlyString) || "Y".equals(attributeReadOnlyString)) {
                     attr.setReadOnly(true);
                 }
 
-                // set name instead of the actual attribute, as it may be inherited....
+                // set name instead of the actual attribute, as it may be
+                // inherited....
                 attr.setDbAttributePath(dbAttrName);
                 objEntity.addAttribute(attr);
             }
@@ -494,20 +493,18 @@ public class EOModelProcessor {
         // per CAY-752, value can be a String or a Number, so handle both
         if (value instanceof Number) {
             return ((Number) value).intValue();
-        }
-        else {
+        } else {
             try {
                 return Integer.parseInt(value.toString());
-            }
-            catch (NumberFormatException nfex) {
+            } catch (NumberFormatException nfex) {
                 return defaultValue;
             }
         }
     }
 
     /**
-     * Create ObjRelationships of the specified entity, as well as DbRelationships of the
-     * corresponding DbEntity.
+     * Create ObjRelationships of the specified entity, as well as
+     * DbRelationships of the corresponding DbEntity.
      */
     protected void makeRelationships(EOModelHelper helper, ObjEntity objEntity) {
         Map entityPlistMap = helper.entityPListMap(objEntity.getName());
@@ -561,10 +558,11 @@ public class EOModelProcessor {
             if (dbSrc != null && dbTarget != null) {
 
                 // in case of inheritance EOF stores duplicates of all inherited
-                // relationships, so we must skip this relationship in DB entity if it is
+                // relationships, so we must skip this relationship in DB entity
+                // if it is
                 // already there...
 
-                dbRel = (DbRelationship) dbSrc.getRelationship(relName);
+                dbRel = dbSrc.getRelationship(relName);
                 if (dbRel == null) {
 
                     dbRel = new DbRelationship();
@@ -582,17 +580,14 @@ public class EOModelProcessor {
 
                         DbJoin join = new DbJoin(dbRel);
 
-                        // find source attribute dictionary and extract the column name
-                        String sourceAttributeName = (String) joinMap
-                                .get("sourceAttribute");
+                        // find source attribute dictionary and extract the
+                        // column name
+                        String sourceAttributeName = (String) joinMap.get("sourceAttribute");
                         join.setSourceName(columnName(attributes, sourceAttributeName));
 
-                        String targetAttributeName = (String) joinMap
-                                .get("destinationAttribute");
+                        String targetAttributeName = (String) joinMap.get("destinationAttribute");
 
-                        join.setTargetName(columnName(
-                                targetAttributes,
-                                targetAttributeName));
+                        join.setTargetName(columnName(targetAttributes, targetAttributeName));
                         dbRel.addJoin(join);
                     }
                 }
@@ -614,30 +609,25 @@ public class EOModelProcessor {
     }
 
     /**
-     * Create reverse DbRelationships that were not created so far, since Cayenne requires
-     * them.
+     * Create reverse DbRelationships that were not created so far, since
+     * Cayenne requires them.
      * 
      * @since 1.0.5
      */
     protected void makeReverseDbRelationships(DbEntity dbEntity) {
         if (dbEntity == null) {
-            throw new NullPointerException(
-                    "Attempt to create reverse relationships for the null DbEntity.");
+            throw new NullPointerException("Attempt to create reverse relationships for the null DbEntity.");
         }
 
         // iterate over a copy of the collection, since in case of
         // reflexive relationships, we may modify source entity relationship map
-        Collection clone = new ArrayList(dbEntity.getRelationships());
-        Iterator it = clone.iterator();
-        while (it.hasNext()) {
-            DbRelationship relationship = (DbRelationship) it.next();
+
+        for (DbRelationship relationship : new ArrayList<DbRelationship>(dbEntity.getRelationships())) {
 
             if (relationship.getReverseRelationship() == null) {
                 DbRelationship reverse = relationship.createReverseRelationship();
 
-                String name = NamedObjectFactory.createName(
-                        DbRelationship.class,
-                        reverse.getSourceEntity(),
+                String name = NamedObjectFactory.createName(DbRelationship.class, reverse.getSourceEntity(),
                         relationship.getName() + "Reverse");
                 reverse.setName(name);
                 relationship.getTargetEntity().addRelationship(reverse);
@@ -668,7 +658,7 @@ public class EOModelProcessor {
             ObjRelationship flatRel = new ObjRelationship();
             flatRel.setName((String) relMap.get("name"));
             flatRel.setSourceEntity(e);
-            
+
             try {
                 flatRel.setDbRelationshipPath(targetPath);
             } catch (ExpressionException ex) {
@@ -682,11 +672,12 @@ public class EOModelProcessor {
             while (toks.hasMoreTokens() && entityInfo != null) {
                 String pathComponent = toks.nextToken();
 
-                // get relationship info and reset entityInfo, so that we could use
-                // entityInfo state as an indicator of valid flat relationship enpoint
+                // get relationship info and reset entityInfo, so that we could
+                // use
+                // entityInfo state as an indicator of valid flat relationship
+                // enpoint
                 // outside the loop
-                Collection relationshipInfo = (Collection) entityInfo
-                        .get("relationships");
+                Collection relationshipInfo = (Collection) entityInfo.get("relationships");
                 entityInfo = null;
 
                 if (relationshipInfo == null) {
@@ -713,8 +704,8 @@ public class EOModelProcessor {
     }
 
     /**
-     * Locates an attribute map matching the name and returns column name for this
-     * attribute.
+     * Locates an attribute map matching the name and returns column name for
+     * this attribute.
      * 
      * @since 1.1
      */
@@ -734,7 +725,8 @@ public class EOModelProcessor {
         return null;
     }
 
-    // sorts ObjEntities so that subentities in inheritance hierarchy are shown last
+    // sorts ObjEntities so that subentities in inheritance hierarchy are shown
+    // last
     final class InheritanceComparator implements Comparator {
 
         DataMap dataMap;
@@ -746,8 +738,7 @@ public class EOModelProcessor {
         public int compare(Object o1, Object o2) {
             if (o1 == null) {
                 return o2 != null ? -1 : 0;
-            }
-            else if (o2 == null) {
+            } else if (o2 == null) {
                 return 1;
             }
 
@@ -763,12 +754,12 @@ public class EOModelProcessor {
         int compareEntities(ObjEntity e1, ObjEntity e2) {
             if (e1 == null) {
                 return e2 != null ? -1 : 0;
-            }
-            else if (e2 == null) {
+            } else if (e2 == null) {
                 return 1;
             }
 
-            // entity goes first if it is a direct or indirect superentity of another
+            // entity goes first if it is a direct or indirect superentity of
+            // another
             // one
             if (e1.isSubentityOf(e2)) {
                 return 1;

Modified: cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/EOModelPrototypesTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/EOModelPrototypesTest.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/EOModelPrototypesTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/EOModelPrototypesTest.java Sun Aug  4 18:27:08 2013
@@ -55,15 +55,15 @@ public class EOModelPrototypesTest exten
         assertNotNull(dbe);
 
         // test that an attribute that has ObjAttribute has its type configured
-        DbAttribute dba1 = (DbAttribute) dbe.getAttribute("DOCUMENT_TYPE");
+        DbAttribute dba1 = dbe.getAttribute("DOCUMENT_TYPE");
         assertEquals(Types.VARCHAR, dba1.getType());
 
         // test that a numeric attribute has its type configured
-        DbAttribute dba2 = (DbAttribute) dbe.getAttribute("TEST_NUMERIC");
+        DbAttribute dba2 = dbe.getAttribute("TEST_NUMERIC");
         assertEquals(Types.INTEGER, dba2.getType());
 
         // test that an attribute that has no ObjAttribute has its type configured
-        DbAttribute dba3 = (DbAttribute) dbe.getAttribute("DOCUMENT_ID");
+        DbAttribute dba3 = dbe.getAttribute("DOCUMENT_ID");
         assertEquals(Types.INTEGER, dba3.getType());
     }
 

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java?rev=1510297&r1=1510296&r2=1510297&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java (original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java Sun Aug  4 18:27:08 2013
@@ -67,31 +67,22 @@ public class CreateRelationshipAction ex
         ObjEntity objEnt = getProjectController().getCurrentObjEntity();
         if (objEnt != null) {
 
-            ObjRelationship rel = (ObjRelationship) NamedObjectFactory.createObject(
-                    ObjRelationship.class,
-                    objEnt);
+            ObjRelationship rel = (ObjRelationship) NamedObjectFactory.createObject(ObjRelationship.class, objEnt);
 
             createObjRelationship(objEnt, rel);
 
             application.getUndoManager().addEdit(
-                    new CreateRelationshipUndoableEdit(objEnt, new ObjRelationship[] {
-                        rel
-                    }));
-        }
-        else {
+                    new CreateRelationshipUndoableEdit(objEnt, new ObjRelationship[] { rel }));
+        } else {
             DbEntity dbEnt = getProjectController().getCurrentDbEntity();
             if (dbEnt != null) {
 
-                DbRelationship rel = (DbRelationship) NamedObjectFactory.createObject(
-                        DbRelationship.class,
-                        dbEnt);
+                DbRelationship rel = NamedObjectFactory.createObject(DbRelationship.class, dbEnt);
 
                 createDbRelationship(dbEnt, rel);
 
                 application.getUndoManager().addEdit(
-                        new CreateRelationshipUndoableEdit(dbEnt, new DbRelationship[] {
-                            rel
-                        }));
+                        new CreateRelationshipUndoableEdit(dbEnt, new DbRelationship[] { rel }));
             }
         }
     }
@@ -109,23 +100,12 @@ public class CreateRelationshipAction ex
     /**
      * Fires events when a obj rel was added
      */
-    static void fireObjRelationshipEvent(
-            Object src,
-            ProjectController mediator,
-            ObjEntity objEntity,
+    static void fireObjRelationshipEvent(Object src, ProjectController mediator, ObjEntity objEntity,
             ObjRelationship rel) {
 
-        mediator.fireObjRelationshipEvent(new RelationshipEvent(
-                src,
-                rel,
-                objEntity,
-                MapEvent.ADD));
-
-        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
-                src,
-                rel,
-                objEntity,
-                mediator.getCurrentDataMap(),
+        mediator.fireObjRelationshipEvent(new RelationshipEvent(src, rel, objEntity, MapEvent.ADD));
+
+        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(src, rel, objEntity, mediator.getCurrentDataMap(),
                 (DataChannelDescriptor) mediator.getProject().getRootNode());
 
         mediator.fireObjRelationshipDisplayEvent(rde);
@@ -143,23 +123,11 @@ public class CreateRelationshipAction ex
     /**
      * Fires events when a db rel was added
      */
-    static void fireDbRelationshipEvent(
-            Object src,
-            ProjectController mediator,
-            DbEntity dbEntity,
-            DbRelationship rel) {
-
-        mediator.fireDbRelationshipEvent(new RelationshipEvent(
-                src,
-                rel,
-                dbEntity,
-                MapEvent.ADD));
-
-        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
-                src,
-                rel,
-                dbEntity,
-                mediator.getCurrentDataMap(),
+    static void fireDbRelationshipEvent(Object src, ProjectController mediator, DbEntity dbEntity, DbRelationship rel) {
+
+        mediator.fireDbRelationshipEvent(new RelationshipEvent(src, rel, dbEntity, MapEvent.ADD));
+
+        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(src, rel, dbEntity, mediator.getCurrentDataMap(),
                 (DataChannelDescriptor) mediator.getProject().getRootNode());
 
         mediator.fireDbRelationshipDisplayEvent(rde);
@@ -175,8 +143,7 @@ public class CreateRelationshipAction ex
         }
 
         if (object instanceof Relationship) {
-            return ((Relationship) object).getParent() != null
-                    && ((Relationship) object).getParent() instanceof Entity;
+            return ((Relationship) object).getParent() != null && ((Relationship) object).getParent() instanceof Entity;
         }
 
         return false;