Changeset 2479


Ignore:
Timestamp:
Aug 2, 2006, 9:40:05 AM (17 years ago)
Author:
Martin Svensson
Message:

References #173 Made it possible to attach a Hardware item to BiomaterialEvent?- and PlateEvent? items

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

Legend:

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

    r2382 r2479  
    379379    getData().setProtocol(protocol == null ? null : protocol.getData());
    380380  }
     381 
     382  /**
     383    Get the {@link Hardware} that was used in this event.
     384    @return A <code>Hardware</code> item, or null if not known
     385    @throws PermissionDeniedException If the logged in user doesn't have
     386      read permission to the hardware
     387    @throws BaseException If there is another error
     388  */
     389  public Hardware getHardware()
     390    throws PermissionDeniedException, BaseException
     391  {
     392    return getDbControl().getItem(Hardware.class, getData().getHardware());
     393  }
     394 
     395  /**
     396    Get the {@link Hardware} that was used in this event.
     397    @param hardware A <code>Hardware</code> item, or null if not
     398    @throws PermissionDeniedException If the logged in user doesn't have
     399      write permission on this event or use permission for the hardware
     400  */
     401  public void setHardware(Hardware hardware)
     402    throws PermissionDeniedException
     403  {
     404    checkPermission(Permission.WRITE);
     405    if (hardware != null) hardware.checkPermission(Permission.USE);
     406    getData().setHardware(hardware == null ? null : hardware.getData());
     407  }
    381408
    382409  /**
  • trunk/src/core/net/sf/basedb/core/PlateEvent.java

    r2382 r2479  
    249249    getData().setProtocol(protocol == null ? null : protocol.getData());
    250250  }
     251 
     252  /**
     253    Get the {@link Hardware} that was used in this event.
     254    @return A <code>Hardware</code>item or null of not known
     255      @throws PermissionDeniedException If the logged in user doesn't have
     256        read permission to the hardware.   
     257      @throws BaseException If there is another error.
     258  */
     259  public Hardware getHardware()
     260    throws PermissionDeniedException, BaseException
     261  {
     262    return getDbControl().getItem(Hardware.class, getData().getHardware());
     263  }
     264 
     265  /**
     266    Set the {@link Hardware} that was used in this event.
     267    @param hardware A <code>Hardware</code> item or null if not known.
     268    @throws PermissionDeniedException If the logged in user doesn't have
     269      write on this event or use permission for the hardware.
     270  */
     271  public void setHardware(Hardware hardware)
     272    throws PermissionDeniedException
     273  {
     274    checkPermission(Permission.WRITE);
     275    if (hardware != null) hardware.checkPermission(Permission.USE);
     276    getData().setHardware(hardware == null ? null : hardware.getData());
     277  }
    251278
    252279  /**
  • trunk/src/core/net/sf/basedb/core/data/BioMaterialEventData.java

    r2304 r2479  
    132132  }
    133133
     134  private HardwareData hardware;
     135  /**
     136    Get the hardware used in this event
     137    @hibernate.many-to-one column="`hardware_id`" not-null="false" outer-join="false"
     138  */
     139  public HardwareData getHardware()
     140  {
     141    return this.hardware;
     142  }
     143  public void setHardware(HardwareData hardware)
     144  {
     145    this.hardware = hardware;
     146  }
     147 
    134148  private Date entryDate;
    135149  /**
  • trunk/src/core/net/sf/basedb/core/data/PlateEventData.java

    r2304 r2479  
    130130    this.eventDate = eventDate;
    131131  }
     132 
     133  private HardwareData hardware;
     134  /**
     135    Get the hardware used in this event.
     136    @hibernate.many-to-one column="`hardware_id`" not-null="false" outer-join="false"
     137  */
     138  public HardwareData getHardware()
     139  {
     140    return this.hardware;
     141  }
     142  public void setHardware(HardwareData hardware)
     143  {
     144    this.hardware = hardware;
     145  }
    132146
    133147  /**
Note: See TracChangeset for help on using the changeset viewer.