View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of 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.filegenerator.business;
35  
36  import java.io.Serializable;
37  import java.sql.Timestamp;
38  import java.util.Optional;
39  
40  import fr.paris.lutece.portal.business.user.AdminUser;
41  
42  /**
43   *
44   * class TemporaryFile
45   *
46   */
47  public class TemporaryFile implements Serializable
48  {
49      private static final long serialVersionUID = -5789366144218904989L;
50  
51      private int _nIdFile;
52      private String _idPhysicalFile;
53      private String _strTitle;
54      private int _nSize;
55      private String _strExtension;
56      private String _strMimeType;
57      private Timestamp _dateCreation;
58      private AdminUser _user;
59      private String _description;
60  
61      /**
62       *
63       * @return the id of the file
64       */
65      public int getIdFile( )
66      {
67          return _nIdFile;
68      }
69  
70      /**
71       * set the id of the file
72       * 
73       * @param idFile
74       *            id of the file
75       */
76      public void setIdFile( int idFile )
77      {
78          _nIdFile = idFile;
79      }
80  
81      /**
82       *
83       * @return the title of the file
84       */
85      public String getTitle( )
86      {
87          return _strTitle;
88      }
89  
90      /**
91       * set the title of the file
92       * 
93       * @param title
94       *            the title of the file
95       */
96      public void setTitle( String title )
97      {
98          _strTitle = title;
99      }
100 
101     /**
102      *
103      * @return the size of the file
104      */
105     public int getSize( )
106     {
107         return _nSize;
108     }
109 
110     /**
111      * set the size of the file
112      * 
113      * @param size
114      *            the size of the file
115      */
116     public void setSize( int size )
117     {
118         _nSize = size;
119     }
120 
121     /**
122      *
123      * @return the extension of the file
124      */
125     public String getExtension( )
126     {
127         return _strExtension;
128     }
129 
130     /**
131      * set the extension of the file
132      * 
133      * @param extension
134      *            the title of the file
135      */
136     public void setExtension( String extension )
137     {
138         _strExtension = extension;
139     }
140 
141     /**
142      *
143      * @return the extension of the file
144      */
145     public String getMimeType( )
146     {
147         return _strMimeType;
148     }
149 
150     /**
151      * set the mime type of the file
152      * 
153      * @param mimeType
154      *            the mime type of the file
155      */
156     public void setMimeType( String mimeType )
157     {
158         _strMimeType = mimeType;
159     }
160 
161     /**
162      *
163      * @return the creation date of the file
164      */
165     public Timestamp getDateCreation( )
166     {
167         return Optional.ofNullable( _dateCreation ).map( Timestamp::toInstant ).map( Timestamp::from ).orElse( null );
168     }
169 
170     /**
171      * set the creation date of the file
172      * 
173      * @param dateCreation
174      *            the creation date of the file
175      */
176     public void setDateCreation( Timestamp dateCreation )
177     {
178 
179         _dateCreation = Optional.ofNullable( dateCreation ).map( Timestamp::toInstant ).map( Timestamp::from ).orElse( null );
180     }
181 
182     /**
183      * @return the user
184      */
185     public AdminUser getUser( )
186     {
187         return _user;
188     }
189 
190     /**
191      * @param user
192      *            the user to set
193      */
194     public void setUser( AdminUser user )
195     {
196         _user = user;
197     }
198 
199     /**
200      * @return the description
201      */
202     public String getDescription( )
203     {
204         return _description;
205     }
206 
207     /**
208      * @param description
209      *            the description to set
210      */
211     public void setDescription( String description )
212     {
213         _description = description;
214     }
215 
216     /**
217      * @return the idPhysicalFile
218      */
219     public String getIdPhysicalFile( )
220     {
221         return _idPhysicalFile;
222     }
223 
224     /**
225      * @param idPhysicalFile
226      *            the idPhysicalFile to set
227      */
228     public void setIdPhysicalFile( String idPhysicalFile )
229     {
230         _idPhysicalFile = idPhysicalFile;
231     }
232 }