View Javadoc
1   /*
2    * To change this license header, choose License Headers in Project Properties.
3    * To change this template file, choose Tools | Templates
4    * and open the template in the editor.
5    */
6   package fr.paris.lutece.plugins.grubusiness.business.notification;
7   
8   /**
9    *
10   * @author seboo
11   */
12  public class StatusMessage
13  {
14      // Variables declarations
15      private String _strType;
16      private String _strStatus;
17      private String _strReason;
18      private String _strMessage;
19  
20      /**
21       * Constructor
22       * 
23       * @param _strType
24       * @param _strStatus
25       * @param _strReason
26       * @param _strMessage 
27       */
28      public StatusMessage(String _strType, String _strStatus, String _strReason, String _strMessage)
29      {
30          this._strType = _strType;
31          this._strStatus = _strStatus;
32          this._strReason = _strReason;
33          this._strMessage = _strMessage;
34      }
35      
36      
37  
38      /**
39       * get type 
40       * 
41       * @return the type
42       */
43      public String getType( )
44      {
45          return _strType;
46      }
47  
48      /**
49       * set type
50       * 
51       * @param _strType 
52       */
53      public void setType(String _strType)
54      {
55          this._strType = _strType;
56      }
57  
58      /**
59       * get status 
60       * 
61       * @return the status 
62       */
63      public String getStatus( )
64      {
65          return _strStatus;
66      }
67  
68      /**
69       * set status
70       * 
71       * @param _strStatus 
72       */
73      public void setStatus(String _strStatus)
74      {
75          this._strStatus = _strStatus;
76      }
77  
78      /**
79       * get reason
80       * 
81       * @return the reason 
82       */
83      public String getReason( )
84      {
85          return _strReason;
86      }
87  
88      /**
89       * set reason
90       * 
91       * @param _strReason 
92       */
93      public void setReason(String _strReason)
94      {
95          this._strReason = _strReason;
96      }
97  
98      /**
99       * get message
100      * 
101      * @return the message 
102      */
103     public String getStrMessage( )
104     {
105         return _strMessage;
106     }
107 
108     /**
109      * set message
110      * 
111      * @param _strMessage 
112      */
113     public void setStrMessage(String _strMessage) 
114     {
115         this._strMessage = _strMessage;
116     }
117     
118     /**
119      * returns the property values of the statusMessage as a list of String
120      * 
121      * @return the list of attributes values as string list
122      */
123     public String asJson( )
124     {
125         return "{" +
126                 "\"type\":\""    + _strType    + "\"," +
127                 "\"status\":\""  + _strStatus  + "\"," +
128                 "\"reason\":\""  + (_strReason == null ? "" : _strReason.replace( "\"","\\\"").replace("\n", "\\\\n").replace("\r", "\\\\r").replace("\t", "\\\\t")) + "\"," +
129                 "\"message\":\"" + (_strMessage == null ? "": _strMessage.replace( "\"","\\\"").replace("\n", "\\\\n").replace("\r", "\\\\r").replace("\t", "\\\\t")) + "\"}";
130     }
131 
132     
133 }