Skip to content

Commit

Permalink
BAH-4096 | Use xml based bean creations and removed annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 committed Aug 29, 2024
1 parent 90b21fb commit d8d8c1d
Show file tree
Hide file tree
Showing 19 changed files with 158 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import java.util.Optional;

@Repository

public interface ReferenceDAO {

Optional<Reference> getReferenceByTypeAndTargetUUID(String type, String targetUUID) throws DAOException;

Reference saveReference(Reference reference) throws DAOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.springframework.stereotype.Repository;


@Repository

public interface ScheduleDAO {

Schedule getSchedule(Integer scheduleId) throws DAOException;

Schedule saveSchedule(Schedule schedule) throws DAOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.time.LocalDateTime;
import java.util.List;

@Repository

public interface SlotDAO {

Slot getSlot(Integer slotId) throws DAOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class HibernateCareTeamDAO implements CareTeamDAO {

private static final Logger log = LoggerFactory.getLogger(HibernateCareTeamDAO.class);
private final SessionFactory sessionFactory;
private SessionFactory sessionFactory;

@Autowired
public HibernateCareTeamDAO(SessionFactory sessionFactory) {
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@

import java.util.Optional;

@Repository
public class HibernateReferenceDAO implements ReferenceDAO {

private static final Logger log = LoggerFactory.getLogger(HibernateReferenceDAO.class);

private final SessionFactory sessionFactory;
private SessionFactory sessionFactory;

@Autowired
public HibernateReferenceDAO(SessionFactory sessionFactory) {
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class HibernateScheduleDAO implements ScheduleDAO {

private static final Logger log = LoggerFactory.getLogger(HibernateScheduleDAO.class);
private final SessionFactory sessionFactory;
private SessionFactory sessionFactory;

@Autowired
public HibernateScheduleDAO(SessionFactory sessionFactory) {
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

@Override
public Schedule getSchedule(Integer scheduleId) throws DAOException {
return sessionFactory.getCurrentSession().get(Schedule.class, scheduleId);
}

@Override
public Schedule saveSchedule(Schedule schedule) throws DAOException {
sessionFactory.getCurrentSession().saveOrUpdate(schedule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
import java.time.temporal.ChronoUnit;
import java.util.List;

@Repository
public class HibernateSlotDAO implements SlotDAO {

private static final Logger log = LoggerFactory.getLogger(HibernateSlotDAO.class);

private final SessionFactory sessionFactory;

@Autowired
public HibernateSlotDAO(SessionFactory sessionFactory) {
private SessionFactory sessionFactory;

public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

@Override
public Slot getSlot(Integer slotId) throws DAOException {
return sessionFactory.getCurrentSession().get(Slot.class, slotId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
import java.util.Date;
import java.util.List;

@Repository
public class HibernateWardDAO implements WardDAO {

private static final Logger log = LoggerFactory.getLogger(HibernateWardDAO.class);

private final SessionFactory sessionFactory;
private SessionFactory sessionFactory;

@Autowired
public HibernateWardDAO(SessionFactory sessionFactory) {
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.openmrs.api.OpenmrsService;


@Service

public interface CareTeamService extends OpenmrsService {

CareTeam saveCareTeam(CareTeam careTeam) throws APIException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import java.util.Optional;

@Service

public interface ReferenceService extends OpenmrsService {

// @Authorized({ PrivilegeConstants.EDIT_IPD_SCHEDULES })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import org.springframework.stereotype.Service;


@Service

public interface ScheduleService extends OpenmrsService {

// @Authorized({ PrivilegeConstants.EDIT_IPD_SCHEDULES })
Schedule getSchedule(Integer scheduleId) throws APIException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.List;
import java.util.Map;

@Service

public interface SlotService extends OpenmrsService {

// @Authorized({ PrivilegeConstants.EDIT_IPD_SLOTS })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CareTeamServiceImpl extends BaseOpenmrsService implements CareTeamService {

private static final Logger log = LoggerFactory.getLogger(CareTeamServiceImpl.class);

private final CareTeamDAO careTeamDAO;
private CareTeamDAO careTeamDAO;

@Autowired
public CareTeamServiceImpl(CareTeamDAO careTeamDAO) {
public void setCareTeamDAO(CareTeamDAO careTeamDAO) {
this.careTeamDAO = careTeamDAO;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@

import java.util.Optional;

@Service
@Transactional
public class ReferenceServiceImpl extends BaseOpenmrsService implements ReferenceService {

private static final Logger log = LoggerFactory.getLogger(ReferenceServiceImpl.class);

private final ReferenceDAO referenceDAO;
private ReferenceDAO referenceDAO;

@Autowired
public ReferenceServiceImpl(ReferenceDAO referenceDAO) {
public void setReferenceDAO(ReferenceDAO referenceDAO) {
this.referenceDAO = referenceDAO;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
@Service
@Transactional
public class ScheduleServiceImpl extends BaseOpenmrsService implements ScheduleService {

private static final Logger log = LoggerFactory.getLogger(ScheduleServiceImpl.class);

private final ScheduleDAO scheduleDAO;

@Autowired
public ScheduleServiceImpl(ScheduleDAO scheduleDAO) {
private ScheduleDAO scheduleDAO;

public void setScheduleDAO(ScheduleDAO scheduleDAO) {
this.scheduleDAO = scheduleDAO;
}

Expand All @@ -30,7 +29,7 @@ public ScheduleServiceImpl(ScheduleDAO scheduleDAO) {
public Schedule getSchedule(Integer scheduleId) throws APIException {
return scheduleDAO.getSchedule(scheduleId);
}

@Override
public Schedule saveSchedule(Schedule schedule) throws APIException {
return scheduleDAO.saveSchedule(schedule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,21 @@
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class SlotServiceImpl extends BaseOpenmrsService implements SlotService {

private static final Logger log = LoggerFactory.getLogger(SlotServiceImpl.class);

private final SlotDAO slotDAO;
private ConceptService conceptService;

@Autowired
public SlotServiceImpl(SlotDAO slotDAO, ConceptService conceptService) {
private SlotDAO slotDAO;
private ConceptService conceptService;

public void setSlotDAO(SlotDAO slotDAO) {
this.slotDAO = slotDAO;
}
public void setConceptService(ConceptService conceptService) {
this.conceptService = conceptService;
}


@Override
@Transactional(readOnly = true)
public Slot getSlot(Integer slotId) throws APIException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class WardServiceImpl implements WardService {

private final WardDAO wardDAO;
private WardDAO wardDAO;

@Autowired
public WardServiceImpl(WardDAO wardDAO) {
public void setWardDAO(WardDAO wardDAO) {
this.wardDAO = wardDAO;
}


@Override
public WardPatientsSummary getIPDWardPatientSummary(String wardUuid, String providerUuid) {
Location location= Context.getService(LocationService.class).getLocationByUuid(wardUuid);
Expand Down
Loading

0 comments on commit d8d8c1d

Please sign in to comment.