Changeset 3821
- Timestamp:
- Sep 7, 2010, 8:56:11 AM (13 years ago)
- 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 1 1 /** 2 3 2 * 3 */ 4 4 package org.proteios.action.file; 5 5 6 import java.util.List; 6 7 import org.proteios.action.ProteiosAction; 7 8 import org.proteios.action.job.ListJobs; … … 14 15 import org.proteios.core.PluginDefinition; 15 16 import org.proteios.core.Project; 16 import org.proteios.gui.form.FormFactory; 17 17 import org.proteios.gui.form.*; 18 18 import se.lu.thep.waf.ActionException; 19 19 import se.lu.thep.waf.constraints.InvalidParameterValue; 20 20 21 import java.util.List;22 23 21 /** 24 25 26 27 22 * Creates a plugin job for each file id 23 * 24 * @author fredrik 25 */ 28 26 public class CreateFileJobs 29 27 extends ProteiosAction<CreateFileJobs> 30 28 { 31 32 33 34 35 36 37 38 List<Integer> files = getValidIntegerList(FormFactory.VID);39 Integer pluginDefId = getValidInteger(FormFactory.VPLUGINDEFID);40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 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 } 70 68 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHits.java
r3817 r3821 66 66 String gelId = getSessionAttribute(ExternalGelIdField.VPARAM); 67 67 String plateId = getSessionAttribute(ExternalPlateIdField.VPARAM); 68 Integer pluginDefId = getSessionAttribute( FormFactory.VPLUGINDEFID);68 Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM); 69 69 List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM); 70 70 ItemFactory factory = new ItemFactory(dc); -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1a.java
r3325 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 … … 32 32 import org.proteios.core.DbControl; 33 33 import org.proteios.core.Project; 34 import org.proteios.gui.form.Form; 35 import org.proteios.gui.form.FormFactory; 36 34 import org.proteios.gui.form.*; 37 35 import se.lu.thep.waf.ActionException; 38 36 import se.lu.thep.waf.constraints.InvalidParameterValue; 39 37 40 38 /** 41 42 39 * @author olle 40 */ 43 41 public class ImportHitsNonGelWizardStep1a 44 42 extends ProteiosAction<ImportHitsNonGelWizardStep1a> 45 43 { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 saveToSession(FormFactory.VFWDACTION);91 saveToSession(FormFactory.VPLUGINDEFID);92 93 94 95 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 } 97 95 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1b.java
r3325 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 30 import java.util.List; 30 31 import org.proteios.action.ProteiosAction; 31 32 import org.proteios.action.job.ListJobs; … … 40 41 import org.proteios.core.Project; 41 42 import org.proteios.core.StringParameterType; 42 import org.proteios.gui.form.FormFactory; 43 43 import org.proteios.gui.form.*; 44 44 import se.lu.thep.waf.ActionException; 45 45 import se.lu.thep.waf.constraints.InvalidParameterValue; … … 47 47 import se.lu.thep.waf.constraints.VString; 48 48 49 import java.util.List;50 51 49 /** 52 53 50 * @author olle 51 */ 54 52 public class ImportHitsNonGelWizardStep1b 55 53 extends ProteiosAction<ImportHitsNonGelWizardStep1b> 56 54 { 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);76 List<Integer> fileIds = getValidIntegerList(FormFactory.VID);77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 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 } 125 123 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep2a.java
r2724 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 … … 32 32 import org.proteios.core.DbControl; 33 33 import org.proteios.core.Project; 34 import org.proteios.gui.form.Form; 35 import org.proteios.gui.form.FormFactory; 36 34 import org.proteios.gui.form.*; 37 35 import se.lu.thep.waf.ActionException; 38 36 import se.lu.thep.waf.constraints.InvalidParameterValue; 39 37 40 38 /** 41 42 39 * @author olle 40 */ 43 41 public class ImportHitsNonGelWizardStep2a 44 42 extends ProteiosAction<ImportHitsNonGelWizardStep2a> 45 43 { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 saveToSession(FormFactory.VFWDACTION);63 saveToSession(FormFactory.VPLUGINDEFID);64 65 66 67 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 } 69 67 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep2b.java
r2724 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 30 import java.util.List; 30 31 import org.proteios.action.ProteiosAction; 31 32 import org.proteios.action.job.ListJobs; … … 38 39 import org.proteios.core.PluginDefinition; 39 40 import org.proteios.core.Project; 40 import org.proteios.gui.form. FormFactory;41 import org.proteios.gui.form.*; 41 42 import se.lu.thep.waf.ActionException; 42 43 import se.lu.thep.waf.constraints.InvalidParameterValue; 43 import java.util.List;44 44 45 45 /** 46 47 46 * @author olle 47 */ 48 48 public class ImportHitsNonGelWizardStep2b 49 49 extends ProteiosAction<ImportHitsNonGelWizardStep2b> 50 50 { 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 Integer pluginDefId = getSessionAttribute(FormFactory.VPLUGINDEFID);66 List<Integer> fileIds = getValidIntegerList(FormFactory.VID);67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 } 93 93 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep1a.java
r3816 r3821 61 61 saveToSession(ExternalGelIdField.VPARAM); 62 62 saveToSession(ForwardField.VPARAM); 63 saveToSession( FormFactory.VPLUGINDEFID);63 saveToSession(PluginIdField.VPARAM); 64 64 setSessionAttribute(ViewActiveDirectory.VDIRID, project 65 65 .getProjectDirectory().getId()); -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep1b.java
r3816 r3821 65 65 Project project = isProjectActive(dc); 66 66 String gelId = getSessionAttribute(ExternalGelIdField.VPARAM); 67 Integer pluginDefId = getSessionAttribute( FormFactory.VPLUGINDEFID);67 Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM); 68 68 List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM); 69 69 if(fileIds == null || fileIds.isEmpty()) -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep2a.java
r3817 r3821 61 61 saveToSession(ExternalPlateIdField.VPARAM); 62 62 saveToSession(ForwardField.VPARAM); 63 saveToSession( FormFactory.VPLUGINDEFID);63 saveToSession(PluginIdField.VPARAM); 64 64 setSessionAttribute(ViewActiveDirectory.VDIRID, project 65 65 .getProjectDirectory().getId()); -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep2b.java
r3817 r3821 67 67 Project project = isProjectActive(dc); 68 68 String plateId = getSessionAttribute(ExternalPlateIdField.VPARAM); 69 Integer pluginDefId = getSessionAttribute( FormFactory.VPLUGINDEFID);69 Integer pluginDefId = getSessionAttribute(PluginIdField.VPARAM); 70 70 List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM); 71 71 if(fileIds == null || fileIds.isEmpty()) -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep3a.java
r2070 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 … … 32 32 import org.proteios.core.DbControl; 33 33 import org.proteios.core.Project; 34 import org.proteios.gui.form.Form; 35 import org.proteios.gui.form.FormFactory; 36 34 import org.proteios.gui.form.*; 37 35 import se.lu.thep.waf.ActionException; 38 36 import se.lu.thep.waf.constraints.InvalidParameterValue; 39 37 40 38 /** 41 42 39 * @author olle 40 */ 43 41 public class ImportHitsWizardStep3a 44 42 extends ProteiosAction<ImportHitsWizardStep3a> 45 43 { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 saveToSession(FormFactory.VFWDACTION);63 saveToSession(FormFactory.VPLUGINDEFID);64 65 66 67 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 } 69 67 } -
trunk/client/servlet/src/org/proteios/action/hit/ImportHitsWizardStep3b.java
r3630 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2007 Gregory Vincic, Olle Mansson 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.hit; 29 29 30 import java.util.List; 30 31 import org.proteios.action.ProteiosAction; 31 32 import org.proteios.action.job.ListJobs; … … 38 39 import org.proteios.core.PluginDefinition; 39 40 import org.proteios.core.Project; 40 import org.proteios.gui.form. FormFactory;41 import org.proteios.gui.form.*; 41 42 import se.lu.thep.waf.ActionException; 42 43 import se.lu.thep.waf.constraints.InvalidParameterValue; 43 import java.util.List;44 44 45 45 /** 46 47 46 * @author olle 47 */ 48 48 public class ImportHitsWizardStep3b 49 49 extends ProteiosAction<ImportHitsWizardStep3b> 50 50 { 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 68 59 { 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); 70 96 } 71 ItemFactory factory = new ItemFactory(dc);72 /***********************************************************************73 * Create job74 */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 parameters86 FileParameterType filesParam = new FileParameterType();87 job.setParameterValue("file", filesParam, file);88 dc.saveItem(job);89 }90 dc.commit();91 setMessage("Job created");92 /***********************************************************************93 * Layout94 */95 setForwardTo(ListJobs.class);96 }97 97 } -
trunk/client/servlet/src/org/proteios/action/peakListSet/CreateFileExportJob.java
r2381 r3821 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2006, 2007 Gregory Vincic 5 5 6 7 8 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. 9 9 10 11 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 12 13 14 15 16 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. 17 17 18 19 20 21 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. 22 22 23 24 25 26 27 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 */ 28 28 package org.proteios.action.peakListSet; 29 29 … … 39 39 import org.proteios.core.StringParameterType; 40 40 import org.proteios.core.User; 41 import org.proteios.gui.form.Form; 42 import org.proteios.gui.form.FormFactory; 41 import org.proteios.gui.form.*; 43 42 import se.lu.thep.waf.ActionException; 44 43 import se.lu.thep.waf.constraints.InvalidParameterValue; 45 44 46 45 /** 47 48 46 * @author gregory 47 */ 49 48 public class CreateFileExportJob 50 49 extends ProteiosAction<CreateFileExportJob> 51 50 { 52 53 54 55 56 57 58 59 60 61 Integer plsId = getValidInteger(FormFactory.VID);62 Integer pluginDefId = getValidInteger(FormFactory.VPLUGINDEFID);63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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 } 97 96 } -
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3818 r3821 235 235 public static final VString VFWD2ACTION = new VString("forward2ActionId", 236 236 1, 255, false); 237 public static final VInteger VPLUGINDEFID = new VInteger("definitionId", 1,238 true); // Remove239 237 public static final VString VCLASSNAME = new VString("className", 1, 255, 240 238 true); … … 2330 2328 fs.add(itemIdF); 2331 2329 // Select plugin field 2332 Select<VInteger> typeS = new Select<VInteger>(VPLUGINDEFID); 2333 typeS.setLabel("Plugin"); 2330 Select<VInteger> typeS = new PluginSelect(); 2334 2331 if (pls != null) 2335 2332 { … … 2402 2399 // Cleaning up from here 2403 2400 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 plugins2423 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 2434 2401 public Form getImportHitsWizardStep1Form(Project project) 2435 2402 { … … 2446 2413 * Hidden text field for storing plugin id to use. 2447 2414 */ 2448 TextField<Integer> pluginIdF = new HiddenIntegerField(VPLUGINDEFID);2415 TextField<Integer> pluginIdF = new PluginIdField(); 2449 2416 PluginDefinition pluginDef = PluginDefinition.getByClassName( 2450 2417 project.getDbControl(), … … 2509 2476 * Hidden text field for storing plugin id to use. 2510 2477 */ 2511 TextField<Integer> pluginIdF = new HiddenIntegerField(VPLUGINDEFID);2478 TextField<Integer> pluginIdF = new PluginIdField(); 2512 2479 PluginDefinition pluginDef = PluginDefinition.getByClassName( 2513 2480 project.getDbControl(), … … 2553 2520 * Hidden text field for storing plugin id to use. 2554 2521 */ 2555 TextField<Integer> pluginIdF = new HiddenIntegerField(VPLUGINDEFID);2522 TextField<Integer> pluginIdF = new PluginIdField(); 2556 2523 PluginDefinition pluginDef = PluginDefinition.getByClassName( 2557 2524 project.getDbControl(), … … 2600 2567 * Hidden text field for storing plugin id to use. 2601 2568 */ 2602 TextField<Integer> pluginIdF = new HiddenIntegerField(VPLUGINDEFID);2569 TextField<Integer> pluginIdF = new PluginIdField(); 2603 2570 PluginDefinition pluginDef = PluginDefinition.getByClassName( 2604 2571 project.getDbControl(), … … 2674 2641 * Hidden text field for storing plugin id to use. 2675 2642 */ 2676 TextField<Integer> pluginIdF = new HiddenIntegerField(VPLUGINDEFID);2643 TextField<Integer> pluginIdF = new PluginIdField(); 2677 2644 PluginDefinition pluginDef = PluginDefinition.getByClassName( 2678 2645 project.getDbControl(),
Note: See TracChangeset
for help on using the changeset viewer.