Hi,
I’m looking for a generic approach to working with draft (or concept) entities. Such entities would be visible only within a certain context, e.g. a ‘draft table’ or alike. In the remainder of the system, such entities should not be shown.
So far I’m considering to using a concept field (to indicate whether an entity is a concept entity or not) and applying a constraint to keep concept entities from showing up within the system.
On the entity (preferably using an interface etc.):
@Column(name = "CONCEPT")
private Boolean concept = false; // This is the default
public Boolean getConcept() {
return concept != null && concept;
}
public void setConcept(Boolean concept) {
this.concept = concept;
}
With a constraint on the root group:
{E}.concept = true
This would be very convenient both in terms of the effort and reliability except that it doesn’t allow to have a screen / location that does show these entities in a ‘draft table’ as they are filtered out at all times. There is no way to bypass a constraint (for the same user / session) at some locations, is there?
Another option would be to - again - use a concept field and adapt each and every query on them to exclude the concept entities except for the ‘draft table’. This is a lot of work and may lead to errors in future developments.
Do you have any suggestions on how to approach something like this?
Any help appreciated.
Regards,
-b