Changeset 3821


Ignore:
Timestamp:
Sep 7, 2010, 8:56:11 AM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Removed VPLUGINDEFID from FormFactory?.

Location:
trunk/client/servlet/src/org/proteios
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/file/CreateFileJobs.java

    r1958 r3821  
    11/**
    2  *
    3  */
     2*
     3*/
    44package org.proteios.action.file;
    55
     6import java.util.List;
    67import org.proteios.action.ProteiosAction;
    78import org.proteios.action.job.ListJobs;
     
    1415import org.proteios.core.PluginDefinition;
    1516import org.proteios.core.Project;
    16 import org.proteios.gui.form.FormFactory;
    17 
     17import org.proteios.gui.form.*;
    1818import se.lu.thep.waf.ActionException;
    1919import se.lu.thep.waf.constraints.InvalidParameterValue;
    2020
    21 import java.util.List;
    22 
    2321/**
    24  * Creates a plugin job for each file id
    25  *
    26  * @author fredrik
    27  */
     22* Creates a plugin job for each file id
     23*
     24* @author fredrik
     25*/
    2826public class CreateFileJobs
    29     extends ProteiosAction<CreateFileJobs>
     27extends ProteiosAction<CreateFileJobs>
    3028{
    31   @Override
    32   protected void runMe()
    33       throws ActionException, InvalidParameterValue
    34   {
    35     /*
    36     * Get a valid list of file ids
    37     */
    38     List<Integer> files = getValidIntegerList(FormFactory.VID);
    39     Integer pluginDefId = getValidInteger(FormFactory.VPLUGINDEFID);
    40     /*
    41     * execute the plugin on the selected files
    42     */
    43     DbControl dc = newDbControl();
    44     PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
    45     ItemFactory factory = new ItemFactory(dc);
    46     int jobCount = 0;
    47     for (Integer fileId : files)
    48     {
    49       Job job = factory.createJob(plugin, null);
    50       job.setName(plugin.getName());
    51       // Tell the job which file to work with
    52       File file = factory.getById(File.class, fileId);
    53       job
    54         .setDescription("File: " + file.getName());
    55       // Tell the job which file to work with
    56       FileParameterType fileParam = new FileParameterType();
    57       job.setParameterValue("file", fileParam, file);
    58       dc.saveItem(job);
    59       // Set project
    60       Project project = isProjectActive(dc);
    61       ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
    62         Project.class, null);
    63       job.setParameterValue("project", projectParam, project);
    64       jobCount++;
    65     }
    66     dc.commit();
    67     setMessage(jobCount + " jobs created");
    68     setForwardTo(ListJobs.class);
    69   }
     29  @Override
     30  protected void runMe()
     31  throws ActionException, InvalidParameterValue
     32  {
     33    /*
     34    * Get a valid list of file ids
     35    */
     36    List<Integer> files = getValidIntegerList(ItemIdField.VPARAM);
     37    Integer pluginDefId = getValidInteger(PluginIdField.VPARAM);
     38    /*
     39    * execute the plugin on the selected files
     40    */
     41    DbControl dc = newDbControl();
     42    PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
     43    ItemFactory factory = new ItemFactory(dc);
     44    int jobCount = 0;
     45    for (Integer fileId : files)
     46    {
     47      Job job = factory.createJob(plugin, null);
     48      job.setName(plugin.getName());
     49      // Tell the job which file to work with
     50      File file = factory.getById(File.class, fileId);
     51      job
     52      .setDescription("File: " + file.getName());
     53      // Tell the job which file to work with
     54      FileParameterType fileParam = new FileParameterType();
     55      job.setParameterValue("file", fileParam, file);
     56      dc.saveItem(job);
     57      // Set project
     58      Project project = isProjectActive(dc);
     59      ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
     60      Project.class, null);
     61      job.setParameterValue("project", projectParam, project);
     62      jobCount++;
     63    }
     64    dc.commit();
     65    setMessage(jobCount + " jobs created");
     66    setForwardTo(ListJobs.class);
     67  }
    7068}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHits.java

    r3817 r3821  
    6666    String gelId = getSessionAttribute(ExternalGelIdField.VPARAM);
    6767    String plateId = getSessionAttribute(ExternalPlateIdField.VPARAM);
    68     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
     68    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
    6969    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
    7070    ItemFactory factory = new ItemFactory(dc);
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1a.java

    r3325 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     
    3232import org.proteios.core.DbControl;
    3333import org.proteios.core.Project;
    34 import org.proteios.gui.form.Form;
    35 import org.proteios.gui.form.FormFactory;
    36 
     34import org.proteios.gui.form.*;
    3735import se.lu.thep.waf.ActionException;
    3836import se.lu.thep.waf.constraints.InvalidParameterValue;
    3937
    4038/**
    41  * @author olle
    42  */
     39* @author olle
     40*/
    4341public class ImportHitsNonGelWizardStep1a
    44     extends ProteiosAction<ImportHitsNonGelWizardStep1a>
     42extends ProteiosAction<ImportHitsNonGelWizardStep1a>
    4543{
    46   /*
    47   * (non-Javadoc)
    48   *
    49   * @see org.proteios.action.ProteiosAction#runMe()
    50   */
    51   @Override
    52   protected void runMe()
    53       throws ActionException, InvalidParameterValue
    54   {
    55     /***********************************************************************
    56     * Verify parameters
    57     */
    58     DbControl dc = newDbControl();
    59     Project project = isProjectActive(dc);
    60     Form impForm = getFormFactory().getImportHitsNonGelWizardStep1Form(project);
    61     // Check input for local sample id
    62     verifyParameters(impForm);
    63     String enteredLocalSampleId = getString(FormFactory.VLOCALSAMPLEID);
    64     String selectedLocalSampleId = getString(FormFactory.VLOCALSAMPLEIDSELECTED);
    65     Boolean useRegexPattern = getValidBoolean(ImportHitsNonGelWizardStep1b.VUSEREGEXPATTERN);
    66     String regexPattern = getValidString(ImportHitsNonGelWizardStep1b.VREGEXPATTERN);
    67     log.debug("enteredLocalSampleId = \"" + enteredLocalSampleId + "\"");
    68     log.debug("selectedLocalSampleId = \"" + selectedLocalSampleId + "\"");
    69     log.debug("useRegexPattern = " + useRegexPattern);
    70     log.debug("regexPattern = \"" + regexPattern + "\"");
    71     // Use entered local sample id if existing, else selected local sample id
    72     if (enteredLocalSampleId == null || enteredLocalSampleId.equals(""))
    73     {
    74       // No entered local sample id, check select box
    75       if (selectedLocalSampleId == null || selectedLocalSampleId.equals(""))
    76       {
    77         // No selected local sample id
    78         setError("Enter/select a local sample id");
    79         return;
    80       }
    81       else
    82       {
    83         // User selected a local sample id, use it
    84         setAttribute(FormFactory.VLOCALSAMPLEID, selectedLocalSampleId);
    85       }
    86     }
    87     saveToSession(FormFactory.VLOCALSAMPLEID);
    88     setSessionAttribute(ImportHitsNonGelWizardStep1b.VUSEREGEXPATTERN, useRegexPattern);
    89     saveToSession(ImportHitsNonGelWizardStep1b.VREGEXPATTERN);
    90     saveToSession(FormFactory.VFWDACTION);
    91     saveToSession(FormFactory.VPLUGINDEFID);
    92     setSessionAttribute(ViewActiveDirectory.VDIRID, project
    93       .getProjectDirectory().getId());
    94     setSessionAttribute(ViewActiveDirectory.VSELECT, true);
    95     setForwardTo(ViewActiveDirectory.class);
    96   }
     44  /*
     45  * (non-Javadoc)
     46  *
     47  * @see org.proteios.action.ProteiosAction#runMe()
     48  */
     49  @Override
     50  protected void runMe()
     51  throws ActionException, InvalidParameterValue
     52  {
     53    /***********************************************************************
     54    * Verify parameters
     55    */
     56    DbControl dc = newDbControl();
     57    Project project = isProjectActive(dc);
     58    Form impForm = getFormFactory().getImportHitsNonGelWizardStep1Form(project);
     59    // Check input for local sample id
     60    verifyParameters(impForm);
     61    String enteredLocalSampleId = getString(FormFactory.VLOCALSAMPLEID);
     62    String selectedLocalSampleId = getString(FormFactory.VLOCALSAMPLEIDSELECTED);
     63    Boolean useRegexPattern = getValidBoolean(ImportHitsNonGelWizardStep1b.VUSEREGEXPATTERN);
     64    String regexPattern = getValidString(ImportHitsNonGelWizardStep1b.VREGEXPATTERN);
     65    log.debug("enteredLocalSampleId = \"" + enteredLocalSampleId + "\"");
     66    log.debug("selectedLocalSampleId = \"" + selectedLocalSampleId + "\"");
     67    log.debug("useRegexPattern = " + useRegexPattern);
     68    log.debug("regexPattern = \"" + regexPattern + "\"");
     69    // Use entered local sample id if existing, else selected local sample id
     70    if (enteredLocalSampleId == null || enteredLocalSampleId.equals(""))
     71    {
     72      // No entered local sample id, check select box
     73      if (selectedLocalSampleId == null || selectedLocalSampleId.equals(""))
     74      {
     75        // No selected local sample id
     76        setError("Enter/select a local sample id");
     77        return;
     78      }
     79      else
     80      {
     81        // User selected a local sample id, use it
     82        setAttribute(FormFactory.VLOCALSAMPLEID, selectedLocalSampleId);
     83      }
     84    }
     85    saveToSession(FormFactory.VLOCALSAMPLEID);
     86    setSessionAttribute(ImportHitsNonGelWizardStep1b.VUSEREGEXPATTERN, useRegexPattern);
     87    saveToSession(ImportHitsNonGelWizardStep1b.VREGEXPATTERN);
     88    saveToSession(ForwardField.VPARAM);
     89    saveToSession(PluginIdField.VPARAM);
     90    setSessionAttribute(ViewActiveDirectory.VDIRID, project
     91    .getProjectDirectory().getId());
     92    setSessionAttribute(ViewActiveDirectory.VSELECT, true);
     93    setForwardTo(ViewActiveDirectory.class);
     94  }
    9795}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1b.java

    r3325 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     30import java.util.List;
    3031import org.proteios.action.ProteiosAction;
    3132import org.proteios.action.job.ListJobs;
     
    4041import org.proteios.core.Project;
    4142import org.proteios.core.StringParameterType;
    42 import org.proteios.gui.form.FormFactory;
    43 
     43import org.proteios.gui.form.*;
    4444import se.lu.thep.waf.ActionException;
    4545import se.lu.thep.waf.constraints.InvalidParameterValue;
     
    4747import se.lu.thep.waf.constraints.VString;
    4848
    49 import java.util.List;
    50 
    5149/**
    52  * @author olle
    53  */
     50* @author olle
     51*/
    5452public class ImportHitsNonGelWizardStep1b
    55     extends ProteiosAction<ImportHitsNonGelWizardStep1b>
     53extends ProteiosAction<ImportHitsNonGelWizardStep1b>
    5654{
    57   public static final VBoolean VUSEREGEXPATTERN = new VBoolean("useRegexPattern", false);
    58   public static final VString VREGEXPATTERN = new VString("regexPattern", 0, 255, false);
    59 
    60   /*
    61   * (non-Javadoc)
    62   *
    63   * @see org.proteios.action.ProteiosAction#runMe()
    64   */
    65   @Override
    66   protected void runMe()
    67       throws ActionException, InvalidParameterValue
    68   {
    69     /***********************************************************************
    70     * Verify parameters
    71     */
    72     DbControl dc = newDbControl();
    73     Project project = isProjectActive(dc);
    74     String localSampleId = getSessionAttribute(FormFactory.VLOCALSAMPLEID);
    75     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
    76     List<Integer> fileIds = getValidIntegerList(FormFactory.VID);
    77     Boolean useRegexPattern = getSessionAttribute(VUSEREGEXPATTERN);
    78     String regexPattern = getSessionAttribute(VREGEXPATTERN);
    79     // Set default value of regex pattern use flag to false
    80     if (useRegexPattern == null)
    81     {
    82       useRegexPattern = false;
    83     }
    84     log.debug("useRegexPattern = " + useRegexPattern);
    85     log.debug("regexPattern = \"" + regexPattern + "\"");
    86     /***********************************************************************
    87     * Create job
    88     */
    89     ItemFactory factory = new ItemFactory(dc);
    90     for (Integer fileId : fileIds)
    91     {
    92       File file = factory.getById(File.class, fileId);
    93       PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
    94       Job job = factory.createJob(plugin, null);
    95       job.setName(plugin.getName() + " File: " + file.getName());
    96       job
    97         .setDescription("Local sample ID: " + localSampleId + " File: " + file
    98           .getName());
    99       //
    100       StringParameterType localSampleIdParam = new StringParameterType();
    101       job.setParameterValue("localSampleId", localSampleIdParam, localSampleId);
    102       //
    103       ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
    104         Project.class, null);
    105       job.setParameterValue("project", projectParam, project);
    106       // File parameters
    107       FileParameterType filesParam = new FileParameterType();
    108       job.setParameterValue("file", filesParam, file);
    109       //
    110       BooleanParameterType useRegexPatternFlagParam = new BooleanParameterType();
    111       job.setParameterValue("useRegexPattern", useRegexPatternFlagParam, useRegexPattern);
    112       //
    113       StringParameterType regexPatternParam = new StringParameterType();
    114       job.setParameterValue("regexPattern", regexPatternParam, regexPattern);
    115       //
    116       dc.saveItem(job);
    117     }
    118     dc.commit();
    119     setMessage("Job created - Wait for jobs to finish before next step");
    120     /***********************************************************************
    121     * Layout
    122     */
    123     setForwardTo(ListJobs.class);
    124   }
     55  public static final VBoolean VUSEREGEXPATTERN = new VBoolean("useRegexPattern", false);
     56  public static final VString VREGEXPATTERN = new VString("regexPattern", 0, 255, false);
     57 
     58  /*
     59  * (non-Javadoc)
     60  *
     61  * @see org.proteios.action.ProteiosAction#runMe()
     62  */
     63  @Override
     64  protected void runMe()
     65  throws ActionException, InvalidParameterValue
     66  {
     67    /***********************************************************************
     68    * Verify parameters
     69    */
     70    DbControl dc = newDbControl();
     71    Project project = isProjectActive(dc);
     72    String localSampleId = getSessionAttribute(FormFactory.VLOCALSAMPLEID);
     73    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
     74    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
     75    Boolean useRegexPattern = getSessionAttribute(VUSEREGEXPATTERN);
     76    String regexPattern = getSessionAttribute(VREGEXPATTERN);
     77    // Set default value of regex pattern use flag to false
     78    if (useRegexPattern == null)
     79    {
     80      useRegexPattern = false;
     81    }
     82    log.debug("useRegexPattern = " + useRegexPattern);
     83    log.debug("regexPattern = \"" + regexPattern + "\"");
     84    /***********************************************************************
     85    * Create job
     86    */
     87    ItemFactory factory = new ItemFactory(dc);
     88    for (Integer fileId : fileIds)
     89    {
     90      File file = factory.getById(File.class, fileId);
     91      PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
     92      Job job = factory.createJob(plugin, null);
     93      job.setName(plugin.getName() + " File: " + file.getName());
     94      job
     95      .setDescription("Local sample ID: " + localSampleId + " File: " + file
     96      .getName());
     97      //
     98      StringParameterType localSampleIdParam = new StringParameterType();
     99      job.setParameterValue("localSampleId", localSampleIdParam, localSampleId);
     100      //
     101      ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
     102      Project.class, null);
     103      job.setParameterValue("project", projectParam, project);
     104      // File parameters
     105      FileParameterType filesParam = new FileParameterType();
     106      job.setParameterValue("file", filesParam, file);
     107      //
     108      BooleanParameterType useRegexPatternFlagParam = new BooleanParameterType();
     109      job.setParameterValue("useRegexPattern", useRegexPatternFlagParam, useRegexPattern);
     110      //
     111      StringParameterType regexPatternParam = new StringParameterType();
     112      job.setParameterValue("regexPattern", regexPatternParam, regexPattern);
     113      //
     114      dc.saveItem(job);
     115    }
     116    dc.commit();
     117    setMessage("Job created - Wait for jobs to finish before next step");
     118    /***********************************************************************
     119    * Layout
     120    */
     121    setForwardTo(ListJobs.class);
     122  }
    125123}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep2a.java

    r2724 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     
    3232import org.proteios.core.DbControl;
    3333import org.proteios.core.Project;
    34 import org.proteios.gui.form.Form;
    35 import org.proteios.gui.form.FormFactory;
    36 
     34import org.proteios.gui.form.*;
    3735import se.lu.thep.waf.ActionException;
    3836import se.lu.thep.waf.constraints.InvalidParameterValue;
    3937
    4038/**
    41  * @author olle
    42  */
     39* @author olle
     40*/
    4341public class ImportHitsNonGelWizardStep2a
    44     extends ProteiosAction<ImportHitsNonGelWizardStep2a>
     42extends ProteiosAction<ImportHitsNonGelWizardStep2a>
    4543{
    46   /*
    47   * (non-Javadoc)
    48   *
    49   * @see org.proteios.action.ProteiosAction#runMe()
    50   */
    51   @Override
    52   protected void runMe()
    53       throws ActionException, InvalidParameterValue
    54   {
    55     /***********************************************************************
    56     * Verify parameters
    57     */
    58     DbControl dc = newDbControl();
    59     Project project = isProjectActive(dc);
    60     Form impForm = getFormFactory().getImportHitsNonGelWizardStep2Form(project);
    61     verifyParameters(impForm);
    62     saveToSession(FormFactory.VFWDACTION);
    63     saveToSession(FormFactory.VPLUGINDEFID);
    64     setSessionAttribute(ViewActiveDirectory.VDIRID, project
    65       .getProjectDirectory().getId());
    66     setSessionAttribute(ViewActiveDirectory.VSELECT, true);
    67     setForwardTo(ViewActiveDirectory.class);
    68   }
     44  /*
     45  * (non-Javadoc)
     46  *
     47  * @see org.proteios.action.ProteiosAction#runMe()
     48  */
     49  @Override
     50  protected void runMe()
     51  throws ActionException, InvalidParameterValue
     52  {
     53    /***********************************************************************
     54    * Verify parameters
     55    */
     56    DbControl dc = newDbControl();
     57    Project project = isProjectActive(dc);
     58    Form impForm = getFormFactory().getImportHitsNonGelWizardStep2Form(project);
     59    verifyParameters(impForm);
     60    saveToSession(ForwardField.VPARAM);
     61    saveToSession(PluginIdField.VPARAM);
     62    setSessionAttribute(ViewActiveDirectory.VDIRID, project
     63    .getProjectDirectory().getId());
     64    setSessionAttribute(ViewActiveDirectory.VSELECT, true);
     65    setForwardTo(ViewActiveDirectory.class);
     66  }
    6967}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep2b.java

    r2724 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     30import java.util.List;
    3031import org.proteios.action.ProteiosAction;
    3132import org.proteios.action.job.ListJobs;
     
    3839import org.proteios.core.PluginDefinition;
    3940import org.proteios.core.Project;
    40 import org.proteios.gui.form.FormFactory;
     41import org.proteios.gui.form.*;
    4142import se.lu.thep.waf.ActionException;
    4243import se.lu.thep.waf.constraints.InvalidParameterValue;
    43 import java.util.List;
    4444
    4545/**
    46  * @author olle
    47  */
     46* @author olle
     47*/
    4848public class ImportHitsNonGelWizardStep2b
    49     extends ProteiosAction<ImportHitsNonGelWizardStep2b>
     49extends ProteiosAction<ImportHitsNonGelWizardStep2b>
    5050{
    51   /*
    52   * (non-Javadoc)
    53   *
    54   * @see org.proteios.action.ProteiosAction#runMe()
    55   */
    56   @Override
    57   protected void runMe()
    58       throws ActionException, InvalidParameterValue
    59   {
    60     /***********************************************************************
    61     * Verify parameters
    62     */
    63     DbControl dc = newDbControl();
    64     Project project = isProjectActive(dc);
    65     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
    66     List<Integer> fileIds = getValidIntegerList(FormFactory.VID);
    67     ItemFactory factory = new ItemFactory(dc);
    68     /***********************************************************************
    69     * Create job
    70     */
    71     for (Integer fileId : fileIds)
    72     {
    73       File file = factory.getById(File.class, fileId);
    74       PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
    75       Job job = factory.createJob(plugin, null);
    76       job.setName(plugin.getName() + " File: " + file.getName());
    77       job.setDescription("File: " + file.getName());
    78       ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
    79         Project.class, null);
    80       job.setParameterValue("project", projectParam, project);
    81       // File parameters
    82       FileParameterType filesParam = new FileParameterType();
    83       job.setParameterValue("file", filesParam, file);
    84       dc.saveItem(job);
    85     }
    86     dc.commit();
    87     setMessage("Job created");
    88     /***********************************************************************
    89     * Layout
    90     */
    91     setForwardTo(ListJobs.class);
    92   }
     51  /*
     52  * (non-Javadoc)
     53  *
     54  * @see org.proteios.action.ProteiosAction#runMe()
     55  */
     56  @Override
     57  protected void runMe()
     58  throws ActionException, InvalidParameterValue
     59  {
     60    /***********************************************************************
     61    * Verify parameters
     62    */
     63    DbControl dc = newDbControl();
     64    Project project = isProjectActive(dc);
     65    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
     66    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
     67    ItemFactory factory = new ItemFactory(dc);
     68    /***********************************************************************
     69    * Create job
     70    */
     71    for (Integer fileId : fileIds)
     72    {
     73      File file = factory.getById(File.class, fileId);
     74      PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
     75      Job job = factory.createJob(plugin, null);
     76      job.setName(plugin.getName() + " File: " + file.getName());
     77      job.setDescription("File: " + file.getName());
     78      ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
     79      Project.class, null);
     80      job.setParameterValue("project", projectParam, project);
     81      // File parameters
     82      FileParameterType filesParam = new FileParameterType();
     83      job.setParameterValue("file", filesParam, file);
     84      dc.saveItem(job);
     85    }
     86    dc.commit();
     87    setMessage("Job created");
     88    /***********************************************************************
     89    * Layout
     90    */
     91    setForwardTo(ListJobs.class);
     92  }
    9393}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep1a.java

    r3816 r3821  
    6161    saveToSession(ExternalGelIdField.VPARAM);
    6262    saveToSession(ForwardField.VPARAM);
    63     saveToSession(FormFactory.VPLUGINDEFID);
     63    saveToSession(PluginIdField.VPARAM);
    6464    setSessionAttribute(ViewActiveDirectory.VDIRID, project
    6565      .getProjectDirectory().getId());
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep1b.java

    r3816 r3821  
    6565    Project project = isProjectActive(dc);
    6666    String gelId = getSessionAttribute(ExternalGelIdField.VPARAM);
    67     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
     67    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
    6868    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
    6969  if(fileIds == null || fileIds.isEmpty())
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep2a.java

    r3817 r3821  
    6161    saveToSession(ExternalPlateIdField.VPARAM);
    6262    saveToSession(ForwardField.VPARAM);
    63     saveToSession(FormFactory.VPLUGINDEFID);
     63    saveToSession(PluginIdField.VPARAM);
    6464    setSessionAttribute(ViewActiveDirectory.VDIRID, project
    6565      .getProjectDirectory().getId());
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep2b.java

    r3817 r3821  
    6767    Project project = isProjectActive(dc);
    6868    String plateId = getSessionAttribute(ExternalPlateIdField.VPARAM);
    69     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
     69    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
    7070    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
    7171  if(fileIds == null || fileIds.isEmpty())
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep3a.java

    r2070 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     
    3232import org.proteios.core.DbControl;
    3333import org.proteios.core.Project;
    34 import org.proteios.gui.form.Form;
    35 import org.proteios.gui.form.FormFactory;
    36 
     34import org.proteios.gui.form.*;
    3735import se.lu.thep.waf.ActionException;
    3836import se.lu.thep.waf.constraints.InvalidParameterValue;
    3937
    4038/**
    41  * @author olle
    42  */
     39* @author olle
     40*/
    4341public class ImportHitsWizardStep3a
    44     extends ProteiosAction<ImportHitsWizardStep3a>
     42extends ProteiosAction<ImportHitsWizardStep3a>
    4543{
    46   /*
    47   * (non-Javadoc)
    48   *
    49   * @see org.proteios.action.ProteiosAction#runMe()
    50   */
    51   @Override
    52   protected void runMe()
    53       throws ActionException, InvalidParameterValue
    54   {
    55     /***********************************************************************
    56     * Verify parameters
    57     */
    58     DbControl dc = newDbControl();
    59     Project project = isProjectActive(dc);
    60     Form impForm = getFormFactory().getImportHitsWizardStep3Form(project);
    61     verifyParameters(impForm);
    62     saveToSession(FormFactory.VFWDACTION);
    63     saveToSession(FormFactory.VPLUGINDEFID);
    64     setSessionAttribute(ViewActiveDirectory.VDIRID, project
    65       .getProjectDirectory().getId());
    66     setSessionAttribute(ViewActiveDirectory.VSELECT, true);
    67     setForwardTo(ViewActiveDirectory.class);
    68   }
     44  /*
     45  * (non-Javadoc)
     46  *
     47  * @see org.proteios.action.ProteiosAction#runMe()
     48  */
     49  @Override
     50  protected void runMe()
     51  throws ActionException, InvalidParameterValue
     52  {
     53    /***********************************************************************
     54    * Verify parameters
     55    */
     56    DbControl dc = newDbControl();
     57    Project project = isProjectActive(dc);
     58    Form impForm = getFormFactory().getImportHitsWizardStep3Form(project);
     59    verifyParameters(impForm);
     60    saveToSession(ForwardField.VPARAM);
     61    saveToSession(PluginIdField.VPARAM);
     62    setSessionAttribute(ViewActiveDirectory.VDIRID, project
     63    .getProjectDirectory().getId());
     64    setSessionAttribute(ViewActiveDirectory.VSELECT, true);
     65    setForwardTo(ViewActiveDirectory.class);
     66  }
    6967}
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep3b.java

    r3630 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2007 Gregory Vincic, Olle Mansson
     4Copyright (C) 2007 Gregory Vincic, Olle Mansson
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  Proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13Proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.hit;
    2929
     30import java.util.List;
    3031import org.proteios.action.ProteiosAction;
    3132import org.proteios.action.job.ListJobs;
     
    3839import org.proteios.core.PluginDefinition;
    3940import org.proteios.core.Project;
    40 import org.proteios.gui.form.FormFactory;
     41import org.proteios.gui.form.*;
    4142import se.lu.thep.waf.ActionException;
    4243import se.lu.thep.waf.constraints.InvalidParameterValue;
    43 import java.util.List;
    4444
    4545/**
    46  * @author olle
    47  */
     46* @author olle
     47*/
    4848public class ImportHitsWizardStep3b
    49     extends ProteiosAction<ImportHitsWizardStep3b>
     49extends ProteiosAction<ImportHitsWizardStep3b>
    5050{
    51   /*
    52    * (non-Javadoc)
    53    *
    54    * @see org.proteios.action.ProteiosAction#runMe()
    55    */
    56   @Override
    57   protected void runMe()
    58       throws ActionException, InvalidParameterValue
    59   {
    60     /***********************************************************************
    61      * Verify parameters
    62      */
    63     DbControl dc = newDbControl();
    64     Project project = isProjectActive(dc);
    65     Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);
    66     List<Integer> fileIds = getValidIntegerList(FormFactory.VID);
    67   if(fileIds == null || fileIds.isEmpty())
     51  /*
     52  * (non-Javadoc)
     53  *
     54  * @see org.proteios.action.ProteiosAction#runMe()
     55  */
     56  @Override
     57  protected void runMe()
     58  throws ActionException, InvalidParameterValue
    6859  {
    69    throw new InvalidParameterValue("Please select at least one file");
     60    /***********************************************************************
     61    * Verify parameters
     62    */
     63    DbControl dc = newDbControl();
     64    Project project = isProjectActive(dc);
     65    Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM);
     66    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
     67    if(fileIds == null || fileIds.isEmpty())
     68    {
     69      throw new InvalidParameterValue("Please select at least one file");
     70    }
     71    ItemFactory factory = new ItemFactory(dc);
     72    /***********************************************************************
     73    * Create job
     74    */
     75    for (Integer fileId : fileIds)
     76    {
     77      File file = factory.getById(File.class, fileId);
     78      PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
     79      Job job = factory.createJob(plugin, null);
     80      job.setName(plugin.getName() + " File: " + file.getName());
     81      job.setDescription("File: " + file.getName());
     82      ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
     83      Project.class, null);
     84      job.setParameterValue("project", projectParam, project);
     85      // File parameters
     86      FileParameterType filesParam = new FileParameterType();
     87      job.setParameterValue("file", filesParam, file);
     88      dc.saveItem(job);
     89    }
     90    dc.commit();
     91    setMessage("Job created");
     92    /***********************************************************************
     93    * Layout
     94    */
     95    setForwardTo(ListJobs.class);
    7096  }
    71     ItemFactory factory = new ItemFactory(dc);
    72     /***********************************************************************
    73      * Create job
    74      */
    75     for (Integer fileId : fileIds)
    76     {
    77       File file = factory.getById(File.class, fileId);
    78       PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
    79       Job job = factory.createJob(plugin, null);
    80       job.setName(plugin.getName() + " File: " + file.getName());
    81       job.setDescription("File: " + file.getName());
    82       ItemParameterType<Project> projectParam = new ItemParameterType<Project>(
    83         Project.class, null);
    84       job.setParameterValue("project", projectParam, project);
    85       // File parameters
    86       FileParameterType filesParam = new FileParameterType();
    87       job.setParameterValue("file", filesParam, file);
    88       dc.saveItem(job);
    89     }
    90     dc.commit();
    91     setMessage("Job created");
    92     /***********************************************************************
    93      * Layout
    94      */
    95     setForwardTo(ListJobs.class);
    96   }
    9797}
  • trunk/client/servlet/src/org/proteios/action/peakListSet/CreateFileExportJob.java

    r2381 r3821  
    11/*
    2  $Id$
     2$Id$
    33
    4  Copyright (C) 2006, 2007 Gregory Vincic
     4Copyright (C) 2006, 2007 Gregory Vincic
    55
    6  Files are copyright by their respective authors. The contributions to
    7  files where copyright is not explicitly stated can be traced with the
    8  source code revision system.
     6Files are copyright by their respective authors. The contributions to
     7files where copyright is not explicitly stated can be traced with the
     8source code revision system.
    99
    10  This file is part of Proteios.
    11  Available at http://www.proteios.org/
     10This file is part of Proteios.
     11Available at http://www.proteios.org/
    1212
    13  proteios-2.x is free software; you can redistribute it and/or
    14  modify it under the terms of the GNU General Public License
    15  as published by the Free Software Foundation; either version 2
    16  of the License, or (at your option) any later version.
     13proteios-2.x is free software; you can redistribute it and/or
     14modify it under the terms of the GNU General Public License
     15as published by the Free Software Foundation; either version 2
     16of the License, or (at your option) any later version.
    1717
    18  Proteios is distributed in the hope that it will be useful,
    19  but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  GNU General Public License for more details.
     18Proteios is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
    2222
    23  You should have received a copy of the GNU General Public License
    24  along with this program; if not, write to the Free Software
    25  Foundation, Inc., 59 Temple Place - Suite 330,
    26  Boston, MA  02111-1307, USA.
    27  */
     23You should have received a copy of the GNU General Public License
     24along with this program; if not, write to the Free Software
     25Foundation, Inc., 59 Temple Place - Suite 330,
     26Boston, MA  02111-1307, USA.
     27*/
    2828package org.proteios.action.peakListSet;
    2929
     
    3939import org.proteios.core.StringParameterType;
    4040import org.proteios.core.User;
    41 import org.proteios.gui.form.Form;
    42 import org.proteios.gui.form.FormFactory;
     41import org.proteios.gui.form.*;
    4342import se.lu.thep.waf.ActionException;
    4443import se.lu.thep.waf.constraints.InvalidParameterValue;
    4544
    4645/**
    47  * @author gregory
    48  */
     46* @author gregory
     47*/
    4948public class CreateFileExportJob
    50     extends ProteiosAction<CreateFileExportJob>
     49extends ProteiosAction<CreateFileExportJob>
    5150{
    52   @Override
    53   protected void runMe()
    54       throws ActionException, InvalidParameterValue
    55   {
    56     /***********************************************************************
    57     * Verify parameters
    58     */
    59     Form form = getFormFactory().getExportPeakListSetForm(null);
    60     verifyParameters(form);
    61     Integer plsId = getValidInteger(FormFactory.VID);
    62     Integer pluginDefId = getValidInteger(FormFactory.VPLUGINDEFID);
    63     String filename = getValidString(FormFactory.VNAME);
    64     /***********************************************************************
    65     * Create job
    66     */
    67     DbControl dc = newDbControl();
    68     ItemFactory factory = new ItemFactory(dc);
    69     PeakListSet pls = PeakListSet.getById(dc, plsId);
    70     PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
    71     Job job = factory.createJob(plugin, null);
    72     job.setName(plugin.getName());
    73     /***********************************************************************
    74     * Plugin parameters
    75     */
    76     ItemParameterType<PeakListSet> plsParam = new ItemParameterType<PeakListSet>(
    77       PeakListSet.class, null);
    78     job
    79       .setDescription("Export of " + pls.getName() + " [" + plsId + "] to file '" + filename + "'");
    80     job.setParameterValue("peaklistset", plsParam, pls);
    81     // Save the file under users home directory
    82     ItemParameterType<Directory> dirParam = new ItemParameterType<Directory>(
    83       Directory.class, null);
    84     User owner = User.getById(dc, getSessionControl().getLoggedInUserId());
    85     Directory dir = owner.getHomeDirectory();
    86     if (dir == null)
    87       throw new ActionException("User has no home directory");
    88     job.setParameterValue("directory", dirParam, dir);
    89     //
    90     StringParameterType filenameParam = new StringParameterType();
    91     job.setParameterValue("filename", filenameParam, filename);
    92     dc.saveItem(job);
    93     dc.commit();
    94     setMessage("Job created");
    95     setForwardTo(ListJobs.class);
    96   }
     51  @Override
     52  protected void runMe()
     53  throws ActionException, InvalidParameterValue
     54  {
     55    /***********************************************************************
     56    * Verify parameters
     57    */
     58    Form form = getFormFactory().getExportPeakListSetForm(null);
     59    verifyParameters(form);
     60    Integer plsId = getValidInteger(ItemIdField.VPARAM);
     61    Integer pluginDefId = getValidInteger(PluginIdField.VPARAM);
     62    String filename = getValidString(FormFactory.VNAME);
     63    /***********************************************************************
     64    * Create job
     65    */
     66    DbControl dc = newDbControl();
     67    ItemFactory factory = new ItemFactory(dc);
     68    PeakListSet pls = PeakListSet.getById(dc, plsId);
     69    PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId);
     70    Job job = factory.createJob(plugin, null);
     71    job.setName(plugin.getName());
     72    /***********************************************************************
     73    * Plugin parameters
     74    */
     75    ItemParameterType<PeakListSet> plsParam = new ItemParameterType<PeakListSet>(
     76    PeakListSet.class, null);
     77    job
     78    .setDescription("Export of " + pls.getName() + " [" + plsId + "] to file '" + filename + "'");
     79    job.setParameterValue("peaklistset", plsParam, pls);
     80    // Save the file under users home directory
     81    ItemParameterType<Directory> dirParam = new ItemParameterType<Directory>(
     82    Directory.class, null);
     83    User owner = User.getById(dc, getSessionControl().getLoggedInUserId());
     84    Directory dir = owner.getHomeDirectory();
     85    if (dir == null)
     86    throw new ActionException("User has no home directory");
     87    job.setParameterValue("directory", dirParam, dir);
     88    //
     89    StringParameterType filenameParam = new StringParameterType();
     90    job.setParameterValue("filename", filenameParam, filename);
     91    dc.saveItem(job);
     92    dc.commit();
     93    setMessage("Job created");
     94    setForwardTo(ListJobs.class);
     95  }
    9796}
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3818 r3821  
    235235  public static final VString VFWD2ACTION = new VString("forward2ActionId",
    236236    1, 255, false);
    237   public static final VInteger VPLUGINDEFID = new VInteger("definitionId", 1,
    238     true); // Remove
    239237  public static final VString VCLASSNAME = new VString("className", 1, 255,
    240238    true);
     
    23302328    fs.add(itemIdF);
    23312329    // Select plugin field
    2332     Select<VInteger> typeS = new Select<VInteger>(VPLUGINDEFID);
    2333     typeS.setLabel("Plugin");
     2330    Select<VInteger> typeS = new PluginSelect();
    23342331    if (pls != null)
    23352332    {
     
    24022399 // Cleaning up from here
    24032400
    2404   public Form getImportHitsForm(Project project)
    2405   {
    2406     DbControl dc = project.getDbControl();
    2407     Form form = new Form("importHitsForm");
    2408     if (dc != null && dc.isConnected())
    2409     {
    2410       //
    2411       Fieldset properties = new Fieldset();
    2412       properties.getLegendTitle().setTitle("Properties");
    2413       form.addFieldset(properties);
    2414       //
    2415       TextField<String> forwardF = new ForwardField();
    2416       forwardF.setValue(actionFactory.getId(ImportHits.class));
    2417       properties.add(forwardF);
    2418       //
    2419       properties.add(new ExternalGelIdField(false));
    2420       //
    2421       properties.add(new ExternalPlateIdField());
    2422       // Selector of plugins
    2423       properties.add(new PluginSelect(dc, Plugin.MainType.IMPORT,
    2424         Plugin.MainType.OTHER));
    2425       //
    2426       // properties.add(selectFileType(dc));
    2427       //
    2428       // properties.add(selectDirectory(project.getProjectDirectory()));
    2429     }
    2430     return form;
    2431   }
    2432 
    2433 
    24342401  public Form getImportHitsWizardStep1Form(Project project)
    24352402  {
     
    24462413       * Hidden text field for storing plugin id to use.
    24472414       */
    2448       TextField<Integer> pluginIdF = newHiddenIntegerField(VPLUGINDEFID);
     2415      TextField<Integer> pluginIdF = new PluginIdField();
    24492416      PluginDefinition pluginDef = PluginDefinition.getByClassName(
    24502417        project.getDbControl(),
     
    25092476       * Hidden text field for storing plugin id to use.
    25102477       */
    2511       TextField<Integer> pluginIdF = newHiddenIntegerField(VPLUGINDEFID);
     2478      TextField<Integer> pluginIdF = new PluginIdField();
    25122479      PluginDefinition pluginDef = PluginDefinition.getByClassName(
    25132480        project.getDbControl(),
     
    25532520       * Hidden text field for storing plugin id to use.
    25542521       */
    2555       TextField<Integer> pluginIdF = newHiddenIntegerField(VPLUGINDEFID);
     2522      TextField<Integer> pluginIdF = new PluginIdField();
    25562523      PluginDefinition pluginDef = PluginDefinition.getByClassName(
    25572524        project.getDbControl(),
     
    26002567       * Hidden text field for storing plugin id to use.
    26012568       */
    2602       TextField<Integer> pluginIdF = newHiddenIntegerField(VPLUGINDEFID);
     2569      TextField<Integer> pluginIdF = new PluginIdField();
    26032570      PluginDefinition pluginDef = PluginDefinition.getByClassName(
    26042571        project.getDbControl(),
     
    26742641       * Hidden text field for storing plugin id to use.
    26752642       */
    2676       TextField<Integer> pluginIdF = newHiddenIntegerField(VPLUGINDEFID);
     2643      TextField<Integer> pluginIdF = new PluginIdField();
    26772644      PluginDefinition pluginDef = PluginDefinition.getByClassName(
    26782645        project.getDbControl(),
Note: See TracChangeset for help on using the changeset viewer.