1 /* 2 * Copyright (c) 2002-2021, 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.releaser.business; 35 36 import java.io.Serializable; 37 38 import org.codehaus.jackson.annotate.JsonIgnore; 39 import org.codehaus.jackson.annotate.JsonIgnoreProperties; 40 41 import fr.paris.lutece.plugins.releaser.util.CommandResult; 42 43 // TODO: Auto-generated Javadoc 44 /** 45 * WorkflowReleaseContext. 46 */ 47 48 @JsonIgnoreProperties( { 49 "releaserUser" 50 } ) 51 public class WorkflowReleaseContext implements Serializable 52 { 53 54 /** The Constant WORKFLOW_RESOURCE_TYPE. */ 55 public static final String WORKFLOW_RESOURCE_TYPE = "WORKFLOW_RELEASE_CONTEXT"; 56 57 /** The Constant serialVersionUID. */ 58 private static final long serialVersionUID = 8956577881980599537L; 59 60 /** The n id. */ 61 private int _nId; 62 63 /** The component. */ 64 private Component _component; 65 66 /** The site. */ 67 private Site _site; 68 69 /** The command result. */ 70 private CommandResult _commandResult; 71 72 /** The releaser user. */ 73 @JsonIgnore 74 private ReleaserUser _releaserUser; 75 76 /** The str ref branch release. */ 77 private String _strRefBranchRelease; 78 79 /** The str ref branch release From. */ 80 private String _strRefBranchReleaseFrom; 81 82 /** 83 * Gets the id. 84 * 85 * @return get Id 86 */ 87 public int getId( ) 88 { 89 return _nId; 90 } 91 92 /** 93 * Sets the id. 94 * 95 * @param _nId 96 * the new id 97 */ 98 public void setId( int _nId ) 99 { 100 this._nId = _nId; 101 } 102 103 /** 104 * Gets the component. 105 * 106 * @return componet 107 */ 108 public Component getComponent( ) 109 { 110 return _component; 111 } 112 113 /** 114 * Sets the component. 115 * 116 * @param _component 117 * the new component 118 */ 119 public void setComponent( Component _component ) 120 { 121 this._component = _component; 122 } 123 124 /** 125 * Gets the command result. 126 * 127 * @return command result 128 */ 129 public CommandResult getCommandResult( ) 130 { 131 return _commandResult; 132 } 133 134 /** 135 * Sets the command result. 136 * 137 * @param _commandResult 138 * command result 139 */ 140 public void setCommandResult( CommandResult _commandResult ) 141 { 142 this._commandResult = _commandResult; 143 } 144 145 /** 146 * Sets the site. 147 * 148 * @param site 149 * the new site 150 */ 151 public void setSite( Site site ) 152 { 153 _site = site; 154 } 155 156 /** 157 * Gets the site. 158 * 159 * @return get Site 160 */ 161 public Site getSite( ) 162 { 163 return _site; 164 } 165 166 /** 167 * Checks if is lutece site. 168 * 169 * @return true if the component is a lutece site 170 */ 171 public boolean isLuteceSite( ) 172 { 173 return _component == null && _site != null; 174 } 175 176 /** 177 * Gets the releaser user. 178 * 179 * @return getReleaserUser 180 */ 181 @JsonIgnore 182 public ReleaserUser getReleaserUser( ) 183 { 184 return _releaserUser; 185 } 186 187 /** 188 * Sets the releaser user. 189 * 190 * @param _releaserUser 191 * the new releaser user 192 */ 193 @JsonIgnore 194 public void setReleaserUser( ReleaserUser _releaserUser ) 195 { 196 this._releaserUser = _releaserUser; 197 } 198 199 /** 200 * Gets the ref branch release. 201 * 202 * @return getRefBranchRelease 203 */ 204 public String getRefBranchRelease( ) 205 { 206 return _strRefBranchRelease; 207 } 208 209 /** 210 * Sets the ref branch release. 211 * 212 * @param _strRefBranchRelease 213 * the new ref branch release 214 */ 215 public void setRefBranchRelease( String _strRefBranchRelease ) 216 { 217 this._strRefBranchRelease = _strRefBranchRelease; 218 } 219 220 /** 221 * Gets the ref branch release from. 222 * 223 * @return getRefBranchReleaseFrom 224 */ 225 public String getRefBranchReleaseFrom( ) 226 { 227 return _strRefBranchReleaseFrom; 228 } 229 230 /** 231 * Sets the ref branch Release From. 232 * 233 * @param _strRefBranchReleaseFrom 234 * the new ref branch Release From 235 */ 236 public void setRefBranchReleaseFrom( String _strRefBranchReleaseFrom ) 237 { 238 this._strRefBranchReleaseFrom = _strRefBranchReleaseFrom; 239 } 240 241 /** 242 * Gets the releaser resource. 243 * 244 * @return getReleaserResource 245 */ 246 public IReleaserResource getReleaserResource( ) 247 { 248 249 if ( this.getSite( ) != null ) 250 { 251 return this.getSite( ); 252 253 } 254 return this.getComponent( ); 255 } 256 257 }