Add assert to check that a limiting or virtual resource is not bound to any user
This commit is contained in:
parent
11b11a485d
commit
8706e7b421
1 changed files with 16 additions and 0 deletions
|
|
@ -239,4 +239,20 @@ public class Worker extends Resource {
|
|||
return getId().equals(worker.getId());
|
||||
}
|
||||
|
||||
@AssertTrue(message = "Limiting resources cannot be bound to any user")
|
||||
public boolean checkLimitingResourceNotBoundToUser() {
|
||||
if (isLimitingResource()) {
|
||||
return user == null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "Virtual resources cannot be bound to any user")
|
||||
public boolean checkVirtualResourceNotBoundToUser() {
|
||||
if (isVirtual()) {
|
||||
return user == null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue