From 352bc4c0838b06af94d0db36ae839407bf619787 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Wed, 12 Jul 2017 18:16:48 +0200 Subject: [PATCH] MemberShareDAO and MemberAssetDAO are never used --- .../hsadmin/dao/customer/MemberAssetDao.java | 35 ------------------- .../hsadmin/dao/customer/MemberShareDao.java | 35 ------------------- .../service/customer/MemberAssetService.java | 7 +--- .../service/customer/MemberShareService.java | 7 +--- .../customer/MemberShareServiceTest.java | 6 +--- 5 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 cust-services/src/main/java/de/hsadmin/dao/customer/MemberAssetDao.java delete mode 100644 cust-services/src/main/java/de/hsadmin/dao/customer/MemberShareDao.java diff --git a/cust-services/src/main/java/de/hsadmin/dao/customer/MemberAssetDao.java b/cust-services/src/main/java/de/hsadmin/dao/customer/MemberAssetDao.java deleted file mode 100644 index 26f88fe..0000000 --- a/cust-services/src/main/java/de/hsadmin/dao/customer/MemberAssetDao.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.hsadmin.dao.customer; - -import javax.ejb.Stateless; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import de.hsadmin.bo.customer.MemberAsset; -import de.hsadmin.common.error.TechnicalException; -import de.hsadmin.common.error.UserException; -import de.hsadmin.service.customer.MemberAssetVO; - -@Stateless -public class MemberAssetDao { - - @PersistenceContext(name="hsar") - private EntityManager entityManager; - - public MemberAsset findMemberAssetByValues(MemberAssetVO prototype) throws UserException, TechnicalException { - // TODO MHOENNIG -> PHORMANNS: warum werden immer alle verglichen? OptimisticLocking? - // (p.s. code analog zu Beispielen von dir) - final Query query = entityManager.createQuery("SELECT s FROM MemberAsset s " + - "WHERE s.customer.name = :customer " + - " AND m.action = :action " + - " AND m.date.name = :date" + - " AND m.amount = :amount" + - " AND m.comment = :comment"); - query.setParameter("customer", prototype.get("customer").getValue()); - query.setParameter("action", prototype.get("action").getValue()); - query.setParameter("date", prototype.get("date").getValue()); - query.setParameter("amount", prototype.get("amount").getValue()); - query.setParameter("comment", prototype.get("comment").getValue()); - return (MemberAsset) query.getSingleResult(); - } -} \ No newline at end of file diff --git a/cust-services/src/main/java/de/hsadmin/dao/customer/MemberShareDao.java b/cust-services/src/main/java/de/hsadmin/dao/customer/MemberShareDao.java deleted file mode 100644 index f9ebd3b..0000000 --- a/cust-services/src/main/java/de/hsadmin/dao/customer/MemberShareDao.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.hsadmin.dao.customer; - -import javax.ejb.Stateless; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import de.hsadmin.bo.customer.MemberShare; -import de.hsadmin.common.error.TechnicalException; -import de.hsadmin.common.error.UserException; -import de.hsadmin.service.customer.MemberShareVO; - -@Stateless -public class MemberShareDao { - - @PersistenceContext(name="hsar") - private EntityManager entityManager; - - public MemberShare findMemberShareByValues(MemberShareVO prototype) throws UserException, TechnicalException { - // TODO MHOENNIG -> PHORMANNS: warum werden immer alle verglichen? OptimisticLocking? - // (p.s. code analog zu Beispielen von dir) - final Query query = entityManager.createQuery("SELECT s FROM MemberShare s " + - "WHERE s.customer.name = :customer " + - " AND m.action = :action " + - " AND m.date.name = :date" + - " AND m.quantity = :quantity"+ - " AND m.comment = :comment"); - query.setParameter("customer", prototype.get("customer").getValue()); - query.setParameter("action", prototype.get("action").getValue()); - query.setParameter("date", prototype.get("date").getValue()); - query.setParameter("quantity", prototype.get("quantity").getValue()); - query.setParameter("comment", prototype.get("comment").getValue()); - return (MemberShare) query.getSingleResult(); - } -} diff --git a/cust-services/src/main/java/de/hsadmin/service/customer/MemberAssetService.java b/cust-services/src/main/java/de/hsadmin/service/customer/MemberAssetService.java index 825fb26..df09600 100644 --- a/cust-services/src/main/java/de/hsadmin/service/customer/MemberAssetService.java +++ b/cust-services/src/main/java/de/hsadmin/service/customer/MemberAssetService.java @@ -13,7 +13,6 @@ import de.hsadmin.bo.customer.MemberAsset; import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.UserException; import de.hsadmin.dao.customer.CustomerDao; -import de.hsadmin.dao.customer.MemberAssetDao; import de.hsadmin.login.RequestContext; import de.hsadmin.login.RequiredScope; import de.hsadmin.login.Role; @@ -30,16 +29,12 @@ public class MemberAssetService extends AbstractModule implements @EJB private CustomerDao customerDao; - @EJB - private MemberAssetDao memberAssetDao; - public MemberAssetService() { } - public MemberAssetService(final EntityManager em, final CustomerDao customerDao, final MemberAssetDao memberAssetDao) { + public MemberAssetService(final EntityManager em, final CustomerDao customerDao) { this.entityManager = em; this.customerDao = customerDao; - this.memberAssetDao = memberAssetDao; } @Override diff --git a/cust-services/src/main/java/de/hsadmin/service/customer/MemberShareService.java b/cust-services/src/main/java/de/hsadmin/service/customer/MemberShareService.java index 202010a..df7cfd7 100644 --- a/cust-services/src/main/java/de/hsadmin/service/customer/MemberShareService.java +++ b/cust-services/src/main/java/de/hsadmin/service/customer/MemberShareService.java @@ -13,7 +13,6 @@ import de.hsadmin.bo.customer.MemberShare; import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.UserException; import de.hsadmin.dao.customer.CustomerDao; -import de.hsadmin.dao.customer.MemberShareDao; import de.hsadmin.login.RequestContext; import de.hsadmin.login.RequiredScope; import de.hsadmin.login.Role; @@ -30,16 +29,12 @@ public class MemberShareService extends AbstractModule implements @EJB private CustomerDao customerDao; - @EJB - private MemberShareDao memberShareDao; - public MemberShareService() { } - public MemberShareService(final EntityManager em, final CustomerDao customerDao, final MemberShareDao memberShareDao) { + public MemberShareService(final EntityManager em, final CustomerDao customerDao) { this.entityManager = em; this.customerDao = customerDao; - this.memberShareDao = memberShareDao; } @Override diff --git a/cust-services/src/test/java/de/hsadmin/service/customer/MemberShareServiceTest.java b/cust-services/src/test/java/de/hsadmin/service/customer/MemberShareServiceTest.java index f20a2de..7854574 100644 --- a/cust-services/src/test/java/de/hsadmin/service/customer/MemberShareServiceTest.java +++ b/cust-services/src/test/java/de/hsadmin/service/customer/MemberShareServiceTest.java @@ -23,7 +23,6 @@ import de.hsadmin.bo.customer.MemberShareAction; import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.UserException; import de.hsadmin.dao.customer.CustomerDao; -import de.hsadmin.dao.customer.MemberShareDao; import de.hsadmin.login.RequestContext; import de.hsadmin.login.Role; import de.hsadmin.test.CauseMatcher; @@ -39,9 +38,6 @@ public class MemberShareServiceTest { @Mock private CustomerDao customerDaoMock; - @Mock - private MemberShareDao memberShareDao; - @Rule public ExpectedException expectedExeption = ExpectedException.none(); @@ -52,7 +48,7 @@ public class MemberShareServiceTest { @Before public void init() { MockitoAnnotations.initMocks(this); - memberShareService = new MemberShareService(emMock, customerDaoMock, memberShareDao) { + memberShareService = new MemberShareService(emMock, customerDaoMock) { @Override List runCriteriaQuery(MemberShareVO criteria) throws UserException, TechnicalException { return memberSharesCriteriaQueryResult;