All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evrythng.thng.resource.model.store.Task Maven / Gradle / Ivy

There is a newer version: 1.33
Show newest version
/*
 * (c) Copyright 2015 EVRYTHNG Ltd London / Zurich
 * www.evrythng.com
 */
package com.evrythng.thng.resource.model.store;

import com.evrythng.thng.resource.model.core.DurableResourceModel;
import org.apache.commons.collections.list.SetUniqueList;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Model representation for long tasks to distribute between machines.
 */
public class Task extends DurableResourceModel {

	private static final long serialVersionUID = -9117128840439882175L;
	// private ResourceLocation resourceLocation;
	private Notification.Policy notificationPolicy;
	public static final String FIELD_NOTIFICATION_POLICY = "notificationPolicy";
	private Long completedAt;
	public static final String FIELD_COMPLETED_AT = "completedAt";

	public static final class Notification {

		public static class Policy {

			public Policy() {

			}

			public Policy(final Way singleWay) {

				this.completion = Collections.singletonList(singleWay);
			}

			private List completion;
			public static final String FIELD_COMPLETION = "completion";

			public List getCompletion() {

				return completion;
			}

			public void setCompletion(final List completion) {

				this.completion = completion != null ? SetUniqueList.decorate(new ArrayList(completion)) : null;
			}
		}

		public static interface Way {

			Way.Type getType();

			void setType(Way.Type type);

			enum Type {

				EMAIL
			}
		}
	}

	public Notification.Policy getNotificationPolicy() {

		return notificationPolicy;
	}

	public void setNotificationPolicy(final Notification.Policy notificationPolicy) {

		this.notificationPolicy = notificationPolicy;
	}

	public Long getCompletedAt() {

		return completedAt;
	}

	public void setCompletedAt(final Long completedAt) {

		this.completedAt = completedAt;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy