Opened 6 years ago

#2014 new task

Implement extension point for item initialization

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE Future Release
Component: core Version:
Keywords: Cc:


When creating new items, the BASE core API initializes some properties in different stages. Typically a name and maybe some other properties are set when the getNew() method is called. Other properties are set just before the item is saved to the database when calling DbControl.commit(). For example:

  • Project default settings such as protocols and software
  • Owner of the item
  • Sharing the item to the active project

Typically the above properties are only set if the client application has not already explicitly set them to something else (including null).

We should implement an extensions point that allows extensions to hook into item creation and set default properties for other scenarios. There are some alternative to where this hook should be:

  • In the getNew() method. This might not be the best place since the extensions can't make decisions based on other properties (for example, do X when a sample is of type A and Y when the sample is of type B).
  • When calling DbControl.saveItem(). Typically most properties are set when this method is called, but client application may make changes after calling this method so the drawbacks are more or less the same as above.
  • When calling DbControl.commit() but before the other default properties are set.
  • When calling DbControl.commit() but after the other default properties are set.

Change History (0)

Note: See TracTickets for help on using tickets.