derive insert from request
[jSite2.git] / src / net / pterodactylus / jsite / core / Insert.java
1 /*
2  * jSite2 - Insert.java - Copyright © 2008 David Roden
3  * 
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  * 
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 package net.pterodactylus.jsite.core;
20
21 /**
22  * Represents a currently running or past insert.
23  * 
24  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
25  */
26 public class Insert extends Request {
27
28         /** The project that was inserted. */
29         private final Project project;
30
31         /** The start time of the insert. */
32         private final long startTime;
33
34         /** The end time of the insert. */
35         private long endTime;
36
37         /**
38          * Creates a new insert.
39          * 
40          * @param project
41          *            The project that is inserted
42          * @param node
43          *            The node the project is inserted to
44          * @param identifier
45          *            The identifier of the insert request
46          * @param startTime
47          *            The time the insert was started
48          */
49         public Insert(Project project, Node node, String identifier, long startTime) {
50                 super(node, identifier);
51                 this.project = project;
52                 this.startTime = startTime;
53         }
54
55         /**
56          * Returns the project that is inserted.
57          * 
58          * @return The inserted project
59          */
60         public Project getProject() {
61                 return project;
62         }
63
64         /**
65          * Returns the start time of the insert.
66          * 
67          * @return The start time of the insert
68          */
69         public long getStartTime() {
70                 return startTime;
71         }
72
73         /**
74          * Returns the end time of the insert. If the insert has not yet finished,
75          * <code>-1</code> is returned.
76          * 
77          * @return The end time of the insert, or <code>-1</code> if the insert is
78          *         still running
79          */
80         public long getEndTime() {
81                 return endTime;
82         }
83
84         /**
85          * Sets the end time of the insert.
86          * 
87          * @param endTime
88          *            The end time of the insert
89          */
90         public void setEndTime(long endTime) {
91                 this.endTime = endTime;
92         }
93
94 }