You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2016/11/04 09:34:28 UTC
[2/2] cayenne git commit: cleanup
cleanup
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/f0c0326f
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/f0c0326f
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/f0c0326f
Branch: refs/heads/master
Commit: f0c0326f33a3c911635417ef65cd575fc3f892dc
Parents: a30d9a7
Author: Andrus Adamchik <an...@objectstyle.com>
Authored: Fri Nov 4 12:27:20 2016 +0300
Committer: Andrus Adamchik <an...@objectstyle.com>
Committed: Fri Nov 4 12:29:25 2016 +0300
----------------------------------------------------------------------
.../dbimport/DbImportDbLoaderDelegate.java | 86 --------------------
.../dbimport/DbImportDbLoaderDelegateTest.java | 77 ------------------
.../modeler/dialog/db/DbLoaderHelper.java | 20 -----
3 files changed, 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f0c0326f/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegate.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegate.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegate.java
deleted file mode 100644
index 0de47ab..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.tools.dbimport;
-
-import org.apache.cayenne.dbsync.reverse.db.DefaultDbLoaderDelegate;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.ObjEntity;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @since 4.0
- */
-class DbImportDbLoaderDelegate extends DefaultDbLoaderDelegate {
-
- private final List<DbEntity> addedDbEntities;
- private final List<DbEntity> removedDbEntities;
- private final List<ObjEntity> addedObjEntities;
- private final List<ObjEntity> removedObjEntities;
-
- DbImportDbLoaderDelegate() {
- addedDbEntities = new ArrayList<>();
- removedDbEntities = new ArrayList<>();
- addedObjEntities = new ArrayList<>();
- removedObjEntities = new ArrayList<>();
- }
-
- @Override
- public void dbEntityAdded(DbEntity ent) {
- ent.getDataMap().addDbEntity(ent);
- addedDbEntities.add(ent);
- }
-
- @Override
- public void dbEntityRemoved(DbEntity ent) {
- ent.getDataMap().removeDbEntity(ent.getName());
- removedDbEntities.add(ent);
- }
-
- @Override
- public void objEntityAdded(ObjEntity ent) {
- ent.getDataMap().addObjEntity(ent);
- addedObjEntities.add(ent);
- }
-
- @Override
- public void objEntityRemoved(ObjEntity ent) {
- ent.getDataMap().removeObjEntity(ent.getName());
- removedObjEntities.add(ent);
- }
-
- public List<DbEntity> getAddedDbEntities() {
- return Collections.unmodifiableList(addedDbEntities);
- }
-
- public List<DbEntity> getRemovedDbEntities() {
- return Collections.unmodifiableList(removedDbEntities);
- }
-
- public List<ObjEntity> getAddedObjEntities() {
- return Collections.unmodifiableList(addedObjEntities);
- }
-
- public List<ObjEntity> getRemovedObjEntities() {
- return Collections.unmodifiableList(removedObjEntities);
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f0c0326f/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegateTest.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegateTest.java b/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegateTest.java
deleted file mode 100644
index 6e0858d..0000000
--- a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportDbLoaderDelegateTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.tools.dbimport;
-
-import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.ObjEntity;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class DbImportDbLoaderDelegateTest {
-
- private DbImportDbLoaderDelegate delegate;
- private DataMap dataMap;
- private DbEntity dbEntity;
- private ObjEntity objEntity;
-
- @Before
- public void setUp() {
- delegate = new DbImportDbLoaderDelegate();
- dataMap = new DataMap();
-
- dbEntity = new DbEntity("TestDbEntity");
- dbEntity.setDataMap(dataMap);
-
- objEntity = new ObjEntity("TestObjEntity");
- objEntity.setDataMap(dataMap);
- }
-
- @Test
- public void testDbEntityAdded() {
- delegate.dbEntityAdded(dbEntity);
-
- final List<DbEntity> entities = Arrays.asList(dbEntity);
-
- assertEquals(1, dataMap.getDbEntities().size());
- assertTrue(dataMap.getDbEntities().containsAll(entities));
-
- assertEquals(entities, delegate.getAddedDbEntities());
- }
-
- @Test
- public void testDbEntityRemoved() {
- // Make sure the entity is in the datamap to start.
- dataMap.addDbEntity(dbEntity);
-
- delegate.dbEntityRemoved(dbEntity);
-
- // The entity should no longer be in the map.
- assertEquals(0, dataMap.getDbEntities().size());
-
- assertEquals(Arrays.asList(dbEntity), delegate.getRemovedDbEntities());
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f0c0326f/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
index 81b10be..7e1fc2a 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
@@ -226,17 +226,6 @@ public class DbLoaderHelper {
}
@Override
- public void objEntityAdded(ObjEntity entity) {
- checkCanceled();
-
- loadStatusNote = "Creating ObjEntity '" + entity.getName() + "'...";
-
- if (existingMap) {
- mediator.fireObjEntityEvent(new EntityEvent(this, entity, MapEvent.ADD));
- }
- }
-
- @Override
public void dbEntityRemoved(DbEntity entity) {
checkCanceled();
@@ -246,15 +235,6 @@ public class DbLoaderHelper {
}
@Override
- public void objEntityRemoved(ObjEntity entity) {
- checkCanceled();
-
- if (existingMap) {
- mediator.fireObjEntityEvent(new EntityEvent(Application.getFrame(), entity, MapEvent.REMOVE));
- }
- }
-
- @Override
public boolean dbRelationship(DbEntity entity) {
checkCanceled();