Class DocumentAnnotationPermission
- All Implemented Interfaces:
Permission<Document>
,Serializable
Attention: this class is a web technology adaption of the jadice document platform version. The
original can be found in DocumentAnnotationPermission
When using the jadice web toolkit, it is expected to use this implementation on the client at all
times.
The default behavior is the following: on the server side, document platform permissions are
automatically transformed into a json object when sending data to the client. On the
opposite way, i.e. sending a message from client side to be later prcessed by a MessageListener
,
the json-serialized permissions are transformed again into corresponding document platform
versions.
An annotation permission object to be used to define per document annotation permissions. This
class contains several predefined permissions which can be used to generate a suitable permission
set. As an example take a look at the following code. Assume you would like to define a
permission that the removal of annotations within a document should be denied.
At -1-
you can use this class to get a predefined annotation permission. For a deny
permission use the static constant DENY
, otherwise use ALLOW
. Then use
one of the predefined permissions, in this case the REMOVE_ANNOTATION
permission.
At -2-
you see an example of how to apply the permission to a single
Document
instance. Doing so denies the removal of any annotation from this
Document
; other Documents
are not touched by this permission.
// -1-
final
DocumentAnnotationPermission<Object> re = DocumentAnnotationPermission.
DENY.REMOVE;
// -2-
final
Document document = ...;
document.getPermissions().getPermissions().add(re);
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.levigo.jadice.document.Permission
Permission.Vote
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DocumentAnnotationPermission.Factory
static final DocumentAnnotationPermission.Factory
Fields inherited from interface com.levigo.jadice.document.Permission
DENY_ALL, GRANT_ALL
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentAnnotationPermission
(Class<? extends Intent> intentClass, Permission.Vote vote) -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
boolean
pertainsTo
(Class<? extends Intent> intentClass) Return whether this permission pertains to the given action.toString()
Make a permission decision about the given intended action on the given domain object.
-
Field Details
-
ALLOW
-
DENY
-
-
Constructor Details
-
DocumentAnnotationPermission
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
pertainsTo
Description copied from interface:Permission
Return whether this permission pertains to the given action. If this method returnstrue
, this permission will be asked to make decisions about actions if the given class. Note to implementors: thePermission.vote(Object, Intent)
method is guaranteed to never be called for actions of classes for which this method has returned false. You may therefore skipinstanceof
checks in thePermission.vote(Object, Intent)
method, if you do them here.- Specified by:
pertainsTo
in interfacePermission<Document>
- Parameters:
intentClass
-- Returns:
true
if this method pertains to actions of the given class,false
otherwise
-
vote
Description copied from interface:Permission
Make a permission decision about the given intended action on the given domain object.- Specified by:
vote
in interfacePermission<Document>
- Parameters:
intent
-- Returns:
- the decision
-
toString
-