Changeset 3767


Ignore:
Timestamp:
Aug 16, 2010, 3:00:39 PM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #685. Refactoring action class ViewActiveMascotParameterSetStorage?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/mascot/ViewActiveMascotParameterSetStorage.java

    r3297 r3767  
    6363      throws ActionException, InvalidParameterValue
    6464  {
    65     /***********************************************************************
    66      * Properties
    67      */
    6865    // Get the MascotParameterSetStorage item to use for the search
    69     Integer mascotpssId = getValidInteger(VMASCOTPARAMETERSETSTORAGEID);
     66    Integer mascotpssId;
     67  Boolean useWebInterfaceFlag;
     68  String mascotSearchUserName, mascotSearchUserEmail;
     69  DbControl dc;
     70  ItemFactory factory;
     71  MascotParameterSetStorage mascotpss;
     72  MascotParameterFileUtil fileUtil;
     73  InputStream iStream;
     74  MascotParameterSet mascotParameterSet;
     75  MascotParameterSetOptionsUtil util;
     76  Form mascotParameterSetForm;
     77  Toolbar toolbar;
     78  ActionLink save,saveAs,searchMascot,saveAsAndSearchMascot;
     79  RowLayout layout;
     80  Title title;
     81  List<Integer> spectrumFileIds, mascotpssIds;
     82  List<String> enzymeStringList;
     83  List<Option> enzymeOptionList;
     84  List<String> missedCleavagesStringList;
     85  List<Option> missedCleavagesOptionList;
     86  List<String> sequenceLibraryStringList;
     87  List<Option> sequenceLibraryOptionList;
     88  List<String> speciesStringList;
     89  List<Option> speciesOptionList;
     90  List<String> fixedModsStringList;
     91  List<Option> fixedModsOptionList;
     92  List<String> variableModsStringList;
     93  List<Option> variableModsOptionList;
     94  List<String> quantitationStringList;
     95  List<Option> quantitationOptionList;
     96  List<String> peptideTolUnitStringList;
     97  List<Option> peptideTolUnitOptionList;
     98  List<String> peptideIsotopeErrorStringList;
     99  List<Option> peptideIsotopeErrorOptionList;
     100  List<String> msMsTolUnitStringList;
     101  List<Option> msMsTolUnitOptionList;
     102  List<String> peptideChargeStringList;
     103  List<Option> peptideChargeOptionList;
     104  List<String> dataFormatStringList;
     105  List<Option> dataFormatOptionList;
     106  List<String> instrumentStringList;
     107  List<Option> instrumentOptionList;
     108  List<String> reportTopStringList;
     109  List<Option> reportTopOptionList;
     110  // Define
     111
     112  mascotpssId = getValidInteger(VMASCOTPARAMETERSETSTORAGEID);
     113    useWebInterfaceFlag = getValidBoolean(SearchMascot.VMASCOTUSEWEBINTERFACEFLAG);
     114
     115    if (useWebInterfaceFlag == null)
     116    {
     117      useWebInterfaceFlag = true;
     118    }
     119    // Optional Mascot search user data
     120    mascotSearchUserName = getValidString(SearchMascot.VMASCOT_SEARCH_USER_NAME);
     121    mascotSearchUserEmail = getValidString(SearchMascot.VMASCOT_SEARCH_USER_EMAIL);
     122
    70123    log.debug("mascotParameterSetStorageId from VMASCOTPARAMETERSETSTORAGEID = " + mascotpssId);
    71     // Get the MascotParameterSetStorage item to use for the search
    72     Boolean useWebInterfaceFlag = getValidBoolean(SearchMascot.VMASCOTUSEWEBINTERFACEFLAG);
    73124    log.debug("useWebInterfaceFlag from SearchMascot.VMASCOTUSEWEBINTERFACEFLAG = " + useWebInterfaceFlag);
    74     if (useWebInterfaceFlag == null)
    75     {
    76       useWebInterfaceFlag = true;
    77     }
    78125    log.debug("useWebInterfaceFlag = " + useWebInterfaceFlag);
    79     // SearchMascot.VMASCOTUSEWEBINTERFACEFLAG
    80     // Get optional Mascot search user data
    81     String mascotSearchUserName = getValidString(SearchMascot.VMASCOT_SEARCH_USER_NAME);
    82     String mascotSearchUserEmail = getValidString(SearchMascot.VMASCOT_SEARCH_USER_EMAIL);
    83126    log.debug("mascotSearchUserName = \"" + mascotSearchUserName + "\"");
    84127    log.debug("mascotSearchUserEmail = \"" + mascotSearchUserEmail + "\"");
     
    86129    if (mascotpssId == null || mascotpssId == 0)
    87130    {
    88       List<Integer> mascotpssIds = getValidIntegerList(FormFactory.VID);
     131      mascotpssIds = getValidIntegerList(FormFactory.VID);
    89132      log.debug("mascotpssIds from FormFactory.VID = " + mascotpssIds);
    90133      // Make sure at least one file has been selected
     
    99142    log.debug("mascotpssId = " + mascotpssId);
    100143    // Get the spectrum file items to use for the search
    101     List<Integer> spectrumFileIds = getValidIntegerList(SearchMascot.VSPECTRUMFILEID);
     144    spectrumFileIds = getValidIntegerList(SearchMascot.VSPECTRUMFILEID);
    102145    log.debug("spectrumFileIds = " + spectrumFileIds);
    103     //
    104     DbControl dc = newDbControl();
    105     ItemFactory factory = getItemFactory(dc);
    106     MascotParameterSetStorage mascotpss = factory.getById(MascotParameterSetStorage.class, mascotpssId);
     146    dc = newDbControl();
     147    factory = getItemFactory(dc);
     148    mascotpss = factory.getById(MascotParameterSetStorage.class, mascotpssId);
    107149    // Get Mascot parameter data from xml file
    108     MascotParameterFileUtil mascotParameterFileUtil = new MascotParameterFileUtil();
    109     InputStream iStream = mascotpss.getParameterFile().getDownloadStream(0);
    110     mascotParameterFileUtil.setXMLInputStream(iStream);
    111     MascotParameterSet mascotParameterSet = mascotParameterFileUtil.fetchMascotParameterSet();
    112     // Get Mascot parameter set option alternatives
     150    fileUtil = new MascotParameterFileUtil();
     151    iStream = mascotpss.getParameterFile().getDownloadStream(0);
     152    fileUtil.setXMLInputStream(iStream);
     153    mascotParameterSet = fileUtil.fetchMascotParameterSet();
    113154    // Get MascotParameterSetOptionsUtil instance
    114     MascotParameterSetOptionsUtil mascotParameterSetOptionUtil = new MascotParameterSetOptionsUtil(mascotParameterSet.getSearchType());
    115     mascotParameterSetOptionUtil.setWebInterfaceUsed(useWebInterfaceFlag);
     155    util = new MascotParameterSetOptionsUtil(mascotParameterSet.getSearchType());
     156    util.setWebInterfaceUsed(useWebInterfaceFlag);
    116157    // Get enzyme option data
    117     List<String> enzymeStringList = mascotParameterSetOptionUtil.fetchEnzymeStringList();
    118     List<Option> enzymeOptionList = stringListToOptionList(enzymeStringList);
     158    enzymeStringList = util.fetchEnzymeStringList();
     159    enzymeOptionList = stringListToOptionList(enzymeStringList);
    119160    // Get missed cleavages option data
    120     List<String> missedCleavagesStringList = mascotParameterSetOptionUtil.fetchMissedCleavagesStringList();
    121     List<Option> missedCleavagesOptionList = stringListToOptionList(missedCleavagesStringList);
     161    missedCleavagesStringList = util.fetchMissedCleavagesStringList();
     162    missedCleavagesOptionList = stringListToOptionList(missedCleavagesStringList);
    122163    // Get sequence library option data
    123     List<String> sequenceLibraryStringList = mascotParameterSetOptionUtil.fetchSequenceLibraryStringList();
    124     List<Option> sequenceLibraryOptionList = stringListToOptionList(sequenceLibraryStringList);
     164    sequenceLibraryStringList = util.fetchSequenceLibraryStringList();
     165    sequenceLibraryOptionList = stringListToOptionList(sequenceLibraryStringList);
    125166    // Get species option data
    126     List<String> speciesStringList = mascotParameterSetOptionUtil.fetchSpeciesStringList();
    127     List<Option> speciesOptionList = stringListToOptionList(speciesStringList);
     167    speciesStringList = util.fetchSpeciesStringList();
     168    speciesOptionList = stringListToOptionList(speciesStringList);
    128169    // Get fixed modifications option data
    129     List<String> fixedModsStringList = mascotParameterSetOptionUtil.fetchModificationStringList();
    130     List<Option> fixedModsOptionList = stringListToOptionList(fixedModsStringList);
     170    fixedModsStringList = util.fetchModificationStringList();
     171    fixedModsOptionList = stringListToOptionList(fixedModsStringList);
    131172    // Get variable modifications option data
    132     List<String> variableModsStringList = mascotParameterSetOptionUtil.fetchModificationStringList();
    133     List<Option> variableModsOptionList = stringListToOptionList(variableModsStringList);
     173    variableModsStringList = util.fetchModificationStringList();
     174    variableModsOptionList = stringListToOptionList(variableModsStringList);
    134175    // Get quantitation option data
    135     List<String> quantitationStringList = mascotParameterSetOptionUtil.fetchQuantitationStringList();
    136     List<Option> quantitationOptionList = stringListToOptionList(quantitationStringList);
     176    quantitationStringList = util.fetchQuantitationStringList();
     177    quantitationOptionList = stringListToOptionList(quantitationStringList);
    137178    // Get peptide tolerance unit option data
    138     List<String> peptideTolUnitStringList = mascotParameterSetOptionUtil.fetchPeptideTolUnitStringList();
    139     List<Option> peptideTolUnitOptionList = stringListToOptionList(peptideTolUnitStringList);
     179    peptideTolUnitStringList = util.fetchPeptideTolUnitStringList();
     180    peptideTolUnitOptionList = stringListToOptionList(peptideTolUnitStringList);
    140181    // Get peptide isotope error option data
    141     List<String> peptideIsotopeErrorStringList = mascotParameterSetOptionUtil.fetchPeptideIsotopeErrorStringList();
    142     List<Option> peptideIsotopeErrorOptionList = stringListToOptionList(peptideIsotopeErrorStringList);
     182    peptideIsotopeErrorStringList = util.fetchPeptideIsotopeErrorStringList();
     183    peptideIsotopeErrorOptionList = stringListToOptionList(peptideIsotopeErrorStringList);
    143184    // Get quantitation option data
    144     List<String> msMsTolUnitStringList = mascotParameterSetOptionUtil.fetchMsMsTolUnitStringList();
    145     List<Option> msMsTolUnitOptionList = stringListToOptionList(msMsTolUnitStringList);
     185    msMsTolUnitStringList = util.fetchMsMsTolUnitStringList();
     186    msMsTolUnitOptionList = stringListToOptionList(msMsTolUnitStringList);
    146187    // Get peptide charge option data
    147     List<String> peptideChargeStringList = mascotParameterSetOptionUtil.fetchPeptideChargeStringList();
    148     List<Option> peptideChargeOptionList = stringListToOptionList(peptideChargeStringList);
     188    peptideChargeStringList = util.fetchPeptideChargeStringList();
     189    peptideChargeOptionList = stringListToOptionList(peptideChargeStringList);
    149190    // Get data format option data
    150     List<String> dataFormatStringList = mascotParameterSetOptionUtil.fetchDataFormatStringList();
    151     List<Option> dataFormatOptionList = stringListToOptionList(dataFormatStringList);
     191    dataFormatStringList = util.fetchDataFormatStringList();
     192    dataFormatOptionList = stringListToOptionList(dataFormatStringList);
    152193    // Get instrument option data
    153     List<String> instrumentStringList = mascotParameterSetOptionUtil.fetchInstrumentStringList();
    154     List<Option> instrumentOptionList = stringListToOptionList(instrumentStringList);
     194    instrumentStringList = util.fetchInstrumentStringList();
     195    instrumentOptionList = stringListToOptionList(instrumentStringList);
    155196    // Get report top option data
    156     List<String> reportTopStringList = mascotParameterSetOptionUtil.fetchReportTopStringList();
    157     List<Option> reportTopOptionList = stringListToOptionList(reportTopStringList);
     197    reportTopStringList = util.fetchReportTopStringList();
     198    reportTopOptionList = stringListToOptionList(reportTopStringList);
    158199    // Mascot parameter set form
    159     Form mascotParameterSetForm = getFormFactory().getMascotParameterSetForm(mascotParameterSet,
     200    mascotParameterSetForm = getFormFactory().getMascotParameterSetForm(mascotParameterSet,
    160201      enzymeOptionList,
    161202      missedCleavagesOptionList,
     
    172213      instrumentOptionList,
    173214      reportTopOptionList);
    174     /***********************************************************************
    175      * Annotations table
    176      */
    177     /*
    178     Annotator anna = new Annotator(getItemFactory(dc));
    179     TableFactory tableFactory = getTableFactory();
    180     tableFactory.reset();
    181     tableFactory.setItemClass(Annotation.class);
    182     ItemQuery<Annotation> annotationQuery = anna.getAnnotationSet(mascotpss)
    183       .getAnnotations();
    184     tableFactory.setQuery(annotationQuery);
    185     tableFactory.setMaxResults(100);
    186     Table annotationsTable = tableFactory.build();
    187     */
    188     /***********************************************************************
     215
     216  /***********************************************************************
    189217     * Toolbar
    190218     */
    191     Toolbar toolbar = new Toolbar();
     219    toolbar = new Toolbar();
    192220    if (spectrumFileIds == null)
    193221    {
    194222      // Save Mascot parameter set button
    195       ActionLink save = getActionLink(SaveMascotParameterSetStorage.class, "Save");
     223      save = getActionLink(SaveMascotParameterSetStorage.class, "Save");
    196224      save.addParameter(VMASCOTPARAMETERSETSTORAGEID, mascotpssId);
    197225      save.addParameter(SearchMascot.VMASCOT_SEARCH_USER_NAME, mascotSearchUserName);
     
    201229      toolbar.add(save);
    202230      // "Save As" Mascot parameter set button
    203       ActionLink saveAs = getActionLink(SaveMascotParameterSetStorage.class, "SaveAs");
     231      saveAs = getActionLink(SaveMascotParameterSetStorage.class, "SaveAs");
    204232      saveAs.addParameter(VMASCOTPARAMETERSETSTORAGEID, mascotpssId);
    205233      saveAs.addParameter(SearchMascot.VMASCOT_SEARCH_USER_NAME, mascotSearchUserName);
     
    213241    {
    214242      // Save and Search Mascot
    215       ActionLink searchMascot = getActionLink(SaveMascotParameterSetStorage.class, "SaveAndSearchMascot");
     243      searchMascot = getActionLink(SaveMascotParameterSetStorage.class, "SaveAndSearchMascot");
    216244      searchMascot.addParameter(VMASCOTPARAMETERSETSTORAGEID, mascotpssId);
    217245      searchMascot.addParameter(SearchMascot.VMASCOT_SEARCH_USER_NAME, mascotSearchUserName);
     
    226254      toolbar.add(searchMascot);
    227255      // "Save As" and Search Mascot
    228       ActionLink saveAsAndSearchMascot = getActionLink(SaveMascotParameterSetStorage.class, "SaveAsAndSearchMascot");
     256      saveAsAndSearchMascot = getActionLink(SaveMascotParameterSetStorage.class, "SaveAsAndSearchMascot");
    229257      saveAsAndSearchMascot.addParameter(VMASCOTPARAMETERSETSTORAGEID, mascotpssId);
    230258      saveAsAndSearchMascot.addParameter(SearchMascot.VMASCOT_SEARCH_USER_NAME, mascotSearchUserName);
     
    244272     * Layout
    245273     */
    246     RowLayout layout = getLayoutFactory().getRowLayout();
    247     Title title = new Title("MascotParameterSet");
     274    layout = getLayoutFactory().getRowLayout();
     275    title = new Title("MascotParameterSet");
    248276    title.setSubtitle(mascotpss.getName());
    249277    layout.add(title);
    250     //
    251     /*
    252     Tab annotations = new Tab("OtherSettings", "annotationsTab");
    253     annotations.setGuiElement(annotationsTable);
    254     ts.add(annotations);
    255     */
    256     layout.add(mascotParameterSetForm);
     278  layout.add(mascotParameterSetForm);
    257279    setLayout(layout);
    258280  }
     
    272294      return null;
    273295    }
    274     List<Option> optionList = new ArrayList<Option>(0);
     296    List<Option> optionList = new ArrayList<Option>(stringList.size());
    275297    for (int i = 0; i < stringList.size(); i = i + 2)
    276298    {
Note: See TracChangeset for help on using the changeset viewer.