Changeset 3815
- Timestamp:
- Sep 2, 2010, 5:23:54 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/locale/en/dictionary
r3777 r3815 42 42 ActiveProject=Active Project 43 43 ActiveProjectId=Active Project ID 44 AddContactInfo=Add contact info 45 AddSampleInfo=Add sample name 44 46 AddDiGESeparation=Add DiGE 45 47 AddFiles=Add Files … … 687 689 SampleConcentrationInGramsPerLiter=Sample concentration (g/l) 688 690 SampleExternalId=Sample external ID 691 SampleInfo=Sample information 689 692 SampleMassInGrams=Sample mass (g) 690 693 SampleName=Sample name -
trunk/client/servlet/src/org/proteios/action/hit/CreatePrideExportJob.java
r3741 r3815 30 30 import org.proteios.action.ProteiosAction; 31 31 import org.proteios.action.job.ListJobs; 32 import org.proteios.core.BooleanParameterType; 32 33 import org.proteios.core.DbControl; 33 34 import org.proteios.core.Directory; … … 75 76 "prideProtocolFileId", 0, false); 76 77 public static final VString VEXPERIMENTTITLE = new VString("expTitle",0,256,false); 77 78 public static final VString VCONTACTNAME = new VString("contactName",0,256,false); 79 public static final VString VCONTACTINST = new VString("contactInst",0,256,false); 80 public static final VString VCONTACTINFO = new VString("contactInfo",0,256,false); 81 public static final VString VCONTACTEMAIL = new VString("contactEmail",0,256,false); 82 public static final VString VCONTACTURL = new VString("contactURL",0,256,false); 83 public static final VBoolean VADDCONTACT = new VBoolean("addContact", false); 84 public static final VBoolean VADDSAMPLENAME = new VBoolean("addSampleName", false); 78 85 79 86 /* … … 122 129 } 123 130 log.debug("appendExtraPrefix = " + appendExtraPrefix); 131 Boolean addContact = getSessionAttribute(VADDCONTACT); 132 if (addContact == null) 133 { 134 addContact = new Boolean(false); 135 } 136 Boolean addSampleName = getSessionAttribute(VADDSAMPLENAME); 137 if (addSampleName == null) 138 { 139 addSampleName = new Boolean(false); 140 } 141 String contactName = getSessionAttribute(VCONTACTNAME); 142 String contactInfo = getSessionAttribute(VCONTACTINFO); 143 String contactInst = getSessionAttribute(VCONTACTINST); 124 144 if (appendExtraPrefix != null && appendExtraPrefix) 125 145 { … … 266 286 job.setParameterValue("experimentTitle", new StringParameterType(), expTitle); 267 287 job.setParameterValue("details", new StringParameterType(), part); 288 job.setParameterValue("addContact", new BooleanParameterType(), addContact); 289 job.setParameterValue("addSampleName", new BooleanParameterType(), addSampleName); 290 job.setParameterValue("contactName", new StringParameterType(), contactName); 291 job.setParameterValue("contactInst", new StringParameterType(), contactInst); 292 job.setParameterValue("contactInfo", new StringParameterType(), contactInfo); 268 293 job.setParameterValue("prideProtocolFileId", new IntegerParameterType(), 269 294 prideProtocolFileId); … … 281 306 job.setParameterValue("directory", dirParam, dir); 282 307 job 283 .setDescription("Output file: " + dir.getName() + "/" + outputFilename + ", FDR upper cutoff: " + fdrCutoff );308 .setDescription("Output file: " + dir.getName() + "/" + outputFilename + ", FDR upper cutoff: " + fdrCutoff ); 284 309 dc.saveItem(job); 285 310 dc.commit(); -
trunk/client/servlet/src/org/proteios/action/hit/PrideExport.java
r3741 r3815 39 39 import org.proteios.gui.TitledWindow; 40 40 import org.proteios.gui.Toolbar; 41 import org.proteios.gui.form.Checkbox; 42 import org.proteios.gui.form.Fieldset; 41 43 import org.proteios.gui.form.Form; 44 import org.proteios.gui.form.FormFactory; 45 import org.proteios.gui.form.TextField; 42 46 import org.proteios.gui.layout.RowLayout; 47 import org.proteios.gui.table.Column; 48 import org.proteios.gui.table.Table; 43 49 import org.proteios.plugins.PrideExportPlugin; 44 50 45 51 import se.lu.thep.waf.ActionException; 46 52 import se.lu.thep.waf.constraints.InvalidParameterValue; 53 import se.lu.thep.waf.constraints.VBoolean; 47 54 48 55 import java.util.ArrayList; … … 60 67 /* 61 68 * (non-Javadoc) 62 *63 69 * @see org.proteios.action.ProteiosAction#runMe() 64 70 */ … … 72 78 String filenamePrefixDefault = new String("PrideExport_"); 73 79 /* 74 * Add timestamp to optional filename prefix in this class, 75 * in stead of in job plugin class, as we want output files76 * for all jobs created in the same session to share the same77 * timestamp, even if the jobs arenot executed simultaneously.80 * Add timestamp to optional filename prefix in this class, instead of 81 * in job plugin class, as we want output files for all jobs created in 82 * the same session to share the same timestamp, even if the jobs are 83 * not executed simultaneously. 78 84 */ 79 85 // Append timestamp in YYYYMMDD_HHMM format to filename prefix … … 81 87 log.debug("filenamePrefixDefault = \"" + filenamePrefixDefault + "\""); 82 88 // Get form 83 Form form = getFormFactory().getPrideExportForm( 84 project, filenamePrefixDefault); 85 86 //String prideExportTitle = "PRIDE " + PrideExportPlugin.PRIDE_XML_VERSION_STR + " " + getLocale().get("PrideExportAfterVersionNumber"); 89 Form form = getFormFactory().getPrideExportForm(project, 90 filenamePrefixDefault); 91 form.addFieldset(getContactFieldset()); 92 Fieldset fs = new Fieldset(); 93 fs.getLegendTitle().setTitle("SampleInfo"); 94 Checkbox<VBoolean> isFDR = new Checkbox<VBoolean>( 95 CreatePrideExportJob.VADDSAMPLENAME); 96 isFDR.setLabel("AddSampleInfo"); 97 isFDR.setValue("true"); 98 isFDR.setHelp("Replace sample info in peaklists with local sample id from hits report"); 99 fs.add(isFDR); 100 form.addFieldset(fs); 101 // String prideExportTitle = "PRIDE " + 102 // PrideExportPlugin.PRIDE_XML_VERSION_STR + " " + 103 // getLocale().get("PrideExportAfterVersionNumber"); 87 104 String prideExportTitle = new String("PrideExport"); 88 105 Title title = new Title(prideExportTitle); … … 100 117 form.setToolbar(tb); 101 118 ActionLink al = getActionFactory().getActionLink( 102 SelectPrideProtocolFileStep1a.class, "NextSelectPrideProtocolFileOptional"); 119 SelectPrideProtocolFileStep1a.class, 120 "NextSelectPrideProtocolFileOptional"); 103 121 tb.add(al); 104 122 /*********************************************************************** … … 112 130 } 113 131 114 132 115 133 /** 116 134 * Append timestamp to filename prefix 117 135 * 118 136 * @param filenamePrefix String Original filename prefix 119 * @return String Filename prefix with appended "YYYYMMDD_HHMM" timestamp and underscore. 137 * @return String Filename prefix with appended "YYYYMMDD_HHMM" timestamp 138 * and underscore. 120 139 */ 121 140 private String appendTimestampToPrefix(String filenamePrefix) … … 143 162 144 163 164 private Fieldset getContactFieldset() 165 { 166 Fieldset fs = new Fieldset(); 167 fs.getLegendTitle().setTitle("SpectrumFileContactInput"); 168 Checkbox<VBoolean> isFDR = new Checkbox<VBoolean>( 169 CreatePrideExportJob.VADDCONTACT); 170 isFDR.setLabel("AddContactInfo"); 171 isFDR.setValue("true"); 172 isFDR.setHelp("Replace contact info in peaklists"); 173 fs.add(isFDR); 174 TextField<String> nameF = new TextField<String>( 175 CreatePrideExportJob.VCONTACTNAME); 176 nameF.setValue(getOwner().getName()); 177 nameF.setLabel("Name"); 178 fs.add(nameF); 179 TextField<String> institutionF = new TextField<String>( 180 CreatePrideExportJob.VCONTACTINST); 181 institutionF.setLabel("Institution"); 182 institutionF.setValue(getOwner().getOrganisation()); 183 fs.add(institutionF); 184 TextField<String> contactInfoF = new TextField<String>( 185 CreatePrideExportJob.VCONTACTINFO); 186 contactInfoF.setLabel("ContactInfo"); 187 contactInfoF.setValue(getOwner().getEmail()); 188 fs.add(contactInfoF); 189 return fs; 190 } 191 145 192 private static final List<Context> contexts = new ArrayList<Context>(1); 146 193 static 147 194 { 148 TableToolbarContext context = new TableToolbarContext( 149 "PrideExportBtn", "PrideExportBtn", PrideExport.class, 150 Hit.class); 195 TableToolbarContext context = new TableToolbarContext("PrideExportBtn", 196 "PrideExportBtn", PrideExport.class, Hit.class); 151 197 context.setOrder(5); 152 198 contexts.add(context); … … 156 202 /* 157 203 * (non-Javadoc) 158 *159 204 * @see org.proteios.ContextEnabled#listContexts() 160 205 */ … … 163 208 return contexts; 164 209 } 210 165 211 } -
trunk/client/servlet/src/org/proteios/action/hit/SelectPrideProtocolFileStep1a.java
r3741 r3815 94 94 setSessionAttribute(FormFactory.VNONREQUIRED_FILENAME, filenamePrefix); 95 95 setSessionAttribute(CreatePrideExportJob.VEXTRAPREFIX, appendExtraPrefix); 96 setSessionAttribute(CreatePrideExportJob.VADDCONTACT, getValidBoolean(CreatePrideExportJob.VADDCONTACT)); 97 setSessionAttribute(CreatePrideExportJob.VADDSAMPLENAME, getValidBoolean(CreatePrideExportJob.VADDSAMPLENAME)); 98 setSessionAttribute(CreatePrideExportJob.VCONTACTNAME, getString(CreatePrideExportJob.VCONTACTNAME)); 99 setSessionAttribute(CreatePrideExportJob.VCONTACTINFO, getString(CreatePrideExportJob.VCONTACTINFO)); 100 setSessionAttribute(CreatePrideExportJob.VCONTACTINST, getString(CreatePrideExportJob.VCONTACTINST)); 96 101 // Get original forward action 97 102 String forward2Id = getValidString(FormFactory.VFWDACTION); -
trunk/plugin/src/org/proteios/plugins/PrideExportPlugin.java
r3742 r3815 138 138 private Integer prideProtocolFileId = null; 139 139 private File prideProtocolFile = null; 140 private String contactInfo; 141 private String contactName; 142 private String contactInst; 143 private Boolean addContact; 144 private Boolean addSampleName; 140 145 /* 141 146 * Optional warning message for a successful job completion. … … 399 404 String lSampleId = (String) job.getValue("localSampleId"); 400 405 experimentShortTitle = (String) job.getValue("experimentTitle"); 406 contactInfo = (String) job.getValue("contactInfo"); 407 contactName = (String) job.getValue("contactName"); 408 contactInst = (String) job.getValue("contactInst"); 409 addContact = (Boolean) job.getValue("addContact"); 410 addSampleName = (Boolean) job.getValue("addSampleName"); 401 411 experimentTitle = experimentShortTitle + " " + (String) job 402 412 .getValue("details"); … … 600 610 // Copy mzData XML blocks from peak list file item 601 611 // copyMzDataXMLBlocks(xmlCrudeWriter, peakListFileId); 602 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, "mzData"); 612 if (addContact.booleanValue() && !addSampleName.booleanValue()) 613 { 614 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 615 "mzData", "contact"); 616 writeContactBlock(xmlCrudeWriter); 617 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 618 "/contact", "mzData"); 619 620 } 621 else if (addContact.booleanValue()) 622 { 623 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 624 "mzData", "admin"); 625 writeSampleBlock(xmlCrudeWriter); 626 xmlCrudeWriter.writeStartElement("contact"); 627 xmlCrudeWriter.writeStartElementEnd(); 628 writeContactBlock(xmlCrudeWriter); 629 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 630 "/contact", "mzData"); 631 } 632 else if (!addSampleName.booleanValue()) 633 { 634 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 635 "mzData", null); 636 } 637 else 638 { 639 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 640 "mzData", "admin"); 641 writeSampleBlock(xmlCrudeWriter); 642 copySelectedXMLBlocks(dc, xmlCrudeWriter, peakListFileId, 643 "contact", "mzData"); 644 } 603 645 // 604 646 boolean externalIdOrderingFlag = true; … … 1102 1144 // Copy protocol block from protocol XML file 1103 1145 copySelectedXMLBlocks(dc, xmlCrudeWriter, prideProtocolFileId, 1104 "Protocol" );1146 "Protocol", null); 1105 1147 } 1106 1148 else … … 3279 3321 private void copySelectedXMLBlocks(DbControl dc, 3280 3322 XMLCrudeWriterImpl xmlCrudeWriterImpl, Integer sourceFileId, 3281 String selectedXmlTagName )3323 String selectedXmlTagName, String selectedXMLEndTag) 3282 3324 throws XMLStreamException 3283 3325 { … … 3317 3359 "<" + selectedXmlTagName); 3318 3360 // selectedXMLBlockEndLinePattern example: ".*</mzData>" 3361 3362 if (selectedXMLEndTag == null) 3363 { 3364 selectedXMLEndTag = "/"+selectedXmlTagName; 3365 } 3319 3366 String selectedXMLBlockEndLinePattern = new String( 3320 ".*</" + selectedXmlTagName + ">"); 3367 ".*<" + selectedXMLEndTag + ">.*"); 3368 String selectedXMLBlockEnd = new String( 3369 "<" + selectedXMLEndTag + ">"); 3370 3321 3371 log 3322 3372 .debug("selectedXMLBlockStartLinePattern = \"" + selectedXMLBlockStartLinePattern + "\""); … … 3348 3398 firstLine = false; 3349 3399 } 3400 if (inSelectedXMLBlock && line 3401 .matches(selectedXMLBlockEndLinePattern)) 3402 { 3403 int end = currentLine.indexOf(selectedXMLBlockEnd) + selectedXMLBlockEnd 3404 .length(); 3405 currentLine = currentLine.substring(0, end); 3406 inSelectedXMLBlock = false; 3407 } 3350 3408 xmlCrudeWriterImpl.writeIndentedText(currentLine, 3351 3409 extraIndentation); 3352 3410 } 3353 3411 // Skip part of source XML file after selected XML block 3354 if (inSelectedXMLBlock && line 3355 .matches(selectedXMLBlockEndLinePattern)) 3356 { 3357 inSelectedXMLBlock = false; 3358 } 3412 3359 3413 } 3360 3414 } … … 3401 3455 3402 3456 3457 private void writeContactBlock(XMLCrudeWriterImpl xmlCrudeWriter) 3458 { 3459 try 3460 { 3461 // writeStartTag("contact"); 3462 // 3463 // writeStartTag("name"); 3464 xmlCrudeWriter.writeStartElement("name"); 3465 xmlCrudeWriter.writeStartElementEnd(); 3466 xmlCrudeWriter.writeCharacters(contactName); 3467 // writeEndTag("name"); 3468 xmlCrudeWriter.writeEndElement("name"); 3469 // 3470 // writeStartTag("institution"); 3471 xmlCrudeWriter.writeStartElement("institution"); 3472 xmlCrudeWriter.writeStartElementEnd(); 3473 xmlCrudeWriter.writeCharacters(contactInst); 3474 // writeEndTag("institution"); 3475 xmlCrudeWriter.writeEndElement("institution"); 3476 xmlCrudeWriter.writeStartElement("contactInfo"); 3477 xmlCrudeWriter.writeStartElementEnd(); 3478 xmlCrudeWriter.writeCharacters(contactInfo); 3479 xmlCrudeWriter.writeEndElement("contactInfo"); 3480 // 3481 } 3482 catch (XMLStreamException e) 3483 { 3484 log 3485 .warn("Problem when generating xml file " + xmlFilePath + " : " + e); 3486 } 3487 } 3488 3489 private void writeSampleBlock(XMLCrudeWriterImpl xmlCrudeWriter) 3490 { 3491 try 3492 { 3493 // writeStartTag("contact"); 3494 // 3495 // writeStartTag("name"); 3496 xmlCrudeWriter.writeStartElement("sampleName"); 3497 xmlCrudeWriter.writeStartElementEnd(); 3498 xmlCrudeWriter.writeCharacters(localSampleId); 3499 // writeEndTag("name"); 3500 xmlCrudeWriter.writeEndElement("sampleName"); 3501 // 3502 // writeStartTag("institution"); 3503 xmlCrudeWriter.writeStartElement("sampleDescription"); 3504 xmlCrudeWriter.writeStartElementEnd(); 3505 // writeEndTag("institution"); 3506 xmlCrudeWriter.writeEndElement("sampleDescription"); 3507 // 3508 } 3509 catch (XMLStreamException e) 3510 { 3511 log 3512 .warn("Problem when generating xml file " + xmlFilePath + " : " + e); 3513 } 3514 } 3403 3515 /** 3404 3516 * Checks if an XML file is valid according to a specific XML Schema
Note: See TracChangeset
for help on using the changeset viewer.