Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.inkubator.sms.gateway.service.impl; import com.inkubator.common.util.RandomNumberUtil; import com.inkubator.datacore.service.impl.IServiceImpl; import com.inkubator.securitycore.util.UserInfoUtil; import com.inkubator.sms.gateway.dao.ModemDefinitionDao; import com.inkubator.sms.gateway.dao.TaskDefinitionDao; import com.inkubator.sms.gateway.entity.TaskDefinition; import com.inkubator.sms.gateway.service.TaskDefinitionService; import java.util.Date; import java.util.List; import org.hibernate.criterion.Order; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; /** * * @author Deni Husni FR */ @Service(value = "taskDefinitionService") @Lazy public class TaskDefinitionServiceImpl extends IServiceImpl implements TaskDefinitionService { @Autowired private TaskDefinitionDao taskDefinitionDao; @Autowired private ModemDefinitionDao modemDefinitionDao; @Override public TaskDefinition getEntiyByPK(String id) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntiyByPK(Integer id) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public TaskDefinition getEntiyByPK(Long id) throws Exception { TaskDefinition definition = taskDefinitionDao.getByFullText(id); definition.getModemDefinition().getManufacture(); return definition; } @Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(TaskDefinition entity) throws Exception { System.out.println(" User " + UserInfoUtil.getUserName()); entity.setModemDefinition(modemDefinitionDao.getEntiyByPK(entity.getModemDefinition().getId())); entity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); entity.setCreatedBy(UserInfoUtil.getUserName()); entity.setCretedOn(new Date()); entity.setSendingCount(0); this.taskDefinitionDao.save(entity); } @Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(TaskDefinition entity) throws Exception { TaskDefinition taskDefinition = taskDefinitionDao.getEntiyByPK(entity.getId()); taskDefinition.setDate(entity.getDate()); taskDefinition.setDestination(entity.getDestination()); taskDefinition.setFromSending(entity.getFromSending()); taskDefinition.setModemDefinition(modemDefinitionDao.getEntiyByPK(entity.getModemDefinition().getId())); taskDefinition.setIsRepeatOnCondition(entity.getIsRepeatOnCondition()); taskDefinition.setName(entity.getName()); taskDefinition.setRepeatTime(entity.getRepeatTime()); taskDefinition.setScheduleType(entity.getScheduleType()); taskDefinition.setSendingCount(entity.getSendingCount()); taskDefinition.setSmsContent(entity.getSmsContent()); taskDefinition.setTime(entity.getTime()); taskDefinition.setUpdatedBy(UserInfoUtil.getUserName()); taskDefinition.setUpdatedOn(new Date()); this.taskDefinitionDao.update(taskDefinition); } @Override public void saveOrUpdate(TaskDefinition enntity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition saveData(TaskDefinition entity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition updateData(TaskDefinition entity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition saveOrUpdateData(TaskDefinition entity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(String id, Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(String id, Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(String id, Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Integer id, Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Integer id, Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Integer id, Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Long id, Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Long id, Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public TaskDefinition getEntityByPkIsActive(Long id, Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void delete(TaskDefinition entity) throws Exception { this.taskDefinitionDao.delete(entity); } @Override public void softDelete(TaskDefinition entity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public Long getTotalData() throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public Long getTotalDataIsActive(Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public Long getTotalDataIsActive(Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public Long getTotalDataIsActive(Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllData() throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllData(Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllData(Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllData(Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllDataPageAble(int firstResult, int maxResults, Order order) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllDataPageAbleIsActive(int firstResult, int maxResults, Order order, Boolean isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllDataPageAbleIsActive(int firstResult, int maxResults, Order order, Integer isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public List<TaskDefinition> getAllDataPageAbleIsActive(int firstResult, int maxResults, Order order, Byte isActive) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50) public List<TaskDefinition> getAllByFullTextService(String parameter, int minResult, int maxResult, Order order) throws Exception { return this.taskDefinitionDao.getAllByFullTextService(parameter, minResult, maxResult, order); } @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Integer getTotalByFullTextService(String parameter) throws Exception { return this.taskDefinitionDao.getTotalByFullTextService(parameter); } }