Changeset 7301


Ignore:
Timestamp:
Mar 1, 2017, 2:19:47 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2058: Item overview is not working when going from extract to derived bioassay

This should fix the first part of the problem so that forward-loading links from extract to derived bioassays are considered.

This will load derived bioassays that has no parent derived bioassays and are linked directly to the extract. Note that there is no need to check other parents items here since if they are included in the overview tree the derived bioassay would have been included on that level instead.

Location:
trunk/src/core/net/sf/basedb/util/overview/loader
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/overview/loader/DerivedBioAssayLoader.java

    r7004 r7301  
    9898      returnNode = createForwardNode((DerivedBioAssay)parentNode.getItem(dc), dc, context, parentNode);
    9999    }
     100    else if (parentType == Item.EXTRACT)
     101    {
     102      returnNode = createForwardNode((Extract)parentNode.getItem(dc), dc, context, parentNode);
     103    }
    100104    else if (parentType == Item.ITEMLIST)
    101105    {
     
    269273  }
    270274
     275  private Node createForwardNode(Extract extract, DbControl dc, OverviewContext context, Node extractNode)
     276  {
     277    NodeFactory<DerivedBioAssay> nf = getNodeFactory(dc, context);
     278    Node folderNode = null;
     279    ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery();
     280    query.restrict(Restrictions.eq(Hql.property("extract"), Hql.entity(extract)));
     281    query.join(Hql.leftJoin("parents", "parent"));
     282    query.restrict(Restrictions.eq(Hql.alias("parent"), null));
     283    context.initQuery(query, "name");
     284    ItemResultIterator<DerivedBioAssay> it = query.iterate(dc);
     285    while (it.hasNext())
     286    {
     287      DerivedBioAssay dba = it.next();
     288      if (folderNode == null)
     289      {
     290        folderNode =  new Node("derivedbioassays", "Derived bioassays", extractNode, ChildNodeDirection.FORWARD);
     291      }
     292      createItemNode(nf, dba, dba, false, folderNode, ChildNodeDirection.FORWARD);
     293    }
     294    postValidateFolder(nf, folderNode, extractNode, false);
     295    return folderNode;
     296  }
     297
     298 
    271299  /**
    272300    Create a reverse-loading bioassay node for the bioassay that is the parent
  • trunk/src/core/net/sf/basedb/util/overview/loader/ExtractLoader.java

    r7004 r7301  
    212212  /**
    213213    Loads the child extracts and physical bioassays that has been created from
    214     this extract. Raw bioassays linking to this parent extract and doesn't have
    215     a parent derived bioassay are alos loaded.
     214    this extract. Derived and raw bioassays linking to this parent extract and doesn't have
     215    a parent derived bioassay are also loaded.
    216216    @see ExtractLoader#createForwardNode(DbControl, OverviewContext, Node)
    217217    @see PhysicalBioAssayLoader#createForwardNode(DbControl, OverviewContext, Node)
     218    @see DerivedBioAssayLoader#createForwardNode(DbControl, OverviewContext, Node)
     219    @see RawBioAssayLoader#createForwardNode(DbControl, OverviewContext, Node)
    218220  */
    219221  @Override
     
    222224    getNodeLoader(context, Item.PHYSICALBIOASSAY).createForwardNode(dc, context, extractNode);
    223225    getNodeLoader(context, Item.EXTRACT).createForwardNode(dc, context, extractNode);
     226    getNodeLoader(context, Item.DERIVEDBIOASSAY).createForwardNode(dc, context, extractNode);
    224227    getNodeLoader(context, Item.RAWBIOASSAY).createForwardNode(dc, context, extractNode);
    225228  }
Note: See TracChangeset for help on using the changeset viewer.