Commits

vmorsiani committed d7ad516

expose available TicketCategory through TicketService

Comments (0)

Files changed (3)

jticketing-core/src/main/java/org/wanna/jticketing/persistence/dao/TicketCategoryDao.java

+package org.wanna.jticketing.persistence.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.wanna.jticketing.persistence.entity.TicketCategoryEntity;
+
+public interface TicketCategoryDao extends JpaRepository<TicketCategoryEntity,Long>, JpaSpecificationExecutor<TicketCategoryEntity> {
+}

jticketing-core/src/main/java/org/wanna/jticketing/persistence/service/ticket/TicketService.java

 package org.wanna.jticketing.persistence.service.ticket;
 
+import org.wanna.jticketing.persistence.entity.TicketCategoryEntity;
 import org.wanna.jticketing.persistence.entity.TicketEntity;
 import org.wanna.jticketing.persistence.entity.UserEntity;
 
     TicketEntity assign(TicketEntity ticket,UserEntity user);
     TicketEntity createTicket(TicketEntity ticket);
     TicketEntity findByReference(String reference);
+    List<TicketCategoryEntity> getAvailableTicketCategory(UserEntity userEntity);
 }

jticketing-core/src/main/java/org/wanna/jticketing/persistence/service/ticket/TicketServiceImpl.java

 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.wanna.jticketing.persistence.dao.TicketCategoryDao;
 import org.wanna.jticketing.persistence.dao.TicketDao;
 import org.wanna.jticketing.persistence.dao.specification.ticket.TicketSpecifications;
+import org.wanna.jticketing.persistence.entity.TicketCategoryEntity;
 import org.wanna.jticketing.persistence.entity.TicketEntity;
 import org.wanna.jticketing.persistence.entity.TicketStatusEntity;
 import org.wanna.jticketing.persistence.entity.UserEntity;
 public class TicketServiceImpl implements TicketService{
     @Resource
     TicketDao ticketDao;
+    @Resource
+    TicketCategoryDao ticketCategoryDao;
 
     TicketReferenceGenerator ticketReferenceGenerator = new DefaultReferenceGenerator();
 
     public TicketEntity findByReference(final String reference) {
         return ticketDao.findOne(TicketSpecifications.withReference(reference));
     }
+
+    @Override
+    public List<TicketCategoryEntity> getAvailableTicketCategory(UserEntity userEntity){
+        return ticketCategoryDao.findAll();
+    }
+
+
 }