View Javadoc
1   /*
2    * Copyright (c) 2002-2017, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.chatbot.business;
35  
36  import java.io.Serializable;
37  
38  /**
39   * Post
40   */
41  public class Post implements Serializable
42  {
43      public static final int AUTHOR_BOT = 0;
44      public static final int AUTHOR_USER = 1;
45      public static final String CONTENT_TYPE_TEXT = "text";
46      public static final String CONTENT_TYPE_IMAGE = "image";
47      public static final String CONTENT_TYPE_CARD = "card";
48      private static final long serialVersionUID = 1L;
49  
50      // Variables declarations
51      private String _strContent;
52      private String _strContentType = CONTENT_TYPE_TEXT;
53      private int _nAuthor;
54  
55      /**
56       * Constructor
57       */
58      public Post( )
59      {
60      }
61  
62      /**
63       * Constructor
64       * 
65       * @param strContent
66       *            The content
67       * 
68       *            NB : Default content type is 'text'
69       */
70      public Post( String strContent )
71      {
72          _strContent = strContent;
73      }
74  
75      /**
76       * Constructor
77       * 
78       * @param strContent
79       *            The content
80       * @param nAuthor
81       *            The author
82       * 
83       *            NB : Default content type is 'text'
84       */
85      public Post( String strContent, int nAuthor )
86      {
87          _strContent = strContent;
88          _nAuthor = nAuthor;
89      }
90  
91      /**
92       * Constructor
93       * 
94       * @param strContent
95       *            The content
96       */
97      public Post( String strContent, String strContentType, int nAuthor )
98      {
99          _strContent = strContent;
100         _strContentType = strContentType;
101         _nAuthor = nAuthor;
102     }
103 
104     /**
105      * Returns the Content
106      * 
107      * @return The Content
108      */
109     public String getContent( )
110     {
111         return _strContent;
112     }
113 
114     /**
115      * Sets the Content
116      * 
117      * @param strContent
118      *            The Content
119      */
120     public void setContent( String strContent )
121     {
122         _strContent = strContent;
123     }
124 
125     /**
126      * Returns the ContentType
127      * 
128      * @return The ContentType
129      */
130     public String getContentType( )
131     {
132         return _strContentType;
133     }
134 
135     /**
136      * Sets the ContentType
137      * 
138      * @param strContentType
139      *            The ContentType
140      */
141     public void setContentType( String strContentType )
142     {
143         _strContentType = strContentType;
144     }
145 
146     /**
147      * Returns the Author
148      * 
149      * @return The Author
150      */
151     public int getAuthor( )
152     {
153         return _nAuthor;
154     }
155 
156     /**
157      * Sets the Author
158      * 
159      * @param nAuthor
160      *            The Author
161      */
162     public void setAuthor( int nAuthor )
163     {
164         _nAuthor = nAuthor;
165     }
166 }