cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [03/12] cayenne git commit: CAY-2026 Java 7
Date Sat, 12 Sep 2015 10:41:06 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java b/cayenne-server/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
index bed52b5..361ad8d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
@@ -24,103 +24,97 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.cayenne.Persistent;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.MappingNamespace;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.query.Query;
 
-/**
- */
 public class MockMappingNamespace implements MappingNamespace {
 
-    private Map<String, DbEntity> dbEntities = new HashMap<String, DbEntity>();
-    private Map<String, ObjEntity> objEntities = new HashMap<String, ObjEntity>();
-    private Map<String, Query> queries = new HashMap<String, Query>();
-    private Map<String, Procedure> procedures = new HashMap<String, Procedure>();
-
-    public Embeddable getEmbeddable(String className) {
-        return null;
-    }
-
-    public SQLResult getResult(String name) {
-        return null;
-    }
-
-    public EntityListener getEntityListener(String className) {
-        return null;
-    }
-
-    public void addDbEntity(DbEntity entity) {
-        dbEntities.put(entity.getName(), entity);
-    }
-
-    public void addObjEntity(ObjEntity entity) {
-        objEntities.put(entity.getName(), entity);
-    }
-
-    public void addQuery(Query query) {
-        queries.put(query.getName(), query);
-    }
-
-    public void addProcedure(Procedure procedure) {
-        procedures.put(procedure.getName(), procedure);
-    }
-
-    public DbEntity getDbEntity(String name) {
-        return dbEntities.get(name);
-    }
-
-    public ObjEntity getObjEntity(String name) {
-        return objEntities.get(name);
-    }
-
-    public Procedure getProcedure(String name) {
-        return procedures.get(name);
-    }
-
-    public Query getQuery(String name) {
-        return queries.get(name);
-    }
-
-    public Collection<DbEntity> getDbEntities() {
-        return dbEntities.values();
-    }
-
-    public Collection<ObjEntity> getObjEntities() {
-        return objEntities.values();
-    }
-
-    public Collection<Procedure> getProcedures() {
-        return procedures.values();
-    }
-
-    public Collection<Query> getQueries() {
-        return queries.values();
-    }
-    
-    public Collection<Embeddable> getEmbeddables() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    
-    public EntityInheritanceTree getInheritanceTree(String entityName) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    
-    public ObjEntity getObjEntity(Class<?> entityClass) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    
-    public Collection<SQLResult> getResults() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    
-    public ObjEntity getObjEntity(Persistent object) {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	private Map<String, DbEntity> dbEntities = new HashMap<>();
+	private Map<String, ObjEntity> objEntities = new HashMap<>();
+	private Map<String, Query> queries = new HashMap<>();
+	private Map<String, Procedure> procedures = new HashMap<>();
+
+	public Embeddable getEmbeddable(String className) {
+		return null;
+	}
+
+	public SQLResult getResult(String name) {
+		return null;
+	}
+
+	public EntityListener getEntityListener(String className) {
+		return null;
+	}
+
+	public void addDbEntity(DbEntity entity) {
+		dbEntities.put(entity.getName(), entity);
+	}
+
+	public void addObjEntity(ObjEntity entity) {
+		objEntities.put(entity.getName(), entity);
+	}
+
+	public void addQuery(Query query) {
+		queries.put(query.getName(), query);
+	}
+
+	public void addProcedure(Procedure procedure) {
+		procedures.put(procedure.getName(), procedure);
+	}
+
+	public DbEntity getDbEntity(String name) {
+		return dbEntities.get(name);
+	}
+
+	public ObjEntity getObjEntity(String name) {
+		return objEntities.get(name);
+	}
+
+	public Procedure getProcedure(String name) {
+		return procedures.get(name);
+	}
+
+	public Query getQuery(String name) {
+		return queries.get(name);
+	}
+
+	public Collection<DbEntity> getDbEntities() {
+		return dbEntities.values();
+	}
+
+	public Collection<ObjEntity> getObjEntities() {
+		return objEntities.values();
+	}
+
+	public Collection<Procedure> getProcedures() {
+		return procedures.values();
+	}
+
+	public Collection<Query> getQueries() {
+		return queries.values();
+	}
+
+	public Collection<Embeddable> getEmbeddables() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EntityInheritanceTree getInheritanceTree(String entityName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public ObjEntity getObjEntity(Class<?> entityClass) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Collection<SQLResult> getResults() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public ObjEntity getObjEntity(Persistent object) {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/map/ObjEntityIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/map/ObjEntityIT.java b/cayenne-server/src/test/java/org/apache/cayenne/map/ObjEntityIT.java
index d6ac1a1..793874c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/map/ObjEntityIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/map/ObjEntityIT.java
@@ -141,7 +141,7 @@ public class ObjEntityIT extends ServerCase {
     public void testLastPathComponent() {
         ObjEntity artistE = runtime.getDataDomain().getEntityResolver().getObjEntity("Artist");
 
-        Map<String, String> aliases = new HashMap<String, String>();
+        Map<String, String> aliases = new HashMap<>();
         aliases.put("a", "paintingArray.toGallery");
 
         PathComponent<ObjAttribute, ObjRelationship> lastAttribute = artistE.lastPathComponent(

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/query/SQLSelectIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLSelectIT.java b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLSelectIT.java
index 6c4de62..1ff4e4b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLSelectIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLSelectIT.java
@@ -364,7 +364,7 @@ public class SQLSelectIT extends ServerCase {
 		tPainting.insert(1, "painting1", 1.0);
 		tPainting.insert(2, "painting2", null);
 
-		Map<String, Object> params = new HashMap<String, Object>();
+		Map<String, Object> params = new HashMap<>();
 		params.put("a", null);
 		params.put("b", "painting1");
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
index a88a6c8..bf37bca 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
@@ -40,7 +40,7 @@ public class SQLTemplateTest {
 
 		assertTrue(query.getParams().isEmpty());
 
-		Map<String, Object> params = new HashMap<String, Object>();
+		Map<String, Object> params = new HashMap<>();
 		params.put("a", "b");
 
 		query.setParams(params);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplate_LegacyTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplate_LegacyTest.java b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplate_LegacyTest.java
index 9cc5106..527a21b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplate_LegacyTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLTemplate_LegacyTest.java
@@ -69,7 +69,7 @@ public class SQLTemplate_LegacyTest {
 		assertNotNull(query.getParameters());
 		assertTrue(query.getParameters().isEmpty());
 
-		Map<String, Object> params = new HashMap<String, Object>();
+		Map<String, Object> params = new HashMap<>();
 		params.put("a", "b");
 
 		query.setParameters(params);
@@ -95,10 +95,10 @@ public class SQLTemplate_LegacyTest {
 		assertNotNull(query.getParameters());
 		assertTrue(query.getParameters().isEmpty());
 
-		Map<String, Object> params1 = new HashMap<String, Object>();
+		Map<String, Object> params1 = new HashMap<>();
 		params1.put("a", "b");
 
-		Map<String, Object> params2 = new HashMap<String, Object>();
+		Map<String, Object> params2 = new HashMap<>();
 		params2.put("1", "2");
 
 		query.setParameters(new Map[] { params1, params2, null });

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java b/cayenne-server/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
index 9bce4db..0769f25 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
@@ -182,7 +182,7 @@ public class PropertyUtilsTest {
 	@Test
 	public void testSetPropertyMap() {
 		Map<String, Object> o1 = createMap();
-		Map<String, Object> o2 = new HashMap<String, Object>();
+		Map<String, Object> o2 = new HashMap<>();
 
 		PropertyUtils.setProperty(o2, "byteArrayField", o1.get("byteArrayField"));
 		PropertyUtils.setProperty(o2, "integerField", o1.get("integerField"));
@@ -367,7 +367,7 @@ public class PropertyUtilsTest {
 	}
 
 	protected Map<String, Object> createMap() {
-		Map<String, Object> o1 = new HashMap<String, Object>();
+		Map<String, Object> o1 = new HashMap<>();
 		o1.put("byteArrayField", new byte[] { 1, 2, 3 });
 		o1.put("integerField", new Integer(33));
 		o1.put("intField", new Integer(-44));

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/remote/hessian/service/HessianServiceTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/remote/hessian/service/HessianServiceTest.java b/cayenne-server/src/test/java/org/apache/cayenne/remote/hessian/service/HessianServiceTest.java
index f5d5b32..7e18c2d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/remote/hessian/service/HessianServiceTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/remote/hessian/service/HessianServiceTest.java
@@ -19,9 +19,13 @@
 
 package org.apache.cayenne.remote.hessian.service;
 
-import com.caucho.services.server.ServiceContext;
-import com.mockrunner.mock.web.MockHttpServletRequest;
-import com.mockrunner.mock.web.MockHttpSession;
+import static org.junit.Assert.assertSame;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.configuration.Constants;
@@ -29,47 +33,43 @@ import org.apache.cayenne.configuration.ObjectContextFactory;
 import org.apache.cayenne.event.MockEventBridgeFactory;
 import org.junit.Test;
 
-import javax.servlet.http.HttpSession;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertSame;
+import com.caucho.services.server.ServiceContext;
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockHttpSession;
 
 public class HessianServiceTest {
 
-    @Test
-    public void testGetSession() throws Exception {
+	@Test
+	public void testGetSession() throws Exception {
 
-        Map<String, String> map = new HashMap<String, String>();
-        map.put(
-                Constants.SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY,
-                MockEventBridgeFactory.class.getName());
+		Map<String, String> map = new HashMap<>();
+		map.put(Constants.SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY, MockEventBridgeFactory.class.getName());
 
-        ObjectContextFactory factory = new ObjectContextFactory() {
+		ObjectContextFactory factory = new ObjectContextFactory() {
 
-            public ObjectContext createContext(DataChannel parent) {
-                return null;
-            }
+			public ObjectContext createContext(DataChannel parent) {
+				return null;
+			}
 
-            public ObjectContext createContext() {
-                return null;
-            }
-        };
-        HessianService service = new HessianService(factory, map);
+			public ObjectContext createContext() {
+				return null;
+			}
+		};
+		HessianService service = new HessianService(factory, map);
 
-        MockHttpServletRequest request = new MockHttpServletRequest();
-        HttpSession session = new MockHttpSession();
-        request.setSession(session);
+		MockHttpServletRequest request = new MockHttpServletRequest();
+		HttpSession session = new MockHttpSession();
+		request.setSession(session);
 
-        // for some eason need to call this to get session activated in the mock request
-        request.getSession();
+		// for some reason need to call this to get session activated in the
+		// mock request
+		request.getSession();
 
-        try {
-            ServiceContext.begin(request, null, null);
-            assertSame(session, service.getSession(false));
-        }
-        finally {
-            ServiceContext.end();
-        }
-    }
+		try {
+			ServiceContext.begin(request, null, null);
+			assertSame(session, service.getSession(false));
+		} finally {
+			ServiceContext.end();
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java b/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
index c1703be..00feca6 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
@@ -18,6 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.remote.service;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.ObjectContext;
@@ -30,118 +37,106 @@ import org.apache.cayenne.remote.RemoteSession;
 import org.apache.cayenne.util.Util;
 import org.junit.Test;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
 public class BaseRemoteServiceTest {
 
-    @Test
-    public void testConstructor() throws Exception {
-
-        Map<String, String> map = new HashMap<String, String>();
-        map.put(
-                Constants.SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY,
-                MockEventBridgeFactory.class.getName());
-
-        ObjectContextFactory factory = new ObjectContextFactory() {
-
-            public ObjectContext createContext(DataChannel parent) {
-                return null;
-            }
-
-            public ObjectContext createContext() {
-                return null;
-            }
-        };
-        BaseRemoteService service = new BaseRemoteService(factory, map) {
-
-            @Override
-            protected ServerSession createServerSession() {
-                return null;
-            }
-
-            @Override
-            protected ServerSession createServerSession(String name) {
-                return null;
-            }
-
-            @Override
-            protected ServerSession getServerSession() {
-                return null;
-            }
-        };
-        assertEquals(MockEventBridgeFactory.class.getName(), service
-                .getEventBridgeFactoryName());
-        assertSame(factory, service.contextFactory);
-
-    }
-
-    @Test
-    public void testProcessMessageExceptionSerializability() throws Throwable {
-
-        Map<String, String> map = new HashMap<String, String>();
-        ObjectContextFactory factory = new ObjectContextFactory() {
-
-            public ObjectContext createContext(DataChannel parent) {
-                return null;
-            }
-
-            public ObjectContext createContext() {
-                return null;
-            }
-        };
-        BaseRemoteService service = new BaseRemoteService(factory, map) {
-
-            @Override
-            protected ServerSession createServerSession() {
-                return new ServerSession(new RemoteSession("a"), null);
-            }
-
-            @Override
-            protected ServerSession createServerSession(String name) {
-                return createServerSession();
-            }
-
-            @Override
-            protected ServerSession getServerSession() {
-                return createServerSession();
-            }
-        };
-
-        try {
-            service.processMessage(new QueryMessage(null) {
-
-                @Override
-                public Query getQuery() {
-                    // serializable exception thrown
-                    throw new CayenneRuntimeException();
-                }
-            });
-
-            fail("Expected to throw");
-        }
-        catch (Exception ex) {
-            Util.cloneViaSerialization(ex);
-        }
-
-        try {
-            service.processMessage(new QueryMessage(null) {
-
-                @Override
-                public Query getQuery() {
-                    // non-serializable exception thrown
-                    throw new MockUnserializableException();
-                }
-            });
-
-            fail("Expected to throw");
-        }
-        catch (Exception ex) {
-            Util.cloneViaSerialization(ex);
-        }
-    }
+	@Test
+	public void testConstructor() throws Exception {
+
+		Map<String, String> map = new HashMap<>();
+		map.put(Constants.SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY, MockEventBridgeFactory.class.getName());
+
+		ObjectContextFactory factory = new ObjectContextFactory() {
+
+			public ObjectContext createContext(DataChannel parent) {
+				return null;
+			}
+
+			public ObjectContext createContext() {
+				return null;
+			}
+		};
+		BaseRemoteService service = new BaseRemoteService(factory, map) {
+
+			@Override
+			protected ServerSession createServerSession() {
+				return null;
+			}
+
+			@Override
+			protected ServerSession createServerSession(String name) {
+				return null;
+			}
+
+			@Override
+			protected ServerSession getServerSession() {
+				return null;
+			}
+		};
+		assertEquals(MockEventBridgeFactory.class.getName(), service.getEventBridgeFactoryName());
+		assertSame(factory, service.contextFactory);
+
+	}
+
+	@Test
+	public void testProcessMessageExceptionSerializability() throws Throwable {
+
+		Map<String, String> map = new HashMap<>();
+		ObjectContextFactory factory = new ObjectContextFactory() {
+
+			public ObjectContext createContext(DataChannel parent) {
+				return null;
+			}
+
+			public ObjectContext createContext() {
+				return null;
+			}
+		};
+		BaseRemoteService service = new BaseRemoteService(factory, map) {
+
+			@Override
+			protected ServerSession createServerSession() {
+				return new ServerSession(new RemoteSession("a"), null);
+			}
+
+			@Override
+			protected ServerSession createServerSession(String name) {
+				return createServerSession();
+			}
+
+			@Override
+			protected ServerSession getServerSession() {
+				return createServerSession();
+			}
+		};
+
+		try {
+			service.processMessage(new QueryMessage(null) {
+
+				@Override
+				public Query getQuery() {
+					// serializable exception thrown
+					throw new CayenneRuntimeException();
+				}
+			});
+
+			fail("Expected to throw");
+		} catch (Exception ex) {
+			Util.cloneViaSerialization(ex);
+		}
+
+		try {
+			service.processMessage(new QueryMessage(null) {
+
+				@Override
+				public Query getQuery() {
+					// non-serializable exception thrown
+					throw new MockUnserializableException();
+				}
+			});
+
+			fail("Expected to throw");
+		} catch (Exception ex) {
+			Util.cloneViaSerialization(ex);
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/unit/UnitDbAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/UnitDbAdapter.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/UnitDbAdapter.java
index df1d1dd..b6ff454 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/UnitDbAdapter.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/UnitDbAdapter.java
@@ -307,7 +307,7 @@ public class UnitDbAdapter {
     protected Map<String, Collection<String>> getConstraints(Connection conn, DataMap map,
             Collection<String> includeTables) throws SQLException {
 
-        Map<String, Collection<String>> constraintMap = new HashMap<String, Collection<String>>();
+        Map<String, Collection<String>> constraintMap = new HashMap<>();
 
         DatabaseMetaData metadata = conn.getMetaData();
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ConnectionProperties.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ConnectionProperties.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ConnectionProperties.java
index 2fb2606..3a66b5b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ConnectionProperties.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ConnectionProperties.java
@@ -35,81 +35,81 @@ import org.apache.commons.collections.ExtendedProperties;
  */
 class ConnectionProperties {
 
-    private static final String ADAPTER_KEY = "adapter";
-    private static final String ADAPTER20_KEY = "cayenne.adapter";
-    private static final String USER_NAME_KEY = "jdbc.username";
-    private static final String PASSWORD_KEY = "jdbc.password";
-    private static final String URL_KEY = "jdbc.url";
-    private static final String DRIVER_KEY = "jdbc.driver";
-
-    private Map<String, DataSourceInfo> connectionInfos;
-
-    /**
-     * Constructor for ConnectionProperties.
-     */
-    ConnectionProperties(ExtendedProperties props) {
-        connectionInfos = new HashMap<String, DataSourceInfo>();
-        for (String name : extractNames(props)) {
-            DataSourceInfo dsi = buildDataSourceInfo(props.subset(name));
-            connectionInfos.put(name, dsi);
-        }
-    }
-
-    int size() {
-        return connectionInfos.size();
-    }
-
-    /**
-     * Returns DataSourceInfo object for a symbolic name. If name does not match
-     * an existing object, returns null.
-     */
-    DataSourceInfo getConnection(String name) {
-        return connectionInfos.get(name);
-    }
-
-    /**
-     * Creates a DataSourceInfo object from a set of properties.
-     */
-    private DataSourceInfo buildDataSourceInfo(ExtendedProperties props) {
-        DataSourceInfo dsi = new DataSourceInfo();
-
-        String adapter = props.getString(ADAPTER_KEY);
-
-        // try legacy adapter key
-        if (adapter == null) {
-            adapter = props.getString(ADAPTER20_KEY);
-        }
-
-        dsi.setAdapterClassName(adapter);
-        dsi.setUserName(props.getString(USER_NAME_KEY));
-        dsi.setPassword(props.getString(PASSWORD_KEY));
-        dsi.setDataSourceUrl(props.getString(URL_KEY));
-        dsi.setJdbcDriver(props.getString(DRIVER_KEY));
-
-        return dsi;
-    }
-
-    /**
-     * Returns a list of connection names configured in the properties object.
-     */
-    private List<String> extractNames(ExtendedProperties props) {
-        Iterator<?> it = props.getKeys();
-        List<String> list = new ArrayList<String>();
-
-        while (it.hasNext()) {
-            String key = (String) it.next();
-
-            int dotInd = key.indexOf('.');
-            if (dotInd <= 0 || dotInd >= key.length()) {
-                continue;
-            }
-
-            String name = key.substring(0, dotInd);
-            if (!list.contains(name)) {
-                list.add(name);
-            }
-        }
-
-        return list;
-    }
+	private static final String ADAPTER_KEY = "adapter";
+	private static final String ADAPTER20_KEY = "cayenne.adapter";
+	private static final String USER_NAME_KEY = "jdbc.username";
+	private static final String PASSWORD_KEY = "jdbc.password";
+	private static final String URL_KEY = "jdbc.url";
+	private static final String DRIVER_KEY = "jdbc.driver";
+
+	private Map<String, DataSourceInfo> connectionInfos;
+
+	/**
+	 * Constructor for ConnectionProperties.
+	 */
+	ConnectionProperties(ExtendedProperties props) {
+		connectionInfos = new HashMap<>();
+		for (String name : extractNames(props)) {
+			DataSourceInfo dsi = buildDataSourceInfo(props.subset(name));
+			connectionInfos.put(name, dsi);
+		}
+	}
+
+	int size() {
+		return connectionInfos.size();
+	}
+
+	/**
+	 * Returns DataSourceInfo object for a symbolic name. If name does not match
+	 * an existing object, returns null.
+	 */
+	DataSourceInfo getConnection(String name) {
+		return connectionInfos.get(name);
+	}
+
+	/**
+	 * Creates a DataSourceInfo object from a set of properties.
+	 */
+	private DataSourceInfo buildDataSourceInfo(ExtendedProperties props) {
+		DataSourceInfo dsi = new DataSourceInfo();
+
+		String adapter = props.getString(ADAPTER_KEY);
+
+		// try legacy adapter key
+		if (adapter == null) {
+			adapter = props.getString(ADAPTER20_KEY);
+		}
+
+		dsi.setAdapterClassName(adapter);
+		dsi.setUserName(props.getString(USER_NAME_KEY));
+		dsi.setPassword(props.getString(PASSWORD_KEY));
+		dsi.setDataSourceUrl(props.getString(URL_KEY));
+		dsi.setJdbcDriver(props.getString(DRIVER_KEY));
+
+		return dsi;
+	}
+
+	/**
+	 * Returns a list of connection names configured in the properties object.
+	 */
+	private List<String> extractNames(ExtendedProperties props) {
+		Iterator<?> it = props.getKeys();
+		List<String> list = new ArrayList<String>();
+
+		while (it.hasNext()) {
+			String key = (String) it.next();
+
+			int dotInd = key.indexOf('.');
+			if (dotInd <= 0 || dotInd >= key.length()) {
+				continue;
+			}
+
+			String name = key.substring(0, dotInd);
+			if (!list.contains(name)) {
+				list.add(name);
+			}
+		}
+
+		return list;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SQLTemplateCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SQLTemplateCustomizerProvider.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SQLTemplateCustomizerProvider.java
index f3d3281..cc8fd53 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SQLTemplateCustomizerProvider.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SQLTemplateCustomizerProvider.java
@@ -33,9 +33,9 @@ public class SQLTemplateCustomizerProvider implements Provider<SQLTemplateCustom
     private DbAdapter dbAdapter;
 
     public SQLTemplateCustomizer get() throws ConfigurationException {
-        Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
+        Map<String, Map<String, String>> map = new HashMap<>();
 
-        Map<String, String> q1 = new HashMap<String, String>();
+        Map<String, String> q1 = new HashMap<>();
         q1.put(
                 "org.apache.cayenne.dba.postgres.PostgresAdapter",
                 "SELECT #result('ARTIST_ID'), RTRIM(#result('ARTIST_NAME')), "
@@ -49,7 +49,7 @@ public class SQLTemplateCustomizerProvider implements Provider<SQLTemplateCustom
                 "SELECT #result('ARTIST_ID'), #result('ARTIST_NAME'), "
                         + "#result('DATE_OF_BIRTH') FROM ARTIST ORDER BY ARTIST_ID");
 
-        Map<String, String> q2 = new HashMap<String, String>();
+        Map<String, String> q2 = new HashMap<>();
         q2.put(
                 "org.apache.cayenne.dba.postgres.PostgresAdapter",
                 "SELECT #result('ARTIST_ID'), RTRIM(#result('ARTIST_NAME')), #result('DATE_OF_BIRTH') "
@@ -63,7 +63,7 @@ public class SQLTemplateCustomizerProvider implements Provider<SQLTemplateCustom
                 "SELECT #result('ARTIST_ID'), #result('ARTIST_NAME'), #result('DATE_OF_BIRTH') "
                         + "FROM ARTIST WHERE ARTIST_ID = #bind($id)");
 
-        Map<String, String> q3 = new HashMap<String, String>();
+        Map<String, String> q3 = new HashMap<>();
         q3
                 .put(
                         "org.apache.cayenne.dba.oracle.OracleAdapter",

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceFactory.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceFactory.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceFactory.java
index 8b1308a..f4f51b1 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceFactory.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceFactory.java
@@ -44,8 +44,8 @@ public class ServerCaseDataSourceFactory {
 
 		this.objectFactory = objectFactory;
 		this.dataSourceInfo = dataSourceInfo;
-		this.dataSources = new HashMap<String, DataSource>();
-		this.mapsWithDedicatedDataSource = new HashSet<String>(Arrays.asList("map-db1", "map-db2"));
+		this.dataSources = new HashMap<>();
+		this.mapsWithDedicatedDataSource = new HashSet<>(Arrays.asList("map-db1", "map-db2"));
 
 		this.sharedDataSource = createDataSource();
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceInfoProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceInfoProvider.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceInfoProvider.java
index 722a234..1e657ef 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceInfoProvider.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDataSourceInfoProvider.java
@@ -58,7 +58,7 @@ public class ServerCaseDataSourceInfoProvider implements Provider<DataSourceInfo
         this.connectionProperties = new ConnectionProperties(properties);
         logger.info("Loaded  " + connectionProperties.size() + " DataSource configurations from properties file");
 
-        this.inMemoryDataSources = new HashMap<String, DataSourceInfo>();
+        this.inMemoryDataSources = new HashMap<>();
 
         // preload default in-memory DataSources. Will use them as defaults if
         // nothing is configured in ~/.cayenne/connection.properties

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/util/concurrentlinkedhashmap/ConcurrentLinkedHashMapTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/util/concurrentlinkedhashmap/ConcurrentLinkedHashMapTest.java b/cayenne-server/src/test/java/org/apache/cayenne/util/concurrentlinkedhashmap/ConcurrentLinkedHashMapTest.java
index 9b84b9f..1840964 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/util/concurrentlinkedhashmap/ConcurrentLinkedHashMapTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/util/concurrentlinkedhashmap/ConcurrentLinkedHashMapTest.java
@@ -25,49 +25,47 @@ import static org.junit.Assert.assertNull;
 
 public class ConcurrentLinkedHashMapTest {
 
-    @Test
-    public void testPutGet() {
-        ConcurrentLinkedHashMap<String, Object> m = new ConcurrentLinkedHashMap.Builder<String, Object>()
-                .maximumWeightedCapacity(10)
-                .build();
+	@Test
+	public void testPutGet() {
+		ConcurrentLinkedHashMap<String, Object> m = new ConcurrentLinkedHashMap.Builder<String, Object>()
+				.maximumWeightedCapacity(10).build();
 
-        assertEquals(0, m.size());
-        m.put("k1", 100);
-        assertEquals(1, m.size());
-        assertNull(m.get("nosuchkey"));
-        assertEquals(100, m.get("k1"));
+		assertEquals(0, m.size());
+		m.put("k1", 100);
+		assertEquals(1, m.size());
+		assertNull(m.get("nosuchkey"));
+		assertEquals(100, m.get("k1"));
 
-        m.put("k2", 200);
-        assertEquals(2, m.size());
-        assertEquals(200, m.get("k2"));
-    }
+		m.put("k2", 200);
+		assertEquals(2, m.size());
+		assertEquals(200, m.get("k2"));
+	}
 
-    @Test
-    public void testLRU() {
-        ConcurrentLinkedHashMap<String, Object> m = new ConcurrentLinkedHashMap.Builder<String, Object>()
-                .maximumWeightedCapacity(5)
-                .build();
+	@Test
+	public void testLRU() {
+		ConcurrentLinkedHashMap<String, Object> m = new ConcurrentLinkedHashMap.Builder<String, Object>()
+				.maximumWeightedCapacity(5).build();
 
-        assertEquals(0, m.size());
-        m.put("k1", 100);
-        assertEquals(1, m.size());
-        m.put("k2", 101);
-        assertEquals(2, m.size());
-        m.put("k3", 102);
-        assertEquals(3, m.size());
-        m.put("k4", 103);
-        assertEquals(4, m.size());
-        m.put("k5", 104);
-        assertEquals(5, m.size());
-        m.put("k6", 105);
-        assertEquals(5, m.size());
-        m.put("k7", 106);
-        assertEquals(5, m.size());
-        m.put("k8", 107);
-        assertEquals(5, m.size());
+		assertEquals(0, m.size());
+		m.put("k1", 100);
+		assertEquals(1, m.size());
+		m.put("k2", 101);
+		assertEquals(2, m.size());
+		m.put("k3", 102);
+		assertEquals(3, m.size());
+		m.put("k4", 103);
+		assertEquals(4, m.size());
+		m.put("k5", 104);
+		assertEquals(5, m.size());
+		m.put("k6", 105);
+		assertEquals(5, m.size());
+		m.put("k7", 106);
+		assertEquals(5, m.size());
+		m.put("k8", 107);
+		assertEquals(5, m.size());
 
-        m.remove("k6");
-        assertEquals(4, m.size());
+		m.remove("k6");
+		assertEquals(4, m.size());
 
-    }
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/velocity/BindDirectiveIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/velocity/BindDirectiveIT.java b/cayenne-server/src/test/java/org/apache/cayenne/velocity/BindDirectiveIT.java
index 4f71bad..69c8fc4 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/velocity/BindDirectiveIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/velocity/BindDirectiveIT.java
@@ -78,7 +78,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_Timestamp() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Integer(1));
 		parameters.put("name", "ArtistWithDOB");
 		Calendar cal = Calendar.getInstance();
@@ -96,7 +96,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_SQLDate() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Integer(1));
 		parameters.put("name", "ArtistWithDOB");
 		Calendar cal = Calendar.getInstance();
@@ -114,7 +114,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_UtilDate() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Integer(1));
 		parameters.put("name", "ArtistWithDOB");
 		Calendar cal = Calendar.getInstance();
@@ -159,7 +159,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_NullParam() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Long(1));
 		parameters.put("name", "ArtistWithoutDOB");
 		// passing null in parameter
@@ -175,7 +175,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_NullParam_JDBCTypes() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Long(1));
 		parameters.put("name", "ArtistWithoutDOB");
 		// passing null in parameter
@@ -191,7 +191,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_SkippedParam() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Long(1));
 		parameters.put("name", "ArtistWithoutDOB");
 		// skipping "dob"
@@ -206,7 +206,7 @@ public class BindDirectiveIT extends ServerCase {
 
 	@Test
 	public void testBind_SkippedParam_JDBCTypes() throws Exception {
-		Map<String, Object> parameters = new HashMap<String, Object>();
+		Map<String, Object> parameters = new HashMap<>();
 		parameters.put("id", new Long(1));
 		parameters.put("name", "ArtistWithoutDOB");
 		// skipping "dob"

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessorTest.java
index 9387468..b6c6ff3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessorTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessorTest.java
@@ -171,7 +171,7 @@ public class VelocitySQLTemplateProcessorTest {
 				+ "COLUMN1 #bindNotEqual($helper.cayenneExp($a, 'db:ID_COLUMN1')) "
 				+ "AND COLUMN2 #bindNotEqual($helper.cayenneExp($a, 'db:ID_COLUMN2'))";
 
-		Map<String, Object> idMap = new HashMap<String, Object>();
+		Map<String, Object> idMap = new HashMap<>();
 		idMap.put("ID_COLUMN1", new Integer(3));
 		idMap.put("ID_COLUMN2", "aaa");
 		ObjectId id = new ObjectId("T", idMap);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessor_ChainTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessor_ChainTest.java b/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessor_ChainTest.java
index 6bbc271..c864918 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessor_ChainTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/velocity/VelocitySQLTemplateProcessor_ChainTest.java
@@ -63,7 +63,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 	public void testProcessTemplateFullChain() throws Exception {
 		String template = "#chain(' OR ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end" + "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", "[A]");
 		map.put("b", "[B]");
 		map.put("c", "[C]");
@@ -77,7 +77,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", "[A]");
 		map.put("b", "[B]");
 		map.put("c", "[C]");
@@ -91,7 +91,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", "[A]");
 		map.put("c", "[C]");
 
@@ -104,7 +104,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("b", "[B]");
 		map.put("c", "[C]");
 
@@ -117,7 +117,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", "[A]");
 		map.put("b", "[B]");
 
@@ -130,7 +130,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + " some other stuff" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", "[A]");
 		map.put("c", "[C]");
 
@@ -160,7 +160,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)[A]#end" + "#chunk($b)[B]#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", false);
 		map.put("b", 0);
 
@@ -173,7 +173,7 @@ public class VelocitySQLTemplateProcessor_ChainTest {
 		String template = "#chain(' OR ' 'WHERE ')" + "#chunk($a)$a#end" + "#chunk($b)$b#end" + "#chunk($c)$c#end"
 				+ "#end";
 
-		Map<String, Object> map = new HashMap<String, Object>();
+		Map<String, Object> map = new HashMap<>();
 		map.put("a", false);
 		map.put("b", 0);
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java b/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
index 6f2f881..beee072 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
@@ -93,7 +93,7 @@ public class ClassGenerationAction {
 		this.usePkgPath = true;
 		this.makePairs = true;
 		this.context = new VelocityContext();
-		this.templateCache = new HashMap<String, Template>(5);
+		this.templateCache = new HashMap<>(5);
 
 		this.artifacts = new ArrayList<Artifact>();
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-tools/src/main/java/org/apache/cayenne/gen/DataMapUtils.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/gen/DataMapUtils.java b/cayenne-tools/src/main/java/org/apache/cayenne/gen/DataMapUtils.java
index d1ad7c9..a6caf08 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/gen/DataMapUtils.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/gen/DataMapUtils.java
@@ -54,166 +54,168 @@ import org.apache.commons.collections.set.ListOrderedSet;
  */
 public class DataMapUtils {
 
-    Map<String, Map<String, String>> queriesMap = new HashMap<String, Map<String, String>>();
-
-    /**
-     * Return valid method name based on query name (replace all illegal characters with
-     * underscore '_').
-     * 
-     * @param query
-     * @return Method name that perform query.
-     */
-    public String getQueryMethodName(Query query) {
-        return NameConverter.underscoredToJava(query.getName(), true);
-    }
-
-    /**
-     * Get all parameter names that used in query qualifier.
-     *
-     * @param query
-     * @return Parameter names.
-     */
-    public Collection getParameterNames(SelectQuery<?> query) {
-        
-        if(query.getQualifier() == null) {
-            return Collections.EMPTY_SET;
-        }
-        
-        Map<String, String> queryParameters = queriesMap.get(query.getName());
-
-        if (queryParameters == null) {
-            queryParameters = getParameterNames(query.getQualifier(), query.getRoot());
-            queriesMap.put(query.getName(), queryParameters);
-        }
-
-        return parseQualifier(query.getQualifier().toString());
-    }
-
-    public Boolean isValidParameterNames(SelectQuery<?> query) {
-        
-        if(query.getQualifier() == null) {
-            return true;
-        }
-        
-        Map<String, String> queryParameters = queriesMap.get(query.getName());
-
-        if (queryParameters == null) {
-            try {
-                queryParameters = getParameterNames(query.getQualifier(), query.getRoot());
-            } catch (Exception e) {
-                // if we have wrong path in queryParameters return false.
-                return false;
-            }
-        }
-        
-        if(query instanceof SelectQuery) {
-            for(Ordering ordering: ((SelectQuery<?>)query).getOrderings()) {
-                // validate paths in ordering
-                String path = ordering.getSortSpecString();
-                Iterator<CayenneMapEntry> it = ((ObjEntity)query.getRoot()).resolvePathComponents(path);
-                while (it.hasNext()) {
-                    try {
-                        it.next();
-                    } catch (ExpressionException e) {
-                        // if we have wrong path in orderings return false.
-                        return false;
-                    }
-                }
-            }
-        }
-
-        return true;
-    }
-    
-    /**
-     * Get list of parameter names in the same order as in qualifier.
-     * 
-     * @param qualifierString to be parsed
-     * @return List of parameter names.
-     */
-    private Set parseQualifier(String qualifierString) {
-        Set result = new ListOrderedSet();
-        Pattern pattern = Pattern.compile("\\$[\\w]+");
-        Matcher matcher = pattern.matcher(qualifierString);
-        while(matcher.find()) {
-            String name = matcher.group();
-            result.add(NameConverter.underscoredToJava(name.substring(1), false));
-        }
-        
-        return result;
-    }
-
-    public boolean hasParameters(SelectQuery<?> query) {
-        Map queryParameters = queriesMap.get(query.getName());
-
-        if (queryParameters == null) {
-            return false;
-        }
-
-        return queryParameters.keySet().size() > 0;
-
-    }
-
-    /**
-     * Get type of parameter for given name.
-     *
-     * @param query
-     * @param name
-     * @return Parameter type.
-     */
-    public String getParameterType(SelectQuery<?> query, String name) {
-            return queriesMap.get(query.getName()).get(name);
-    }
-
-    private Map<String, String> getParameterNames(Expression expression, Object root) {
-        if (expression != null) {
-            Map<String, String> types = new HashMap<String, String>();
-            String typeName = "";
-            List<String> names = new LinkedList<String>();
-
-            for (int i = 0; i < expression.getOperandCount(); i++) {
-                Object operand = expression.getOperand(i);
-
-                if (operand instanceof Expression) {
-                    types.putAll(getParameterNames((Expression) operand, root));
-                }
-
-                if (operand instanceof ASTObjPath) {
-                    PathComponent<ObjAttribute, ObjRelationship> component = ((Entity) root).lastPathComponent((ASTObjPath) operand, null);
-                    ObjAttribute attribute = component.getAttribute();
-                    if (attribute != null) {
-                        typeName = attribute.getType();
-                    } else {
-                        ObjRelationship relationship = component.getRelationship();
-                        if (relationship != null) {
-                            typeName = ((ObjEntity) relationship.getTargetEntity()).getClassName();
-                        } else {
-                            typeName = "Object";
-                        }
-                    }
-                }
-                
-                if (operand instanceof ASTList) {
-                    Object[] values = (Object[]) ((ASTList) operand).getOperand(0);
-                    for (Object value : values) {
-                        if (value instanceof ExpressionParameter) {
-                            names.add(((ExpressionParameter) value).getName());
-                        }
-                    }
-                }
-
-                if (operand instanceof ExpressionParameter) {
-                    names.add(((ExpressionParameter) operand).getName());
-                }
-
-            }
-
-            for (String name : names) {
-                types.put(NameConverter.underscoredToJava(name, false), typeName);
-            }
-
-            return types;
-        }
-        return Collections.EMPTY_MAP;
-    }
+	Map<String, Map<String, String>> queriesMap = new HashMap<>();
+
+	/**
+	 * Return valid method name based on query name (replace all illegal
+	 * characters with underscore '_').
+	 * 
+	 * @param query
+	 * @return Method name that perform query.
+	 */
+	public String getQueryMethodName(Query query) {
+		return NameConverter.underscoredToJava(query.getName(), true);
+	}
+
+	/**
+	 * Get all parameter names that used in query qualifier.
+	 *
+	 * @param query
+	 * @return Parameter names.
+	 */
+	public Collection getParameterNames(SelectQuery<?> query) {
+
+		if (query.getQualifier() == null) {
+			return Collections.EMPTY_SET;
+		}
+
+		Map<String, String> queryParameters = queriesMap.get(query.getName());
+
+		if (queryParameters == null) {
+			queryParameters = getParameterNames(query.getQualifier(), query.getRoot());
+			queriesMap.put(query.getName(), queryParameters);
+		}
+
+		return parseQualifier(query.getQualifier().toString());
+	}
+
+	public Boolean isValidParameterNames(SelectQuery<?> query) {
+
+		if (query.getQualifier() == null) {
+			return true;
+		}
+
+		Map<String, String> queryParameters = queriesMap.get(query.getName());
+
+		if (queryParameters == null) {
+			try {
+				queryParameters = getParameterNames(query.getQualifier(), query.getRoot());
+			} catch (Exception e) {
+				// if we have wrong path in queryParameters return false.
+				return false;
+			}
+		}
+
+		if (query instanceof SelectQuery) {
+			for (Ordering ordering : ((SelectQuery<?>) query).getOrderings()) {
+				// validate paths in ordering
+				String path = ordering.getSortSpecString();
+				Iterator<CayenneMapEntry> it = ((ObjEntity) query.getRoot()).resolvePathComponents(path);
+				while (it.hasNext()) {
+					try {
+						it.next();
+					} catch (ExpressionException e) {
+						// if we have wrong path in orderings return false.
+						return false;
+					}
+				}
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Get list of parameter names in the same order as in qualifier.
+	 * 
+	 * @param qualifierString
+	 *            to be parsed
+	 * @return List of parameter names.
+	 */
+	private Set parseQualifier(String qualifierString) {
+		Set result = new ListOrderedSet();
+		Pattern pattern = Pattern.compile("\\$[\\w]+");
+		Matcher matcher = pattern.matcher(qualifierString);
+		while (matcher.find()) {
+			String name = matcher.group();
+			result.add(NameConverter.underscoredToJava(name.substring(1), false));
+		}
+
+		return result;
+	}
+
+	public boolean hasParameters(SelectQuery<?> query) {
+		Map queryParameters = queriesMap.get(query.getName());
+
+		if (queryParameters == null) {
+			return false;
+		}
+
+		return queryParameters.keySet().size() > 0;
+
+	}
+
+	/**
+	 * Get type of parameter for given name.
+	 *
+	 * @param query
+	 * @param name
+	 * @return Parameter type.
+	 */
+	public String getParameterType(SelectQuery<?> query, String name) {
+		return queriesMap.get(query.getName()).get(name);
+	}
+
+	private Map<String, String> getParameterNames(Expression expression, Object root) {
+		if (expression != null) {
+			Map<String, String> types = new HashMap<>();
+			String typeName = "";
+			List<String> names = new LinkedList<String>();
+
+			for (int i = 0; i < expression.getOperandCount(); i++) {
+				Object operand = expression.getOperand(i);
+
+				if (operand instanceof Expression) {
+					types.putAll(getParameterNames((Expression) operand, root));
+				}
+
+				if (operand instanceof ASTObjPath) {
+					PathComponent<ObjAttribute, ObjRelationship> component = ((Entity) root).lastPathComponent(
+							(ASTObjPath) operand, null);
+					ObjAttribute attribute = component.getAttribute();
+					if (attribute != null) {
+						typeName = attribute.getType();
+					} else {
+						ObjRelationship relationship = component.getRelationship();
+						if (relationship != null) {
+							typeName = ((ObjEntity) relationship.getTargetEntity()).getClassName();
+						} else {
+							typeName = "Object";
+						}
+					}
+				}
+
+				if (operand instanceof ASTList) {
+					Object[] values = (Object[]) ((ASTList) operand).getOperand(0);
+					for (Object value : values) {
+						if (value instanceof ExpressionParameter) {
+							names.add(((ExpressionParameter) value).getName());
+						}
+					}
+				}
+
+				if (operand instanceof ExpressionParameter) {
+					names.add(((ExpressionParameter) operand).getName());
+				}
+
+			}
+
+			for (String name : names) {
+				types.put(NameConverter.underscoredToJava(name, false), typeName);
+			}
+
+			return types;
+		}
+		return Collections.EMPTY_MAP;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/cayenne-tools/src/main/java/org/apache/cayenne/gen/ImportUtils.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/gen/ImportUtils.java b/cayenne-tools/src/main/java/org/apache/cayenne/gen/ImportUtils.java
index 16fa18d..5eb4208 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/gen/ImportUtils.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/gen/ImportUtils.java
@@ -34,242 +34,233 @@ import org.apache.cayenne.util.Util;
  */
 public class ImportUtils {
 
-    public static final String importOrdering[] = new String[] {
-            "java.", "javax.", "org.", "com."
-    };
-
-    static final String primitives[] = new String[] {
-            "long", "double", "byte", "boolean", "float", "short", "int", "char"
-    };
-
-    static final String primitiveClasses[] = new String[] {
-            Long.class.getName(), Double.class.getName(), Byte.class.getName(),
-            Boolean.class.getName(), Float.class.getName(), Short.class.getName(),
-            Integer.class.getName(), Character.class.getName()
-    };
-
-    static Map<String, String> classesForPrimitives = Util.toMap(
-            primitives,
-            primitiveClasses);
-    static Map<String, String> primitivesForClasses = Util.toMap(
-            primitiveClasses,
-            primitives);
-
-    protected Map<String, String> importTypesMap = new HashMap<String, String>();
-    protected Map<String, String> reservedImportTypesMap = new HashMap<String, String>(); // Types
-    // forced
-    // to
-    // be
-    // FQN
-
-    protected String packageName;
-
-    public ImportUtils() {
-        super();
-    }
-
-    protected boolean canRegisterType(String typeName) {
-        // Not sure why this would ever happen, but it did
-        if (null == typeName)
-            return false;
-
-        StringUtils stringUtils = StringUtils.getInstance();
-        String typeClassName = stringUtils.stripPackageName(typeName);
-        String typePackageName = stringUtils.stripClass(typeName);
-
-        if (typePackageName.length() == 0)
-            return false; // disallow non-packaged types (primitives, probably)
-        if ("java.lang".equals(typePackageName))
-            return false;
-
-        // Can only have one type -- rest must use fqn
-        if (reservedImportTypesMap.containsKey(typeClassName))
-            return false;
-        if (importTypesMap.containsKey(typeClassName))
-            return false;
-
-        return true;
-    }
-
-    /**
-     * Reserve a fully-qualified data type class name so it cannot be used by another
-     * class. No import statements will be generated for reserved types. Typically, this
-     * is the fully-qualified class name of the class being generated.
-     * 
-     * @param typeName FQ data type class name.
-     */
-    public void addReservedType(String typeName) {
-        if (!canRegisterType(typeName))
-            return;
-
-        StringUtils stringUtils = StringUtils.getInstance();
-        String typeClassName = stringUtils.stripPackageName(typeName);
-
-        reservedImportTypesMap.put(typeClassName, typeName);
-    }
-
-    /**
-     * Register a fully-qualified data type class name. For example,
-     * org.apache.cayenne.CayenneDataObject.
-     * 
-     * @param typeName FQ data type class name.
-     */
-    public void addType(String typeName) {
-        if (!canRegisterType(typeName))
-            return;
-
-        StringUtils stringUtils = StringUtils.getInstance();
-        String typePackageName = stringUtils.stripClass(typeName);
-        String typeClassName = stringUtils.stripPackageName(typeName);
-
-        if (typePackageName.equals(packageName))
-            return;
-
-        importTypesMap.put(typeClassName, typeName);
-    }
-
-    /**
-     * Add the package name to use for this importUtil invocation.
-     * 
-     * @param packageName
-     */
-    public void setPackage(String packageName) {
-        this.packageName = packageName;
-    }
-
-    /**
-     * Performs processing similar to <code>formatJavaType(String)</code>, with special
-     * handling of primitive types and their Java class counterparts. This method allows
-     * users to make a decision whether to use primitives or not, regardless of how type
-     * is mapped.
-     */
-    public String formatJavaType(String typeName, boolean usePrimitives) {
-        if (usePrimitives) {
-            String primitive = primitivesForClasses.get(typeName);
-            return (primitive != null) ? primitive : formatJavaType(typeName);
-        }
-        else {
-            String primitiveClass = classesForPrimitives.get(typeName);
-            return (primitiveClass != null)
-                    ? formatJavaType(primitiveClass)
-                    : formatJavaType(typeName);
-        }
-    }
-
-    /**
-     * Removes registered package and non-reserved registered type name prefixes from java
-     * types
-     */
-    public String formatJavaType(String typeName) {
-        if (typeName != null) {
-            StringUtils stringUtils = StringUtils.getInstance();
-            String typeClassName = stringUtils.stripPackageName(typeName);
-
-            if (!reservedImportTypesMap.containsKey(typeClassName)) {
-                if (importTypesMap.containsKey(typeClassName)) {
-                    if (typeName.equals(importTypesMap.get(typeClassName)))
-                        return typeClassName;
-                }
-            }
-
-            String typePackageName = stringUtils.stripClass(typeName);
-            if ("java.lang".equals(typePackageName))
-                return typeClassName;
-            if ((null != packageName) && (packageName.equals(typePackageName)))
-                return typeClassName;
-        }
-
-        return typeName;
-    }
-
-    /**
-     * @since 3.0
-     */
-    public String formatJavaTypeAsNonBooleanPrimitive(String type) {
-        String value = ImportUtils.classesForPrimitives.get(type);
-        return formatJavaType(value != null ? value : type);
-    }
-
-    /**
-     * @since 3.0
-     */
-    public boolean isNonBooleanPrimitive(String type) {
-        return ImportUtils.classesForPrimitives.containsKey(type) && !isBoolean(type);
-    }
-
-    /**
-     * @since 3.0
-     */
-    public boolean isBoolean(String type) {
-        return "boolean".equals(type);
-    }
-
-    /**
-     * Generate package and list of import statements based on the registered types.
-     */
-    public String generate() {
-        StringBuilder outputBuffer = new StringBuilder();
-
-        if (null != packageName) {
-            outputBuffer.append("package ");
-            outputBuffer.append(packageName);
-
-            // Using UNIX line endings intentionally - generated Java files should look
-            // the same regardless of platform to prevent developer teams working on
-            // multiple OS's to override each other's work
-            outputBuffer.append(";\n\n");
-        }
-
-        List<String> typesList = new ArrayList<String>(importTypesMap.values());
-        Collections.sort(typesList, new Comparator<String>() {
-
-            public int compare(String s1, String s2) {
-
-                for (String ordering : importOrdering) {
-                    if ((s1.startsWith(ordering)) && (!s2.startsWith(ordering))) {
-                        return -1;
-                    }
-                    if ((!s1.startsWith(ordering)) && (s2.startsWith(ordering))) {
-                        return 1;
-                    }
-                }
-
-                return s1.compareTo(s2);
-            }
-        });
-
-        String lastStringPrefix = null;
-        boolean firstIteration = true;
-        for (String typeName : typesList) {
-
-            if (firstIteration) {
-                firstIteration = false;
-            }
-            else {
-                outputBuffer.append('\n');
-            }
-            // Output another newline if we're in a different root package.
-            // Find root package
-            String thisStringPrefix = typeName;
-            int dotIndex = typeName.indexOf('.');
-            if (-1 != dotIndex) {
-                thisStringPrefix = typeName.substring(0, dotIndex);
-            }
-            // if this isn't the first import,
-            if (null != lastStringPrefix) {
-                // and it's different from the last import
-                if (false == thisStringPrefix.equals(lastStringPrefix)) {
-                    // output a newline; force UNIX style per comment above
-                    outputBuffer.append("\n");
-                }
-            }
-            lastStringPrefix = thisStringPrefix;
-
-            outputBuffer.append("import ");
-            outputBuffer.append(typeName);
-            outputBuffer.append(';');
-        }
-
-        return outputBuffer.toString();
-    }
+	public static final String importOrdering[] = new String[] { "java.", "javax.", "org.", "com." };
+
+	static final String primitives[] = new String[] { "long", "double", "byte", "boolean", "float", "short", "int",
+			"char" };
+
+	static final String primitiveClasses[] = new String[] { Long.class.getName(), Double.class.getName(),
+			Byte.class.getName(), Boolean.class.getName(), Float.class.getName(), Short.class.getName(),
+			Integer.class.getName(), Character.class.getName() };
+
+	static Map<String, String> classesForPrimitives = Util.toMap(primitives, primitiveClasses);
+	static Map<String, String> primitivesForClasses = Util.toMap(primitiveClasses, primitives);
+
+	protected Map<String, String> importTypesMap = new HashMap<>();
+
+	// Types forced to be FQN
+	protected Map<String, String> reservedImportTypesMap = new HashMap<>();
+
+	protected String packageName;
+
+	public ImportUtils() {
+		super();
+	}
+
+	protected boolean canRegisterType(String typeName) {
+		// Not sure why this would ever happen, but it did
+		if (null == typeName)
+			return false;
+
+		StringUtils stringUtils = StringUtils.getInstance();
+		String typeClassName = stringUtils.stripPackageName(typeName);
+		String typePackageName = stringUtils.stripClass(typeName);
+
+		if (typePackageName.length() == 0)
+			return false; // disallow non-packaged types (primitives, probably)
+		if ("java.lang".equals(typePackageName))
+			return false;
+
+		// Can only have one type -- rest must use fqn
+		if (reservedImportTypesMap.containsKey(typeClassName))
+			return false;
+		if (importTypesMap.containsKey(typeClassName))
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * Reserve a fully-qualified data type class name so it cannot be used by
+	 * another class. No import statements will be generated for reserved types.
+	 * Typically, this is the fully-qualified class name of the class being
+	 * generated.
+	 * 
+	 * @param typeName
+	 *            FQ data type class name.
+	 */
+	public void addReservedType(String typeName) {
+		if (!canRegisterType(typeName))
+			return;
+
+		StringUtils stringUtils = StringUtils.getInstance();
+		String typeClassName = stringUtils.stripPackageName(typeName);
+
+		reservedImportTypesMap.put(typeClassName, typeName);
+	}
+
+	/**
+	 * Register a fully-qualified data type class name. For example,
+	 * org.apache.cayenne.CayenneDataObject.
+	 * 
+	 * @param typeName
+	 *            FQ data type class name.
+	 */
+	public void addType(String typeName) {
+		if (!canRegisterType(typeName))
+			return;
+
+		StringUtils stringUtils = StringUtils.getInstance();
+		String typePackageName = stringUtils.stripClass(typeName);
+		String typeClassName = stringUtils.stripPackageName(typeName);
+
+		if (typePackageName.equals(packageName))
+			return;
+
+		importTypesMap.put(typeClassName, typeName);
+	}
+
+	/**
+	 * Add the package name to use for this importUtil invocation.
+	 * 
+	 * @param packageName
+	 */
+	public void setPackage(String packageName) {
+		this.packageName = packageName;
+	}
+
+	/**
+	 * Performs processing similar to <code>formatJavaType(String)</code>, with
+	 * special handling of primitive types and their Java class counterparts.
+	 * This method allows users to make a decision whether to use primitives or
+	 * not, regardless of how type is mapped.
+	 */
+	public String formatJavaType(String typeName, boolean usePrimitives) {
+		if (usePrimitives) {
+			String primitive = primitivesForClasses.get(typeName);
+			return (primitive != null) ? primitive : formatJavaType(typeName);
+		} else {
+			String primitiveClass = classesForPrimitives.get(typeName);
+			return (primitiveClass != null) ? formatJavaType(primitiveClass) : formatJavaType(typeName);
+		}
+	}
+
+	/**
+	 * Removes registered package and non-reserved registered type name prefixes
+	 * from java types
+	 */
+	public String formatJavaType(String typeName) {
+		if (typeName != null) {
+			StringUtils stringUtils = StringUtils.getInstance();
+			String typeClassName = stringUtils.stripPackageName(typeName);
+
+			if (!reservedImportTypesMap.containsKey(typeClassName)) {
+				if (importTypesMap.containsKey(typeClassName)) {
+					if (typeName.equals(importTypesMap.get(typeClassName)))
+						return typeClassName;
+				}
+			}
+
+			String typePackageName = stringUtils.stripClass(typeName);
+			if ("java.lang".equals(typePackageName))
+				return typeClassName;
+			if ((null != packageName) && (packageName.equals(typePackageName)))
+				return typeClassName;
+		}
+
+		return typeName;
+	}
+
+	/**
+	 * @since 3.0
+	 */
+	public String formatJavaTypeAsNonBooleanPrimitive(String type) {
+		String value = ImportUtils.classesForPrimitives.get(type);
+		return formatJavaType(value != null ? value : type);
+	}
+
+	/**
+	 * @since 3.0
+	 */
+	public boolean isNonBooleanPrimitive(String type) {
+		return ImportUtils.classesForPrimitives.containsKey(type) && !isBoolean(type);
+	}
+
+	/**
+	 * @since 3.0
+	 */
+	public boolean isBoolean(String type) {
+		return "boolean".equals(type);
+	}
+
+	/**
+	 * Generate package and list of import statements based on the registered
+	 * types.
+	 */
+	public String generate() {
+		StringBuilder outputBuffer = new StringBuilder();
+
+		if (null != packageName) {
+			outputBuffer.append("package ");
+			outputBuffer.append(packageName);
+
+			// Using UNIX line endings intentionally - generated Java files
+			// should look
+			// the same regardless of platform to prevent developer teams
+			// working on
+			// multiple OS's to override each other's work
+			outputBuffer.append(";\n\n");
+		}
+
+		List<String> typesList = new ArrayList<String>(importTypesMap.values());
+		Collections.sort(typesList, new Comparator<String>() {
+
+			public int compare(String s1, String s2) {
+
+				for (String ordering : importOrdering) {
+					if ((s1.startsWith(ordering)) && (!s2.startsWith(ordering))) {
+						return -1;
+					}
+					if ((!s1.startsWith(ordering)) && (s2.startsWith(ordering))) {
+						return 1;
+					}
+				}
+
+				return s1.compareTo(s2);
+			}
+		});
+
+		String lastStringPrefix = null;
+		boolean firstIteration = true;
+		for (String typeName : typesList) {
+
+			if (firstIteration) {
+				firstIteration = false;
+			} else {
+				outputBuffer.append('\n');
+			}
+			// Output another newline if we're in a different root package.
+			// Find root package
+			String thisStringPrefix = typeName;
+			int dotIndex = typeName.indexOf('.');
+			if (-1 != dotIndex) {
+				thisStringPrefix = typeName.substring(0, dotIndex);
+			}
+			// if this isn't the first import,
+			if (null != lastStringPrefix) {
+				// and it's different from the last import
+				if (false == thisStringPrefix.equals(lastStringPrefix)) {
+					// output a newline; force UNIX style per comment above
+					outputBuffer.append("\n");
+				}
+			}
+			lastStringPrefix = thisStringPrefix;
+
+			outputBuffer.append("import ");
+			outputBuffer.append(typeName);
+			outputBuffer.append(';');
+		}
+
+		return outputBuffer.toString();
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
index 96e7f44..0f8131c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
@@ -37,91 +37,83 @@ import org.apache.commons.logging.LogFactory;
  */
 public class CodeTemplateManager {
 
-    public static final String STANDARD_SERVER_SUPERCLASS = "Standard Server Superclass";
-    public static final String STANDARD_SERVER_SUBCLASS = "Standard Server Subclass";
-    static final String STANDARD_CLIENT_SUPERCLASS = "Standard Client Superclass";
-    static final String STANDARD_CLIENT_SUBCLASS = "Standard Client Subclass";
-
-    public static final String NODE_NAME = "codeTemplateManager";
-
-    protected List<String> standardSubclassTemplates;
-    protected List<String> standardSuperclassTemplates;
-    protected Map<String, String> customTemplates;
-    protected Map<String, String> standardTemplates;
-
-    private static Log logger = LogFactory.getLog(CodeTemplateManager.class);
-
-    public Preferences getTemplatePreferences(Application application) {
-        return application.getPreferencesNode(this.getClass(), NODE_NAME);
-    }
-
-    public CodeTemplateManager(Application application) {
-        standardSuperclassTemplates = new ArrayList<String>(3);
-
-        standardSuperclassTemplates.add(STANDARD_SERVER_SUPERCLASS);
-        standardSuperclassTemplates.add(STANDARD_CLIENT_SUPERCLASS);
- 
-        standardSubclassTemplates = new ArrayList<String>(3);
-        standardSubclassTemplates.add(STANDARD_SERVER_SUBCLASS);
-        standardSubclassTemplates.add(STANDARD_CLIENT_SUBCLASS);
-
-        updateCustomTemplates(getTemplatePreferences(application));
-
-        standardTemplates = new HashMap<String, String>();
-        standardTemplates.put(
-                STANDARD_SERVER_SUPERCLASS,
-                ClassGenerationAction.SUPERCLASS_TEMPLATE);
-        standardTemplates.put(
-                STANDARD_CLIENT_SUPERCLASS,
-                ClientClassGenerationAction.SUPERCLASS_TEMPLATE);
-        standardTemplates.put(
-                STANDARD_SERVER_SUBCLASS,
-                ClassGenerationAction.SUBCLASS_TEMPLATE);
-        standardTemplates.put(
-                STANDARD_CLIENT_SUBCLASS,
-                ClientClassGenerationAction.SUBCLASS_TEMPLATE);
-    }
-
-    /**
-     * Updates custom templates from preferences.
-     */
-    public void updateCustomTemplates(Preferences preference) {
-        String[] keys = null;
-        try {
-            keys = preference.childrenNames();
-        }
-        catch (BackingStoreException e) {
-            logger.warn("Error reading preferences");
-        }
-        this.customTemplates = new HashMap<String, String>(keys.length, 1);
-
-        for (int j = 0; j < keys.length; j++) {
-            FSPath path = new FSPath(preference.node(keys[j]));
-            customTemplates.put(keys[j], path.getPath());
-        }
-    }
-
-    // TODO: andrus, 12/5/2007 - this should also take a "pairs" parameter to correctly
-    // assign standard templates
-    public String getTemplatePath(String name) {
-        Object value = customTemplates.get(name);
-        if (value != null) {
-            return value.toString();
-        }
-
-        value = standardTemplates.get(name);
-        return value != null ? value.toString() : null;
-    }
-
-    public Map<String, String> getCustomTemplates() {
-        return customTemplates;
-    }
-
-    public List<String> getStandardSubclassTemplates() {
-        return standardSubclassTemplates;
-    }
-
-    public List<String> getStandardSuperclassTemplates() {
-        return standardSuperclassTemplates;
-    }
+	public static final String STANDARD_SERVER_SUPERCLASS = "Standard Server Superclass";
+	public static final String STANDARD_SERVER_SUBCLASS = "Standard Server Subclass";
+	static final String STANDARD_CLIENT_SUPERCLASS = "Standard Client Superclass";
+	static final String STANDARD_CLIENT_SUBCLASS = "Standard Client Subclass";
+
+	public static final String NODE_NAME = "codeTemplateManager";
+
+	protected List<String> standardSubclassTemplates;
+	protected List<String> standardSuperclassTemplates;
+	protected Map<String, String> customTemplates;
+	protected Map<String, String> standardTemplates;
+
+	private static Log logger = LogFactory.getLog(CodeTemplateManager.class);
+
+	public Preferences getTemplatePreferences(Application application) {
+		return application.getPreferencesNode(this.getClass(), NODE_NAME);
+	}
+
+	public CodeTemplateManager(Application application) {
+		standardSuperclassTemplates = new ArrayList<String>(3);
+
+		standardSuperclassTemplates.add(STANDARD_SERVER_SUPERCLASS);
+		standardSuperclassTemplates.add(STANDARD_CLIENT_SUPERCLASS);
+
+		standardSubclassTemplates = new ArrayList<String>(3);
+		standardSubclassTemplates.add(STANDARD_SERVER_SUBCLASS);
+		standardSubclassTemplates.add(STANDARD_CLIENT_SUBCLASS);
+
+		updateCustomTemplates(getTemplatePreferences(application));
+
+		standardTemplates = new HashMap<>();
+		standardTemplates.put(STANDARD_SERVER_SUPERCLASS, ClassGenerationAction.SUPERCLASS_TEMPLATE);
+		standardTemplates.put(STANDARD_CLIENT_SUPERCLASS, ClientClassGenerationAction.SUPERCLASS_TEMPLATE);
+		standardTemplates.put(STANDARD_SERVER_SUBCLASS, ClassGenerationAction.SUBCLASS_TEMPLATE);
+		standardTemplates.put(STANDARD_CLIENT_SUBCLASS, ClientClassGenerationAction.SUBCLASS_TEMPLATE);
+	}
+
+	/**
+	 * Updates custom templates from preferences.
+	 */
+	public void updateCustomTemplates(Preferences preference) {
+		String[] keys = null;
+		try {
+			keys = preference.childrenNames();
+		} catch (BackingStoreException e) {
+			logger.warn("Error reading preferences");
+		}
+		this.customTemplates = new HashMap<>(keys.length, 1);
+
+		for (int j = 0; j < keys.length; j++) {
+			FSPath path = new FSPath(preference.node(keys[j]));
+			customTemplates.put(keys[j], path.getPath());
+		}
+	}
+
+	// TODO: andrus, 12/5/2007 - this should also take a "pairs" parameter to
+	// correctly
+	// assign standard templates
+	public String getTemplatePath(String name) {
+		Object value = customTemplates.get(name);
+		if (value != null) {
+			return value.toString();
+		}
+
+		value = standardTemplates.get(name);
+		return value != null ? value.toString() : null;
+	}
+
+	public Map<String, String> getCustomTemplates() {
+		return customTemplates;
+	}
+
+	public List<String> getStandardSubclassTemplates() {
+		return standardSubclassTemplates;
+	}
+
+	public List<String> getStandardSuperclassTemplates() {
+		return standardSuperclassTemplates;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
index 46a2c6f..bbb8e74 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
@@ -58,7 +58,7 @@ public class ProjectFileChangeTracker extends Thread {
 
     public ProjectFileChangeTracker(ProjectController mediator) {
 
-        this.files = new ConcurrentHashMap<String, FileInfo>();
+        this.files = new ConcurrentHashMap<>();
         this.mediator = mediator;
 
         setName("cayenne-modeler-file-change-tracker");


Mime
View raw message