view m-toolbox/classes/+utils/@helper/isSubmissionPlist.m @ 19:69e3d49b4b0c database-connection-manager

Update ltpda_uo.fromRepository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% ISSUBMISSIONPLIST Checks if the input plist is a submission plist.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: ISSUBMISSIONPLIST Checks if the input plist is a submission
%              plist. This means that this method checks that the input
%              plist have only some of the following keys:
%              'hostname'
%              'database'
%              'username'
%              'password'
%              'experiment title'
%              'experiment description'
%              'analysis description'
%              'quantity'
%              'keywords'
%              'reference ids'
%              'additional comments'
%              'additional authors'
%              'binary'
%              'no dialog'
%
% CALL:        res = isSubmissionPlist(pl)
%
% VERSION:     $Id: isSubmissionPlist.m,v 1.6 2010/05/03 19:21:52 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function res = isSubmissionPlist(pl)
  
  fields = {...
    'hostname', ...
    'database', ...
    'username', ...
    'password', ...
    'conn',     ...
    'experiment title', ...
    'experiment_title', ...
    'experiment description', ...
    'experiment_description', ...
    'analysis description', ...
    'analysis_description', ...
    'quantity', ...
    'keywords', ...
    'reference ids', ...
    'reference_ids', ...
    'additional comments', ...
    'additional_comments', ...
    'additional authors', ...
    'additional_authors', ...
    'binary', ...
    'sinfo filename', ...
    'sinfo_filename', ...
    'no dialog', ...
    'use selector'};
  
  if pl.nparams >= 1
    keys = lower({pl.params(:).key});
    
    res = utils.helper.ismember(keys, fields);
    
    if all(res)
      res = true;
    else
      res = false;
    end
    
  else
    res = false;
  end
  
end