Skip to content

Commit

Permalink
Merge pull request #381 from k-joseph/TRUNK-3258
Browse files Browse the repository at this point in the history
TRUNK-3258
  • Loading branch information
dkayiwa committed Aug 8, 2013
2 parents f6d17fa + 4a77c0d commit 678b1b2
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 27 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/org/openmrs/api/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public static ObsService getObsService() {
}

/**
* @return note services
* @return note service
*/
public static NoteService getNoteService() {
return getServiceContext().getNoteService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public ObsService getObsService() {
}

/**
* @return note services
* @return note service
*/
public NoteService getNoteService() {
return getService(NoteService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public void deleteNote(Note note) throws DAOException {
sessionFactory.getCurrentSession().delete(note);
}

/**
* @see org.openmrs.api.db.NoteDAO#voidNote(org.openmrs.notification.Note, java.lang.String)
*/
public Note voidNote(Note note, String reason) throws APIException {
log.debug("voiding note because " + reason);
sessionFactory.getCurrentSession().save(note);
Expand Down
16 changes: 16 additions & 0 deletions api/src/main/java/org/openmrs/notification/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class Note extends BaseOpenmrsData implements Serializable {
private static final long serialVersionUID = -5392076713513109152L;

// Data

/**
* noteId, an identifier for a patient note.
*/
private Integer noteId;

private String text;
Expand All @@ -55,10 +59,16 @@ public class Note extends BaseOpenmrsData implements Serializable {
public Note() {
}

/**
* @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
*/
public void setId(Integer id) {
setNoteId(noteId);
}

/**
* @see org.openmrs.OpenmrsObject#getId()
*/
public Integer getId() {
return getNoteId();
}
Expand Down Expand Up @@ -119,10 +129,16 @@ public void setWeight(Integer weight) {
this.weight = weight;
}

/**
* @return Returns the noteId.
*/
public Integer getNoteId() {
return noteId;
}

/**
* @param noteId the noteId to set.
*/
public void setNoteId(Integer noteId) {
this.noteId = noteId;
}
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/org/openmrs/notification/NoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public interface NoteService {
*
* @param user the user to match on
* @return a List<Note> object containing all non-voided notes for the specified user Get all
* Notes for a given person, Does not return voided notes.</br>
* Notes for a given user, Does not return voided notes.</br>
* @param user the user to match on
* @return a List<Note> object containing all non-voided notes for the specified person
* @return a List<Note> object containing all non-voided notes for the specified user
*/
@Authorized(PrivilegeConstants.VIEW_NOTE)
@Authorized(PrivilegeConstants.GET_NOTE)
public List<Note> getNotes(User user) throws Exception;

/**
Expand Down
7 changes: 0 additions & 7 deletions api/src/main/java/org/openmrs/util/PrivilegeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@ public class PrivilegeConstants {

public static final String PURGE_OBS = "Purge Observations";

/**
* @deprecated Use org.openmrs.util.PrivilegeConstants.GET_NOTE
*/
@Deprecated
@AddOnStartup(description = "Able to view patient notes")
public static final String VIEW_NOTE = GET_NOTE;

@AddOnStartup(description = "Able to edit patient notes")
public static final String EDIT_NOTE = "Edit Notes";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
<property name="weight" type="java.lang.Integer" length="11"
column="weight" not-null="false" />
<property name="uuid" type="java.lang.String" column="uuid"
length="38" unique="true" />
length="38" unique="true" not-null="true" />
<many-to-one name="patient" class="org.openmrs.Patient"
column="patient" not-null="false" />
column="patient" not-null="true" />
<many-to-one name="noteType" class="org.openmrs.notification.NoteType"
column="note_type" not-null="false" />
column="notification_note_type_id" not-null="true" />
</class>

</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.openmrs.notification">
<class name="org.openmrs.notification.NoteType" table="notification_note"
<class name="org.openmrs.notification.NoteType" table="notification_note_type"
batch-size="25">
<id name="id" type="int" column="note_type_id" unsaved-value="0">
<id name="id" type="int" column="notification_note_type_id" unsaved-value="0">
<generator class="native">
<param name="sequence">notification_note_note_id_seq</param>
<param name="sequence">notification_note_notification_note_type_id_seq</param>
</generator>
</id>
<discriminator column="note_type_id" insert="false" />
<discriminator column="notification_note_type_id" insert="false" />

<property name="name" type="java.lang.String" column="name"
length="50" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<patient patient_id="8" creator="1" date_created="2006-01-18 00:00:00.0"
changed_by="1" date_changed="2008-08-18 12:24:34.0" voided="false"
void_reason="" />
<notification_note_type
notification_note_type_id="8" name="sample note type" description="" />
<notification_note note_id="1" text="sample text1"
creator="1" date_created="2013-04-15 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="false" />
date_changed="2013-05-15 17:00:35.0" is_voided="false"
uuid="559fa1a8-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
<notification_note note_id="2" text="sample text2"
creator="1" date_created="2013-04-15 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="true" date_voided="2013-07-31 13:47:35.0"
voided_by="1" void_reason="testing" note_type_id="2" name="sample name" />
voided_by="1" void_reason="testing" uuid="559f9fc8-fe06-11e2-8ebb-f23c91aec05e"
patient="8" notification_note_type_id="8" />
<notification_note note_id="3" text="sample text3"
creator="1" date_created="2013-04-15 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="true" date_voided="2013-05-15 17:47:35.0"
voided_by="1" void_reason="testing" />
voided_by="1" void_reason="testing" uuid="559f9de8-fe06-11e2-8ebb-f23c91aec05e"
patient="8" notification_note_type_id="8" />
<notification_note note_id="4" text="sample text4"
creator="1" date_created="2013-05-14 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="false" />
date_changed="2013-05-15 17:00:35.0" is_voided="false"
uuid="559f9bfe-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
<notification_note note_id="5" text="sample text5"
creator="1" date_created="2013-05-14 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="false" />
date_changed="2013-05-15 17:00:35.0" is_voided="false"
uuid="559f9a00-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
<notification_note note_id="6" text="sample text6"
creator="1" date_created="2013-05-14 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="false" />
date_changed="2013-05-15 17:00:35.0" is_voided="false"
uuid="559f973a-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
<notification_note note_id="7" text="sample text7"
creator="1" date_created="2013-05-14 16:35:35.0" changed_by="1"
date_changed="2013-05-15 17:00:35.0" is_voided="false" />
date_changed="2013-05-15 17:00:35.0" is_voided="false"
uuid="559f9528-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
<notification_note note_id="8" is_voided="false"
text="sample text8" creator="1" date_created="2013-07-31 18:47:35.0" />
text="sample text8" creator="1" date_created="2013-07-31 18:47:35.0"
uuid="559f921c-fe06-11e2-8ebb-f23c91aec05e" patient="8"
notification_note_type_id="8" />
</dataset>

0 comments on commit 678b1b2

Please sign in to comment.