summaryrefslogtreecommitdiff
path: root/src/de/podfetcher/service/DownloadStatus.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/podfetcher/service/DownloadStatus.java')
-rw-r--r--src/de/podfetcher/service/DownloadStatus.java124
1 files changed, 83 insertions, 41 deletions
diff --git a/src/de/podfetcher/service/DownloadStatus.java b/src/de/podfetcher/service/DownloadStatus.java
index 3c9f3c9de..8fb6a124b 100644
--- a/src/de/podfetcher/service/DownloadStatus.java
+++ b/src/de/podfetcher/service/DownloadStatus.java
@@ -1,48 +1,90 @@
package de.podfetcher.service;
+import java.util.Date;
+
import de.podfetcher.feed.FeedFile;
-/** Contains status attributes for one download*/
+/** Contains status attributes for one download */
public class DownloadStatus {
- protected FeedFile feedfile;
- protected int progressPercent;
- protected long soFar;
- protected long size;
- protected int statusMsg;
- protected int reason;
- protected boolean successful;
- protected boolean done;
-
- public DownloadStatus(FeedFile feedfile) {
- this.feedfile = feedfile;
- }
-
- public FeedFile getFeedFile() {
- return feedfile;
- }
-
- public int getProgressPercent() {
- return progressPercent;
- }
-
- public long getSoFar() {
- return soFar;
- }
-
- public long getSize() {
- return size;
- }
-
- public int getStatusMsg() {
- return statusMsg;
- }
-
- public int getReason() {
- return reason;
- }
-
- public boolean isSuccessful() {
- return successful;
- }
+ public Date getCompletionDate() {
+ return completionDate;
+ }
+
+ /** Unique id for storing the object in database. */
+ protected long id;
+
+ protected FeedFile feedfile;
+ protected int progressPercent;
+ protected long soFar;
+ protected long size;
+ protected int statusMsg;
+ protected int reason;
+ protected boolean successful;
+ protected boolean done;
+ protected Date completionDate;
+
+ public DownloadStatus(FeedFile feedfile) {
+ this.feedfile = feedfile;
+ }
+
+ /** Constructor for restoring Download status entries from DB. */
+ public DownloadStatus(long id, FeedFile feedfile, boolean successful, int reason,
+ Date completionDate) {
+ this.id = id;
+ this.feedfile = feedfile;
+ progressPercent = 100;
+ soFar = 0;
+ size = 0;
+ this.reason = reason;
+ this.successful = successful;
+ this.done = true;
+ this.completionDate = completionDate;
+ }
+
+
+ /** Constructor for creating new completed downloads. */
+ public DownloadStatus(FeedFile feedfile, int reason,
+ boolean successful) {
+ this(0, feedfile, successful, reason, new Date());
+ }
+
+ public FeedFile getFeedFile() {
+ return feedfile;
+ }
+
+ public int getProgressPercent() {
+ return progressPercent;
+ }
+
+ public long getSoFar() {
+ return soFar;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public int getStatusMsg() {
+ return statusMsg;
+ }
+
+ public int getReason() {
+ return reason;
+ }
+
+ public boolean isSuccessful() {
+ return successful;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+
+
} \ No newline at end of file