Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #14 - HAPI will now not ignore _id parameter when choosing a
backing method
- Loading branch information
1 parent
5d2d6f4
commit 9a58e2e
Showing
6 changed files
with
159 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
ca.uhn.fhir.rest.method.SearchMethodBinding.invalidSpecialParamName=Method [{0}] in provider [{1}] contains search parameter annotated to use name [{2}] - This name is reserved according to the FHIR specification and can not be used as a search parameter name. |
45 changes: 45 additions & 0 deletions
45
hapi-fhir-base/src/test/java/ca/uhn/fhir/i18n/HapiLocalizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ca.uhn.fhir.i18n; | ||
|
||
import java.text.MessageFormat; | ||
import java.util.Map; | ||
import java.util.ResourceBundle; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
/** | ||
* This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with caution | ||
*/ | ||
public class HapiLocalizer { | ||
|
||
private ResourceBundle myBundle; | ||
private final Map<String, MessageFormat> myKeyToMessageFormat = new ConcurrentHashMap<String, MessageFormat>(); | ||
|
||
public HapiLocalizer() { | ||
myBundle = ResourceBundle.getBundle(HapiLocalizer.class.getPackage().getName() + ".hapi-messages"); | ||
} | ||
|
||
public String getMessage(String theKey, Object... theParameters) { | ||
if (theParameters != null && theParameters.length > 0) { | ||
MessageFormat format = myKeyToMessageFormat.get(theKey); | ||
if (format != null) { | ||
return format.format(theParameters).toString(); | ||
} | ||
|
||
String formatString = myBundle.getString(theKey); | ||
if (formatString== null) { | ||
formatString = "!MESSAGE!"; | ||
} | ||
|
||
format = new MessageFormat(formatString); | ||
myKeyToMessageFormat.put(theKey, format); | ||
return format.format(theParameters).toString(); | ||
} else { | ||
String retVal = myBundle.getString(theKey); | ||
if (retVal == null) { | ||
retVal = "!MESSAGE!"; | ||
} | ||
return retVal; | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.