package com.veggie.src.java.controllers.transaction;

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

public class RequestItemController implements Controller {

	//Instance Variables
	private Notification notification;
	private Form requestItemForm;

	//Methods
	public RequestItemController() {
		AbstractFormBuilder builder = AbstractFormBuilderFactory.getInstance().createFormBuilder();
		builder.addField("Title");
		builder.addField("Description");
		requestItemForm = builder.getResult();
	}

	public Form activate() {
		//TO DO
		return null;
	}

	public Notification submitForm(Form form) {
		//TO DO
		return null;
	}

	public void respondToNotification(Notification notif) {
		//TO DO
	}


}

@@ -175,16 +175,246 @@
 ation.*;
+%0Aimport com.veggie.src.java.controllers.*;%0Aimport com.veggie.src.java.database.*;%0Aimport com.veggie.src.java.core.*;%0Aimport com.veggie.src.java.core.account.*;%0Aimport com.veggie.src.java.core.transaction.*;%0A%0Aimport java.util.List;
 %0A%0Apublic
@@ -555,16 +555,120 @@
 temForm;
+%0A%09private TransactionDatabaseManager transactionManager;%0A%09private AccountDatabaseManager accountManager;
 %0A%0A%09//Met
@@ -824,13 +824,18 @@
 ld(%22
-Title
+Account ID
 %22);%0A
@@ -910,16 +910,216 @@
 sult();%0A
+%09%09transactionManager = AbstractDatabaseManagerFactory.getInstance().createTransactionDatabaseManager();%0A%09%09accountManager = AbstractDatabaseManagerFactory.getInstance().createAccountDatabaseManager();%0A
 %09%7D%0A%0A%09pub
@@ -1142,37 +1142,38 @@
 e() %7B%0A%09%09
-//TO DO%0A%09%09return null
+return requestItemForm
 ;%0A%09%7D%0A%0A%09p
@@ -1221,101 +1221,535 @@
 %7B%0A%09%09
-//TO DO%0A%09%09return null;%0A%09%7D%0A%0A%09public void respondToNotification(Notification notif) %7B%0A%09%09//TO DO
+requestItemForm = form;%0A%09%09notification = AbstractNotificationFactory.getInstance().createConfirmNotification(%22Proceed with item request?%22);%0A%09%09return null;%0A%09%7D%0A%0A%09public void respondToNotification(Notification notif) %7B%0A%09%09if (notif.ok()) %7B%0A%09%09%09List%3CString%3E formData = requestItemForm.getData();%0A%09%09%09PatronAccount user = (PatronAccount) accountManager.getUser(Integer.parseInt(formData.get(0)));%0A%09%09%09RequestTransaction newRequest = new RequestTransaction(user, formData.get(1), 0);%0A%09%09%09transactionManager.addTransaction(newRequest);%0A%09%09%7D
 %0A%09%7D%0A

Implement RequestItemController