Mercurial > hg > ltpda
diff m-toolbox/classes/@workspaceBrowser/retrieveObjectsFromDialog.m @ 30:317b5f447f3e database-connection-manager
Update workspaceBrowser
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line diff
--- a/m-toolbox/classes/@workspaceBrowser/retrieveObjectsFromDialog.m Mon Dec 05 16:20:06 2011 +0100 +++ b/m-toolbox/classes/@workspaceBrowser/retrieveObjectsFromDialog.m Mon Dec 05 16:20:06 2011 +0100 @@ -6,8 +6,8 @@ if ~isa(varargin{1}, 'mpipeline.repository.RepositoryRetrieveDialog') error('### The first input must be a mpipeline.repository.RepositoryRetrieveDialog'); end - if ~isa(varargin{2}, 'mpipeline.repository.RepositoryConnection') - error('### The first input must be a mpipeline.repository.RepositoryConnection'); + if ~isa(varargin{2}, 'java.sql.Connection') + error('### The first input must be a java.sql.Connection'); end qb = varargin{1}; @@ -75,9 +75,9 @@ disp(sprintf('+ retrieving object %d', ids(j))); % determine object type - tt = char(mpipeline.repository.MySQLUtils.getObjectTypeForID(conn, ids(j))); - - if isempty(tt) || strcmp(tt, 'No Data') + try + tt = utils.repository.getObjectType(conn, ids(j)); + catch utils.helper.errorDlg('Object type is unknown. Does this object really exist?'); return end @@ -89,13 +89,9 @@ obj_names = [obj_names {objname}]; % Retrieve object - hostname = char(conn.getHostname); - db = char(conn.getDatabase); - % add history - pl = plist('hostname', hostname, 'database', db, 'ID', ids(j), 'conn', conn); + pl = plist('id', ids(j), 'conn', conn); if retrieveBinary - pl.append('Binary', 'yes'); - disp(sprintf('*** performing binary retrieval.')); + pl.append('binary', 'yes'); end obj = eval(sprintf('%s(pl);', tt)); @@ -107,27 +103,17 @@ for k=1:length(cids) % get Ids from Cid - ids = mpipeline.repository.MySQLUtils.getObjectIDsFromCollectionID(conn, cids(k)); + ids = utils.repository.getCollectionIDs(conn, cids(k)); if isempty(ids) error('### This collection doesn''t seem to exist.'); end for j=1:length(ids) disp(sprintf('+ retrieving collection %d : %d', cids(k), ids(j))); - tt = char(mpipeline.repository.MySQLUtils.getObjectTypeForID(conn, ids(j))); + tt = utils.repository.getObjectType(conn, ids(j)); if ismember(tt, utils.helper.ltpda_userclasses) % Retrieve object - if isa(conn, 'database') - ipbits = regexp(conn.URL, '([0-9]+)', 'match'); - ip = [ipbits{1} '.' ipbits{2} '.' ipbits{3} '.' ipbits{4}]; - db = regexp(conn.URL, '/', 'split'); - db = db{end}; - else - ip = conn.getHostname; - db = conn.getDatabase; - end - % add history - pl = plist('hostname', ip, 'database', db, 'ID', ids(j), 'conn', conn); + pl = plist('id', ids(j), 'conn', conn); obj = eval(sprintf('%s(pl);', tt)); objname = sprintf('%sC%03d_%03d', prefix, cids(k), ids(j));