public class UserNotePropertyAccessor extends StringPropertyAccessor<Note,UserNoteProperty>
PropertyManagement
Modifier | Constructor and Description |
---|---|
protected |
UserNotePropertyAccessor(EventDispatcher eventDispatcher)
Don't construct it from the outside packages.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertReadAccess(Note note)
Checks, that the current user is allowed to read the topic the note is in.
|
protected void |
assertWriteAccess(Note note)
Method to assert, that the current user has write access to the given object.
|
protected Long |
getObjectId(Note object) |
PropertyType |
getPropertyType() |
<T> Collection<T> |
getUsersOfProperty(Long noteId,
String keyGroup,
String key,
String value,
Converter<User,T> converter)
Return the users that a given property for a note.
|
protected UserNoteProperty |
handleCreateNewProperty(Note note)
Create a new property and associate it with the object
|
protected Set<StringPropertyTO> |
handleGetAllObjectProperties(Note note)
Get all properties of the object.
|
protected UserNoteProperty |
handleGetObjectPropertyUnfiltered(Note note,
String keyGroup,
String propertyKey)
Get an object property for the given group and key
|
protected void |
handleRemoveObjectProperty(Note note,
String keyGroup,
String key)
Removes the property of an object
|
boolean |
hasProperty(Long noteId,
String keyGroup,
String key,
String value)
Test whether the current user has a given property for a note
|
protected Note |
load(Long id) |
protected void |
setPropertyValue(UserNoteProperty property,
String value) |
getAllObjectProperties, setObjectProperties
addToFilterDefinition, assertLoadObject, assertValidForCreateAndUpdate, getFilterDefintion, getGlobalObjectProperty, getObjectProperty, getObjectPropertyUnfiltered, handleSetObjectProperty, handleSetObjectPropertyUnfiltered, removeFromFilterDefinition, removeObjectProperty, setGlobalObjectProperty, setObjectProperty, setObjectPropertyUnfiltered
protected UserNotePropertyAccessor(EventDispatcher eventDispatcher)
eventDispatcher
- the event dispatcher to use for firing eventsprotected void assertReadAccess(Note note) throws AuthorizationException
assertReadAccess
in class PropertyAccessor<Note,UserNoteProperty,String>
note
- The object.AuthorizationException
- Thrown, when the read access to the object was denied.protected void assertWriteAccess(Note note) throws AuthorizationException
Does it by calling assertReadAccess(Note)
.
assertWriteAccess
in class PropertyAccessor<Note,UserNoteProperty,String>
note
- The object to assert write access for.AuthorizationException
- Thrown, when the current user is not allowed to write to the given object.protected Long getObjectId(Note object)
getObjectId
in class PropertyAccessor<Note,UserNoteProperty,String>
object
- the object the property is / will be assigned topublic PropertyType getPropertyType()
getPropertyType
in class PropertyAccessor<Note,UserNoteProperty,String>
public <T> Collection<T> getUsersOfProperty(Long noteId, String keyGroup, String key, String value, Converter<User,T> converter) throws NotFoundException, AuthorizationException
T
- the target type of the conversionnoteId
- the ID of the note for which the users that have the property should be returnedkeyGroup
- the group key of the searched propertykey
- the group of the searched propertyvalue
- the value of the searched propertyconverter
- the converter to convert the found usersNotFoundException
- in case the note does not existAuthorizationException
- in case the current user is not allowed to read the propertyprotected UserNoteProperty handleCreateNewProperty(Note note)
handleCreateNewProperty
in class PropertyAccessor<Note,UserNoteProperty,String>
note
- the object to add a new property toprotected Set<StringPropertyTO> handleGetAllObjectProperties(Note note) throws AuthorizationException
StringPropertyAccessor
handleGetAllObjectProperties
in class StringPropertyAccessor<Note,UserNoteProperty>
note
- the objectAuthorizationException
- in case the user is not allowed to access the properties of the objectprotected UserNoteProperty handleGetObjectPropertyUnfiltered(Note note, String keyGroup, String propertyKey) throws AuthorizationException
PropertyAccessor
handleGetObjectPropertyUnfiltered
in class PropertyAccessor<Note,UserNoteProperty,String>
note
- the object to get the property ofkeyGroup
- the key group of the property to getpropertyKey
- the key of the propert no such property existsAuthorizationException
- Thrown, when the user is not allowed to access the property.protected void handleRemoveObjectProperty(Note note, String keyGroup, String key) throws AuthorizationException
PropertyAccessor
handleRemoveObjectProperty
in class PropertyAccessor<Note,UserNoteProperty,String>
note
- object to get the property ofkeyGroup
- the key group of the property to getkey
- the key of the propertyAuthorizationException
- Thrown, when the user is not allowed to access.public boolean hasProperty(Long noteId, String keyGroup, String key, String value) throws NotFoundException, AuthorizationException
noteId
- the ID of the note for which the existence of the property should be checkedkeyGroup
- the group key of the searched propertykey
- the group of the searched propertyvalue
- the value of the searched propertyAuthorizationException
- in case the current user is not allowed to read the propertyNotFoundException
- in case the note does not existprotected Note load(Long id)
load
in class PropertyAccessor<Note,UserNoteProperty,String>
id
- the id of the objectprotected void setPropertyValue(UserNoteProperty property, String value)
setPropertyValue
in class StringPropertyAccessor<Note,UserNoteProperty>
property
- The property.value
- The value.Copyright © 2019 Communote team. All rights reserved.