Skip to content
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 @@ -9,7 +9,6 @@

import java.util.List;

@Repository
public class EpisodeAttributeTypeDaoImpl implements EpisodeAttributeTypeDao {

private static final String HQL_SELECT_ALL_EPISODE_ATTRIBUTE_TYPE = "FROM EpisodeAttributeType";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

import java.util.List;

@Repository
public class EpisodeDAOImpl implements EpisodeDAO {

@Autowired
private SessionFactory sessionFactory;

public EpisodeDAOImpl(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}

@Override
public void save(Episode episode) {
session().save(episode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.openmrs.module.episodes.service;

import org.openmrs.ConceptAttributeType;
import org.openmrs.annotation.Authorized;
import org.openmrs.module.episodes.EpisodeAttributeType;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class EpisodeAttributeTypeServiceImpl implements EpisodeAttributeTypeService {

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

import java.util.List;

@Component
@Transactional
public class EpisodeServiceImpl implements EpisodeService {
@Autowired

private EpisodeDAO episodeDAO;

public EpisodeServiceImpl(EpisodeDAO episodeDAO) {
this.episodeDAO = episodeDAO;
}

@Override
public void save(Episode episode) {
episodeDAO.save(episode);
Expand Down
61 changes: 60 additions & 1 deletion api/src/main/resources/moduleApplicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,65 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<context:component-scan base-package="org.openmrs.module.episodes"/>
<bean id="episodeDao" class="org.openmrs.module.episodes.dao.impl.EpisodeDAOImpl">
<constructor-arg name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="episodeAttributeTypeDao" class="org.openmrs.module.episodes.dao.impl.EpisodeAttributeTypeDaoImpl">
<constructor-arg name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="episodeService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="target">
<bean class="org.openmrs.module.episodes.service.impl.EpisodeServiceImpl">
<constructor-arg name="episodeDAO" ref="episodeDao"/>
</bean>
</property>
<property name="preInterceptors">
<ref bean="serviceInterceptors"/>
</property>
<property name="transactionAttributeSource">
<ref bean="transactionAttributeSource"/>
</property>
</bean>

<bean id="episodeAttributeTypeService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="target">
<bean class="org.openmrs.module.episodes.service.impl.EpisodeAttributeTypeServiceImpl">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need a property setter. You can use constructor-arg

<constructor-arg name="episodeAttributeTypeDao" ref="episodeAttributeTypeDao"/>
</bean>
</property>
<property name="preInterceptors">
<ref bean="serviceInterceptors"/>
</property>
<property name="transactionAttributeSource">
<ref bean="transactionAttributeSource"/>
</property>
</bean>

<bean parent="serviceContext">
<property name="moduleService">
<list merge="true">
<value>org.openmrs.module.episodes.service.EpisodeService</value>
<ref bean="episodeService"/>
</list>
</property>
</bean>

<bean parent="serviceContext">
<property name="moduleService">
<list merge="true">
<value>org.openmrs.module.episodes.service.EpisodeAttributeTypeService</value>
<ref bean="episodeAttributeTypeService"/>
</list>
</property>
</bean>



</beans>