view m-toolbox/classes/+utils/@helper/isSubmissionPlist.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +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