Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- here is Note.hbm.xml file
- <?xml version="1.0"?>
- <!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.1//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
- <hibernate-mapping package="org.openmrs.module.patientnotes">
- <class name="Note" table="note">
- <id name="id" type="int" column="id" unsaved-value="0">
- <generator class="native" />
- </id>
- <property name="voided" type="java.lang.Boolean" column="is_voided" not-null="true" length="1" />
- <property name="dateVoided" type="java.util.Date" column="date_voided" not-null="true" length="19" />
- <many-to-one name="voided_By" class="org.openmrs.User" not-null="true" />
- <property name="voidReason" type="java.lang.String"
- column="void_reason" length="255" />
- </class>
- </hibernate-mapping>
- private Boolean voided = Boolean.FALSE;
- private Date dateVoided;
- private User voidedBy;
- private String voidReason;
- public Boolean getVoided() {
- return voided;
- }
- public void setVoided(Boolean voided) {
- this.voided = voided;
- }
- public Date getDateVoided() {
- return dateVoided;
- }
- public void setDateVoided(Date dateVoided) {
- this.dateVoided = dateVoided;
- }
- public User getVoidedBy() {
- return voidedBy;
- }
- public void setVoidedBy(User voidedBy) {
- this.voidedBy = voidedBy;
- }
- public String getVoidReason() {
- return voidReason;
- }
- and finnaly in HibernateNoteDAO.java
- log.info("voiding note because " + reason);
- return (Note) sessionFactory.getCurrentSession().get(Note.class, note);
- }
- I have written the test case that is yet failing till now
- that is
- package org.openmrs.api.db;
- import static org.junit.Assert.*;
- import org.junit.Ignore;
- import org.junit.Test;
- import org.openmrs.PersonName;
- import org.openmrs.notification.Note;
- import org.openmrs.test.BaseContextSensitiveTest;
- import org.openmrs.test.Verifies;
- public class NoteDAOTest extends BaseContextSensitiveTest{
- private NoteDAO dao = null;
- @Test
- public void voidNote_shouldvoidNote() throws Exception {
- Note note = new Note();
- String reason = null;
- assertEquals(dao.voidNote(note, reason), note.getVoided());
- }
- }
- ___________________________________________________________________________________
- added code in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement