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.appcenter.modules.fastdeployapplication.business.context;
35  
36  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.CommandResult;
37  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.FastDeployApplicationData;
38  import java.io.Serializable;
39  import java.util.HashMap;
40  
41  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.vcs.AbstractVCSUser;
42  
43  public abstract class AbstractWorkflowDeployContext implements Serializable
44  {
45      /**
46       *
47       */
48      protected static final long serialVersionUID = 1L;
49      public static final String WORKFLOW_RESOURCE_TYPE = "WORKFLOW_DEPLOY_CONTEXT";
50      protected int _nId;
51      protected FastDeployApplicationData _fastDeployApplicationData;
52      protected HashMap<String, String> _hashServerApplicationInstance;
53      protected String _strCodeEnvironement;
54      protected CommandResult _commandResult;
55      protected AbstractVCSUser _vcsUser;
56      protected int _nIdWorkflow;
57      protected int _nIdApplication;
58      private String _strPermission;
59      private Integer _nDiskRequiredFreespace;
60     
61     
62      
63      
64      public String getPermission() {
65  		return null;
66  	}
67  
68  	
69  	private String _strCustomMavenCommand;
70  
71      
72      
73      public int getId( )
74      {
75          return _nId;
76      }
77  
78      public void setId( int nId )
79      {
80          _nId = nId;
81      }
82  
83    
84  
85    
86  
87      public void setCommandResult( CommandResult _commandResult )
88      {
89          this._commandResult = _commandResult;
90      }
91  
92      public CommandResult getCommandResult( )
93      {
94          return _commandResult;
95      }
96  
97      
98  
99      public String getCodeEnvironement( )
100     {
101         return _strCodeEnvironement;
102     }
103 
104     public void setCodeEnvironement( String strCodeEnvironement )
105     {
106         _strCodeEnvironement = strCodeEnvironement;
107     }
108 
109     public String getCodeServerInstance( String strType )
110     {
111         String strTypeServerInstance = null;
112 
113         if ( _hashServerApplicationInstance != null )
114         {
115             strTypeServerInstance = _hashServerApplicationInstance.get( strType );
116             if ( strTypeServerInstance != null )
117             {
118                 strTypeServerInstance = strTypeServerInstance.split("_")[0];
119             }
120         }
121 
122         return strTypeServerInstance;
123     }
124 
125     public void setCodeServerInstance( String strCodeServerAppplicationInstance, String strType )
126     {
127         if ( _hashServerApplicationInstance == null )
128         {
129             _hashServerApplicationInstance = new HashMap<String, String>( );
130         }
131 
132         _hashServerApplicationInstance.put( strType, strCodeServerAppplicationInstance );
133     }
134 
135     
136    
137     /**
138      * Get the VCS user who is logged into the current workflow context
139      * 
140      * @return the VCS user
141      */
142     public AbstractVCSUser getVcsUser( )
143     {
144         return _vcsUser;
145     }
146 
147     /**
148      * Set the VCS user who is logged into the current workflow context
149      * 
150      * @param vcsUser
151      *            the VCSUser
152      */
153     public void setVcsUser( AbstractVCSUser vcsUser )
154     {
155         this._vcsUser = vcsUser;
156     }
157 
158     /**
159      * Get the string representing the custom maven command
160      * @return the custom maven command
161      */
162     public String getCustomMavenCommand() 
163     {
164         return _strCustomMavenCommand;
165     }
166 
167     /**
168      * Set the string representing the custom maven command
169      * @param strCustomMavenCommand  the string representing the custom maven command
170      */
171     public void setCustomMavenCommand(String strCustomMavenCommand) 
172     {
173         _strCustomMavenCommand = strCustomMavenCommand;
174     }
175 
176     public FastDeployApplicationData getFastDeployApplicationData( )
177     {
178         return _fastDeployApplicationData;
179     }
180 
181     public void setFastDeployApplicationData( FastDeployApplicationData _fastDeployApplicationData )
182     {
183         this._fastDeployApplicationData = _fastDeployApplicationData;
184     }
185 
186     public int getIdWorkflow( )
187     {
188         return _nIdWorkflow;
189     }
190 
191     public void setIdWorkflow( int nIdWorkflow )
192     {
193         this._nIdWorkflow = nIdWorkflow;
194     }
195 
196     public int getIdApplication() 
197     {
198         return _nIdApplication;
199     }
200 
201     public void setIdApplication(int nIdApplication) 
202     {
203         _nIdApplication = nIdApplication;
204     }
205 
206     public Integer getDiskRequiredFreespace( )
207     {
208         return _nDiskRequiredFreespace;
209     }
210 
211     public void setDiskRequiredFreespace( Integer _strDiskRequiredFreespace )
212     {
213         this._nDiskRequiredFreespace = _strDiskRequiredFreespace;
214     }
215     
216     
217 }