Subversion Repository Public Repository

Pharmacy_09_03_18

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcarecommonutil.util;

import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.Properties;

// TODO: Auto-generated Javadoc
/**
 * The Class MessageProperties.
 *
 * @author dell
 */
public class MessageProperties {
    
    /** The properties. */
    static Properties properties;
    
    /** The input stream. */
    InputStream inputStream = getClass().getResourceAsStream("/emrmessages.properties");  
    InputStream inputStreamDemo = getClass().getResourceAsStream("/messageToSend.properties");  
    
    /** The msg. */
    static MessageProperties msg;
    static{
        try{
            properties=new Properties();
            //FileInputStream fis=new FileInputStream(System.getProperty("user.home")+File.separator+"emr"+"/messages.properties");
            msg=new MessageProperties();
            properties.load(msg.inputStream);
            properties.load(msg.inputStreamDemo);
            msg.inputStream.close();
        }catch (IOException e) {
	      throw new RuntimeException("Error in loading properties file ");
	}
    }
    
    /**
     * Gets the message.
     *
     * @param key the key
     * @return the message
     */
    public static String getMessage(String key){
        return properties.getProperty(key);
    }
    
    /**
     * Gets the message.
     *
     * @param key the key
     * @param params the params
     * @return the message
     */
    public static String getMessage(String key,Object... params){
        if(params==null){
            return properties.getProperty(key);
        }else{
            String message = MessageFormat.format(properties.getProperty(key), params);
            return message;
        }
    }
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaCommonUtil/src/main/java/com/bestray/healthcarecommonutil/util/MessageProperties.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:30:57 +0000