cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [01/12] cayenne git commit: CAY-2026 Java 7
Date Sat, 12 Sep 2015 10:41:04 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master e9dd773b5 -> 13d0da532


http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/ClasspathPreferences.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/ClasspathPreferences.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/ClasspathPreferences.java
index af3a7ae..685f868 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/ClasspathPreferences.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/ClasspathPreferences.java
@@ -213,7 +213,7 @@ public class ClasspathPreferences extends CayenneController {
     public void addChangedPreferences(String key, String value) {
         Map<String, String> map = editor.getChangedPreferences().get(preferences);
         if (map == null) {
-            map = new HashMap<String, String>();
+            map = new HashMap<>();
         }
         map.put(key, value);
         editor.getChangedPreferences().put(preferences, map);
@@ -222,7 +222,7 @@ public class ClasspathPreferences extends CayenneController {
     public void addRemovedPreferences(String key) {
         Map<String, String> map = editor.getRemovedPreferences().get(preferences);
         if (map == null) {
-            map = new HashMap<String, String>();
+            map = new HashMap<>();
         }
         map.put(key, "");
         editor.getRemovedPreferences().put(preferences, map);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/GeneralPreferences.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/GeneralPreferences.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/GeneralPreferences.java
index f390942..fdf8b15 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/GeneralPreferences.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/GeneralPreferences.java
@@ -32,126 +32,112 @@ import org.apache.cayenne.swing.ObjectBinding;
 
 public class GeneralPreferences extends CayenneController {
 
-    public static final String AUTO_LOAD_PROJECT_PREFERENCE = "autoLoadProject";
-    public static final String DELETE_PROMPT_PREFERENCE = "deletePrompt";
-    public static final String ENCODING_PREFERENCE = "encoding";
-
-    protected GeneralPreferencesView view;
-    protected CayennePreferenceEditor editor;
-
-    protected boolean autoLoadProjectPreference;
-    protected String encoding;
-    protected boolean deletePromptPreference;
-
-    protected Preferences preferences;
-
-    protected ObjectBinding encodingBinding;
-    protected ObjectBinding autoLoadProjectBinding;
-    protected ObjectBinding deletePromptBinding;
-
-    public GeneralPreferences(PreferenceDialog parentController) {
-        super(parentController);
-        this.view = new GeneralPreferencesView();
-
-        PreferenceEditor editor = parentController.getEditor();
-        if (editor instanceof CayennePreferenceEditor) {
-            this.editor = (CayennePreferenceEditor) editor;
-            this.view.setEnabled(true);
-            initBindings();
-
-            encodingBinding.updateView();
-            autoLoadProjectBinding.updateView();
-            deletePromptBinding.updateView();
-        }
-        else {
-            this.view.setEnabled(false);
-        }
-    }
-
-    public Component getView() {
-        return view;
-    }
-
-    protected void initBindings() {
-        // init model objects
-        preferences = application.getPreferencesNode(GeneralPreferences.class, "");
-
-        this.encoding = preferences.get(ENCODING_PREFERENCE, null);
-
-        this.autoLoadProjectPreference = preferences.getBoolean(
-                AUTO_LOAD_PROJECT_PREFERENCE,
-                false);
-        this.deletePromptPreference = preferences.getBoolean(
-                DELETE_PROMPT_PREFERENCE,
-                false);
-
-        // build child controllers...
-        EncodingSelector encodingSelector = new EncodingSelector(this, view
-                .getEncodingSelector());
-
-        // create bindings...
-        BindingBuilder builder = new BindingBuilder(
-                getApplication().getBindingFactory(),
-                this);
-
-        this.encodingBinding = builder.bindToProperty(
-                encodingSelector,
-                "encoding",
-                EncodingSelector.ENCODING_PROPERTY_BINDING);
-
-        this.autoLoadProjectBinding = builder.bindToCheckBox(
-                view.getAutoLoadProject(),
-                "autoLoadProject");
-
-        this.deletePromptBinding = builder.bindToCheckBox(
-                view.getDeletePrompt(),
-                "deletePrompt");
-    }
-
-    public String getEncoding() {
-        return encoding;
-    }
-
-    public void setEncoding(String encoding) {
-        addChangedPreferences(ENCODING_PREFERENCE, encoding);
-        this.encoding = encoding;
-    }
-
-    public boolean getAutoLoadProject() {
-        return autoLoadProjectPreference;
-    }
-
-    public void setAutoLoadProject(boolean autoLoadProject) {
-
-        addChangedBooleanPreferences(AUTO_LOAD_PROJECT_PREFERENCE, autoLoadProject);
-        this.autoLoadProjectPreference = autoLoadProject;
-    }
-
-    public boolean getDeletePrompt() {
-        return deletePromptPreference;
-    }
-
-    public void setDeletePrompt(boolean deletePrompt) {
-
-        addChangedBooleanPreferences(DELETE_PROMPT_PREFERENCE, deletePrompt);
-        this.deletePromptPreference = deletePrompt;
-    }
-
-    public void addChangedBooleanPreferences(String key, boolean value) {
-        Map<String, Boolean> map = editor.getChangedBooleanPreferences().get(preferences);
-        if (map == null) {
-            map = new HashMap<String, Boolean>();
-        }
-        map.put(key, value);
-        editor.getChangedBooleanPreferences().put(preferences, map);
-    }
-
-    public void addChangedPreferences(String key, String value) {
-        Map<String, String> map = editor.getChangedPreferences().get(preferences);
-        if (map == null) {
-            map = new HashMap<String, String>();
-        }
-        map.put(key, value);
-        editor.getChangedPreferences().put(preferences, map);
-    }
+	public static final String AUTO_LOAD_PROJECT_PREFERENCE = "autoLoadProject";
+	public static final String DELETE_PROMPT_PREFERENCE = "deletePrompt";
+	public static final String ENCODING_PREFERENCE = "encoding";
+
+	protected GeneralPreferencesView view;
+	protected CayennePreferenceEditor editor;
+
+	protected boolean autoLoadProjectPreference;
+	protected String encoding;
+	protected boolean deletePromptPreference;
+
+	protected Preferences preferences;
+
+	protected ObjectBinding encodingBinding;
+	protected ObjectBinding autoLoadProjectBinding;
+	protected ObjectBinding deletePromptBinding;
+
+	public GeneralPreferences(PreferenceDialog parentController) {
+		super(parentController);
+		this.view = new GeneralPreferencesView();
+
+		PreferenceEditor editor = parentController.getEditor();
+		if (editor instanceof CayennePreferenceEditor) {
+			this.editor = (CayennePreferenceEditor) editor;
+			this.view.setEnabled(true);
+			initBindings();
+
+			encodingBinding.updateView();
+			autoLoadProjectBinding.updateView();
+			deletePromptBinding.updateView();
+		} else {
+			this.view.setEnabled(false);
+		}
+	}
+
+	public Component getView() {
+		return view;
+	}
+
+	protected void initBindings() {
+		// init model objects
+		preferences = application.getPreferencesNode(GeneralPreferences.class, "");
+
+		this.encoding = preferences.get(ENCODING_PREFERENCE, null);
+
+		this.autoLoadProjectPreference = preferences.getBoolean(AUTO_LOAD_PROJECT_PREFERENCE, false);
+		this.deletePromptPreference = preferences.getBoolean(DELETE_PROMPT_PREFERENCE, false);
+
+		// build child controllers...
+		EncodingSelector encodingSelector = new EncodingSelector(this, view.getEncodingSelector());
+
+		// create bindings...
+		BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
+
+		this.encodingBinding = builder.bindToProperty(encodingSelector, "encoding",
+				EncodingSelector.ENCODING_PROPERTY_BINDING);
+
+		this.autoLoadProjectBinding = builder.bindToCheckBox(view.getAutoLoadProject(), "autoLoadProject");
+
+		this.deletePromptBinding = builder.bindToCheckBox(view.getDeletePrompt(), "deletePrompt");
+	}
+
+	public String getEncoding() {
+		return encoding;
+	}
+
+	public void setEncoding(String encoding) {
+		addChangedPreferences(ENCODING_PREFERENCE, encoding);
+		this.encoding = encoding;
+	}
+
+	public boolean getAutoLoadProject() {
+		return autoLoadProjectPreference;
+	}
+
+	public void setAutoLoadProject(boolean autoLoadProject) {
+
+		addChangedBooleanPreferences(AUTO_LOAD_PROJECT_PREFERENCE, autoLoadProject);
+		this.autoLoadProjectPreference = autoLoadProject;
+	}
+
+	public boolean getDeletePrompt() {
+		return deletePromptPreference;
+	}
+
+	public void setDeletePrompt(boolean deletePrompt) {
+
+		addChangedBooleanPreferences(DELETE_PROMPT_PREFERENCE, deletePrompt);
+		this.deletePromptPreference = deletePrompt;
+	}
+
+	public void addChangedBooleanPreferences(String key, boolean value) {
+		Map<String, Boolean> map = editor.getChangedBooleanPreferences().get(preferences);
+		if (map == null) {
+			map = new HashMap<>();
+		}
+		map.put(key, value);
+		editor.getChangedBooleanPreferences().put(preferences, map);
+	}
+
+	public void addChangedPreferences(String key, String value) {
+		Map<String, String> map = editor.getChangedPreferences().get(preferences);
+		if (map == null) {
+			map = new HashMap<>();
+		}
+		map.put(key, value);
+		editor.getChangedPreferences().put(preferences, map);
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/BaseGraphBuilder.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/BaseGraphBuilder.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/BaseGraphBuilder.java
index 3293223..ccc3b0d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/BaseGraphBuilder.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/BaseGraphBuilder.java
@@ -150,9 +150,9 @@ abstract class BaseGraphBuilder implements GraphBuilder, DataMapListener {
             }
         });
 
-        entityCells = new HashMap<String, DefaultGraphCell>();
-        createdObjects = new ArrayList<DefaultGraphCell>();
-        relCells = new HashMap<String, DefaultEdge>();
+        entityCells = new HashMap<>();
+        createdObjects = new ArrayList<>();
+        relCells = new HashMap<>();
 
         /**
          * an array for entities that are not connected to anyone. We add them

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/AdapterMapping.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/AdapterMapping.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/AdapterMapping.java
index 706bccc..86c2f46 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/AdapterMapping.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/AdapterMapping.java
@@ -50,10 +50,10 @@ public class AdapterMapping {
     protected Map<String, String> eofPluginToAdapterMap;
 
     public AdapterMapping() {
-        this.adapterToJDBCDriverMap = new HashMap<String, String>();
-        this.adapterToJDBCURLMap = new HashMap<String, String>();
-        this.jdbcDriverToAdapterMap = new HashMap<String, String>();
-        this.eofPluginToAdapterMap = new HashMap<String, String>();
+        this.adapterToJDBCDriverMap = new HashMap<>();
+        this.adapterToJDBCURLMap = new HashMap<>();
+        this.jdbcDriverToAdapterMap = new HashMap<>();
+        this.eofPluginToAdapterMap = new HashMap<>();
 
         initDefaults();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerLogFactory.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerLogFactory.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerLogFactory.java
index 950af7f..1e8ff99 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerLogFactory.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerLogFactory.java
@@ -18,36 +18,37 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.util;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogConfigurationException;
 import org.apache.commons.logging.impl.LogFactoryImpl;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
- * Factory for creating ModelerLogger instances. LogFactoryImpl is 
- * subclassed to save default behavior 
+ * Factory for creating ModelerLogger instances. LogFactoryImpl is subclassed to
+ * save default behavior
  */
 public class ModelerLogFactory extends LogFactoryImpl {
-    /**
-     * Local cache of modeler loggers
-     */
-    protected Map<String, ModelerLogger> localCache;
-    
-    public ModelerLogFactory() {
-        localCache = new HashMap<String, ModelerLogger>();
-    }
-    
-    @Override
-    public Log getInstance(String name) throws LogConfigurationException {
-        ModelerLogger local = localCache.get(name);
-        if (local == null) {
-            Log def = super.getInstance(name);
-            
-            local = new ModelerLogger(name, def);
-            localCache.put(name, local);
-        }
-        return local;
-    }
+
+	/**
+	 * Local cache of modeler loggers
+	 */
+	protected Map<String, ModelerLogger> localCache;
+
+	public ModelerLogFactory() {
+		localCache = new HashMap<>();
+	}
+
+	@Override
+	public Log getInstance(String name) throws LogConfigurationException {
+		ModelerLogger local = localCache.get(name);
+		if (local == null) {
+			Log def = super.getInstance(name);
+
+			local = new ModelerLogger(name, def);
+			localCache.put(name, local);
+		}
+		return local;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayennePreferenceEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayennePreferenceEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayennePreferenceEditor.java
index 782c396..3f00e7e 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayennePreferenceEditor.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayennePreferenceEditor.java
@@ -50,9 +50,9 @@ public abstract class CayennePreferenceEditor implements PreferenceEditor {
 
     public CayennePreferenceEditor(CayenneProjectPreferences cayenneProjectPreferences) {
         this.cayenneProjectPreferences = cayenneProjectPreferences;
-        this.changedPreferences = new HashMap<Preferences, Map<String, String>>();
-        this.removedPreferences = new HashMap<Preferences, Map<String, String>>();
-        this.changedBooleanPreferences = new HashMap<Preferences, Map<String, Boolean>>();
+        this.changedPreferences = new HashMap<>();
+        this.removedPreferences = new HashMap<>();
+        this.changedBooleanPreferences = new HashMap<>();
         this.removedNode = new ArrayList<Preferences>();
         this.addedNode = new ArrayList<Preferences>();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayenneProjectPreferences.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayenneProjectPreferences.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayenneProjectPreferences.java
index 516294e..f3b70f8 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayenneProjectPreferences.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/CayenneProjectPreferences.java
@@ -36,12 +36,12 @@ public class CayenneProjectPreferences {
     private Map<Preferences, CayennePreference> projectCayennePreferences;
 
     public CayenneProjectPreferences() {
-        cayennePreferences = new HashMap<Class<?>, ChildrenMapPreference>();
+        cayennePreferences = new HashMap<>();
 
         cayennePreferences.put(DBConnectionInfo.class, new ChildrenMapPreference(
                 new DBConnectionInfo()));
 
-        projectCayennePreferences = new HashMap<Preferences, CayennePreference>();
+        projectCayennePreferences = new HashMap<>();
 
         for (ChildrenMapPreference value : cayennePreferences.values()) {
             value.initChildrenPreferences();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/ChildrenMapPreference.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/ChildrenMapPreference.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/ChildrenMapPreference.java
index 5cfcad8..5e433cf 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/ChildrenMapPreference.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/ChildrenMapPreference.java
@@ -31,114 +31,107 @@ import org.apache.cayenne.CayenneRuntimeException;
 
 public class ChildrenMapPreference extends PreferenceDecorator {
 
-    private Map<String, Object> children;
-    private List<String> removeObject;
-
-    public ChildrenMapPreference(CayennePreference delegate) {
-        super(delegate);
-        this.children = new HashMap<String, Object>();
-        this.removeObject = new ArrayList<String>();
-    }
-
-    public ChildrenMapPreference(CayennePreference delegate, Preferences preferences) {
-        super(delegate);
-        delegate.setCurrentPreference(preferences);
-        this.children = new HashMap<String, Object>();
-    }
-
-    public void initChildrenPreferences() {
-        Map<String, Object> children = new HashMap<String, Object>();
-        try {
-            String[] names = getCurrentPreference().childrenNames();
-            for (int i = 0; i < names.length; i++) {
-
-                try {
-                    Class cls = delegate.getClass();
-                    Class partypes[] = new Class[2];
-                    partypes[0] = String.class;
-                    partypes[1] = boolean.class;
-                    Constructor ct = cls.getConstructor(partypes);
-                    Object arglist[] = new Object[2];
-                    arglist[0] = names[i];
-                    arglist[1] = true;
-                    Object retobj = ct.newInstance(arglist);
-                    children.put(names[i], retobj);
-                }
-                catch (Throwable e) {
-                    new CayenneRuntimeException("Error initializing preference", e);
-                }
-            }
-
-            this.children.putAll(children);
-        }
-        catch (BackingStoreException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public Map getChildrenPreferences() {
-        return children;
-    }
-
-    public CayennePreference getObject(String key) {
-        return (CayennePreference) children.get(key);
-    }
-
-    public void remove(String key) {
-        removeObject.add(key);
-        children.remove(key);
-    }
-
-    public CayennePreference create(String nodeName) {
-        try {
-            Class cls = delegate.getClass();
-            Class partypes[] = new Class[2];
-            partypes[0] = String.class;
-            partypes[1] = boolean.class;
-            Constructor ct = cls.getConstructor(partypes);
-            Object arglist[] = new Object[2];
-            arglist[0] = nodeName;
-            arglist[1] = false;
-            Object retobj = ct.newInstance(arglist);
-            children.put(nodeName, retobj);
-        }
-        catch (Throwable e) {
-            new CayenneRuntimeException("Error creating preference");
-        }
-        return (CayennePreference) children.get(nodeName);
-    }
-
-    public void create(String nodeName, Object obj) {
-        children.put(nodeName, obj);
-    }
-
-    public void save() {
-        if (removeObject.size() > 0) {
-            for (int i = 0; i < removeObject.size(); i++) {
-                try {
-                    delegate
-                            .getCurrentPreference()
-                            .node(removeObject.get(i))
-                            .removeNode();
-                }
-                catch (BackingStoreException e) {
-                    new CayenneRuntimeException("Error saving preference");
-                }
-            }
-        }
-
-        Iterator it = children.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry pairs = (Map.Entry) it.next();
-
-            delegate.getCurrentPreference().node((String) pairs.getKey());
-            ((CayennePreference) pairs.getValue()).saveObjectPreference();
-
-        }
-    }
-
-    public void cancel() {
-        this.children.clear();
-        initChildrenPreferences();
-    }
+	private Map<String, Object> children;
+	private List<String> removeObject;
+
+	public ChildrenMapPreference(CayennePreference delegate) {
+		super(delegate);
+		this.children = new HashMap<>();
+		this.removeObject = new ArrayList<>();
+	}
+
+	public ChildrenMapPreference(CayennePreference delegate, Preferences preferences) {
+		super(delegate);
+		delegate.setCurrentPreference(preferences);
+		this.children = new HashMap<>();
+	}
+
+	public void initChildrenPreferences() {
+		Map<String, Object> children = new HashMap<>();
+		try {
+			String[] names = getCurrentPreference().childrenNames();
+			for (int i = 0; i < names.length; i++) {
+
+				try {
+					Class cls = delegate.getClass();
+					Class partypes[] = new Class[2];
+					partypes[0] = String.class;
+					partypes[1] = boolean.class;
+					Constructor ct = cls.getConstructor(partypes);
+					Object arglist[] = new Object[2];
+					arglist[0] = names[i];
+					arglist[1] = true;
+					Object retobj = ct.newInstance(arglist);
+					children.put(names[i], retobj);
+				} catch (Throwable e) {
+					new CayenneRuntimeException("Error initializing preference", e);
+				}
+			}
+
+			this.children.putAll(children);
+		} catch (BackingStoreException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public Map getChildrenPreferences() {
+		return children;
+	}
+
+	public CayennePreference getObject(String key) {
+		return (CayennePreference) children.get(key);
+	}
+
+	public void remove(String key) {
+		removeObject.add(key);
+		children.remove(key);
+	}
+
+	public CayennePreference create(String nodeName) {
+		try {
+			Class cls = delegate.getClass();
+			Class partypes[] = new Class[2];
+			partypes[0] = String.class;
+			partypes[1] = boolean.class;
+			Constructor ct = cls.getConstructor(partypes);
+			Object arglist[] = new Object[2];
+			arglist[0] = nodeName;
+			arglist[1] = false;
+			Object retobj = ct.newInstance(arglist);
+			children.put(nodeName, retobj);
+		} catch (Throwable e) {
+			new CayenneRuntimeException("Error creating preference");
+		}
+		return (CayennePreference) children.get(nodeName);
+	}
+
+	public void create(String nodeName, Object obj) {
+		children.put(nodeName, obj);
+	}
+
+	public void save() {
+		if (removeObject.size() > 0) {
+			for (int i = 0; i < removeObject.size(); i++) {
+				try {
+					delegate.getCurrentPreference().node(removeObject.get(i)).removeNode();
+				} catch (BackingStoreException e) {
+					new CayenneRuntimeException("Error saving preference");
+				}
+			}
+		}
+
+		Iterator it = children.entrySet().iterator();
+		while (it.hasNext()) {
+			Map.Entry pairs = (Map.Entry) it.next();
+
+			delegate.getCurrentPreference().node((String) pairs.getKey());
+			((CayennePreference) pairs.getValue()).saveObjectPreference();
+
+		}
+	}
+
+	public void cancel() {
+		this.children.clear();
+		initChildrenPreferences();
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
index abfb138..5a451d3 100644
--- a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
+++ b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
@@ -48,454 +48,454 @@ import org.apache.cayenne.query.SortOrder;
  */
 public class EOQuery<T> extends SelectQuery<T> {
 
-    protected Map<String, ?> plistMap;
-    protected Map bindings;
-
-    public EOQuery(ObjEntity root, Map<String, ?> plistMap) {
-        super(root);
-        this.plistMap = plistMap;
-        initFromPlist(plistMap);
-    }
-
-    protected void initFromPlist(Map<String, ?> plistMap) {
-
-        setDistinct("YES".equalsIgnoreCase((String) plistMap.get("usesDistinct")));
-
-        Object fetchLimit = plistMap.get("fetchLimit");
-        if (fetchLimit != null) {
-            try {
-                if (fetchLimit instanceof Number) {
-                    setFetchLimit(((Number) fetchLimit).intValue());
-                } else {
-                    setFetchLimit(Integer.parseInt(fetchLimit.toString()));
-                }
-            } catch (NumberFormatException nfex) {
-                // ignoring...
-            }
-        }
-
-        // sort orderings
-        List<Map<String, String>> orderings = (List<Map<String, String>>) plistMap.get("sortOrderings");
-        if (orderings != null && !orderings.isEmpty()) {
-            for (Map<String, String> ordering : orderings) {
-                boolean asc = !"compareDescending:".equals(ordering.get("selectorName"));
-                String key = ordering.get("key");
-                if (key != null) {
-                    addOrdering(key, asc ? SortOrder.ASCENDING : SortOrder.DESCENDING);
-                }
-            }
-        }
-
-        // qualifiers
-        Map<String, ?> qualifierMap = (Map<String, ?>) plistMap.get("qualifier");
-        if (qualifierMap != null && !qualifierMap.isEmpty()) {
-            this.setQualifier(makeQualifier(qualifierMap));
-        }
-
-        // prefetches
-        List prefetches = (List) plistMap.get("prefetchingRelationshipKeyPaths");
-        if (prefetches != null && !prefetches.isEmpty()) {
-            Iterator it = prefetches.iterator();
-            while (it.hasNext()) {
-                addPrefetch((String) it.next());
-            }
-        }
-
-        // data rows - note that we do not support fetching individual columns
-        // in the
-        // modeler...
-        if (plistMap.containsKey("rawRowKeyPaths")) {
-            setFetchingDataRows(true);
-        }
-    }
-
-    public String getEOName() {
-        if (root instanceof EOObjEntity) {
-            return ((EOObjEntity) root).localQueryName(getName());
-        } else {
-            return getName();
-        }
-    }
-
-    public Collection getBindingNames() {
-        if (bindings == null) {
-            initBindings();
-        }
-
-        return bindings.keySet();
-    }
-
-    public String bindingClass(String name) {
-        if (bindings == null) {
-            initBindings();
-        }
-
-        return (String) bindings.get(name);
-    }
-
-    private synchronized void initBindings() {
-        if (bindings != null) {
-            return;
-        }
-
-        bindings = new HashMap();
-
-        if (!(root instanceof Entity)) {
-            return;
-        }
-
-        Map qualifier = (Map) plistMap.get("qualifier");
-        initBindings(bindings, (Entity) root, qualifier);
-    }
-
-    private void initBindings(Map bindings, Entity entity, Map qualifier) {
-        if (qualifier == null) {
-            return;
-        }
-
-        if ("EOKeyValueQualifier".equals(qualifier.get("class"))) {
-            String key = (String) qualifier.get("key");
-            if (key == null) {
-                return;
-            }
-
-            Object value = qualifier.get("value");
-            if (!(value instanceof Map)) {
-                return;
-            }
-
-            Map valueMap = (Map) value;
-            if (!"EOQualifierVariable".equals(valueMap.get("class")) || !valueMap.containsKey("_key")) {
-                return;
-            }
-
-            String name = (String) valueMap.get("_key");
-            String className = null;
-
-            // we don't know whether its obj path or db path, so the expression
-            // can blow
-            // ... in fact we can't support DB Path as the key is different from
-            // external
-            // name,
-            // so we will use Object type for all DB path...
-            try {
-                Object lastObject = new ASTObjPath(key).evaluate(entity);
-
-                if (lastObject instanceof ObjAttribute) {
-                    className = ((ObjAttribute) lastObject).getType();
-                } else if (lastObject instanceof ObjRelationship) {
-                    ObjEntity target = ((ObjRelationship) lastObject).getTargetEntity();
-                    if (target != null) {
-                        className = target.getClassName();
-                    }
-                }
-            } catch (ExpressionException ex) {
-                className = "java.lang.Object";
-            }
-
-            if (className == null) {
-                className = "java.lang.Object";
-            }
-
-            bindings.put(name, className);
-
-            return;
-        }
-
-        List children = (List) qualifier.get("qualifiers");
-        if (children != null) {
-            Iterator it = children.iterator();
-            while (it.hasNext()) {
-                initBindings(bindings, entity, (Map) it.next());
-            }
-        }
-    }
-
-    /**
-     * Creates the Expression equivalent of the EOFetchSpecification represented
-     * by the Map.
-     * 
-     * @param qualifierMap
-     *            - FetchSpecification to translate
-     * @return Expression equivalent to FetchSpecification
-     */
-    public synchronized Expression makeQualifier(Map<String, ?> qualifierMap) {
-        if (qualifierMap == null) {
-            return null;
-        }
-
-        return EOFetchSpecificationParser.makeQualifier((EOObjEntity) getRoot(), qualifierMap);
-    }
-
-    /**
-     * EOFetchSpecificationParser parses EOFetchSpecifications from a
-     * WebObjects-style EOModel. It recursively builds Cayenne Expression
-     * objects and assembles them into the final aggregate Expression.
-     */
-    static class EOFetchSpecificationParser {
-
-        // Xcode/EOModeler expressions have a colon at the end of the selector
-        // name
-        // (just like standard Objective-C syntax). WOLips does not. Add both
-        // sets to the hash map to handle both types of models.
-
-        // Selector strings (Java-base).
-        static final String IS_EQUAL_TO = "isEqualTo";
-        static final String IS_NOT_EQUAL_TO = "isNotEqualTo";
-        static final String IS_LIKE = "isLike";
-        static final String CASE_INSENSITIVE_LIKE = "isCaseInsensitiveLike";
-        static final String IS_LESS_THAN = "isLessThan";
-        static final String IS_LESS_THAN_OR_EQUAL_TO = "isLessThanOrEqualTo";
-        static final String IS_GREATER_THAN = "isGreaterThan";
-        static final String IS_GREATER_THAN_OR_EQUAL_TO = "isGreaterThanOrEqualTo";
-
-        private static final String OBJ_C = ":"; // Objective-C syntax addition.
-
-        private static HashMap<String, Integer> selectorToExpressionBridge;
-
-        /**
-         * selectorToExpressionBridge is just a mapping of EOModeler's selector
-         * types to Cayenne Expression types.
-         * 
-         * @return HashMap of Expression types, keyed by the corresponding
-         *         selector name
-         */
-        static synchronized HashMap<String, Integer> selectorToExpressionBridge() {
-            // Initialize selectorToExpressionBridge if needed.
-            if (null == selectorToExpressionBridge) {
-                selectorToExpressionBridge = new HashMap<String, Integer>();
-
-                selectorToExpressionBridge.put(IS_EQUAL_TO, Expression.EQUAL_TO);
-                selectorToExpressionBridge.put(IS_EQUAL_TO + OBJ_C, Expression.EQUAL_TO);
-
-                selectorToExpressionBridge.put(IS_NOT_EQUAL_TO, Expression.NOT_EQUAL_TO);
-                selectorToExpressionBridge.put(IS_NOT_EQUAL_TO + OBJ_C, Expression.NOT_EQUAL_TO);
-
-                selectorToExpressionBridge.put(IS_LIKE, Expression.LIKE);
-                selectorToExpressionBridge.put(IS_LIKE + OBJ_C, Expression.LIKE);
-
-                selectorToExpressionBridge.put(CASE_INSENSITIVE_LIKE, Expression.LIKE_IGNORE_CASE);
-                selectorToExpressionBridge.put(CASE_INSENSITIVE_LIKE + OBJ_C, Expression.LIKE_IGNORE_CASE);
-
-                selectorToExpressionBridge.put(IS_LESS_THAN, Expression.LESS_THAN);
-                selectorToExpressionBridge.put(IS_LESS_THAN + OBJ_C, Expression.LESS_THAN);
-
-                selectorToExpressionBridge.put(IS_LESS_THAN_OR_EQUAL_TO, Expression.LESS_THAN_EQUAL_TO);
-                selectorToExpressionBridge.put(IS_LESS_THAN_OR_EQUAL_TO + OBJ_C, Expression.LESS_THAN_EQUAL_TO);
-
-                selectorToExpressionBridge.put(IS_GREATER_THAN, Expression.GREATER_THAN);
-                selectorToExpressionBridge.put(IS_GREATER_THAN + OBJ_C, Expression.GREATER_THAN);
-
-                selectorToExpressionBridge.put(IS_GREATER_THAN_OR_EQUAL_TO, Expression.GREATER_THAN_EQUAL_TO);
-                selectorToExpressionBridge.put(IS_GREATER_THAN_OR_EQUAL_TO + OBJ_C, Expression.GREATER_THAN_EQUAL_TO);
-            }
-
-            return selectorToExpressionBridge;
-        }
-
-        /**
-         * isAggregate determines whether a qualifier is "aggregate" -- has
-         * children -- or "simple".
-         * 
-         * @param qualifier
-         *            - a Map containing the qualifier settings
-         * @return boolean indicating whether the qualifier is "aggregate"
-         *         qualifier
-         */
-        static boolean isAggregate(Map qualifier) {
-            boolean result = true;
-
-            String theClass = (String) qualifier.get("class");
-            if (theClass == null) {
-                return false; // should maybe throw an exception?
-            }
-            if (theClass.equalsIgnoreCase("EOKeyValueQualifier")
-                    || theClass.equalsIgnoreCase("EOKeyComparisonQualifier")) {
-                result = false;
-            }
-
-            return result;
-        }
-
-        /**
-         * expressionTypeForQualifier looks at a qualifier containing the
-         * EOModeler FetchSpecification and returns the equivalent Cayenne
-         * Expression type for its selector.
-         * 
-         * @param qualifierMap
-         *            - a Map containing the qualifier settings to examine.
-         * @return int Expression type
-         */
-        static int expressionTypeForQualifier(Map qualifierMap) {
-            // get selector
-            String selector = (String) qualifierMap.get("selectorName");
-            return expressionTypeForSelector(selector);
-        }
-
-        /**
-         * expressionTypeForSelector looks at a selector from an EOModeler
-         * FetchSpecification and returns the equivalent Cayenne Expression
-         * type.
-         * 
-         * @param selector
-         *            - a String containing the selector name.
-         * @return int Expression type
-         */
-        static int expressionTypeForSelector(String selector) {
-            Integer expType = selectorToExpressionBridge().get(selector);
-            return (expType != null ? expType.intValue() : -1);
-        }
-
-        /**
-         * aggregateExpressionClassForQualifier looks at a qualifer and returns
-         * the aggregate type: one of Expression.AND, Expression.OR, or
-         * Expression.NOT
-         * 
-         * @param qualifierMap
-         *            - containing the qualifier to examine
-         * @return int aggregate Expression type
-         */
-        static int aggregateExpressionClassForQualifier(Map qualifierMap) {
-            String qualifierClass = (String) qualifierMap.get("class");
-            if (qualifierClass != null) {
-                if (qualifierClass.equalsIgnoreCase("EOAndQualifier")) {
-                    return Expression.AND;
-                } else if (qualifierClass.equalsIgnoreCase("EOOrQualifier")) {
-                    return Expression.OR;
-                } else if (qualifierClass.equalsIgnoreCase("EONotQualifier")) {
-                    return Expression.NOT;
-                }
-            }
-
-            return -1; // error
-        }
-
-        /**
-         * makeQualifier recursively builds an Expression for each condition in
-         * the qualifierMap and assembles from them the complex Expression to
-         * represent the entire EOFetchSpecification.
-         * 
-         * @param qualifierMap
-         *            - Map representation of EOFetchSpecification
-         * @return Expression translation of the EOFetchSpecification
-         */
-        static Expression makeQualifier(EOObjEntity entity, Map qualifierMap) {
-            if (isAggregate(qualifierMap)) {
-                // the fetch specification has more than one qualifier
-                int aggregateClass = aggregateExpressionClassForQualifier(qualifierMap); // AND,
-                // OR,
-                // NOT
-
-                if (aggregateClass == Expression.NOT) {
-                    // NOT qualifiers only have one child, keyed with
-                    // "qualifier"
-                    Map child = (Map) qualifierMap.get("qualifier");
-                    // build the child expression
-                    Expression childExp = makeQualifier(entity, child);
-
-                    return childExp.notExp(); // add the "not" clause and return
-                                              // the
-                    // result
-                } else {
-                    // AND, OR qualifiers can have multiple children, keyed with
-                    // "qualifiers"
-                    // get the list of children
-                    List children = (List) qualifierMap.get("qualifiers");
-                    if (children != null) {
-                        ArrayList<Expression> childExpressions = new ArrayList<Expression>();
-                        // build an Expression for each child
-                        Iterator<Map> it = children.iterator();
-                        while (it.hasNext()) {
-                            Expression childExp = makeQualifier(entity, it.next());
-                            childExpressions.add(childExp);
-                        }
-                        // join the child expressions and return the result
-                        return ExpressionFactory.joinExp(aggregateClass, childExpressions);
-                    }
-                }
-
-            } // end if isAggregate(qualifierMap)...
-
-            // the query has a single qualifier
-            // get expression selector type
-            String qualifierClass = (String) qualifierMap.get("class");
-
-            // the key or key path we're comparing
-            String key = null;
-            // the key, keyPath, value, or parameterized value against which
-            // we're
-            // comparing the key
-            Object comparisonValue = null;
-
-            if ("EOKeyComparisonQualifier".equals(qualifierClass)) {
-                // Comparing two keys or key paths
-                key = (String) qualifierMap.get("leftValue");
-                comparisonValue = qualifierMap.get("rightValue");
-
-                // FIXME: I think EOKeyComparisonQualifier sytle Expressions are
-                // not
-                // supported...
-                return null;
-            } else if ("EOKeyValueQualifier".equals(qualifierClass)) {
-                // Comparing key with a value or parameterized value
-                key = (String) qualifierMap.get("key");
-                Object value = qualifierMap.get("value");
-
-                if (value instanceof Map) {
-                    Map<String, String> valueMap = (Map<String, String>) value;
-                    String objClass = valueMap.get("class"); // can be a
-                    // qualifier class
-                    // or java type
-
-                    if ("EOQualifierVariable".equals(objClass) && valueMap.containsKey("_key")) {
-                        // make a parameterized expression
-                        String paramName = valueMap.get("_key");
-                        comparisonValue = new ExpressionParameter(paramName);
-                    } else {
-                        Object queryVal = valueMap.get("value");
-                        if ("NSNumber".equals(objClass)) {
-                            // comparison to NSNumber -- cast
-                            comparisonValue = queryVal;
-                        } else if ("EONull".equals(objClass)) {
-                            // comparison to null
-                            comparisonValue = null;
-                        } else { // Could there be other types? boolean, date,
-                                 // etc.???
-                                 // no cast
-                            comparisonValue = queryVal;
-                        }
-                    }
-
-                } else if (value instanceof String) {
-                    // value expression
-                    comparisonValue = value;
-                } // end if (value instanceof Map) else...
-            }
-
-            // check whether the key is an object path; if at least one
-            // component is not,
-            // switch to db path..
-
-            Expression keyExp = Expression.fromString(key);
-            try {
-                entity.lastPathComponent(keyExp, Collections.emptyMap());
-            } catch (ExpressionException e) {
-                try {
-                    keyExp = entity.translateToDbPath(keyExp);
-                } catch (Exception dbpathEx) {
-                    return null;
-                }
-            }
-
-            try {
-                Expression exp = ExpressionFactory.expressionOfType(expressionTypeForQualifier(qualifierMap));
-
-                exp.setOperand(0, keyExp);
-                exp.setOperand(1, comparisonValue);
-                return exp;
-            } catch (ExpressionException e) {
-                return null;
-            }
-        }
-    }
+	protected Map<String, ?> plistMap;
+	protected Map bindings;
+
+	public EOQuery(ObjEntity root, Map<String, ?> plistMap) {
+		super(root);
+		this.plistMap = plistMap;
+		initFromPlist(plistMap);
+	}
+
+	protected void initFromPlist(Map<String, ?> plistMap) {
+
+		setDistinct("YES".equalsIgnoreCase((String) plistMap.get("usesDistinct")));
+
+		Object fetchLimit = plistMap.get("fetchLimit");
+		if (fetchLimit != null) {
+			try {
+				if (fetchLimit instanceof Number) {
+					setFetchLimit(((Number) fetchLimit).intValue());
+				} else {
+					setFetchLimit(Integer.parseInt(fetchLimit.toString()));
+				}
+			} catch (NumberFormatException nfex) {
+				// ignoring...
+			}
+		}
+
+		// sort orderings
+		List<Map<String, String>> orderings = (List<Map<String, String>>) plistMap.get("sortOrderings");
+		if (orderings != null && !orderings.isEmpty()) {
+			for (Map<String, String> ordering : orderings) {
+				boolean asc = !"compareDescending:".equals(ordering.get("selectorName"));
+				String key = ordering.get("key");
+				if (key != null) {
+					addOrdering(key, asc ? SortOrder.ASCENDING : SortOrder.DESCENDING);
+				}
+			}
+		}
+
+		// qualifiers
+		Map<String, ?> qualifierMap = (Map<String, ?>) plistMap.get("qualifier");
+		if (qualifierMap != null && !qualifierMap.isEmpty()) {
+			this.setQualifier(makeQualifier(qualifierMap));
+		}
+
+		// prefetches
+		List prefetches = (List) plistMap.get("prefetchingRelationshipKeyPaths");
+		if (prefetches != null && !prefetches.isEmpty()) {
+			Iterator it = prefetches.iterator();
+			while (it.hasNext()) {
+				addPrefetch((String) it.next());
+			}
+		}
+
+		// data rows - note that we do not support fetching individual columns
+		// in the
+		// modeler...
+		if (plistMap.containsKey("rawRowKeyPaths")) {
+			setFetchingDataRows(true);
+		}
+	}
+
+	public String getEOName() {
+		if (root instanceof EOObjEntity) {
+			return ((EOObjEntity) root).localQueryName(getName());
+		} else {
+			return getName();
+		}
+	}
+
+	public Collection getBindingNames() {
+		if (bindings == null) {
+			initBindings();
+		}
+
+		return bindings.keySet();
+	}
+
+	public String bindingClass(String name) {
+		if (bindings == null) {
+			initBindings();
+		}
+
+		return (String) bindings.get(name);
+	}
+
+	private synchronized void initBindings() {
+		if (bindings != null) {
+			return;
+		}
+
+		bindings = new HashMap();
+
+		if (!(root instanceof Entity)) {
+			return;
+		}
+
+		Map qualifier = (Map) plistMap.get("qualifier");
+		initBindings(bindings, (Entity) root, qualifier);
+	}
+
+	private void initBindings(Map bindings, Entity entity, Map qualifier) {
+		if (qualifier == null) {
+			return;
+		}
+
+		if ("EOKeyValueQualifier".equals(qualifier.get("class"))) {
+			String key = (String) qualifier.get("key");
+			if (key == null) {
+				return;
+			}
+
+			Object value = qualifier.get("value");
+			if (!(value instanceof Map)) {
+				return;
+			}
+
+			Map valueMap = (Map) value;
+			if (!"EOQualifierVariable".equals(valueMap.get("class")) || !valueMap.containsKey("_key")) {
+				return;
+			}
+
+			String name = (String) valueMap.get("_key");
+			String className = null;
+
+			// we don't know whether its obj path or db path, so the expression
+			// can blow
+			// ... in fact we can't support DB Path as the key is different from
+			// external
+			// name,
+			// so we will use Object type for all DB path...
+			try {
+				Object lastObject = new ASTObjPath(key).evaluate(entity);
+
+				if (lastObject instanceof ObjAttribute) {
+					className = ((ObjAttribute) lastObject).getType();
+				} else if (lastObject instanceof ObjRelationship) {
+					ObjEntity target = ((ObjRelationship) lastObject).getTargetEntity();
+					if (target != null) {
+						className = target.getClassName();
+					}
+				}
+			} catch (ExpressionException ex) {
+				className = "java.lang.Object";
+			}
+
+			if (className == null) {
+				className = "java.lang.Object";
+			}
+
+			bindings.put(name, className);
+
+			return;
+		}
+
+		List children = (List) qualifier.get("qualifiers");
+		if (children != null) {
+			Iterator it = children.iterator();
+			while (it.hasNext()) {
+				initBindings(bindings, entity, (Map) it.next());
+			}
+		}
+	}
+
+	/**
+	 * Creates the Expression equivalent of the EOFetchSpecification represented
+	 * by the Map.
+	 * 
+	 * @param qualifierMap
+	 *            - FetchSpecification to translate
+	 * @return Expression equivalent to FetchSpecification
+	 */
+	public synchronized Expression makeQualifier(Map<String, ?> qualifierMap) {
+		if (qualifierMap == null) {
+			return null;
+		}
+
+		return EOFetchSpecificationParser.makeQualifier((EOObjEntity) getRoot(), qualifierMap);
+	}
+
+	/**
+	 * EOFetchSpecificationParser parses EOFetchSpecifications from a
+	 * WebObjects-style EOModel. It recursively builds Cayenne Expression
+	 * objects and assembles them into the final aggregate Expression.
+	 */
+	static class EOFetchSpecificationParser {
+
+		// Xcode/EOModeler expressions have a colon at the end of the selector
+		// name
+		// (just like standard Objective-C syntax). WOLips does not. Add both
+		// sets to the hash map to handle both types of models.
+
+		// Selector strings (Java-base).
+		static final String IS_EQUAL_TO = "isEqualTo";
+		static final String IS_NOT_EQUAL_TO = "isNotEqualTo";
+		static final String IS_LIKE = "isLike";
+		static final String CASE_INSENSITIVE_LIKE = "isCaseInsensitiveLike";
+		static final String IS_LESS_THAN = "isLessThan";
+		static final String IS_LESS_THAN_OR_EQUAL_TO = "isLessThanOrEqualTo";
+		static final String IS_GREATER_THAN = "isGreaterThan";
+		static final String IS_GREATER_THAN_OR_EQUAL_TO = "isGreaterThanOrEqualTo";
+
+		private static final String OBJ_C = ":"; // Objective-C syntax addition.
+
+		private static Map<String, Integer> selectorToExpressionBridge;
+
+		/**
+		 * selectorToExpressionBridge is just a mapping of EOModeler's selector
+		 * types to Cayenne Expression types.
+		 * 
+		 * @return HashMap of Expression types, keyed by the corresponding
+		 *         selector name
+		 */
+		static synchronized Map<String, Integer> selectorToExpressionBridge() {
+			// Initialize selectorToExpressionBridge if needed.
+			if (null == selectorToExpressionBridge) {
+				selectorToExpressionBridge = new HashMap<>();
+
+				selectorToExpressionBridge.put(IS_EQUAL_TO, Expression.EQUAL_TO);
+				selectorToExpressionBridge.put(IS_EQUAL_TO + OBJ_C, Expression.EQUAL_TO);
+
+				selectorToExpressionBridge.put(IS_NOT_EQUAL_TO, Expression.NOT_EQUAL_TO);
+				selectorToExpressionBridge.put(IS_NOT_EQUAL_TO + OBJ_C, Expression.NOT_EQUAL_TO);
+
+				selectorToExpressionBridge.put(IS_LIKE, Expression.LIKE);
+				selectorToExpressionBridge.put(IS_LIKE + OBJ_C, Expression.LIKE);
+
+				selectorToExpressionBridge.put(CASE_INSENSITIVE_LIKE, Expression.LIKE_IGNORE_CASE);
+				selectorToExpressionBridge.put(CASE_INSENSITIVE_LIKE + OBJ_C, Expression.LIKE_IGNORE_CASE);
+
+				selectorToExpressionBridge.put(IS_LESS_THAN, Expression.LESS_THAN);
+				selectorToExpressionBridge.put(IS_LESS_THAN + OBJ_C, Expression.LESS_THAN);
+
+				selectorToExpressionBridge.put(IS_LESS_THAN_OR_EQUAL_TO, Expression.LESS_THAN_EQUAL_TO);
+				selectorToExpressionBridge.put(IS_LESS_THAN_OR_EQUAL_TO + OBJ_C, Expression.LESS_THAN_EQUAL_TO);
+
+				selectorToExpressionBridge.put(IS_GREATER_THAN, Expression.GREATER_THAN);
+				selectorToExpressionBridge.put(IS_GREATER_THAN + OBJ_C, Expression.GREATER_THAN);
+
+				selectorToExpressionBridge.put(IS_GREATER_THAN_OR_EQUAL_TO, Expression.GREATER_THAN_EQUAL_TO);
+				selectorToExpressionBridge.put(IS_GREATER_THAN_OR_EQUAL_TO + OBJ_C, Expression.GREATER_THAN_EQUAL_TO);
+			}
+
+			return selectorToExpressionBridge;
+		}
+
+		/**
+		 * isAggregate determines whether a qualifier is "aggregate" -- has
+		 * children -- or "simple".
+		 * 
+		 * @param qualifier
+		 *            - a Map containing the qualifier settings
+		 * @return boolean indicating whether the qualifier is "aggregate"
+		 *         qualifier
+		 */
+		static boolean isAggregate(Map qualifier) {
+			boolean result = true;
+
+			String theClass = (String) qualifier.get("class");
+			if (theClass == null) {
+				return false; // should maybe throw an exception?
+			}
+			if (theClass.equalsIgnoreCase("EOKeyValueQualifier")
+					|| theClass.equalsIgnoreCase("EOKeyComparisonQualifier")) {
+				result = false;
+			}
+
+			return result;
+		}
+
+		/**
+		 * expressionTypeForQualifier looks at a qualifier containing the
+		 * EOModeler FetchSpecification and returns the equivalent Cayenne
+		 * Expression type for its selector.
+		 * 
+		 * @param qualifierMap
+		 *            - a Map containing the qualifier settings to examine.
+		 * @return int Expression type
+		 */
+		static int expressionTypeForQualifier(Map qualifierMap) {
+			// get selector
+			String selector = (String) qualifierMap.get("selectorName");
+			return expressionTypeForSelector(selector);
+		}
+
+		/**
+		 * expressionTypeForSelector looks at a selector from an EOModeler
+		 * FetchSpecification and returns the equivalent Cayenne Expression
+		 * type.
+		 * 
+		 * @param selector
+		 *            - a String containing the selector name.
+		 * @return int Expression type
+		 */
+		static int expressionTypeForSelector(String selector) {
+			Integer expType = selectorToExpressionBridge().get(selector);
+			return (expType != null ? expType.intValue() : -1);
+		}
+
+		/**
+		 * aggregateExpressionClassForQualifier looks at a qualifer and returns
+		 * the aggregate type: one of Expression.AND, Expression.OR, or
+		 * Expression.NOT
+		 * 
+		 * @param qualifierMap
+		 *            - containing the qualifier to examine
+		 * @return int aggregate Expression type
+		 */
+		static int aggregateExpressionClassForQualifier(Map qualifierMap) {
+			String qualifierClass = (String) qualifierMap.get("class");
+			if (qualifierClass != null) {
+				if (qualifierClass.equalsIgnoreCase("EOAndQualifier")) {
+					return Expression.AND;
+				} else if (qualifierClass.equalsIgnoreCase("EOOrQualifier")) {
+					return Expression.OR;
+				} else if (qualifierClass.equalsIgnoreCase("EONotQualifier")) {
+					return Expression.NOT;
+				}
+			}
+
+			return -1; // error
+		}
+
+		/**
+		 * makeQualifier recursively builds an Expression for each condition in
+		 * the qualifierMap and assembles from them the complex Expression to
+		 * represent the entire EOFetchSpecification.
+		 * 
+		 * @param qualifierMap
+		 *            - Map representation of EOFetchSpecification
+		 * @return Expression translation of the EOFetchSpecification
+		 */
+		static Expression makeQualifier(EOObjEntity entity, Map qualifierMap) {
+			if (isAggregate(qualifierMap)) {
+				// the fetch specification has more than one qualifier
+				int aggregateClass = aggregateExpressionClassForQualifier(qualifierMap); // AND,
+				// OR,
+				// NOT
+
+				if (aggregateClass == Expression.NOT) {
+					// NOT qualifiers only have one child, keyed with
+					// "qualifier"
+					Map child = (Map) qualifierMap.get("qualifier");
+					// build the child expression
+					Expression childExp = makeQualifier(entity, child);
+
+					return childExp.notExp(); // add the "not" clause and return
+												// the
+					// result
+				} else {
+					// AND, OR qualifiers can have multiple children, keyed with
+					// "qualifiers"
+					// get the list of children
+					List children = (List) qualifierMap.get("qualifiers");
+					if (children != null) {
+						ArrayList<Expression> childExpressions = new ArrayList<Expression>();
+						// build an Expression for each child
+						Iterator<Map> it = children.iterator();
+						while (it.hasNext()) {
+							Expression childExp = makeQualifier(entity, it.next());
+							childExpressions.add(childExp);
+						}
+						// join the child expressions and return the result
+						return ExpressionFactory.joinExp(aggregateClass, childExpressions);
+					}
+				}
+
+			} // end if isAggregate(qualifierMap)...
+
+			// the query has a single qualifier
+			// get expression selector type
+			String qualifierClass = (String) qualifierMap.get("class");
+
+			// the key or key path we're comparing
+			String key = null;
+			// the key, keyPath, value, or parameterized value against which
+			// we're
+			// comparing the key
+			Object comparisonValue = null;
+
+			if ("EOKeyComparisonQualifier".equals(qualifierClass)) {
+				// Comparing two keys or key paths
+				key = (String) qualifierMap.get("leftValue");
+				comparisonValue = qualifierMap.get("rightValue");
+
+				// FIXME: I think EOKeyComparisonQualifier sytle Expressions are
+				// not
+				// supported...
+				return null;
+			} else if ("EOKeyValueQualifier".equals(qualifierClass)) {
+				// Comparing key with a value or parameterized value
+				key = (String) qualifierMap.get("key");
+				Object value = qualifierMap.get("value");
+
+				if (value instanceof Map) {
+					Map<String, String> valueMap = (Map<String, String>) value;
+					String objClass = valueMap.get("class"); // can be a
+					// qualifier class
+					// or java type
+
+					if ("EOQualifierVariable".equals(objClass) && valueMap.containsKey("_key")) {
+						// make a parameterized expression
+						String paramName = valueMap.get("_key");
+						comparisonValue = new ExpressionParameter(paramName);
+					} else {
+						Object queryVal = valueMap.get("value");
+						if ("NSNumber".equals(objClass)) {
+							// comparison to NSNumber -- cast
+							comparisonValue = queryVal;
+						} else if ("EONull".equals(objClass)) {
+							// comparison to null
+							comparisonValue = null;
+						} else { // Could there be other types? boolean, date,
+									// etc.???
+									// no cast
+							comparisonValue = queryVal;
+						}
+					}
+
+				} else if (value instanceof String) {
+					// value expression
+					comparisonValue = value;
+				} // end if (value instanceof Map) else...
+			}
+
+			// check whether the key is an object path; if at least one
+			// component is not,
+			// switch to db path..
+
+			Expression keyExp = Expression.fromString(key);
+			try {
+				entity.lastPathComponent(keyExp, Collections.emptyMap());
+			} catch (ExpressionException e) {
+				try {
+					keyExp = entity.translateToDbPath(keyExp);
+				} catch (Exception dbpathEx) {
+					return null;
+				}
+			}
+
+			try {
+				Expression exp = ExpressionFactory.expressionOfType(expressionTypeForQualifier(qualifierMap));
+
+				exp.setOperand(0, keyExp);
+				exp.setOperand(1, comparisonValue);
+				return exp;
+			} catch (ExpressionException e) {
+				return null;
+			}
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/parser/DefaultPlistDataStructureFactory.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/parser/DefaultPlistDataStructureFactory.java b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/parser/DefaultPlistDataStructureFactory.java
index 75837de..a035fad 100644
--- a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/parser/DefaultPlistDataStructureFactory.java
+++ b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/parser/DefaultPlistDataStructureFactory.java
@@ -28,11 +28,13 @@ import org.apache.cayenne.wocompat.PlistDataStructureFactory;
 
 class DefaultPlistDataStructureFactory implements PlistDataStructureFactory {
 
-    public Collection<Object> createCollection(String keyPath) {
-        return new ArrayList<Object>();
-    }
+	@Override
+	public Collection<Object> createCollection(String keyPath) {
+		return new ArrayList<Object>();
+	}
 
-    public Map<String, Object> createMap(String keyPath) {
-        return new HashMap<String, Object>();
-    }
+	@Override
+	public Map<String, Object> createMap(String keyPath) {
+		return new HashMap<>();
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/13d0da53/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
index 278b8c9..3997b06 100644
--- a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
+++ b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
@@ -33,7 +33,7 @@ public class Main {
 
     public static void main(String[] args) {
 
-        Map<String, String> properties = new HashMap<String, String>();
+        Map<String, String> properties = new HashMap<>();
         properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial-rop-server/cayenne-service");
         properties.put(Constants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
         properties.put(Constants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");


Mime
View raw message