View Javadoc

1   package org.apache.continuum.taskqueue;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.Serializable;
23  
24  import org.apache.maven.continuum.model.scm.ScmResult;
25  import org.codehaus.plexus.taskqueue.Task;
26  
27  /**
28   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
29   * @version $Id: BuildProjectTask.java 918334 2010-03-03 06:29:26Z brett $
30   */
31  public class BuildProjectTask
32      implements Task, Serializable
33  {
34      private static final long serialVersionUID = 3647734422022017812L;
35  
36      private final int projectId;
37  
38      private final int buildDefinitionId;
39  
40      private final long timestamp;
41  
42      private final int trigger;
43  
44      private long maxExecutionTime;
45  
46      private final String projectName;
47  
48      private final String buildDefinitionLabel;
49  
50      private ScmResult scmResult;
51  
52      int projectGroupId;
53  
54      public BuildProjectTask( int projectId, int buildDefinitionId, int trigger, String projectName,
55                               String buildDefinitionLabel, ScmResult scmResult, int projectGroupId )
56      {
57          this.projectId = projectId;
58  
59          this.buildDefinitionId = buildDefinitionId;
60  
61          this.timestamp = System.currentTimeMillis();
62  
63          this.trigger = trigger;
64  
65          this.projectName = projectName;
66  
67          this.buildDefinitionLabel = buildDefinitionLabel;
68  
69          this.scmResult = scmResult;
70  
71          this.projectGroupId = projectGroupId;
72      }
73  
74      public int getProjectId()
75      {
76          return projectId;
77      }
78  
79      public int getBuildDefinitionId()
80      {
81          return buildDefinitionId;
82      }
83  
84      public long getTimestamp()
85      {
86          return timestamp;
87      }
88  
89      public int getTrigger()
90      {
91          return trigger;
92      }
93  
94      public void setMaxExecutionTime( long maxExecutionTime )
95      {
96          this.maxExecutionTime = maxExecutionTime;
97      }
98  
99      public long getMaxExecutionTime()
100     {
101         return maxExecutionTime;
102     }
103 
104     public String getProjectName()
105     {
106         return projectName;
107     }
108 
109     public String getBuildDefinitionLabel()
110     {
111         return buildDefinitionLabel;
112     }
113 
114     public ScmResult getScmResult()
115     {
116         return scmResult;
117     }
118 
119     public int getProjectGroupId()
120     {
121         return projectGroupId;
122     }
123 
124     public boolean equals( Object obj )
125     {
126         if ( obj == null )
127         {
128             return false;
129         }
130         if ( obj == this )
131         {
132             return true;
133         }
134         if ( !( obj instanceof BuildProjectTask ) )
135         {
136             return false;
137         }
138         BuildProjectTask buildProjectTask = (BuildProjectTask) obj;
139         return buildProjectTask.getBuildDefinitionId() == this.getBuildDefinitionId() &&
140             buildProjectTask.getProjectId() == this.getProjectId() &&
141             buildProjectTask.getTrigger() == this.getTrigger();
142     }
143 
144     public int hashCode()
145     {
146         return this.getBuildDefinitionId() + this.getProjectId() + this.getTrigger();
147     }
148 
149     public int getHashCode()
150     {
151         return this.hashCode();
152     }
153 }