Changeset 6756


Ignore:
Timestamp:
Feb 20, 2015, 2:13:42 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1325: Lists of items (similar funcion as biomaterial lists)

Removed some functionality related to biomaterial lists and replaced that with item lists:

  • Filter on list pages for biosources, samples, extracts and biowells
  • Create biomaterial list button on the same list pages
  • Removed biomaterial lists from "Item overview" completely.

Installation now create Item.ITEMLIST using the same code as Item.BIOMATERIALLIST which should make it a lot easier when upgrading since we don't have to remap permissions, annotation types, any-to-any-links, stored filters etc. that use the code in order to work.

Location:
trunk
Files:
2 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r6755 r6756  
    2626import net.sf.basedb.core.AnnotatableProxy;
    2727import net.sf.basedb.core.AnyToAny;
    28 import net.sf.basedb.core.BioMaterialList;
    2928import net.sf.basedb.core.Coloring;
    3029import net.sf.basedb.core.DataFileType;
     
    12091208
    12101209  /**
    1211     Get available biomaterial lists as an Enumeration that is
    1212     suitable to use in a column definition for a table.
    1213     @param dc The DbControl to use
    1214     @param memberType Only load lists with this member type, or null
    1215       to load any lists
    1216     @param include Include options
    1217     @return The found lists as an enumeration, empty if no lists are
    1218       found
    1219     @since 2.10
    1220   */
    1221   @Deprecated
    1222   public static net.sf.basedb.util.Enumeration<String, String>
    1223     getBioMaterialListsEnum(DbControl dc, Item memberType, Collection<Include> include)
    1224   {
    1225     ItemQuery<BioMaterialList> query = BioMaterialList.getQuery();
    1226     query.include(include == null ? Include.ALL : include);
    1227     if (memberType != null)
    1228     {
    1229       query.restrict(
    1230         Restrictions.eq(
    1231           Hql.property("memberType"),
    1232           Expressions.integer(memberType.getValue())
    1233         )
    1234       );
    1235     }
    1236     query.order(Orders.asc(Hql.property("name")));
    1237     query.setCacheResult(true);
    1238    
    1239     net.sf.basedb.util.Enumeration<String, String> lists =
    1240       new net.sf.basedb.util.Enumeration<String, String>();
    1241     for (BioMaterialList list : query.list(dc))
    1242     {
    1243       lists.add(Integer.toString(list.getId()), HTML.encodeTags(list.getName()));
    1244     }
    1245     return lists;
    1246   }
    1247  
    1248   /**
    12491210    Get available item lists as an Enumeration that is
    12501211    suitable to use in a column definition for a table.
  • trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java

    r6355 r6756  
    198198        {
    199199          Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT, Item.TAG,
    200           Item.BIOMATERIALLIST, Item.BIOPLATE, Item.BIOPLATETYPE, Item.BIOPLATEEVENT, Item.BIOPLATEEVENTTYPE,
    201           Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY, Item.RAWBIOASSAY, Item.EXPERIMENT, Item.FORMULA
     200          Item.BIOPLATE, Item.BIOPLATETYPE, Item.BIOPLATEEVENT, Item.BIOPLATEEVENTTYPE,
     201          Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY, Item.RAWBIOASSAY, Item.EXPERIMENT, Item.FORMULA, Item.ITEMLIST
    202202        })
    203203      );
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/edit/EditUtil.java

    r6748 r6756  
    5757    {
    5858      Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT, Item.TAG,
    59       Item.BIOPLATE, Item.BIOWELL, Item.BIOPLATETYPE, Item.BIOMATERIALLIST, Item.BIOMATERIALEVENT,
     59      Item.BIOPLATE, Item.BIOWELL, Item.BIOPLATETYPE, Item.BIOMATERIALEVENT,
    6060      Item.BIOPLATEEVENT, Item.BIOPLATEEVENTTYPE,
    6161      Item.ARRAYDESIGN, Item.ARRAYBATCH, Item.ARRAYSLIDE,
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java

    r6748 r6756  
    6363      Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT,
    6464      Item.TAG, Item.BIOMATERIALEVENT,
    65       Item.BIOMATERIALLIST, Item.BIOPLATE, Item.BIOWELL, Item.BIOPLATETYPE,
     65      Item.BIOPLATE, Item.BIOWELL, Item.BIOPLATETYPE,
    6666      Item.BIOPLATEEVENT, Item.BIOPLATEEVENTTYPE,
    6767      Item.PLATE, Item.WELL, Item.PLATEEVENT,
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/common.properties

    r6748 r6756  
    116116item.bioplateeventtype  Bioplate event type
    117117item.bioplateeventtype+ Bioplate event types
    118 item.biomateriallist  Biomaterial list
    119 item.biomateriallist+ Biomaterial lists
    120118item.plategeometry  Plate geometry
    121119item.plategeometry+ Plate geometries
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/menu.properties

    r6742 r6756  
    119119bioplates.tooltip.1 Manage bio plates
    120120bioplates.tooltip.0 You do not have permission to manage bio plates
    121 biomateriallists.tooltip.1  Manage biomaterial lists
    122 biomateriallists.tooltip.0  You do not have permission to manage biomaterial lists
    123121# ---------------
    124122bioplatetypes.tooltip.1 Manage bioplate types
  • trunk/src/core/net/sf/basedb/core/Install.java

    r6728 r6756  
    358358      createRoleKey(Item.BIOPLATEEVENT, "Bio plate events", "Gives access to bio plate events", users_create);
    359359      createRoleKey(Item.BIOPLATEEVENTTYPE, "Bio plate event types", "Gives access to bio plate event types", guests_use_administrators_all);
    360       createRoleKey(Item.BIOMATERIALLIST, "Biomaterial lists", "Gives access to biomaterial lists", users_create);
     360      createRoleKey(Item.ITEMLIST, "Item lists", "Gives access to item lists", users_create);
    361361 
    362362      // Reporters
  • trunk/src/core/net/sf/basedb/core/Item.java

    r6755 r6756  
    223223    The item is an {@link ItemList}
    224224  */
    225   ITEMLIST(148, "Item list", "ils", ItemList.class, ItemListData.class, DefinedPermissions.shareable,
     225  ITEMLIST(209, "Item list", "ils", ItemList.class, ItemListData.class, DefinedPermissions.shareable,
    226226      11),
    227227
     
    361361  */
    362362  @Deprecated
    363   BIOMATERIALLIST(209, "Biomaterial list", "bml", BioMaterialList.class, BioMaterialListData.class, DefinedPermissions.shareable,
     363  BIOMATERIALLIST(2090, "Biomaterial list", "bml", BioMaterialList.class, BioMaterialListData.class, DefinedPermissions.shareable,
    364364      480),
    365365
  • trunk/src/core/net/sf/basedb/core/ItemContext.java

    r6700 r6756  
    15871587        boolean fetch = selectOrderBy && sortedProperties.contains(property);
    15881588        String alias = null;
    1589         if (property.startsWith("@") || property.startsWith("£") || property.startsWith("&"))
     1589        if (property.startsWith("@") || property.startsWith("£") || property.startsWith("&") || property.startsWith("§"))
    15901590        {
    15911591          property = property.substring(1);
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r6749 r6756  
    646646      // We support a single selection and either EQ or NEQ operator
    647647      Integer listId = (Integer)getValueAsObject();
     648      String prefix = alias == null ? "$id" : alias + ".id";
    648649      if (operator == Operator.NEQ)
    649650      {
    650         restriction = Hql.restriction("$id<>ALL(SELECT mmb FROM ItemListData lst INNER JOIN lst.members mmb WHERE lst.id=" +listId+")", "$");
     651        restriction = Hql.restriction(prefix+"<>ALL(SELECT mmb FROM ItemListData lst INNER JOIN lst.members mmb WHERE lst.id=" +listId+")", "$");
    651652      }
    652653      else
    653654      {
    654         restriction = Hql.restriction("$id=ANY(SELECT mmb FROM ItemListData lst INNER JOIN lst.members mmb WHERE lst.id=" +listId+")", "$");
     655        restriction = Hql.restriction(prefix+"=ANY(SELECT mmb FROM ItemListData lst INNER JOIN lst.members mmb WHERE lst.id=" +listId+")", "$");
    655656      }
    656657    }
  • trunk/src/core/net/sf/basedb/util/overview/loader/BasicItemNodeLoaderFactory.java

    r6755 r6756  
    231231    registerCheckedNodeLoader(Item.BIOPLATE, BioPlateLoader.class);
    232232    registerCheckedNodeLoader(Item.BIOWELL, BioWellLoader.class);
    233     registerCheckedNodeLoader(Item.BIOMATERIALLIST, BioMaterialListLoader.class);
    234233    registerCheckedNodeLoader(Item.ITEMLIST, ItemListLoader.class);
    235234    registerCheckedNodeLoader(Item.BIOPLATEEVENT, BioPlateEventLoader.class);
  • trunk/src/core/net/sf/basedb/util/overview/loader/BioSourceLoader.java

    r6755 r6756  
    6666    Node returnNode = null;
    6767    Item parentType = parentNode.getItemType();
    68     if (parentType == Item.BIOMATERIALLIST)
    69     {
    70       BioMaterialListLoader.loadMemberNodes(this, dc, context, parentNode);
    71     }
    7268    if (parentType == Item.ITEMLIST)
    7369    {
  • trunk/src/core/net/sf/basedb/util/overview/loader/ExtractLoader.java

    r6755 r6756  
    2727import java.util.Set;
    2828
    29 import net.sf.basedb.core.BioMaterialList;
    3029import net.sf.basedb.core.DbControl;
    3130import net.sf.basedb.core.DerivedBioAssay;
     
    10099      returnNode = createForwardNode((Extract)parentNode.getItem(dc), dc, context, parentNode, false);
    101100    }
    102     else if (parentType == Item.BIOMATERIALLIST)
    103     {
    104       BioMaterialListLoader.loadMemberNodes(this, dc, context, parentNode);
    105     }
    106101    else if (parentType == Item.ITEMLIST)
    107102    {
  • trunk/src/core/net/sf/basedb/util/overview/loader/SampleLoader.java

    r6755 r6756  
    8787      returnNode = createForwardNode((Sample)parentNode.getItem(dc), dc, context, parentNode, false);
    8888    }
    89     else if (parentType == Item.BIOMATERIALLIST)
    90     {
    91       BioMaterialListLoader.loadMemberNodes(this, dc, context, parentNode);
    92     }
    9389    else if (parentType == Item.ITEMLIST)
    9490    {
  • trunk/src/test/TestItemList.java

    r6741 r6756  
    119119  static int test_create(Item memberType, String externalId, boolean setAll)
    120120  {
    121     if (!TestUtil.hasPermission(Permission.CREATE, Item.BIOMATERIALLIST)) return 0;
     121    if (!TestUtil.hasPermission(Permission.CREATE, Item.ITEMLIST)) return 0;
    122122    int id = 0;
    123123    DbControl dc = null;
  • trunk/www/biomaterials/bioplates/wells/list_biowells.jsp

    r6721 r6756  
    350350      />
    351351      <tbl:columndef
    352         id="bioMaterialList"
    353         property="@bioMaterial.bioMaterialLists"
     352        id="itemList"
     353        property="$mbm.§itemLists"
    354354        datatype="int"
    355         title="Biomaterial list"
    356         filterable="true"
    357         enumeration="<%=Base.getBioMaterialListsEnum(dc, bioMaterialType, Include.ALL)%>"
     355        title="Item list"
     356        filterable="true"
     357        enumeration="<%=Base.getItemListsEnum(dc, bioMaterialType, cc.getInclude())%>"
    358358        multiple="false"
    359359      />
  • trunk/www/biomaterials/biosources/biosources.js

    r6400 r6756  
    7676      Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes);
    7777      Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes);
    78       Buttons.addClickHandler('btnNewBioMaterialList', biosources.newBioMaterialListOnClick);
     78      Buttons.addClickHandler('btnNewItemList', biosources.newItemListOnClick);
    7979     
    8080      Buttons.addClickHandler('close', App.closeWindow);
     
    101101  }
    102102 
    103   // Create a new biomaterial list with the selected biosources as members
    104   biosources.newBioMaterialListOnClick = function()
     103  // Create a new item list with the selected biosources as members
     104  biosources.newItemListOnClick = function()
    105105  {
    106     var controller = Items.getController('BIOMATERIALLIST');
    107     Table.submitToPopup('biosources', 'CreateBioMaterialList', controller.width, controller.height);
     106    var controller = Items.getController('ITEMLIST');
     107    Table.submitToPopup('biosources', 'CreateItemList', controller.width, controller.height);
    108108  }
    109109 
  • trunk/www/biomaterials/biosources/index.jsp

    r6192 r6756  
    349349    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin";
    350350  }
    351   else if ("CreateBioMaterialList".equals(cmd))
     351  else if ("CreateItemList".equals(cmd))
    352352  {
    353353    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     
    357357    dc.close();
    358358    cc.setQuery(query);
    359     redirect = "../lists/index.jsp?ID="+ID+"&cmd=NewItem&addBioMaterials=1&formId=biosources&fromContext=BIOSOURCE";
     359    redirect = "../../views/itemlists/index.jsp?ID="+ID+"&cmd=NewItem&addItems=1&memberType=BIOSOURCE&formId=biosources";
    360360  }
    361361  else
  • trunk/www/biomaterials/biosources/list_biosources.jsp

    r6721 r6756  
    234234      />     
    235235      <tbl:columndef
    236         id="bioMaterialList"
    237         property="@bioMaterialLists"
     236        id="itemList"
     237        property="§itemLists"
    238238        datatype="int"
    239         title="Biomaterial list"
    240         filterable="true" 
    241         enumeration="<%=Base.getBioMaterialListsEnum(dc, itemType, cc.getInclude())%>"
     239        title="Item list"
     240        filterable="true"
     241        enumeration="<%=Base.getItemListsEnum(dc, itemType, cc.getInclude())%>"
    242242        multiple="false"
    243243      />
     
    335335          />
    336336          <tbl:button
    337             id="btnNewBioMaterialList"
     337            id="btnNewItemList"
    338338            image="add.png"
    339             title="New biomaterial list&hellip;"
    340             tooltip="Create a new biomaterial list from matching biosources"
    341             visible="<%=sc.hasPermission(Permission.CREATE, Item.BIOMATERIALLIST)%>"
     339            title="New item list&hellip;"
     340            tooltip="Create a new item list from matching biosources"
     341            visible="<%=sc.hasPermission(Permission.CREATE, Item.ITEMLIST)%>"
    342342          />
    343343          <tbl:button
  • trunk/www/biomaterials/extracts/extracts.js

    r6695 r6756  
    120120      Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes);
    121121      Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes);
    122       Buttons.addClickHandler('btnNewBioMaterialList', extracts.newBioMaterialListOnClick);
     122      Buttons.addClickHandler('btnNewItemList', extracts.newItemListOnClick);
    123123      Buttons.addClickHandler('btnPlaceOnPlate', extracts.placeOnPlateOnClick);
    124124      Buttons.addClickHandler('btnNewPooledItem', extracts.newPooledItemOnClick);
     
    170170  }
    171171
    172  
    173   // Create a new biomaterial list with the selected biosources as members
    174   extracts.newBioMaterialListOnClick = function()
    175   {
    176     var controller = Items.getController('BIOMATERIALLIST');
    177     Table.submitToPopup('extracts', 'CreateBioMaterialList', controller.width, controller.height);
     172  // Create a new item list with the selected items as members
     173  extracts.newItemListOnClick = function()
     174  {
     175    var controller = Items.getController('ITEMLIST');
     176    Table.submitToPopup('extracts', 'CreateItemList', controller.width, controller.height);
    178177  }
    179178 
  • trunk/www/biomaterials/extracts/index.jsp

    r6695 r6756  
    502502    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin";
    503503  }
    504   else if ("CreateBioMaterialList".equals(cmd))
     504  else if ("CreateItemList".equals(cmd))
    505505  {
    506506    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     
    510510    dc.close();
    511511    cc.setQuery(query);
    512     redirect = "../lists/index.jsp?ID="+ID+"&cmd=NewItem&addBioMaterials=1&formId=extracts&fromContext=EXTRACT";
     512    redirect = "../../views/itemlists/index.jsp?ID="+ID+"&cmd=NewItem&addItems=1&memberType=EXTRACT&formId=extracts";
    513513  }
    514514  else if ("PlaceOnPlate".equals(cmd))
  • trunk/www/biomaterials/extracts/list_extracts.jsp

    r6721 r6756  
    434434      />     
    435435      <tbl:columndef
    436         id="bioMaterialList"
    437         property="@bioMaterialLists"
     436        id="itemList"
     437        property="§itemLists"
    438438        datatype="int"
    439         title="Biomaterial list"
    440         filterable="true"
    441         enumeration="<%=Base.getBioMaterialListsEnum(dc, itemType, cc.getInclude())%>"
     439        title="Item list"
     440        filterable="true"
     441        enumeration="<%=Base.getItemListsEnum(dc, itemType, cc.getInclude())%>"
    442442        multiple="false"
    443443      />
     
    549549        />
    550550        <tbl:button
    551           id="btnNewBioMaterialList"
     551          id="btnNewItemList"
    552552          image="add.png"
    553           title="New biomaterial list&hellip;"
    554           tooltip="Create a new biomaterial list from matching extracts"
    555           visible="<%=sc.hasPermission(Permission.CREATE, Item.BIOMATERIALLIST)%>"
     553          title="New item list&hellip;"
     554          tooltip="Create a new item list from matching extracts"
     555          visible="<%=sc.hasPermission(Permission.CREATE, Item.ITEMLIST)%>"
    556556        />
    557557        <tbl:button
  • trunk/www/biomaterials/samples/index.jsp

    r6750 r6756  
    477477    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin";
    478478  }
    479   else if ("CreateBioMaterialList".equals(cmd))
    480   {
    481     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    482     final ItemQuery<Sample> query = Sample.getQuery();
    483     dc = sc.newDbControl();
    484     cc.configureQuery(dc, query, true);
    485     dc.close();
    486     cc.setQuery(query);
    487     redirect = "../lists/index.jsp?ID="+ID+"&cmd=NewItem&addBioMaterials=1&formId=samples&fromContext=SAMPLE";
    488   }
    489479  else if ("CreateItemList".equals(cmd))
    490480  {
  • trunk/www/biomaterials/samples/list_samples.jsp

    r6750 r6756  
    406406      />     
    407407      <tbl:columndef
    408         id="bioMaterialList"
    409         property="@bioMaterialLists"
    410         datatype="int"
    411         title="Biomaterial list"
    412         filterable="true"
    413         enumeration="<%=Base.getBioMaterialListsEnum(dc, itemType, cc.getInclude())%>"
    414         multiple="false"
    415       />
    416       <tbl:columndef
    417408        id="itemList"
    418409        property="§itemLists"
     
    522513            title="Columns&hellip;"
    523514            tooltip="Show, hide and re-order columns"
    524           />
    525           <tbl:button
    526             id="btnNewBioMaterialList"
    527             image="add.png"
    528             title="New biomaterial list&hellip;"
    529             tooltip="Create a new biomaterial list from matching samples"
    530             visible="<%=sc.hasPermission(Permission.CREATE, Item.BIOMATERIALLIST)%>"
    531515          />
    532516          <tbl:button
  • trunk/www/biomaterials/samples/samples.js

    r6750 r6756  
    113113      Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes);
    114114      Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes);
    115       Buttons.addClickHandler('btnNewBioMaterialList', samples.newBioMaterialListOnClick);
    116115      Buttons.addClickHandler('btnNewItemList', samples.newItemListOnClick);
    117116      Buttons.addClickHandler('btnPlaceOnPlate', samples.placeOnPlateOnClick);
     
    154153  }
    155154
    156  
    157   // Create a new biomaterial list with the selected biosources as members
    158   samples.newBioMaterialListOnClick = function()
    159   {
    160     var controller = Items.getController('BIOMATERIALLIST');
    161     Table.submitToPopup('samples', 'CreateBioMaterialList', controller.width, controller.height);
    162   }
    163  
    164   // Create a new biomaterial list with the selected biosources as members
     155  // Create a new item list with the selected items as members
    165156  samples.newItemListOnClick = function()
    166157  {
  • trunk/www/views/itemlists/members/list_members.jsp

    r6755 r6756  
    9797<%
    9898final int listId = Values.getInt(request.getParameter("list_id"));
    99 final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, Item.BIOMATERIALLIST);
     99final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, Item.ITEMLIST);
    100100final String ID = sc.getId();
    101101final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
Note: See TracChangeset for help on using the changeset viewer.