Skip to content
Closed
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
@@ -0,0 +1,20 @@
package org.openmrs.module.referencemetadata;

import java.util.Collection;

import org.openmrs.Concept;
import org.openmrs.api.context.Context;

public class AdministrativeNotification {
Copy link
Member

Choose a reason for hiding this comment

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

Has this class got anything to do with the ticket?

Copy link
Member Author

Choose a reason for hiding this comment

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

well i was just trying to figure out , how i can display an administrative notification on the user UI .. but i failed to get exactly an example of how to use the org.openmrs.module.appframework.factory.AdministrativeNotificationProduce

Copy link
Member

Choose a reason for hiding this comment

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

How is it related to this ticket?

Copy link
Member Author

Choose a reason for hiding this comment

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

i thought that method can be used to check whether duplicate concepts exists , and then trigers the administration Notification requested by he ticket

Copy link
Member Author

Choose a reason for hiding this comment

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

though am not yet sure how to display an administration notification on the UI as done in the atlas module. i failed to gt any reference documentation on how to do it

Copy link
Member Author

Choose a reason for hiding this comment

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

oh ya samwel , acoording to the acceptance criteria ...
Upon upgrading an existing OpenMRS installation, if it has two TRUE or FALSE concepts, the administrator should be shown instructions about how to clean this up in their database.

Copy link
Member Author

Choose a reason for hiding this comment

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

soi was trying out making a method that will trigger the amin notification

Copy link
Member Author

Choose a reason for hiding this comment

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

but am soon pushing , i have modified that

Copy link
Member Author

Choose a reason for hiding this comment

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

hi dan , let me close this PR, i have created a new one

Copy link
Member Author

Choose a reason for hiding this comment

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

please look at this #40

and openmrs/openmrs-module-referenceapplication#50

am closing this


public void notify_duplicate_concepts() {
Collection<Concept> concepts = Context.getConceptService().getConceptsByName("YES");

if (concepts.size() == 2) {


} else {

}
}
}
27 changes: 25 additions & 2 deletions api/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

<!--
See http://www.liquibase.org/manual/home#available_database_refactorings
for a list of supported elements and attributes
-->

<changeSet id="deleting_duplicate_concept" author="Mutesasira Moses">
<preConditions onFail="MARK_RAN">
<or>
<sqlCheck expectedResult="2">select count(*) from concept_name where name = 'YES'</sqlCheck>
<sqlCheck expectedResult="2">select count(*) from concept_name where name = 'NO'</sqlCheck>
</or>
</preConditions>
<comment>
it checks whether the duplicate concepts exists and deletes one
</comment>


<sql>
SET FOREIGN_KEY_CHECKS = 0;
delete from concept_name where concept_id =1 or concept_id =2;
delete from concept where concept_id =1 or concept_id =2 ;
SET FOREIGN_KEY_CHECKS = 1;
</sql>
</changeSet>

</databaseChangeLog>