Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jleaf.erp.master.bo.customervsrayon;
- import org.jleaf.core.BusinessFunction;
- import org.jleaf.core.BusinessTransaction;
- import org.jleaf.core.DefaultBusinessTransaction;
- import org.jleaf.core.Dto;
- import org.jleaf.core.annotation.Info;
- import org.jleaf.core.annotation.InfoIn;
- import org.jleaf.core.annotation.InfoOut;
- import org.jleaf.erp.master.dao.RegionCustomerDao;
- import org.jleaf.erp.master.entity.RegionCustomer;
- import org.jleaf.util.GsonUtil;
- import org.jleaf.util.ValidationUtil;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Qualifier;
- import org.springframework.stereotype.Service;
- /**
- * remove Region Customer
- * @author Nadia, Sep 20, 2016
- * @version 1.0
- */
- @Service
- @InfoIn(value = {
- @Info(name = "tenantLoginId", description = "tenant login id", type = Long.class),
- @Info(name = "roleLoginId", description = "role login id", type = Long.class),
- @Info(name = "userLoginId", description = "user login id", type = Long.class),
- @Info(name = "datetime", description = "datetime", type = String.class),
- @Info(name = "id", description = "id", type = Long.class)
- })
- @InfoOut(value = {
- })
- public class RemoveRegionCustomer extends DefaultBusinessTransaction implements
- BusinessTransaction {
- private static final Logger log = LoggerFactory
- .getLogger(RemoveRegionCustomer.class);
- @Autowired
- private RegionCustomerDao regionCustomerDao;
- @Autowired
- @Qualifier("valRegionCustomerExistsById")
- private BusinessFunction valRegionCustomerExistsById;
- @Autowired
- @Qualifier("findRegionCustomerByIndex")
- private BusinessFunction findRegionCustomerByIndex;
- @Autowired
- @Qualifier("findRegionCustomerById")
- private BusinessFunction findRegionCustomerById;
- @Override
- public String getDescription() {
- // TODO Auto-generated method stub
- return "Remove Region Customer";
- }
- @Override
- public Dto prepare(Dto inputDto, Dto originalDto) throws Exception {
- // Pastikan input benar/lengkap
- ValidationUtil.valBlankOrNull(inputDto, "tenantLoginId");
- ValidationUtil.valBlankOrNull(inputDto, "roleLoginId");
- ValidationUtil.valBlankOrNull(inputDto, "userLoginId");
- ValidationUtil.valBlankOrNull(inputDto, "datetime");
- ValidationUtil.valBlankOrNull(inputDto, "id");
- Long tenantLoginId = inputDto.getLong("tenantLoginId");
- Long roleLoginId = inputDto.getLong("roleLoginId");
- Long userLoginId = inputDto.getLong("userLoginId");
- Long datetime = inputDto.getLong("datetime");
- Long id = inputDto.getLong("id");
- // Validasi catalog harus ada (exists)
- Dto regionCustomerDto = findRegionCustomerByIndex
- .execute(new Dto().put("id", id));
- // Prepare data
- inputDto.put("regionCustomerDto", regionCustomerDto);
- return null;
- }
- @Override
- public Dto process(Dto inputDto, Dto originalDto) throws Exception {
- RegionCustomer entity = GsonUtil.fromDto(
- inputDto.getDto("regionCustomerDto"), RegionCustomer.class);
- return new Dto();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment