|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.BasicItem<D> net.sf.basedb.core.OwnedItem<D>
public abstract class OwnedItem<D extends OwnedData>
This class inherits from the BasicItem
class and implements the Ownable
interface.
An Ownable
item is an item that has a
User
as its owner.
Ownable
Constructor Summary | |
---|---|
OwnedItem(D ownedData)
|
Method Summary | |
---|---|
User |
getOwner()
Get the User that is the owner of the item. |
(package private) void |
initPermissions(int granted,
int denied)
If the logged in user is the owner of this item, DELETE, SET_OWNER and SET_PERMISSION permission is granted. |
boolean |
isOwner()
Check if the logged in user is the owner of this item or not. |
(package private) void |
onBeforeCommit(Transactional.Action action)
Overrides the BasicItem.onBeforeCommit(Transactional.Action)
method. |
void |
setOwner(User owner)
Change the owner of the item. |
void |
takeOwnership()
Take ownership of the item. |
(package private) OwnedItemInfo |
toTransferable(OwnedItemInfo info)
|
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.Identifiable |
---|
getId, getType, getVersion |
Methods inherited from interface net.sf.basedb.core.AccessControlled |
---|
checkPermission, getPermissions, hasPermission |
Constructor Detail |
---|
OwnedItem(D ownedData)
Method Detail |
---|
public User getOwner() throws PermissionDeniedException, BaseException
Ownable
User
that is the owner of the item.
getOwner
in interface Ownable
PermissionDeniedException
- If the logged in user doesn't
have read permission to the owner
BaseException
- If there is another errorpublic void setOwner(User owner) throws PermissionDeniedException, InvalidDataException
Ownable
setOwner
in interface Ownable
owner
- The new owner of the item
PermissionDeniedException
- If the logged in user doesn't
have permission to change the owner on the item
InvalidDataException
- If the owner is nullOwnable.takeOwnership()
public void takeOwnership() throws PermissionDeniedException
Ownable
takeOwnership
in interface Ownable
PermissionDeniedException
- If the logged in user doesn't have
permission to take ownershippublic boolean isOwner()
Ownable
isOwner
in interface Ownable
void onBeforeCommit(Transactional.Action action) throws NotLoggedInException, BaseException
BasicItem.onBeforeCommit(Transactional.Action)
method. It sets the owner of the new item to the logged in user, unless
it has already been specified.
onBeforeCommit
in class BasicItem<D extends OwnedData>
NotLoggedInException
- If no user is logged in
BaseException
- If there is another errorTransactional
,
Core API overview - Transaction handling,
Coding rules and guidelines for item classesvoid initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem<D extends OwnedData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedOwnedItemInfo toTransferable(OwnedItemInfo info)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |