/**
 * Copyright 2016, RadiantBlue Technologies, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
package model.service.taskmanaged;

import org.joda.time.DateTime;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Represents a Job that has been sent to a Task-Managed Piazza Service.
 * <p>
 * This object correlates the Job ID with the time that is was pulled off the Jobs queue and sent to an external Service
 * Worker for processing.
 * </p>
 * 
 * @author Patrick.Doody
 *
 */
public class ServiceJob {
	/**
	 * The ID of the Service this Job pertains to.
	 */
	public String serviceId;
	public String jobId;
	public Integer timeouts;
	/**
	 * The time that work began processing on this Job.
	 */
	@JsonIgnore
	public DateTime startedOn;
	/**
	 * The time that the Job was inserted into the Jobs queue.
	 */
	@JsonIgnore
	public DateTime queuedOn;

	public ServiceJob() {
		this.queuedOn = new DateTime();
		this.timeouts = new Integer(0);
	}

	public ServiceJob(String jobId, String serviceId) {
		this();
		this.jobId = jobId;
		this.serviceId = serviceId;
	}

	public String getJobId() {
		return jobId;
	}

	public void setJobId(String jobId) {
		this.jobId = jobId;
	}

	@JsonIgnore
	public DateTime getStartedOn() {
		return startedOn;
	}

	@JsonIgnore
	public void setStartedOn(DateTime startedOn) {
		this.startedOn = startedOn;
	}

	@JsonProperty("startedOn")
	public String getStartedOnString() {
		if (startedOn != null) {
			// Defaults to ISO8601
			return startedOn.toString();
		} else {
			return null;
		}
	}

	@JsonProperty("startedOn")
	public void setStartedOnString(String startedOn) {
		this.startedOn = new DateTime(startedOn);
	}

	@JsonIgnore
	public DateTime getQueuedOn() {
		return queuedOn;
	}

	@JsonIgnore
	public void setQueuedOn(DateTime queuedOn) {
		this.queuedOn = queuedOn;
	}

	@JsonProperty("queuedOn")
	public String getQueuedOnString() {
		if (queuedOn != null) {
			// Defaults to ISO8601
			return queuedOn.toString();
		} else {
			return null;
		}
	}

	@JsonProperty("queuedOn")
	public void setQueuedOnString(String queuedOn) {
		this.queuedOn = new DateTime(queuedOn);
	}

	public Integer getTimeouts() {
		return timeouts;
	}

	public void setTimeouts(Integer timeouts) {
		this.timeouts = timeouts;
	}

	public String getServiceId() {
		return serviceId;
	}

	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}
}

@@ -1958,28 +1958,26 @@
 n%22)%0A%09public 
-Stri
+Lo
 ng getStarte
@@ -2059,32 +2059,33 @@
 n startedOn.
-toString
+getMillis
 ();%0A%09%09%7D else
@@ -2171,20 +2171,18 @@
 nString(
-Stri
+Lo
 ng start
@@ -2428,28 +2428,26 @@
 n%22)%0A%09public 
-Stri
+Lo
 ng getQueued
@@ -2534,16 +2534,17 @@
 dOn.
-toString
+getMillis
 ();%0A
@@ -2636,20 +2636,18 @@
 nString(
-Stri
+Lo
 ng queue

Update Dates to Milliseconds