package mil.dds.anet.views;

import io.leangen.graphql.annotations.GraphQLQuery;

import java.util.Objects;

import org.joda.time.DateTime;

public abstract class AbstractAnetBean {

	protected String uuid;
	protected DateTime createdAt;
	protected DateTime updatedAt;

	public AbstractAnetBean() { 
		uuid = null;
	}

	@GraphQLQuery(name="uuid")
	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	@GraphQLQuery(name="createdAt")
	public DateTime getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(DateTime createdAt) {
		this.createdAt = createdAt;
	}

	@GraphQLQuery(name="updatedAt")
	public DateTime getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(DateTime updatedAt) {
		this.updatedAt = updatedAt;
	}
	
	/*Determines if two beans are "uuid" equal.
	 * That is they have the same uuid. (or are null)
	 */
	public static boolean uuidEqual(AbstractAnetBean a, AbstractAnetBean b) {
		if (a == null && b == null) { return true; }
		if (a == null || b == null) { return false; }
		if (a.getUuid() != null && b.getUuid() != null) {
			return Objects.equals(a.getUuid(), b.getUuid());
		}
		return a.equals(b);
	}
}

@@ -71,40 +71,314 @@
 phQL
-Query;%0A%0Aimport java.util.Objects
+Ignore;%0Aimport io.leangen.graphql.annotations.GraphQLQuery;%0Aimport io.leangen.graphql.annotations.GraphQLRootContext;%0A%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Objects;%0Aimport java.util.concurrent.CompletableFuture;%0A%0Aimport mil.dds.anet.AnetObjectEngine;%0Aimport mil.dds.anet.beans.Note
 ;%0A%0Ai
@@ -535,16 +535,43 @@
 datedAt;
+%0A%09private List%3CNote%3E notes;
 %0A%0A%09publi
@@ -1092,17 +1092,424 @@
 dAt;%0A%09%7D%0A
-%09
+%0A%09@GraphQLQuery(name=%22notes%22)%0A%09public CompletableFuture%3CList%3CNote%3E%3E loadNotes(@GraphQLRootContext Map%3CString, Object%3E context) %7B%0A%09%09return AnetObjectEngine.getInstance().getNoteDao().getNotesForRelatedObject(context, uuid)%0A%09%09%09%09.thenApply(o -%3E %7B notes = o; return o; %7D);%0A%09%7D%0A%0A%09@GraphQLIgnore%0A%09public List%3CNote%3E getNotes() %7B%0A%09%09return notes;%0A%09%7D%0A%0A%09public void setNotes(List%3CNote%3E notes) %7B%0A%09%09this.notes = notes;%0A%09%7D%0A
 %0A%09/*Dete

Add a list of notes to each AbstractAnetBean child