0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 function objs = fromRepository(obj, pli)
0019
0020 VERSION = '$Id: fromRepository.m,v 1.1 2008/08/22 14:17:26 ingo Exp $';
0021
0022
0023 ii = obj.getInfo(class(obj), 'From Repository');
0024
0025 ii.setMversion([VERSION '-->' ii.mversion]);
0026
0027
0028 pl = combine(pli, ii.plists);
0029
0030
0031 conn = find(pl, 'conn');
0032 hostname = find(pl, 'hostname');
0033 database = find(pl, 'database');
0034 ids = find(pl, 'id');
0035
0036
0037 closeConn = 0;
0038 if isempty(conn)
0039 closeConn = 1;
0040
0041 conn = utils.mysql.connect(hostname, database);
0042 end
0043 if ~isa(conn, 'database')
0044 error('### connection to the database failed.');
0045 end
0046
0047
0048 Nids = length(ids);
0049 objs = [];
0050
0051 for kk=1:Nids
0052
0053
0054 id = ids(kk);
0055 utils.helper.msg(utils.const.msg.OPROC2, 'retrieving ID %d', id);
0056
0057
0058 tt = utils.mysql.getObjType(conn, id);
0059
0060
0061 if strcmp(tt, class(obj))
0062
0063 obj = ltpda_uo.retrieve(conn, id);
0064
0065
0066
0067
0068 txt = textscan(conn.URL, '%s', 'Delimiter', '/', 'CollectOutput', 1);
0069 plc = plist('hostname', txt{1}{3}, 'database', txt{1}{4});
0070 combine(pli, plc);
0071 pli.remove('conn');
0072 obj.addHistory(ii, pli, [], obj.hist);
0073
0074
0075 objs = [objs obj];
0076 else
0077 warning(' !skipping ID %d, type %s', id, tt);
0078 end
0079
0080 end
0081
0082
0083 if closeConn
0084 close(conn);
0085 end
0086 end
0087