net.nan21.dnet.module.md.bp.business.serviceimpl.CustomerGroupAcctService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nan21.dnet.module.md.business Show documentation
Show all versions of nan21.dnet.module.md.business Show documentation
MD module business layer implementation.
The newest version!
/*
* DNet eBusiness Suite
* Copyright: 2010-2013 Nan21 Electronics SRL. All rights reserved.
* Use is subject to license terms.
*/
package net.nan21.dnet.module.md.bp.business.serviceimpl;
import java.util.List;
import javax.persistence.EntityManager;
import net.nan21.dnet.core.api.session.Session;
import net.nan21.dnet.core.business.service.entity.AbstractEntityService;
import net.nan21.dnet.module.md.acc.domain.entity.AccSchema;
import net.nan21.dnet.module.md.acc.domain.entity.Account;
import net.nan21.dnet.module.md.bp.business.service.ICustomerGroupAcctService;
import net.nan21.dnet.module.md.bp.domain.entity.CustomerGroup;
import net.nan21.dnet.module.md.bp.domain.entity.CustomerGroupAcct;
/**
* Repository functionality for {@link CustomerGroupAcct} domain entity. It contains
* finder methods based on unique keys as well as reference fields.
*
*/
public class CustomerGroupAcctService
extends
AbstractEntityService
implements
ICustomerGroupAcctService {
public CustomerGroupAcctService() {
super();
}
public CustomerGroupAcctService(EntityManager em) {
super();
this.setEntityManager(em);
}
@Override
public Class getEntityClass() {
return CustomerGroupAcct.class;
}
/**
* Find by unique key
*/
public CustomerGroupAcct findByGroup_schema(CustomerGroup custGroup,
AccSchema accSchema) {
return (CustomerGroupAcct) this.getEntityManager()
.createNamedQuery(CustomerGroupAcct.NQ_FIND_BY_GROUP_SCHEMA)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pCustGroup", custGroup)
.setParameter("pAccSchema", accSchema).getSingleResult();
}
/**
* Find by unique key
*/
public CustomerGroupAcct findByGroup_schema(Long custGroupId,
Long accSchemaId) {
return (CustomerGroupAcct) this
.getEntityManager()
.createNamedQuery(
CustomerGroupAcct.NQ_FIND_BY_GROUP_SCHEMA_PRIMITIVE)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pCustGroupId", custGroupId)
.setParameter("pAccSchemaId", accSchemaId).getSingleResult();
}
/**
* Find by reference: custGroup
*/
public List findByCustGroup(CustomerGroup custGroup) {
return this.findByCustGroupId(custGroup.getId());
}
/**
* Find by ID of reference: custGroup.id
*/
public List findByCustGroupId(Long custGroupId) {
return (List) this
.getEntityManager()
.createQuery(
"select e from CustomerGroupAcct e where e.clientId = :pClientId and e.custGroup.id = :pCustGroupId",
CustomerGroupAcct.class)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pCustGroupId", custGroupId).getResultList();
}
/**
* Find by reference: accSchema
*/
public List findByAccSchema(AccSchema accSchema) {
return this.findByAccSchemaId(accSchema.getId());
}
/**
* Find by ID of reference: accSchema.id
*/
public List findByAccSchemaId(Long accSchemaId) {
return (List) this
.getEntityManager()
.createQuery(
"select e from CustomerGroupAcct e where e.clientId = :pClientId and e.accSchema.id = :pAccSchemaId",
CustomerGroupAcct.class)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pAccSchemaId", accSchemaId).getResultList();
}
/**
* Find by reference: salesAccount
*/
public List findBySalesAccount(Account salesAccount) {
return this.findBySalesAccountId(salesAccount.getId());
}
/**
* Find by ID of reference: salesAccount.id
*/
public List findBySalesAccountId(Long salesAccountId) {
return (List) this
.getEntityManager()
.createQuery(
"select e from CustomerGroupAcct e where e.clientId = :pClientId and e.salesAccount.id = :pSalesAccountId",
CustomerGroupAcct.class)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pSalesAccountId", salesAccountId)
.getResultList();
}
/**
* Find by reference: prepayAccount
*/
public List findByPrepayAccount(Account prepayAccount) {
return this.findByPrepayAccountId(prepayAccount.getId());
}
/**
* Find by ID of reference: prepayAccount.id
*/
public List findByPrepayAccountId(Long prepayAccountId) {
return (List) this
.getEntityManager()
.createQuery(
"select e from CustomerGroupAcct e where e.clientId = :pClientId and e.prepayAccount.id = :pPrepayAccountId",
CustomerGroupAcct.class)
.setParameter("pClientId", Session.user.get().getClientId())
.setParameter("pPrepayAccountId", prepayAccountId)
.getResultList();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy