


Construct an miir filter from a repository
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: fromRepository
DESCRIPTION: Construct an miir filter from a repository
CALL: f = fromRepository(pl)
PARAMETER:
pl: Parameter list object
HISTORY: 07-05-2007 Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 % Construct an miir filter from a repository 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % FUNCTION: fromRepository 0005 % 0006 % DESCRIPTION: Construct an miir filter from a repository 0007 % 0008 % CALL: f = fromRepository(pl) 0009 % 0010 % PARAMETER: 0011 % pl: Parameter list object 0012 % 0013 % HISTORY: 07-05-2007 Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 function fs = fromRepository(f, pli) 0018 0019 VERSION = '$Id: fromRepository.m,v 1.6 2008/08/11 13:14:34 hewitson Exp $'; 0020 % get AO info 0021 ii = miir.getInfo('miir', 'From Repository'); 0022 % Set the method version string in the minfo object 0023 ii.setMversion([VERSION '-->' ii.mversion]); 0024 0025 % Add default values 0026 pl = combine(pli, ii.plists); 0027 0028 % Get parameters 0029 conn = find(pl, 'conn'); 0030 hostname = find(pl, 'hostname'); 0031 database = find(pl, 'database'); 0032 ids = find(pl, 'id'); 0033 0034 % do we have a connection? 0035 closeConn = 0; 0036 if isempty(conn) 0037 closeConn = 1; 0038 % Connect to repository 0039 conn = utils.mysql.connect(hostname, database); 0040 end 0041 if ~isa(conn, 'database') 0042 error('### connection failed.'); 0043 end 0044 0045 % Get each ID 0046 Nids = length(ids); 0047 fs = []; 0048 for kk=1:Nids 0049 0050 %---- This id 0051 id = ids(kk); 0052 utils.helper.msg(utils.const.msg.OPROC2, 'retrieving ID %d', id); 0053 0054 %---- check ID object type 0055 tt = utils.mysql.getObjType(conn, id); 0056 0057 %---- If this is an AO 0058 if strcmp(tt, 'miir') 0059 %---- call database constructor 0060 f = ltpda_uo.retrieve(conn, id); 0061 %---- Add history 0062 0063 % make a new history object 0064 % - remove connection object from plist first 0065 f.addHistory(ii, pli, [], []); 0066 0067 %---- Add to output array 0068 fs = [fs f]; 0069 else 0070 warning(' !skipping ID %d, type %s', id, tt); 0071 end 0072 0073 end 0074 0075 % close connection 0076 if closeConn 0077 close(conn); 0078 end 0079 end 0080 % END