MemberShareDAO and MemberAssetDAO are never used

This commit is contained in:
Peter Hormanns 2017-07-12 18:16:48 +02:00
parent 6c54a57852
commit 352bc4c083
5 changed files with 3 additions and 87 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -13,7 +13,6 @@ import de.hsadmin.bo.customer.MemberAsset;
import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.common.error.UserException; import de.hsadmin.common.error.UserException;
import de.hsadmin.dao.customer.CustomerDao; import de.hsadmin.dao.customer.CustomerDao;
import de.hsadmin.dao.customer.MemberAssetDao;
import de.hsadmin.login.RequestContext; import de.hsadmin.login.RequestContext;
import de.hsadmin.login.RequiredScope; import de.hsadmin.login.RequiredScope;
import de.hsadmin.login.Role; import de.hsadmin.login.Role;
@ -30,16 +29,12 @@ public class MemberAssetService extends AbstractModule<MemberAssetVO> implements
@EJB @EJB
private CustomerDao customerDao; private CustomerDao customerDao;
@EJB
private MemberAssetDao memberAssetDao;
public MemberAssetService() { 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.entityManager = em;
this.customerDao = customerDao; this.customerDao = customerDao;
this.memberAssetDao = memberAssetDao;
} }
@Override @Override

View File

@ -13,7 +13,6 @@ import de.hsadmin.bo.customer.MemberShare;
import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.common.error.UserException; import de.hsadmin.common.error.UserException;
import de.hsadmin.dao.customer.CustomerDao; import de.hsadmin.dao.customer.CustomerDao;
import de.hsadmin.dao.customer.MemberShareDao;
import de.hsadmin.login.RequestContext; import de.hsadmin.login.RequestContext;
import de.hsadmin.login.RequiredScope; import de.hsadmin.login.RequiredScope;
import de.hsadmin.login.Role; import de.hsadmin.login.Role;
@ -30,16 +29,12 @@ public class MemberShareService extends AbstractModule<MemberShareVO> implements
@EJB @EJB
private CustomerDao customerDao; private CustomerDao customerDao;
@EJB
private MemberShareDao memberShareDao;
public MemberShareService() { 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.entityManager = em;
this.customerDao = customerDao; this.customerDao = customerDao;
this.memberShareDao = memberShareDao;
} }
@Override @Override

View File

@ -23,7 +23,6 @@ import de.hsadmin.bo.customer.MemberShareAction;
import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.common.error.UserException; import de.hsadmin.common.error.UserException;
import de.hsadmin.dao.customer.CustomerDao; import de.hsadmin.dao.customer.CustomerDao;
import de.hsadmin.dao.customer.MemberShareDao;
import de.hsadmin.login.RequestContext; import de.hsadmin.login.RequestContext;
import de.hsadmin.login.Role; import de.hsadmin.login.Role;
import de.hsadmin.test.CauseMatcher; import de.hsadmin.test.CauseMatcher;
@ -39,9 +38,6 @@ public class MemberShareServiceTest {
@Mock @Mock
private CustomerDao customerDaoMock; private CustomerDao customerDaoMock;
@Mock
private MemberShareDao memberShareDao;
@Rule @Rule
public ExpectedException expectedExeption = ExpectedException.none(); public ExpectedException expectedExeption = ExpectedException.none();
@ -52,7 +48,7 @@ public class MemberShareServiceTest {
@Before @Before
public void init() { public void init() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
memberShareService = new MemberShareService(emMock, customerDaoMock, memberShareDao) { memberShareService = new MemberShareService(emMock, customerDaoMock) {
@Override @Override
List<MemberShare> runCriteriaQuery(MemberShareVO criteria) throws UserException, TechnicalException { List<MemberShare> runCriteriaQuery(MemberShareVO criteria) throws UserException, TechnicalException {
return memberSharesCriteriaQueryResult; return memberSharesCriteriaQueryResult;