private DefaultMessageSourceServiceImpl() { InputStream stream = OpenmrsClassLoader.getInstance().getResourceAsStream("messages.properties"); if (stream != null) { OpenmrsUtil.loadProperties(props, stream); } }
@Override public void globalPropertyDeleted(String propertyName) { // reset the value setDefaultLocaleCache(null); setLocalesAllowedListCache(null); }
private String getRuntimePropertiesFileName() { String fileName = OpenmrsUtil.getRuntimePropertiesFileNameInTestMode(); if (fileName == null) { fileName = WebConstants.WEBAPP_NAME + "-runtime.properties"; } return fileName; }
/** * Loads a class with an instance of the OpenmrsClassLoader. Convenience method equivalent to * OpenmrsClassLoader.getInstance().loadClass(className); * * @param className the class to load * @return the class that was loaded * @throws ClassNotFoundException * @should load class with the OpenmrsClassLoader */ public static Class<?> loadClass(String className) throws ClassNotFoundException { return OpenmrsClassLoader.getInstance().loadClass(className); }
/** * encrypt text using stored initVector and securityKey * * @param text * @return encrypted text * @since 1.9 * @should encrypt short and long text */ public static String encrypt(String text) { return Security.encrypt(text, Security.getSavedInitVector(), Security.getSavedSecretKey()); }
/** * decrypt text using stored initVector and securityKey * * @param text text to be decrypted * @return decrypted text * @since 1.9 * @should decrypt short and long text */ public static String decrypt(String text) { return Security.decrypt(text, Security.getSavedInitVector(), Security.getSavedSecretKey()); }
/** * @return current locale for this context */ public Locale getLocale() { if (locale == null) { // don't cache default locale - allows recognition of changed default at login page return LocaleUtility.getDefaultLocale(); } return locale; }
@Override public void onApplicationEvent(ContextRefreshedEvent event) { clearCachedHandlers(); } }
/** * If any cause in the given exception chain is an APIAuthenticationException, rethrow that * * @param thrown */ public static void rethrowAPIAuthenticationException(Throwable thrown) { rethrowIfCause(thrown, APIAuthenticationException.class); }
/** * Convenience method to run the changesets using Liquibase to bring the database up to a * version compatible with the code * * @throws InputRequiredException if the changelog file requires some sort of user input. The * error object will list of the user prompts and type of data for each prompt * @see #executeChangelog(String, Map) */ public static void executeChangelog() throws DatabaseUpdateException, InputRequiredException { executeChangelog(null, null); }
/** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @Override public int compare(Person person1, Person person2) { return comparePersonsByName(person1, person2); }
/** * @see org.openmrs.api.GlobalPropertyListener#globalPropertyDeleted(java.lang.String) */ @Override public void globalPropertyDeleted(String propertyName) { // reset the value setDefaultLocation(null); }
/** * @return build version without alpha characters (eg: 1.10.0.24858) * defined in MANIFEST.MF (specification-Version) * * @see #OPENMRS_VERSION_SHORT * @see #OPENMRS_VERSION */ private static String getBuildVersionShort() { return getOpenmrsProperty("openmrs.version.short"); }
/** * @return the instance */ public static OpenmrsClassScanner getInstance() { if (OpenmrsClassScannerHolder.INSTANCE == null) { OpenmrsClassScannerHolder.INSTANCE = new OpenmrsClassScanner(); } return OpenmrsClassScannerHolder.INSTANCE; }
/** * Finds and loads the runtime properties * * @return Properties * @see OpenmrsUtil#getRuntimeProperties(String) */ public static Properties getRuntimeProperties() { return OpenmrsUtil.getRuntimeProperties(WebConstants.WEBAPP_NAME); }
/** * Get the static/singular instance of the module class loader * * @return OpenmrsClassLoader */ public static OpenmrsClassLoader getInstance() { if (OpenmrsClassLoaderHolder.INSTANCE == null) { OpenmrsClassLoaderHolder.INSTANCE = new OpenmrsClassLoader(); } return OpenmrsClassLoaderHolder.INSTANCE; }
/** * Creates a uid of length 20 * * @see #generateUid(Integer) */ public static String generateUid() { return generateUid(20); }
@Override public void globalPropertyChanged(GlobalProperty newValue) { // reset the value setDefaultLocaleCache(null); setLocalesAllowedListCache(null); }
/** * @see org.openmrs.api.GlobalPropertyListener#globalPropertyChanged(org.openmrs.GlobalProperty) */ @Override public void globalPropertyChanged(GlobalProperty newValue) { // reset the value setDefaultLocation(null); }
/** * @return build version with alpha characters (eg:1.10.0 SNAPSHOT Build 24858) * defined in MANIFEST.MF(specification-Vendor) * * @see #OPENMRS_VERSION_SHORT * @see #OPENMRS_VERSION */ private static String getBuildVersion() { return getOpenmrsProperty("openmrs.version.long"); }