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.portal.business.progressmanager;
35  
36  import java.io.Serializable;
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * This is the business class for the object ProgressFeed
42   */
43  public class ProgressFeed implements Serializable
44  {
45      private static final long serialVersionUID = 1L;
46  
47      // Variables declarations
48      private String _strId;
49      private String _strToken;
50  
51      private int _nNbItemTotal = 0;
52  
53      private int _nNbItemSuccess = 0;
54  
55      private int _nNbItemFailure = 0;
56  
57      private List<String> _report = new ArrayList<>( );
58  
59      /**
60       * Returns the Id
61       * 
62       * @return The Id
63       */
64      public String getId( )
65      {
66          return _strId;
67      }
68  
69      /**
70       * Sets the Id
71       * 
72       * @param strId
73       */
74      public void setId( String strId )
75      {
76          _strId = strId;
77      }
78  
79      /**
80       * Returns the Token
81       * 
82       * @return The Token
83       */
84      public String getToken( )
85      {
86          return _strToken;
87      }
88  
89      /**
90       * Sets the Token
91       * 
92       * @param strToken
93       */
94      public void setToken( String strToken )
95      {
96          _strToken = strToken;
97      }
98  
99      /**
100      * Returns the NbItemTotal
101      * 
102      * @return The NbItemTotal
103      */
104     public int getNbItemTotal( )
105     {
106         return _nNbItemTotal;
107     }
108 
109     /**
110      * Sets the NbItemTotal
111      * 
112      * @param nNbItemTotal
113      *            The NbItemTotal
114      */
115     public void setNbItemTotal( int nNbItemTotal )
116     {
117         _nNbItemTotal = nNbItemTotal;
118     }
119 
120     /**
121      * Returns the NbItemSuccess
122      * 
123      * @return The NbItemSuccess
124      */
125     public int getNbItemSuccess( )
126     {
127         return _nNbItemSuccess;
128     }
129 
130     /**
131      * Increments the NbItemSuccess
132      * 
133      * @param nNbItemSuccess
134      *            The NbItemSuccess
135      */
136     public void addSuccessItems( int nNbItemSuccess )
137     {
138         _nNbItemSuccess += nNbItemSuccess;
139     }
140 
141     /**
142      * Returns the NbItemFailure
143      * 
144      * @return The NbItemFailure
145      */
146     public int getNbItemFailure( )
147     {
148         return _nNbItemFailure;
149     }
150 
151     /**
152      * Increments the NbItemFailure
153      * 
154      * @param nNbItemFailure
155      *            The NbItemFailure
156      */
157     public void addFailureItems( int nNbItemFailure )
158     {
159         _nNbItemFailure += nNbItemFailure;
160     }
161 
162     /**
163      * Returns the Report
164      * 
165      * @return The Report
166      */
167     public List<String> getReportList( )
168     {
169         return _report;
170     }
171 
172     /**
173      * Returns the last Report
174      * 
175      * @return The Report
176      */
177     public String getLastReport( )
178     {
179         return ( _report != null && _report.size( ) > 0 ) ? _report.get( _report.size( ) - 1 ) : null;
180     }
181 
182     /**
183      * Add line to the Report
184      * 
185      * @param strReport
186      */
187     public void addReport( String strReport )
188     {
189         _report.add( strReport );
190     }
191 
192     /**
193      * Add lines to the Report
194      * 
195      * @param strReportList
196      */
197     public void addReport( List<String> strReportList )
198     {
199         _report.addAll( strReportList );
200     }
201 }