Changeset 7887


Ignore:
Timestamp:
Dec 4, 2020, 9:56:39 AM (11 months ago)
Author:
Nicklas Nordborg
Message:

References #2229: Synchronization filters that uses a child or parent column are not displayed correctly

Fixes an issue if the child column is from a rawbioassay. In this case, the "item type" is not a subtype, but a raw data type which means we need to check and handle this differently.

Also added a <missing> tag for indicating things that are missing since the filter was created.

Location:
branches/3.17-stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/3.17-stable/src/clients/web/net/sf/basedb/clients/web/util/HTML.java

    r7748 r7887  
    322322        else
    323323        {
    324           m.appendReplacement(sb, "<$2>");
     324          m.appendReplacement(sb, "<$2 $3>");
    325325        }
    326326      }
  • branches/3.17-stable/src/core/net/sf/basedb/util/formatter/PropertyFilterFormatter.java

    r7886 r7887  
    2727import net.sf.basedb.core.DbControl;
    2828import net.sf.basedb.core.Item;
     29import net.sf.basedb.core.ItemNotFoundException;
    2930import net.sf.basedb.core.Nameable;
    3031import net.sf.basedb.core.Operator;
    3132import net.sf.basedb.core.PropertyFilter;
     33import net.sf.basedb.core.RawDataType;
     34import net.sf.basedb.core.RawDataTypes;
    3235import net.sf.basedb.core.Type;
    3336import net.sf.basedb.util.Values;
     
    9699      }
    97100     
    98       int subtypeId = Values.getInt(tmp[baseIndex+2]);
     101      Item relatedItemType = Item.valueOf(tmp[baseIndex+1]);
    99102      property = tmp[baseIndex+3];
    100103      sb.append(function(parentOrChild)).append("(");
    101       sb.append(value(nameOfItem(dc, Item.ITEMSUBTYPE, subtypeId, false)));
     104      if (relatedItemType == Item.RAWBIOASSAY)
     105      {
     106        RawDataType rdt = RawDataTypes.getRawDataType(tmp[baseIndex+2]);
     107        if (rdt == null)
     108        {
     109          sb.append(value(missing(tmp[baseIndex+2], "This raw data type doesn't exist!")));
     110        }
     111        else
     112        {
     113          sb.append(value(rdt.getName()));
     114        }
     115      }
     116      else
     117      {
     118        int subtypeId = Values.getInt(tmp[baseIndex+2]);
     119        sb.append(value(nameOfItem(dc, Item.ITEMSUBTYPE, subtypeId, false)));
     120      }
    102121      sb.append(")");
    103122      if (!property.startsWith("#")) sb.append(".");
     
    283302      return q+((Nameable)itemType.getById(dc, id)).getName()+q;
    284303    }
     304    catch (ItemNotFoundException ex)
     305    {
     306      return missing(Integer.toString(id), "This " + itemType.toString().toLowerCase() + " doesn't exist!");
     307    }
    285308    catch (RuntimeException ex)
    286309    {
    287       return Integer.toString(id);
     310      return missing(Integer.toString(id), ex.getMessage());
    288311    }
    289312  }
     
    321344    return tagElements ? "<function>"+function+"</function>" : function;
    322345  }
     346  private String missing(String missing, String title)
     347  {
     348    return tagElements ? "<missing title=\""+(title!=null ? title :"Missing")+"\">"+missing+"</missing>" : missing;
     349  }
    323350
    324351 
  • branches/3.17-stable/www/views/itemlists/syncfilter/ajax.jsp

    r7605 r7887  
    8989    if (sourceItemType == syncFilter.getSourceItemType())
    9090    {
    91       json.put("filter", HTML.encodeTags(formatFilter(dc, syncFilter), "value|name|operator|function"));
     91      json.put("filter", HTML.encodeTags(formatFilter(dc, syncFilter), "value|name|operator|function|missing"));
    9292    }
    9393  }
  • branches/3.17-stable/www/views/itemlists/syncfilter/filtertext.css

    r7604 r7887  
    2222  color: #666666;
    2323}
    24 
     24.filtertext missing
     25{
     26  text-decoration: underline dashed #d00000;
     27}
  • branches/3.17-stable/www/views/itemlists/view_list.jsp

    r7794 r7887  
    536536                  }
    537537                  %>
    538                   <pre class="filtertext" id="syncfilter.<%=filterId%>"><%=HTML.encodeTags(filterString, "value|name|operator|function")%></pre></tbl:cell>
     538                  <pre class="filtertext" id="syncfilter.<%=filterId%>"><%=HTML.encodeTags(filterString, "value|name|operator|function|missing")%></pre></tbl:cell>
    539539                <tbl:cell column="inSync">
    540540                  <base:icon
Note: See TracChangeset for help on using the changeset viewer.