Changeset 3848
- Timestamp:
- Sep 14, 2010, 12:22:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/hit/CreatePrideExportJob.java
r3844 r3848 28 28 package org.proteios.action.hit; 29 29 30 import java.util.ArrayList;31 import java.util.Calendar;32 import java.util.GregorianCalendar;33 import java.util.List;34 30 import org.proteios.action.ProteiosAction; 35 31 import org.proteios.action.job.ListJobs; … … 53 49 import org.proteios.core.query.Hql; 54 50 import org.proteios.core.query.Restrictions; 55 import org.proteios.gui.form.*; 56 import org.proteios.plugins.PrideExportPlugin; 51 import org.proteios.gui.form.ExternalGelIdField; 52 import org.proteios.gui.form.FormFactory; 53 import org.proteios.gui.form.LocalSampleSelect; 54 57 55 import se.lu.thep.waf.ActionException; 58 56 import se.lu.thep.waf.constraints.InvalidParameterValue; … … 62 60 import se.lu.thep.waf.constraints.VString; 63 61 62 import java.util.ArrayList; 63 import java.util.List; 64 64 65 /** 65 66 * @author gregory … … 68 69 extends ProteiosAction<CreatePrideExportJob> 69 70 { 70 public static final VBoolean VEXTRAPREFIX = new VBoolean("appendPrefix", false); 71 public static final VBoolean VEXTRAPREFIX = new VBoolean("appendPrefix", 72 false); 71 73 public static final VFloat VCUTOFF = new VFloat("cutOff", true); 72 public static final VString VCUTOFFSTRING = new VString("cutOffString", 0, 256, false); 74 public static final VString VCUTOFFSTRING = new VString("cutOffString", 0, 75 256, false); 73 76 public static final VInteger VPRIDEPROTOCOLFILEID = new VInteger( 74 77 "prideProtocolFileId", 0, false); 75 public static final VString VEXPERIMENTTITLE = new VString("expTitle",0,256,false); 76 public static final VString VCONTACTNAME = new VString("contactName",0,256,false); 77 public static final VString VCONTACTINST = new VString("contactInst",0,256,false); 78 public static final VString VCONTACTINFO = new VString("contactInfo",0,256,false); 79 public static final VString VCONTACTEMAIL = new VString("contactEmail",0,256,false); 80 public static final VString VCONTACTURL = new VString("contactURL",0,256,false); 78 public static final VString VEXPERIMENTTITLE = new VString("expTitle", 0, 79 256, false); 80 public static final VString VCONTACTNAME = new VString("contactName", 0, 81 256, false); 82 public static final VString VCONTACTINST = new VString("contactInst", 0, 83 256, false); 84 public static final VString VCONTACTINFO = new VString("contactInfo", 0, 85 256, false); 86 public static final VString VCONTACTEMAIL = new VString("contactEmail", 0, 87 256, false); 88 public static final VString VCONTACTURL = new VString("contactURL", 0, 256, 89 false); 81 90 public static final VBoolean VADDCONTACT = new VBoolean("addContact", false); 82 public static final VBoolean VADDSAMPLENAME = new VBoolean("addSampleName", false); 91 public static final VBoolean VADDSAMPLENAME = new VBoolean("addSampleName", 92 false); 93 83 94 84 95 /* 85 96 * (non-Javadoc) 86 *87 97 * @see org.proteios.action.ProteiosAction#runMe() 88 98 */ … … 118 128 log.debug("filenamePrefix = \"" + filenamePrefix + "\""); 119 129 // 120 // Check if extra prefix (gel external id or local sample id) should be used 121 //Boolean appendExtraPrefix = getValidBoolean(VEXTRAPREFIX); 130 // Check if extra prefix (gel external id or local sample id) should be 131 // used 132 // Boolean appendExtraPrefix = getValidBoolean(VEXTRAPREFIX); 122 133 Boolean appendExtraPrefix = getSessionAttribute(VEXTRAPREFIX); 123 134 log.debug("appendExtraPrefix from request = " + appendExtraPrefix); … … 157 168 if (extraPrefix != null && !extraPrefix.equals("")) 158 169 { 159 if (!filenamePrefix.equals("") && 160 !filenamePrefix.endsWith("_") && 161 !filenamePrefix.endsWith("-") && 162 !filenamePrefix.endsWith(".")) 170 if (!filenamePrefix.equals("") && !filenamePrefix.endsWith("_") && !filenamePrefix 171 .endsWith("-") && !filenamePrefix.endsWith(".")) 163 172 { 164 173 // Add underscore between original prefix and extra prefix … … 194 203 // Find spectrum files in hits list 195 204 ItemQuery<Hit> hitQuery = Hit.getQuery(); 196 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 197 Hql.entity(project)));198 hitQuery.restrict(Restrictions.eq(Hql.property("protein"), 199 Expressions.parameter("protein")));205 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), Hql 206 .entity(project))); 207 hitQuery.restrict(Restrictions.eq(Hql.property("protein"), Expressions 208 .parameter("protein"))); 200 209 hitQuery.setParameter("protein", false, null); 210 201 211 ItemResultList<Hit> hitlist = hitQuery.list(dc); 202 212 List<File> peakListFileList = new ArrayList<File>(0); 203 for (Hit hit : hitlist)213 for (Hit hit : hitlist) 204 214 { 205 215 File file = hit.getPeakListFile(); … … 231 241 { 232 242 dc.close(); 233 throw new ActionException("Couldn't find plugin PrideExportPlugin."); 243 throw new ActionException( 244 "Couldn't find plugin PrideExportPlugin."); 234 245 } 235 246 } … … 237 248 { 238 249 throw new ActionException( 239 "PRIDE Export plugin is not installed. " + e 240 .getMessage()); 250 "PRIDE Export plugin is not installed. " + e.getMessage()); 241 251 } 242 252 log.debug("pluginDef = " + pluginDef); … … 245 255 // Create one job per spectrum file in hits list 246 256 int total = peakListFileList.size(); 247 int i =0;248 for (File file : peakListFileList)257 int i = 0; 258 for (File file : peakListFileList) 249 259 { 250 260 i++; 251 String part = "(" +i+"/"+total+")";261 String part = "(" + i + "/" + total + ")"; 252 262 log.debug("file = " + file); 253 263 String outputFilename = filenamePrefix + file.getName(); … … 267 277 else 268 278 { 269 job.setName(plugin.getName() + " sample: " + localSampleId + ", title: " + expTitle + " "+part); 279 job 280 .setName(plugin.getName() + " sample: " + localSampleId + ", title: " + expTitle + " " + part); 270 281 } 271 282 // 272 283 Integer fileId = file.getId(); 273 job.setParameterValue("peakListFileId", new IntegerParameterType(), fileId); 284 job.setParameterValue("peakListFileId", new IntegerParameterType(), 285 fileId); 274 286 // 275 287 job.setParameterValue("filenamePrefix", new StringParameterType(), … … 282 294 job.setParameterValue("localSampleId", new StringParameterType(), 283 295 localSampleId); 284 job.setParameterValue("experimentTitle", new StringParameterType(), expTitle); 296 job.setParameterValue("experimentTitle", new StringParameterType(), 297 expTitle); 285 298 job.setParameterValue("details", new StringParameterType(), part); 286 job.setParameterValue("addContact", new BooleanParameterType(), addContact); 287 job.setParameterValue("addSampleName", new BooleanParameterType(), addSampleName); 288 job.setParameterValue("contactName", new StringParameterType(), contactName); 289 job.setParameterValue("contactInst", new StringParameterType(), contactInst); 290 job.setParameterValue("contactInfo", new StringParameterType(), contactInfo); 291 job.setParameterValue("prideProtocolFileId", new IntegerParameterType(), 292 prideProtocolFileId); 299 job.setParameterValue("addContact", new BooleanParameterType(), 300 addContact); 301 job.setParameterValue("addSampleName", new BooleanParameterType(), 302 addSampleName); 303 job.setParameterValue("contactName", new StringParameterType(), 304 contactName); 305 job.setParameterValue("contactInst", new StringParameterType(), 306 contactInst); 307 job.setParameterValue("contactInfo", new StringParameterType(), 308 contactInfo); 309 job.setParameterValue("prideProtocolFileId", 310 new IntegerParameterType(), prideProtocolFileId); 293 311 // 294 312 ItemParameterType<Project> projectParam = new ItemParameterType<Project>( … … 304 322 job.setParameterValue("directory", dirParam, dir); 305 323 job 306 .setDescription("Output file: " + dir.getName() + "/" + outputFilename + ", FDR upper cutoff: " + fdrCutoff 324 .setDescription("Output file: " + dir.getName() + "/" + outputFilename + ", FDR upper cutoff: " + fdrCutoff); 307 325 dc.saveItem(job); 308 326 dc.commit();
Note: See TracChangeset
for help on using the changeset viewer.