0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 function ss = ssmFromRepository(pli)
0018 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
0019
0020
0021 pl = combine(pli, ssm.getDefaultPlist('From Repository'));
0022
0023
0024 conn = find(pl, 'conn');
0025 hostname = find(pl, 'hostname');
0026 database = find(pl, 'database');
0027 ids = find(pl, 'id');
0028
0029
0030 closeConn = 0;
0031 if isempty(conn)
0032 closeConn = 1;
0033
0034 conn = mysql_connect(hostname, database);
0035 end
0036 if ~isa(conn, 'database')
0037 error('### connection failed.');
0038 end
0039
0040
0041 Nids = length(ids);
0042 ss = [];
0043 for kk=1:Nids
0044
0045
0046 id = ids(kk);
0047 disp(sprintf(' - retrieving ID %d', id));
0048
0049
0050 tt = mysql_getObjType(conn, id);
0051
0052 if strcmp(tt, mfilename)
0053
0054 s = ltpda_obj_retrieve(conn, id);
0055
0056 s.addHistory(ssm.getInfo('ssm', 'From Repository'), pli, {''}, []);
0057
0058 ss = [ss s];
0059 else
0060 warning(' !skipping ID %d, type %s', id, tt);
0061 end
0062
0063 end
0064
0065
0066 if closeConn
0067 close(conn);
0068 end
0069 end
0070