Changeset 6990


Ignore:
Timestamp:
Nov 2, 2015, 9:13:34 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1958: Add Kit item

Added Kit item in the core layer and links to it from the BioMaterialEvent and BioPlateEvent classes.

Added TestKit for testing the kit item.

Location:
trunk/src
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r6937 r6990  
    876876      A Hibernate query that gets raw bioassays
    877877      using a protocol.
     878    </description>
     879  </query>
     880
     881  <query id="GET_BIOMATERIALEVENTS_FOR_KIT" type="HQL">
     882    <sql>
     883      SELECT {1}
     884      FROM BioMaterialEventData bme
     885      WHERE bme.kit = :kit
     886    </sql>
     887    <description>
     888      A Hibernate query that gets biomaterial
     889      events using a kit.
     890    </description>
     891  </query>
     892
     893  <query id="GET_BIOPLATEEVENTS_FOR_KIT" type="HQL">
     894    <sql>
     895      SELECT {1}
     896      FROM BioPlateEventData bpe
     897      WHERE bpe.kit = :kit
     898    </sql>
     899    <description>
     900      A Hibernate query that gets bioplate events
     901      events using a kit.
    878902    </description>
    879903  </query>
  • trunk/src/core/net/sf/basedb/core/BioMaterialEvent.java

    r6875 r6990  
    568568    hardwareHasBeenSet = true;
    569569    getData().setHardware(hardware == null ? null : hardware.getData());
     570  }
     571
     572  /**
     573    Get the {@link Kit} that was used in this event.
     574    @return A <code>Kit</code> item, or null if not known
     575    @throws PermissionDeniedException If the logged in user doesn't have
     576      read permission to the kit
     577    @throws BaseException If there is another error
     578    @since 3.7
     579  */
     580  public Kit getKit()
     581    throws PermissionDeniedException, BaseException
     582  {
     583    return getDbControl().getItem(Kit.class, getData().getKit());
     584  }
     585 
     586  /**
     587    Set the {@link Kit} that was used in this event.
     588    @param kit A <code>Kit</code> item, or null if not known
     589    @throws PermissionDeniedException If the logged in user doesn't have
     590      write permission on this event or use permission for the kit
     591    @since 3.7
     592  */
     593  public void setKit(Kit kit)
     594    throws PermissionDeniedException
     595  {
     596    checkPermission(Permission.WRITE);
     597    if (kit != null) kit.checkPermission(Permission.USE);
     598    getData().setKit(kit == null ? null : kit.getData());
    570599  }
    571600
  • trunk/src/core/net/sf/basedb/core/BioPlateEvent.java

    r6874 r6990  
    249249
    250250  /**
     251    Get the {@link Kit} that was used in this event.
     252    @return A <code>Kit</code> item, or null if not known
     253    @throws PermissionDeniedException If the logged in user doesn't have
     254      read permission to the kit
     255    @throws BaseException If there is another error
     256    @since 3.7
     257  */
     258  public Kit getKit()
     259    throws PermissionDeniedException, BaseException
     260  {
     261    return getDbControl().getItem(Kit.class, getData().getKit());
     262  }
     263 
     264  /**
     265    Set the {@link Kit} that was used in this event. The kit
     266    is also updated on all related biomaterial events (when the
     267    transaction is committed).
     268   
     269    @param kit A <code>Kit</code> item, or null if not known
     270    @throws PermissionDeniedException If the logged in user doesn't have
     271      write permission on this event or use permission for the kit
     272    @since 3.7
     273  */
     274  public void setKit(Kit kit)
     275    throws PermissionDeniedException
     276  {
     277    checkPermission(Permission.WRITE);
     278    if (kit != null) kit.checkPermission(Permission.USE);
     279    getData().setKit(kit == null ? null : kit.getData());
     280    needSynchronize = true;
     281  }
     282 
     283
     284  /**
    251285    Get the date this event was done in the lab.
    252286    @return A <code>Date</code> object, or null if not known
     
    447481    event.setProtocol(data.getProtocol());
    448482    event.setHardware(data.getHardware());
     483    event.setKit(data.getKit());
    449484  }
    450485 
  • trunk/src/core/net/sf/basedb/core/Install.java

    r6989 r6990  
    338338      createRoleKey(Item.HARDWARE, "Hardware", "Gives access to hardware", power_users_create);
    339339      createRoleKey(Item.SOFTWARE, "Software", "Gives access to software", power_users_create);
    340      
     340      createRoleKey(Item.KIT, "Kit", "Gives access to kits", power_users_create);
     341
    341342      // Platforms, platform variants, platform file types
    342343      createRoleKey(Item.PLATFORM, "Platforms", "Gives access to platforms", guests_use_administrators_all);
  • trunk/src/core/net/sf/basedb/core/Item.java

    r6957 r6990  
    202202    720),
    203203
     204  /**
     205    The item is a {@link Kit}.
     206    @since 3.7
     207  */
     208  KIT(125, "Kit", "kt", Kit.class, KitData.class, DefinedPermissions.shareable,
     209    730),
     210
     211 
    204212  /**
    205213    The item is a {@link News}.
  • trunk/src/test/TestAll.java

    r6755 r6990  
    7171    results.put("TestSoftware", TestSoftware.test_all());
    7272    results.put("TestProtocol", TestProtocol.test_all());
     73    results.put("TestKit", TestKit.test_all());
    7374
    7475    // File parsing
Note: See TracChangeset for help on using the changeset viewer.