/*
 * Copyright (c) 2009 The Olympos Development Team.
 * 
 * http://sourceforge.net/projects/olympos/
 * 
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html. If redistributing this code, this
 * entire header must remain intact.
 */
Ext.namespace("cwe.transaction");

cwe.transaction.AccountConnector = function() {

};

cwe.transaction.AccountConnector = Ext.extend(Ext.form.Hidden, {});

cwe.transaction.AccountConnector.prototype.setValue = function(newValue) {
	this.account = newValue;
};

cwe.transaction.AccountConnector.prototype.getValue = function() {
	var self = this;

	return {
		commit : function(parentRecord, actionSet) {
			return self.commit(parentRecord, actionSet);
		}
	};
};

cwe.transaction.AccountConnector.prototype.commit = function(parentRecord, actionSet) {
	var result = false;

	if (parentRecord.getOid().indexOf("?") != -1) {
		actionSet.addAssociate(this.account.getOid(), parentRecord.getOid(), "TransactionFromAccount");

		result = true;
	}

	return result;
};
