Skip to content

Commit

Permalink
TRUNK-2663 Fixed static access sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Jul 29, 2014
1 parent 367d95a commit be1c036
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class ExistingOrNewVisitAssignmentHandler extends ExistingVisitAssignment

private static volatile Map<EncounterType, VisitType> encounterVisitMapping;

private static void setEncounterVisitMapping(Map<EncounterType, VisitType> encounterVisitMapping) {
ExistingOrNewVisitAssignmentHandler.encounterVisitMapping = encounterVisitMapping;
}

/**
* @see org.openmrs.api.handler.ExistingVisitAssignmentHandler#getDisplayName(java.util.Locale)
*/
Expand Down Expand Up @@ -72,7 +76,7 @@ public void beforeCreateEncounter(Encounter encounter) {

if (encounterVisitMapping == null) {
//initial one-time setup
encounterVisitMapping = new HashMap<EncounterType, VisitType>();
setEncounterVisitMapping(new HashMap<EncounterType, VisitType>());
Context.getAdministrationService().addGlobalPropertyListener(this);
}

Expand All @@ -84,7 +88,7 @@ public void beforeCreateEncounter(Encounter encounter) {
Map<EncounterType, VisitType> newMap = new HashMap<EncounterType, VisitType>(encounterVisitMapping);
newMap.put(encounter.getEncounterType(), visitType);

encounterVisitMapping = newMap;
setEncounterVisitMapping(newMap);
}
visit.setVisitType(visitType);

Expand Down Expand Up @@ -150,12 +154,12 @@ public boolean supportsPropertyName(String propertyName) {

@Override
public void globalPropertyChanged(GlobalProperty newValue) {
encounterVisitMapping = new HashMap<EncounterType, VisitType>();
setEncounterVisitMapping(new HashMap<EncounterType, VisitType>());
}

@Override
public void globalPropertyDeleted(String propertyName) {
encounterVisitMapping = new HashMap<EncounterType, VisitType>();
setEncounterVisitMapping(new HashMap<EncounterType, VisitType>());
}

}

0 comments on commit be1c036

Please sign in to comment.