package devopsdistilled.operp.client.account.panes.controllers.impl;

import javax.inject.Inject;

import devopsdistilled.operp.client.abstracts.EntityOperation;
import devopsdistilled.operp.client.account.models.ReceivedTransactionModel;
import devopsdistilled.operp.client.account.panes.ReceivedTransactionPane;
import devopsdistilled.operp.client.account.panes.controllers.ReceivedTransactionPaneController;
import devopsdistilled.operp.client.account.panes.models.ReceivedTransactionPaneModel;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.client.party.models.CustomerModel;
import devopsdistilled.operp.server.data.entity.account.ReceivedTransaction;

public class ReceivedTransactionPaneControllerImpl implements
		ReceivedTransactionPaneController {

	@Inject
	private ReceivedTransactionPane view;

	@Inject
	private ReceivedTransactionPaneModel model;

	@Inject
	private CustomerModel customerModel;

	@Inject
	private ReceivedTransactionModel receivedTransactionModel;

	@Override
	public void validate() throws EntityValidationException {
		// TODO Auto-generated method stub

	}

	@Override
	public ReceivedTransaction save() {
		return receivedTransactionModel.saveAndUpdateModel(model.getEntity());
	}

	@Override
	public ReceivedTransactionPaneModel getModel() {
		return model;
	}

	@Override
	public ReceivedTransactionPane getView() {
		return view;
	}

	@Override
	public void init(ReceivedTransaction receivedTransaction,
			EntityOperation entityOperation) {

		view.setController(this);
		view.resetComponents();

		model.registerObserver(view);
		model.setEntityAndEntityOperation(receivedTransaction, entityOperation);
		customerModel.registerObserver(view);

		view.init();
	}

}

@@ -1531,16 +1531,140 @@
 ion) %7B%0A%0A
+%09%09if (EntityOperation.Edit == entityOperation) %7B%0A%09%09%09receivedTransactionModel.getService().delete(receivedTransaction);%0A%09%09%7D%0A%0A
 %09%09view.s

Correct Impl when "Edit"