Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Kavitha | Update ipd branch with latest master changes" #84

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,12 +11,14 @@
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 SessionFactory sessionFactory;
private final SessionFactory sessionFactory;

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

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

import java.util.Optional;

@Repository
public class HibernateReferenceDAO implements ReferenceDAO {

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

private SessionFactory sessionFactory;
private final SessionFactory sessionFactory;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
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 SessionFactory sessionFactory;
private final SessionFactory sessionFactory;

public void setSessionFactory(SessionFactory sessionFactory) {
@Autowired
public HibernateScheduleDAO(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,16 +20,18 @@
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;

private SessionFactory sessionFactory;

public void setSessionFactory(SessionFactory sessionFactory) {
@Autowired
public HibernateSlotDAO(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,13 +18,15 @@
import java.util.Date;
import java.util.List;

@Repository
public class HibernateWardDAO implements WardDAO {

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

private SessionFactory sessionFactory;
private final SessionFactory sessionFactory;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class ConfigLoader {

private ObjectMapper objectMapper = new ObjectMapper();

@Value("${ipd.events_config.file_path:/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json}")
private String eventsConfigurationFileLocation;
@Value("${config-file.path}")
private String routeConfigurationFileLocation;

public List<ConfigDetail> getConfigs() {
if (configs.isEmpty()) {
Expand All @@ -32,10 +32,10 @@ public List<ConfigDetail> getConfigs() {

private void loadConfiguration() {
try {
File routeConfigurationFile = new FileSystemResource(eventsConfigurationFileLocation).getFile();
File routeConfigurationFile = new FileSystemResource(routeConfigurationFileLocation).getFile();
this.configs = objectMapper.readValue(routeConfigurationFile, new TypeReference<List<ConfigDetail>>() {});
} catch (IOException exception) {
log.error("Failed to load configuration for file : " + eventsConfigurationFileLocation, exception);
log.error("Failed to load configuration for file : " + routeConfigurationFileLocation, exception);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;


@Component
public class RollOverNonMedicationTasks extends AbstractTask implements ApplicationContextAware {

private static ApplicationContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;


@Component
public class ShiftStartTasks extends AbstractTask implements ApplicationContextAware {

private static ApplicationContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import org.openmrs.Visit;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.ipd.api.model.CareTeam;
import org.openmrs.module.ipd.api.model.Schedule;
import org.springframework.stereotype.Service;
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,14 +14,16 @@
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 CareTeamDAO careTeamDAO;
private final CareTeamDAO careTeamDAO;

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

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

import java.util.Optional;

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

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

private ReferenceDAO referenceDAO;
private final ReferenceDAO referenceDAO;

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

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

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

private final ScheduleDAO scheduleDAO;

private ScheduleDAO scheduleDAO;

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

Expand All @@ -29,7 +30,7 @@ public void setScheduleDAO(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,21 +25,23 @@
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 SlotDAO slotDAO;
private final SlotDAO slotDAO;
private ConceptService conceptService;

public void setSlotDAO(SlotDAO slotDAO) {
@Autowired
public SlotServiceImpl(SlotDAO slotDAO, ConceptService conceptService) {

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,15 +15,18 @@
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class WardServiceImpl implements WardService {

private WardDAO wardDAO;
private final WardDAO wardDAO;

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


@Override
public WardPatientsSummary getIPDWardPatientSummary(String wardUuid, String providerUuid) {
Location location= Context.getService(LocationService.class).getLocationByUuid(wardUuid);
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

# Route definitions
ipd.events_config.file_path=/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json
config-file.path=/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json
Loading
Loading