package com.veggie.src.java;

import com.veggie.src.java.form.*;
import com.veggie.src.java.notification.*;

public class AddItemController implements Controller {

	//Instance Variables
	private Notification notification;
	private Form addItemForm;
	
	//Methods
	public AddItemController() {
		AbstractFormBuilder builder = AbstractFormBuilderFactory.getInstance().createFormBuilder();
		builder.addField("Title");
		builder.addField("Author");
		builder.addField("ISBN");
		builder.addField("Description");
		addItemForm = builder.getResult();
	}
	
	public Form clickAddItemButton() {
	  return addItemForm;
	}
	
	public Notification submitForm() {
		return null;
	}
	
	public void respondToNotification() {
	
	}

}
@@ -100,16 +100,156 @@
 ation.*;
+%0Aimport com.veggie.src.java.database.*;%0Aimport com.veggie.src.java.MediaItem;%0Aimport com.veggie.src.java.MediaTitle;%0A%0Aimport java.util.List;
 %0A%0Apublic
@@ -383,16 +383,81 @@
 emForm;%0A
+%09private TitleDatabaseManager manager;%0A%09private int titleStatus;%0A
 %09%0A%09//Met
@@ -585,16 +585,44 @@
 lder();%0A
+%09%09builder.addField(%22ISBN%22);%0A
 %09%09builde
@@ -676,36 +676,8 @@
 %22);%0A
-%09%09builder.addField(%22ISBN%22);%0A
 %09%09bu
@@ -744,16 +744,103 @@
 sult();%0A
+%09%09manager = AbstractDatabaseManagerFactory.getInstance().createTitleDatabaseManager();%0A
 %09%7D%0A%09%0A%09pu
@@ -942,19 +942,261 @@
 %7B%0A%09%09
-return null
+List%3CString%3E formData = addItemForm.getData();%0A%09%09String isbn = formData.get(0);%0A%09%09titleStatus = manager.checkTitle(isbn, addItemForm.getFieldNames(), formData);%0A%09%09if (titleStatus == MediaTitle.INVALID_TITLE) %7B%0A%09%09%09%0A%09%09%7D else %7B%0A%09%09%0A%09%09%7D%0A%09%09return notification
 ;%0A%09%7D
@@ -1238,14 +1238,15 @@
 on() %7B%0A%09
+%09
 %0A%09%7D%0A%0A%7D

Implement submitForm in AddItemController