Skip to content

Commit

Permalink
Proposed fix for 'Duplicate property mapping of uuid'
Browse files Browse the repository at this point in the history
  • Loading branch information
k-joseph committed Jul 17, 2015
1 parent eb1e749 commit e6e3839
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 59 deletions.
Expand Up @@ -65,17 +65,6 @@ public class ChartSearchBookmark extends BaseOpenmrsObject implements Serializab
@Column(name = "selected_categories")
private String selectedCategories;

/**
* @see org.openmrs.BaseOpenmrsObject#getUuid()
*/
@Basic
@Access(AccessType.PROPERTY)
@Column(name = "bookmark_uuid", length = 38, unique = true)
@Override
public String getUuid() {
return super.getUuid();
}

@Override
public Integer getId() {
return getBookmarkId();
Expand Down
Expand Up @@ -55,17 +55,6 @@ public class ChartSearchHistory extends BaseOpenmrsObject implements Serializabl
@JoinColumn(name = "user_id", nullable = false)
private User historyOwner;

/**
* @see org.openmrs.BaseOpenmrsObject#getUuid()
*/
@Basic
@Access(AccessType.PROPERTY)
@Column(name = "history_uuid", length = 38, unique = true)
@Override
public String getUuid() {
return super.getUuid();
}

@Override
public Integer getId() {
return getSearchId();
Expand Down
Expand Up @@ -75,17 +75,6 @@ public void setId(Integer id) {
setNoteId(id);
}

/**
* @see org.openmrs.BaseOpenmrsObject#getUuid()
*/
@Basic
@Access(AccessType.PROPERTY)
@Column(name = "note_uuid", length = 38, unique = true)
@Override
public String getUuid() {
return super.getUuid();
}

public Integer getNoteId() {
return noteId;
}
Expand Down Expand Up @@ -164,9 +153,10 @@ public String getDisplayColor() {
* @param displayColor
*/
public void setDisplayColor(String displayColor) {
if ("orange".equals(displayColor) || "yellow".equals(displayColor)|| "violet".equals(displayColor) || "lime".equals(displayColor)
|| "beige".equals(displayColor) || "cyan".equals(displayColor) || "lightgreen".equals(displayColor)
|| "deeppink".equals(displayColor) || "magenta".equals(displayColor) || "red".equals(displayColor)) {//don't persist the first option
if ("orange".equals(displayColor) || "yellow".equals(displayColor) || "violet".equals(displayColor)
|| "lime".equals(displayColor) || "beige".equals(displayColor) || "cyan".equals(displayColor)
|| "lightgreen".equals(displayColor) || "deeppink".equals(displayColor) || "magenta".equals(displayColor)
|| "red".equals(displayColor)) {//don't persist the first option
this.displayColor = displayColor;
} else {
this.displayColor = "white";
Expand Down
19 changes: 19 additions & 0 deletions api/src/main/resources/liquibase.xml
Expand Up @@ -397,4 +397,23 @@
<column name="uuid" value="663f961e-24bd-11e5-b345-feff819cdc9f" />
</insert>
</changeSet>
<changeSet id="CSM-111_17072015_1513" author="k-joseph">
<preConditions onFail="MARK_RAN">
<columnExists tableName="chartsearch_history"
columnName="history_uuid" />
<columnExists tableName="chartsearch_bookmark"
columnName="bookmark_uuid" />
<columnExists tableName="chartsearch_note" columnName="note_uuid" />
</preConditions>
<comment>
Re-Renaming history_uuid , bookmark_uuid and note_uuid
to uuid
</comment>
<renameColumn tableName="chartsearch_history"
oldColumnName="history_uuid" newColumnName="uuid" columnDataType="char(38)" />
<renameColumn tableName="chartsearch_bookmark"
oldColumnName="bookmark_uuid" newColumnName="uuid" columnDataType="char(38)" />
<renameColumn tableName="chartsearch_note" oldColumnName="note_uuid"
newColumnName="uuid" columnDataType="char(38)" />
</changeSet>
</databaseChangeLog>
8 changes: 4 additions & 4 deletions omod/src/main/webapp/fragments/searchSavingSection.gsp
Expand Up @@ -124,7 +124,7 @@
jq("#lauche-other-chartsearch-features").hide();
displayExistingBookmarks();
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
updateBookmarksAndNotesUI();
displayQuickSearches();
Expand Down Expand Up @@ -611,7 +611,7 @@
jsonAfterParse.globalNotes = allNotes.globalNotes;
jsonAfterParse.currentUser = allNotes.currentUser;
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
jq("#new-comment-or-note").val("");
jq("#new-comment-or-note").css("border", "");
}
Expand Down Expand Up @@ -655,7 +655,7 @@
jsonAfterParse.globalNotes = allNotes.globalNotes;
jsonAfterParse.currentUser = allNotes.currentUser;
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
}
},
error: function(e) {
Expand All @@ -682,7 +682,7 @@
jsonAfterParse.globalNotes = allNotes.globalNotes;
jsonAfterParse.currentUser = allNotes.currentUser;
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
}
},
error: function(e) {
Expand Down
4 changes: 2 additions & 2 deletions omod/src/main/webapp/fragments/topArea.gsp
Expand Up @@ -15,7 +15,7 @@
jq("#ui-datepicker-stop").datepicker();
showHistorySuggestionsOnLoad();
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
updateCategeriesAtUIGlobally(jsonAfterParse.appliedCategories);
jq( "#date_filter_title" ).click(function() {
Expand Down Expand Up @@ -339,7 +339,7 @@
showHistorySuggestionsOnLoad();
hideSearchSuggestions();
displayBothPersonalAndGlobalNotes();
displayBothPersonalAndGlobalNotes(jsonAfterParse);
displayQuickSearches();
updateBookmarksAndNotesUI();
updateCategeriesAtUIGlobally(jsonAfterParse.appliedCategories);
Expand Down
37 changes: 20 additions & 17 deletions omod/src/main/webapp/resources/scripts/views_factory.js
Expand Up @@ -417,11 +417,11 @@ function enable_graph(obs_id) {
panRange : [ -maxToBePlottedMilli, maxToBePlottedMilli ]
},
zoom : {
interactive : true,
interactive : false,
amount : 0.5
},
pan : {
interactive : true
interactive : false
}
});

Expand Down Expand Up @@ -1047,17 +1047,21 @@ function refresh_data(json) {
$("#location_anchor").text('All Locations');
$("#provider_anchor").text('All Providers');

if (!filteredJson || filteredJson === "") {
displayCategories(json);
displayProviders(json);
displayLocations(json);
}
if (json.noResults.foundNoResults) {
document.getElementById('obsgroups_results').innerHTML = "<div id='found_no_results'>"
+ json.noResults.foundNoResultsMessage
+ " <b> "
+ searchText.value + "</b></div>";
if (!json || json.noResults.foundNoResults) {
if (json) {
document.getElementById('obsgroups_results').innerHTML = "<div id='found_no_results'>"
+ json.noResults.foundNoResultsMessage
+ " <b> "
+ searchText.value + "</b></div>";
} else {
alert("Still Indexing!");
}
} else {
if (!filteredJson || filteredJson === "") {
displayCategories(json);
displayProviders(json);
displayLocations(json);
}
searchText.value = json.search_phrase;
var numberOfResults = json.obs_groups.length + json.obs_singles.length
+ json.patientAllergies.length
Expand All @@ -1083,7 +1087,6 @@ function refresh_data(json) {
addAllResultsFromJSONFromTheServer(json);
displayFailedPrivileges(json);
}
displayBothPersonalAndGlobalNotes();
}

/*
Expand Down Expand Up @@ -1238,14 +1241,14 @@ function updateBookmarksAndNotesUI() {
}
}

function displayBothPersonalAndGlobalNotes() {
var personalNotes = jsonAfterParse.personalNotes;
var globalNotes = jsonAfterParse.globalNotes;
function displayBothPersonalAndGlobalNotes(json) {
var personalNotes = json.personalNotes;
var globalNotes = json.globalNotes;
var displayPersonalNotes = "";
var displayGlobalNotes = "";
var displayAllNotes;
var owner;
var curUser = jsonAfterParse.currentUser;
var curUser = json.currentUser;

if (personalNotes && personalNotes.length !== 0) {
displayPersonalNotes += "<u>Personal Notes (LOW priority):</u><br />";
Expand Down

0 comments on commit e6e3839

Please sign in to comment.