Changeset 7836


Ignore:
Timestamp:
Aug 28, 2020, 7:58:29 AM (21 months ago)
Author:
Nicklas Nordborg
Message:

Fixes #2219: Item list fails to load all parent extracts in some cases

Found two separate issues. First, the CollectExtracts didn't return the correct set of extracts in some cases. Second, the ExtractToParentExtractTransformer need to handle the case when no downstream extracts are found in the same manner as when this has not been checked to begin with.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/listable/CollectExtracts.java

    r6880 r7836  
    184184
    185185    @Override
    186     public Set<Integer> transform(TransformContext context, Set<Integer> source)
     186    public Set<Integer> transform(TransformContext context, final Set<Integer> source)
    187187    {
    188188      DbControl dc = context.getDbControl();
     
    227227 
    228228    @Override
    229     public Set<Integer> transform(TransformContext context, Set<Integer> source)
     229    public Set<Integer> transform(TransformContext context, final Set<Integer> source)
    230230    {
    231231      DbControl dc = context.getDbControl();
     
    262262 
    263263    @Override
    264     public Set<Integer> transform(TransformContext context, Set<Integer> source)
     264    public Set<Integer> transform(TransformContext context, final Set<Integer> source)
    265265    {
    266266      collected.addAll(source);
     
    291291 
    292292    @Override
    293     public Set<Integer> transform(TransformContext context, Set<Integer> source)
    294     {
    295       if (useCollectedAsSource) source = collected;
    296       //System.out.println("Source extracts useCollectedAsSource="+useCollectedAsSource+": " + source);
    297       parents.addAll(new ExtractToParentExtractTransformer(includeSource).transform(context, source));
    298       //System.out.println("Parent extracts: " + parents);
     293    public Set<Integer> transform(TransformContext context, final Set<Integer> source)
     294    {
     295      Set<Integer> sourceToUse = useCollectedAsSource ? collected : source;
     296      parents.addAll(new ExtractToParentExtractTransformer(includeSource).transform(context, sourceToUse));
    299297      return source;
    300298    }
     
    322320 
    323321    @Override
    324     public Set<Integer> transform(TransformContext context, Set<Integer> source)
    325     {
    326       if (useCollectedAsSource) source = collected;
    327       //System.out.println("Source extracts useCollectedAsSource="+useCollectedAsSource+": " + source);
    328       children.addAll(new ExtractToChildExtractTransformer(includeSource).transform(context, source));
    329       //System.out.println("Child extracts: " + children);
     322    public Set<Integer> transform(TransformContext context, final Set<Integer> source)
     323    {
     324      Set<Integer> sourceToUse = useCollectedAsSource ? collected : source;
     325      children.addAll(new ExtractToChildExtractTransformer(includeSource).transform(context, sourceToUse));
    330326      return source;
    331327    }
  • trunk/src/core/net/sf/basedb/util/listable/ExtractToParentExtractTransformer.java

    r7772 r7836  
    112112    Set<Integer> upstream = null;
    113113    Set<Integer> downstream = null;   
    114     if (collectedExtracts != null)
     114    if (collectedExtracts != null && collectedExtracts.getCollected().size() > 0)
    115115    {
    116116      // The 'upstream' is all collected extracts and their parents
     
    137137    {
    138138      Set<Integer> parents = safeIdList(dc, query, "children", children);
    139       //query.setParameter("children", children, Type.INT);
    140       //Set<Integer> parents = new HashSet<Integer>(query.idList(dc));
    141      
    142139      if (upstream != null) parents.removeAll(upstream);
    143140      if (downstream != null) parents.retainAll(downstream);
Note: See TracChangeset for help on using the changeset viewer.