Changeset 3773


Ignore:
Timestamp:
Aug 18, 2010, 10:51:48 AM (13 years ago)
Author:
Gregory Vincic
Message:

Fixing problem with ViewHitSubHits? action. The problem was in the ActionFactory? that did not reuse factories approprietly.

Location:
trunk/client/servlet/src/org/proteios
Files:
3 edited

Legend:

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

    r3723 r3773  
    3939import org.proteios.RoleController;
    4040import org.proteios.action.execute.ViewLoginForm;
     41import org.proteios.action.execute.Login;
    4142import org.proteios.action.extract.ViewExtract;
    4243import org.proteios.action.file.ViewFile;
     
    318319    }
    319320
    320   // Special case for Login action, must check the owner parameter aswell
    321   if(lastAction == null || owner != null)
     321  log.debug(action.getId() + " : Owner is " + owner);
     322  // Special case for Login action, must check the lastAction id aswell
     323  if(lastAction == null || lastAction.getId().equals(Login.class.getName()))
    322324  { // Create new factories and stuff for this action
    323325   log.debug(action.getId() + " : Creating new factories and stuff");
  • trunk/client/servlet/src/org/proteios/action/hit/ViewHitSubHits.java

    r2909 r3773  
    5757      throws ActionException, InvalidParameterValue
    5858  {
    59     /*
    60      * Get hit id from valid parameter and set it as session attribute.
    61      */
    62     Integer hitId = getValidInteger(FormFactory.VID);
    63     log.debug("hitId = " + hitId);
    64     /***********************************************************************
    65      * Get external id data
    66      */
    67     // Define
     59  Integer hitId;
    6860    Table tbl;
    6961    RowLayout layout;
    70     Title title;
     62    Title title;  DbControl dc;
     63  ItemFactory factory;
     64  Hit hit;
     65  List<Hit> hits;
     66
     67    hitId = getValidInteger(FormFactory.VID);
    7168    tbl = (Table) getRequest().getAttribute("table");
     69
     70    log.debug("hitId = " + hitId);
     71
    7272    if (tbl == null)
    7373    {
    7474      // Let ConfigureTableFactory2 action create the table for us
    75       setAttribute(ConfigureTableFactory2.VWRAPPERCLASS, Hit.class
    76         .getName());
    77       setAttribute(ConfigureTableFactory2.VDATACLASS, HitData.class
    78         .getName());
    79       setAttribute(ConfigureTableFactory2.VFORWARDTO,
    80         ViewHitSubHits.class.getName());
     75      setAttribute(ConfigureTableFactory2.VWRAPPERCLASS, Hit.class.getName());
     76      setAttribute(ConfigureTableFactory2.VDATACLASS, HitData.class.getName());
     77      setAttribute(ConfigureTableFactory2.VFORWARDTO, ViewHitSubHits.class.getName()); // Back to this action
    8178      setAttribute(ConfigureTableFactory2.VONLYINPROJECT, true);
    8279      setAttribute(ConfigureTableFactory2.VUSEDEFAULT, false);
     
    8582    else
    8683    {
    87       DbControl dc = newDbControl();
    88       ItemFactory factory = getItemFactory(dc);
    89       Hit hit = factory.getById(Hit.class, hitId);
    90       List<Hit> hits = new ArrayList<Hit>();
     84      title = new Title("HitsCombination");
     85      dc = newDbControl();
     86      factory = getItemFactory(dc);
     87
     88      hit = factory.getById(Hit.class, hitId);
     89      hits = new ArrayList<Hit>();
    9190      hits.add(hit);
    9291      hits.addAll(hit.getSubHitsInCombination());
    93       for (Hit h : hits)
    94       {
    95         log.error("Hit " + h.getScoreType() + " " + h.getScore());
    96       }
     92
    9793      getTableFactory2().setIterator(hits.iterator());
    9894      tbl = getTableFactory2().build();
    9995      tbl.setTitle("Hit");
    100       // List the hits
    101       /*******************************************************************
    102        * Layout
    103        */
    104       title = new Title("HitsCombination");
     96
    10597      layout = getLayoutFactory().getRowLayout();
    10698      layout.add(title);
  • trunk/client/servlet/src/org/proteios/gui/table/TableFactory2.java

    r3314 r3773  
    9090  public Table build()
    9191  {
    92     log.debug("Building table for [" + classDescriptor.getDescribedClass()
    93       .getName() + "]");
     92  if(classDescriptor == null) { log.error("TableFactory2 is missconfigured. classDescriptor is null, make sure you call TableFactory2.setClassDescriptor prior to TableFactory2.build()"); return null; }
     93    log.debug("Building table for [" + classDescriptor.getDescribedClass().getName() + "]");
    9494    Table table = null;
    9595    if (verify())
    9696    {
    97       table = new Table(classDescriptor.getDescribedClass()
    98         .getSimpleName());
     97      table = new Table(classDescriptor.getDescribedClass().getSimpleName());
    9998      table.setHeader(columns);
    10099      while (iterator.hasNext())
Note: See TracChangeset for help on using the changeset viewer.