Changeset 6751


Ignore:
Timestamp:
Feb 20, 2015, 10:39:00 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

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

Added item list -> itemsubtype/rawdatatype link which is intended to be used as a recommendation for the types of items to be members of the list. The raw data type is used for raw bioassay lists and the item subtype for other lists.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/ItemList.java

    r6738 r6751  
    317317 
    318318  /**
     319    Get the subtype of items that can be members in this list. This is
     320    a recommendation only and is not enforced.
     321    @return A subtype or null if not important
     322  */
     323  public ItemSubtype getItemSubtype()
     324  {
     325    return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype());
     326  }
     327 
     328  /**
     329    Set the subtype of items that can be members in this list. The
     330    subtype must have the same member type as this list.
     331    @param subtype A subtype or null if the subtype is not important
     332  */
     333  public void setItemSubtype(ItemSubtype subtype)
     334  {
     335    checkPermission(Permission.WRITE);
     336    if (subtype == null)
     337    {
     338      getData().setItemSubtype(null);
     339    }
     340    else
     341    {
     342      checkMemberType(subtype.getMainItemType());
     343      subtype.checkPermission(Permission.USE);
     344      getData().setItemSubtype(subtype.getData());
     345    }
     346  }
     347 
     348  /**
     349    Get the raw data type of raw bioassays that can be members in this list.
     350    This is a recommendation only and is not enforced.
     351      @return A {@link RawDataType} object
     352  */
     353  public RawDataType getRawDataType()
     354  {
     355    return RawDataTypes.getRawDataType(getData().getRawDataType());   
     356  }
     357 
     358  /**
     359    Set the raw data type of raw bioassays that can be members in this list.
     360    This is a recommendation only and is not enforced. The member
     361    type must be set to {@link Item#RAWBIOASSAY}
     362     
     363      @param rawDataType the {@link RawDataType} to use as default.
     364  */
     365  public void setRawDataType(RawDataType rawDataType)
     366  {
     367    checkPermission(Permission.WRITE);
     368    checkMemberType(Item.RAWBIOASSAY);
     369    getData().setRawDataType(rawDataType == null ? null : rawDataType.getId());
     370  }
     371 
     372  /**
    319373    Add an item to this list.
    320374   
  • trunk/src/core/net/sf/basedb/core/data/ItemListData.java

    r6738 r6751  
    7878  }
    7979 
     80  private ItemSubtypeData subtype;
     81  /**
     82    Get the subtype of items that can be members in this list. This is
     83    a recommendation only and is not enforced.
     84    @hibernate.many-to-one column="`subtype_id`" not-null="false" outer-join="false"
     85  */
     86  public ItemSubtypeData getItemSubtype()
     87  {
     88    return subtype;
     89  }
     90  public void setItemSubtype(ItemSubtypeData subtype)
     91  {
     92    this.subtype = subtype;
     93  }
     94
     95  private String rawDataType;
     96  /**
     97    Get the raw data type of raw bioassays that can be members in this list.
     98    This is a recommendation only and is not enforced.
     99    @hibernate.property column="`rawdatatype`" type="string" length="255" not-null="false"
     100  */
     101  public String getRawDataType()
     102  {
     103    return rawDataType;
     104  }
     105  public void setRawDataType(String rawDataType)
     106  {
     107    this.rawDataType = rawDataType;
     108  }
     109
     110 
    80111  private int size;
    81112  /**
Note: See TracChangeset for help on using the changeset viewer.