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

import java.util.*;

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

public class RespondToRequestController implements Controller {

	//Instance Variables
	private Notification notification;
	private Form respondForm;
	private TransactionDatabaseManager manager;

	//Methods
	public RespondToRequestController() {
		AbstractFormBuilder builder = AbstractFormBuilderFactory.getInstance().createFormBuilder();
		builder.addField("Request ID");
		builder.addField("Response");
		respondForm = builder.getResult();
		manager = AbstractDatabaseManagerFactory.getInstance().createTransactionDatabaseManager();
	}

	public Form activate() {
		return respondForm;
	}

	public Notification submitForm(Form form) {
		respondForm = form;
		notification = AbstractNotificationFactory.getInstance().createConfirmNotification("Proceed with request response?");
		return notification;
	}

 	public void respondToNotification(Notification notif) {
    if (notif.ok()) {
			List<String> formData = respondForm.getData();
			manager.finalizeTransaction(Integer.parseInt(formData.get(0)));
		}
  }

}

@@ -896,16 +896,257 @@
 = form;%0A
+%09%09List%3CString%3E formData = respondForm.getData();%0A%09%09if (!(manager.requestExists(Integer.parseInt(formData.get(0))))) %7B%0A%09%09%09notification = AbstractNotificationFactory.getInstance().createErrorNotification(%22Request does not exist%22);%0A%09%09%7D else %7B%0A%09
 %09%09notifi
@@ -1253,24 +1253,28 @@
 esponse?%22);%0A
+%09%09%7D%0A
 %09%09return not

Add error check to RespondToRequestController