View Javadoc
1   /*
2    * Copyright (c) 2002-2020, 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.appcenter.modules.fastdeployapplication.business;
35  
36  import java.util.HashMap;
37  import java.util.Locale;
38  import java.util.Map;
39  
40  import org.hibernate.validator.constraints.NotEmpty;
41  
42  import com.fasterxml.jackson.annotation.JsonIgnore;
43  
44  import fr.paris.lutece.plugins.appcenter.business.Demand;
45  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.web.FastDeployApplicationsXPage;
46  import fr.paris.lutece.portal.service.datastore.DatastoreService;
47  import fr.paris.lutece.portal.service.template.AppTemplateService;
48  import fr.paris.lutece.util.ReferenceList;
49  
50  /**
51   * 
52   * OpenamDemand
53   *
54   */
55  public class FastDeployApplicationDemand extends Demand
56  {
57  
58      public static final String ID_DEMAND_TYPE = "fastdeployapplication";
59      public static final String DEMAND_TYPE = "fastdeployapplication";
60  
61      private static final String TEMPLATE_SOURCES_DEMAND_INFOS = "skin/plugins/appcenter/modules/fastdeployapplication/application_demand_infos.html";
62  
63      @NotEmpty( message = "#i18n{module.appcenter.fastdeployapplication.validation.applicationName.notEmpty}" )
64      private String _strName;
65      @NotEmpty( message = "#i18n{module.appcenter.fastdeployapplication.validation.applicationWebApp.notEmpty}" )
66      private String _strWebApp;
67      @NotEmpty( message = "#i18n{module.appcenter.fastdeployapplication.validation.applicationSiteUrl.notEmpty}" )
68      private String _strUrlSite;
69      private String _strRepoType;
70      private boolean _bLuteceSite;
71      private String _strMavenDeployCustomGoal;
72      private String _strApplicationCode;
73  
74      /**
75       * 
76       * @return
77       */
78      public String getName( )
79      {
80          return _strName;
81      }
82  
83      /**
84       * 
85       * @param _strName
86       */
87      public void setName( String _strName )
88      {
89          this._strName = _strName;
90      }
91  
92      public String getWebApp( )
93      {
94          return _strWebApp;
95      }
96  
97      public void setWebApp( String _strWebApp )
98      {
99          this._strWebApp = _strWebApp;
100     }
101 
102     public String getUrlSite( )
103     {
104         return _strUrlSite;
105     }
106 
107     public void setUrlSite( String _strUrlSite )
108     {
109         this._strUrlSite = _strUrlSite;
110     }
111 
112     @Override
113     public String getComplementaryInfos( )
114     {
115         Map<String, Object> model = new HashMap<String, Object>( );
116         model.put( MARK_DEMAND, this );
117 
118         return AppTemplateService.getTemplate( TEMPLATE_SOURCES_DEMAND_INFOS, Locale.FRENCH, model ).getHtml( );
119     }
120 
121     /**
122      * Get the demand type id
123      * 
124      * @return the demand type id
125      */
126     @JsonIgnore
127     @Override
128     public String getIdDemandType( )
129     {
130         return ID_DEMAND_TYPE;
131     }
132 
133     /**
134      * Get the demand type id
135      * 
136      * @return the demand type id
137      */
138     @JsonIgnore
139     @Override
140     public String getDemandType( )
141     {
142         return DEMAND_TYPE;
143     }
144 
145     @JsonIgnore
146     @Override
147     public boolean isDependingOfEnvironment( )
148     {
149         return false;
150     }
151 
152     /**
153      * Get the repo type of the application
154      * 
155      * @return the repo type
156      */
157     public String getRepoType( )
158     {
159         return _strRepoType;
160     }
161 
162     /**
163      * Set the repo type of the application
164      * 
165      * @param strRepoType
166      *            the repo type
167      */
168     public void setRepoType( String strRepoType )
169     {
170         _strRepoType = strRepoType;
171     }
172 
173     /**
174      * Get the is LuteceSite boolean
175      * 
176      * @return return true if the application is a Lutece App, false otherwise
177      */
178     public boolean isLuteceSite( )
179     {
180         return _bLuteceSite;
181     }
182 
183     /**
184      * Set the Lutece Site boolean
185      * 
186      * @param bLuteceSite
187      *            the Lutece Site boolean
188      */
189     public void setLuteceSite( boolean bLuteceSite )
190     {
191         _bLuteceSite = bLuteceSite;
192     }
193 
194     /**
195      * Get the maven custom deploy goal
196      * 
197      * @return the custom maven deploy goal
198      */
199     public String getMavenDeployCustomGoal( )
200     {
201         return _strMavenDeployCustomGoal;
202     }
203 
204     /**
205      * Get the maven custom deploy goal
206      * 
207      * @param _strMavenCustomDeployGoal
208      *            The custom Maven Custom deploy goal
209      */
210     public void setMavenDeployCustomGoal( String strMavenCustomDeployGoal )
211     {
212         _strMavenDeployCustomGoal = strMavenCustomDeployGoal;
213     }
214 
215     public String getApplicationCode( )
216     {
217         return _strApplicationCode;
218     }
219 
220     public void setApplicationCode( String strApplicationCode )
221     {
222         _strApplicationCode = strApplicationCode;
223     }
224 
225 }