Class ExplorerResourcesDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.explorer.resources.actions.ExplorerResourcesDAO
-
- All Implemented Interfaces:
LogEnabled,Component,Contextualizable,Serviceable
- Direct Known Subclasses:
ExplorerResourcesDAO,WorkspaceExplorerResourceDAO
public class ExplorerResourcesDAO extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Explorer resources DAO
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classExplorerResourcesDAO.VersionInformationBean for version information
-
Field Summary
Fields Modifier and Type Field Description protected Context_cocoonContextThe cocoon contextprotected Context_contextThe avalon contextprotected CurrentUserProvider_currentUserProviderThe current user provider.protected I18nUtils_i18nUtilsI18n utilsprotected ResourceMetadataPopulatorExtensionPoint_metadataPopulatorEPThe metadata populator extension point.protected ObservationManager_observationManagerObserver manager.protected AmetysObjectResolver_resolverAmetys resolverprotected RightManager_rightManagerThe rights managerprotected ThreadDAO_threadDAOThe thread DAOprotected TikaProvider_tikaProviderThe tika provider.protected UserHelper_userHelperThe users managerstatic StringRIGHTS_COLLECTION_ADDRight id to add a folderstatic StringRIGHTS_COLLECTION_CMIS_ADDRight id to add CMIS collectionstatic StringRIGHTS_COLLECTION_DELETERight id to delete a folderstatic StringRIGHTS_COLLECTION_EDITRight id to edit a folderstatic StringRIGHTS_RESOURCE_ADDRight id to add a resourcestatic StringRIGHTS_RESOURCE_COMMENTRight id to comment a resourcestatic StringRIGHTS_RESOURCE_DELETERight id to delete a resourcestatic StringRIGHTS_RESOURCE_EDIT_DCRight id to edit DC metadata of a resourcestatic StringRIGHTS_RESOURCE_MODERATE_COMMENTRight id to moderate comment a resourcestatic StringRIGHTS_RESOURCE_RENAMERight id to rename a resourcestatic StringRIGHTS_RESOURCE_UNLOCK_ALLRight id to unlock all resourcesstatic StringROLEAvalon Role
-
Constructor Summary
Constructors Constructor Description ExplorerResourcesDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_canAddComment(UserIdentity user, CommentableResource resource)Indicates if an user can add a comment of a given resourceprotected boolean_canDeleteComment(UserIdentity user, CommentableResource resource, JCRPost comment)Indicates if an user can delete a comment of a given resourceprotected boolean_canEditComment(UserIdentity user, CommentableResource resource, JCRPost comment)Indicates if an user can edit a comment of a given resourceprotected Map<String,Object>_comment2json(JCRPost comment, boolean isEdition)Get JSOn representation of a commentprotected String_getComment(JCRPost post)Get the content of a comment as a Stringprotected String_getCommentForEditing(JCRPost post)Get the content of a comment to edit as a Stringprotected void_setComment(JCRPost comment, String content)Update the content of a commentprotected Map<String,Object>_version2json(JCRResource resource, ExplorerResourcesDAO.VersionInformation versionInformation)Get the JSON representation of a version of a resourceMap<String,Object>addCMISCollection(String parentId, String originalName, String url, String login, String password, String repoId, boolean renameIfExists)Creates a new CMIS folder (seeCMISRootResourcesCollection)Map<String,Object>addComment(String resourceId, String comment)Add a comment to a resourceMap<String,Object>addResourceCollection(String parentId, String desiredName, Boolean renameIfExists)Add a resource collectionResourceCollectionaddResourceCollection(ModifiableResourceCollection parent, String desiredName, Boolean renameIfExists, List<String> errors)Add a resource collectionbooleancheckLock(AmetysObject ao)Check lock on a Ametys objectvoidcheckpoint(ModifiableResource resource)Creates a new versionvoidcheckUserRight(AmetysObject object, String rightId)Check the user privilege on objectvoidcontextualize(Context context)Map<String,Object>copyResource(List<String> ids, String target)Copy file resourcesMap<String,Object>copyResource(List<String> ids, ModifiableResourceCollection target)Copy file resourcesModifiableResourcecreateResource(ModifiableResourceCollection collection, String name)Creates aModifiableResourceunder currentModifiableResourceCollection.Map<String,Object>deleteComment(String resourceId, String commentId)Delete the comment of a resourceMap<String,Object>deleteObject(List<String> ids)Delete an objectStringdeleteObject(RemovableAmetysObject object, List<String> errors)Delete an objectMap<String,Object>editCMISCollection(String id, String url, String login, String password, String repoId)Edits a CMIS folder (seeCMISRootResourcesCollection)Map<String,Object>editComment(String resourceId, String commentId, String comment)Edit the comment of a resourcevoidextractResourceMetadata(ModifiableResource resource, String mimeType)Extract the resource's metadata and populate the object accordingly.List<String>filterResourcesByRegExp(String id, String value, List<String> allowedExtensions)Get the path of pages which match filter regexpMap<String,String>getCMISProperties(String id)Get the CMIS properties of collectionMap<String,Object>getComment(String commentId, boolean isEdition)Get a comment of a resourceList<Map<String,Object>>getComments(String resourceId, boolean isEdition)Get the comments of a resourceMap<String,Object>getDCMetadata(String id)Get the DublinCore metadata of aDublinCoreAwareAmetysObjectMap<String,Object>getDefaultInfoAsRootNode(String id)Get the necessary default info for a root node.Map<String,Object>getDefaultInfoAsRootNode(ExplorerNode rootNode)Get the necessary default info for a root node.Map<String,Object>getExplorerNodeProperties(ExplorerNode node)Get the explorer node propertiesMap<String,Object>getNodesInfo(List<String> ids)Get the informations on given nodes (resources or collections)StringgetResourceCollectionType()Get the type of child resource collectionMap<String,Object>getResourceProperties(Resource resource)Get the resource propertiesList<ExplorerNode>getResourcesRootNodes()Get the root nodes for resourcesList<Map<String,Object>>getRootNodesInfo()Retrieves the set of standard data for the explorer root nodebooleangetUserRight(UserIdentity user, String right, AmetysObject object)Retrieve the rights for the userprotected Set<String>getUserRights(ExplorerNode node)Get the user rights on the resource collectionbooleanhasRight(String id, String rightId)Check current user right on given explorer nodebooleanisCMISCollection(String id)Determines if a object is aCMISRootResourcesCollectionMap<String,Object>moveObject(List<String> ids, String targetId)Move objectsMap<String,Object>moveObject(List<String> ids, JCRTraversableAmetysObject targetNode)Move objectsMap<String,Object>renameObject(String id, String name)Rename a resource, or resource collectionJCRAmetysObjectrenameObject(JCRAmetysObject object, String name, List<String> errors)Rename a resource, or resource collectionMap<String,Object>renameResource(String id, String name)Rename a resourceJCRResourcerenameResource(JCRResource resource, String name, List<String> errors)Rename a resourcebooleanresourceExists(String parentId, String name)Determines if a resource with given name already existsbooleanresourceExists(TraversableAmetysObject parent, String name)Determines if a resource with given name already existsList<Map<String,Object>>resourceHistory(String id)Get the history versions of a resourcevoidrestoreResource(String id, String versionName)This action restores an old version of aResource.voidservice(ServiceManager manager)voidsetDCMetadata(String resourceId, Map<String,Object> values)Set the Dublin Core metadata of aResource.voidsetDCMetadata(ModifiableResource resource, Map<String,Object> values)Set the Dublin Core metadata of aResource.voidupdateResource(ModifiableResource resource, InputStream is, String fileName)Updates resource input stream and metadata-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
RIGHTS_RESOURCE_UNLOCK_ALL
public static final String RIGHTS_RESOURCE_UNLOCK_ALL
Right id to unlock all resources- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_ADD
public static final String RIGHTS_RESOURCE_ADD
Right id to add a resource- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_RENAME
public static final String RIGHTS_RESOURCE_RENAME
Right id to rename a resource- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_DELETE
public static final String RIGHTS_RESOURCE_DELETE
Right id to delete a resource- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_EDIT_DC
public static final String RIGHTS_RESOURCE_EDIT_DC
Right id to edit DC metadata of a resource- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_COMMENT
public static final String RIGHTS_RESOURCE_COMMENT
Right id to comment a resource- See Also:
- Constant Field Values
-
RIGHTS_RESOURCE_MODERATE_COMMENT
public static final String RIGHTS_RESOURCE_MODERATE_COMMENT
Right id to moderate comment a resource- See Also:
- Constant Field Values
-
RIGHTS_COLLECTION_CMIS_ADD
public static final String RIGHTS_COLLECTION_CMIS_ADD
Right id to add CMIS collection- See Also:
- Constant Field Values
-
RIGHTS_COLLECTION_ADD
public static final String RIGHTS_COLLECTION_ADD
Right id to add a folder- See Also:
- Constant Field Values
-
RIGHTS_COLLECTION_EDIT
public static final String RIGHTS_COLLECTION_EDIT
Right id to edit a folder- See Also:
- Constant Field Values
-
RIGHTS_COLLECTION_DELETE
public static final String RIGHTS_COLLECTION_DELETE
Right id to delete a folder- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
Ametys resolver
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_observationManager
protected ObservationManager _observationManager
Observer manager.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_i18nUtils
protected I18nUtils _i18nUtils
I18n utils
-
_cocoonContext
protected Context _cocoonContext
The cocoon context
-
_tikaProvider
protected TikaProvider _tikaProvider
The tika provider.
-
_metadataPopulatorEP
protected ResourceMetadataPopulatorExtensionPoint _metadataPopulatorEP
The metadata populator extension point.
-
_userHelper
protected UserHelper _userHelper
The users manager
-
_threadDAO
protected ThreadDAO _threadDAO
The thread DAO
-
-
Constructor Detail
-
ExplorerResourcesDAO
public ExplorerResourcesDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
getResourcesRootNodes
public List<ExplorerNode> getResourcesRootNodes()
Get the root nodes for resources- Returns:
- the root nodes
-
getRootNodesInfo
public List<Map<String,Object>> getRootNodesInfo()
Retrieves the set of standard data for the explorer root node- Returns:
- The data structured in a map
-
getDefaultInfoAsRootNode
public Map<String,Object> getDefaultInfoAsRootNode(String id)
Get the necessary default info for a root node. Can be used to construct a root node for a tree (client side).- Parameters:
id- The root node id- Returns:
- A map which contains a set of default info (such as id, applicationId, path, type etc...)
-
getDefaultInfoAsRootNode
public Map<String,Object> getDefaultInfoAsRootNode(ExplorerNode rootNode)
Get the necessary default info for a root node. Can be used to construct a root node for a tree (client side).- Parameters:
rootNode- The root node- Returns:
- A map which contains a set of default info (such as id, applicationId, path, type etc...)
-
getNodesInfo
public Map<String,Object> getNodesInfo(List<String> ids)
Get the informations on given nodes (resources or collections)- Parameters:
ids- The ids of node- Returns:
- the nodes information
-
getExplorerNodeProperties
public Map<String,Object> getExplorerNodeProperties(ExplorerNode node)
Get the explorer node properties- Parameters:
node- The explorer node- Returns:
- The properties
-
getResourceProperties
public Map<String,Object> getResourceProperties(Resource resource)
Get the resource properties- Parameters:
resource- The resources- Returns:
- The properties
-
filterResourcesByRegExp
public List<String> filterResourcesByRegExp(String id, String value, List<String> allowedExtensions)
Get the path of pages which match filter regexp- Parameters:
id- The id of explorer node to start searchvalue- the value to matchallowedExtensions- The allowed file extensions (lower-case). Can be null or empty to not filter on file extensions- Returns:
- the matching paths
-
getUserRights
protected Set<String> getUserRights(ExplorerNode node)
Get the user rights on the resource collection- Parameters:
node- The explorer node- Returns:
- The user's rights
-
hasRight
public boolean hasRight(String id, String rightId)
Check current user right on given explorer node- Parameters:
id- The id of the explorer noderightId- The if of right to check- Returns:
- true if user has right
-
checkLock
public boolean checkLock(AmetysObject ao)
Check lock on a Ametys object- Parameters:
ao- the Ametys object- Returns:
falseif the Ametys object is locked and can not be edited or deleted
-
checkUserRight
public void checkUserRight(AmetysObject object, String rightId) throws IllegalAccessException
Check the user privilege on object- Parameters:
object- the objectrightId- the right id- Throws:
IllegalAccessException- if the user has no sufficient rights
-
getUserRight
public boolean getUserRight(UserIdentity user, String right, AmetysObject object)
Retrieve the rights for the user- Parameters:
user- The userright- The rightobject- The object- Returns:
- True if the user has the right
-
addResourceCollection
public Map<String,Object> addResourceCollection(String parentId, String desiredName, Boolean renameIfExists)
Add a resource collection- Parameters:
parentId- The identifier of the parent in which the resource collection will be addeddesiredName- The desired name for the resource collectionrenameIfExists- If false, in case of existing name the resource collection will not be created, if true it will be created and renamed- Returns:
- The result map with id, parentId, name and message keys
-
addResourceCollection
public ResourceCollection addResourceCollection(ModifiableResourceCollection parent, String desiredName, Boolean renameIfExists, List<String> errors)
Add a resource collection- Parameters:
parent- The parent collection in which the resource collection will be addeddesiredName- The desired name for the resource collectionrenameIfExists- If false, in case of existing name the resource collection will not be created, if true it will be created and renamederrors- An optional list of possible error messages in case the creation failed. Possible values are: locked, already-exist.- Returns:
- The created resource collection or null if creation failed
-
getResourceCollectionType
public String getResourceCollectionType()
Get the type of child resource collection- Returns:
- the type of child resource collection
-
renameObject
public Map<String,Object> renameObject(String id, String name) throws RepositoryException
Rename a resource, or resource collection- Parameters:
id- The id of the object to renamename- The desired name to set to the object.- Returns:
- The result map with id, name and message keys
- Throws:
RepositoryException- If there is a repository error
-
renameObject
public JCRAmetysObject renameObject(JCRAmetysObject object, String name, List<String> errors) throws RepositoryException
Rename a resource, or resource collection- Parameters:
object- The object to renamename- The desired name to set to the object.errors- An optional list of possible error messages in case the operation failed. Possible values are: locked, already-exist.- Returns:
- The new object
- Throws:
RepositoryException- If there is a repository error
-
deleteObject
public Map<String,Object> deleteObject(List<String> ids)
Delete an object- Parameters:
ids- The list of identifiers for the objects to delete- Returns:
- The result map with a message key in case of an error
-
deleteObject
public String deleteObject(RemovableAmetysObject object, List<String> errors)
Delete an object- Parameters:
object- The object to deleteerrors- An optional list of possible error messages in case the creation failed. Possible values are: locked.- Returns:
- the parent id of the removed object
-
renameResource
public Map<String,Object> renameResource(String id, String name) throws RepositoryException
Rename a resource- Parameters:
id- The id of the resource to renamename- The desired name to set to the resource.- Returns:
- The result map with id, name and message keys
- Throws:
RepositoryException- If there is a repository error
-
renameResource
public JCRResource renameResource(JCRResource resource, String name, List<String> errors) throws RepositoryException
Rename a resource- Parameters:
resource- The resource to renamename- The desired name to set to the resource.errors- An optional list of possible error messages in case the operation failed. Possible values are: locked, already-exist.- Returns:
- The new resource
- Throws:
RepositoryException- If there is a repository error
-
copyResource
public Map<String,Object> copyResource(List<String> ids, String target) throws RepositoryException
Copy file resources- Parameters:
ids- The list of identifiers for the resources to copytarget- The id of target to copy into- Returns:
- The result map with a message key in case of an error or with the list of uncopied/copied resources
- Throws:
RepositoryException- If there is a repository error
-
copyResource
public Map<String,Object> copyResource(List<String> ids, ModifiableResourceCollection target) throws RepositoryException
Copy file resources- Parameters:
ids- The list of identifiers for the resources to copytarget- The target to copy into- Returns:
- The result map with a message key in case of an error or with the list of uncopied/copied resources
- Throws:
RepositoryException- If there is a repository error
-
moveObject
public Map<String,Object> moveObject(List<String> ids, String targetId) throws RepositoryException
Move objects- Parameters:
ids- The list of identifiers for the objects to movetargetId- The id of target to move into- Returns:
- The result map with a message key in case of an error or with the list of unmoved/moved objects
- Throws:
RepositoryException- If there is a repository error
-
moveObject
public Map<String,Object> moveObject(List<String> ids, JCRTraversableAmetysObject targetNode) throws RepositoryException
Move objects- Parameters:
ids- The list of identifiers for the objects to movetargetNode- The target to move into- Returns:
- The result map with a message key in case of an error or with the list of unmoved/moved objects
- Throws:
RepositoryException- If there is a repository error
-
resourceHistory
public List<Map<String,Object>> resourceHistory(String id) throws RepositoryException
Get the history versions of a resource- Parameters:
id- the id of resource- Returns:
- The versions
- Throws:
RepositoryException- if an error occurred
-
_version2json
protected Map<String,Object> _version2json(JCRResource resource, ExplorerResourcesDAO.VersionInformation versionInformation) throws RepositoryException
Get the JSON representation of a version of a resource- Parameters:
resource- the resourceversionInformation- the version information- Returns:
- the version as JSON object
- Throws:
RepositoryException- if failed to get revision
-
restoreResource
public void restoreResource(String id, String versionName)
This action restores an old version of aResource.- Parameters:
id- the id of resourceversionName- the name of version to restore
-
resourceExists
public boolean resourceExists(String parentId, String name)
Determines if a resource with given name already exists- Parameters:
parentId- the id of parent collectionname- the name of resource- Returns:
- true if a resource with same name exists
-
resourceExists
public boolean resourceExists(TraversableAmetysObject parent, String name)
Determines if a resource with given name already exists- Parameters:
parent- the parent collectionname- the name of resource- Returns:
- true if a resource with same name exists
-
setDCMetadata
public void setDCMetadata(String resourceId, Map<String,Object> values) throws ProcessingException
Set the Dublin Core metadata of aResource.- Parameters:
resourceId- the id of resourcevalues- the DC values- Throws:
ProcessingException- if an error occurred
-
setDCMetadata
public void setDCMetadata(ModifiableResource resource, Map<String,Object> values)
Set the Dublin Core metadata of aResource.- Parameters:
resource- the resourcevalues- the DC values
-
getDCMetadata
public Map<String,Object> getDCMetadata(String id)
Get the DublinCore metadata of aDublinCoreAwareAmetysObject- Parameters:
id- the id of resource- Returns:
- the DC metadata
-
addCMISCollection
public Map<String,Object> addCMISCollection(String parentId, String originalName, String url, String login, String password, String repoId, boolean renameIfExists)
Creates a new CMIS folder (seeCMISRootResourcesCollection)- Parameters:
parentId- the id of parent folderoriginalName- the original name if CMIS folderurl- The url of CMIS repositorylogin- The user's login to access CMIS repositorypassword- The user's password to access CMIS repositoryrepoId- The id of CMIS repositoryrenameIfExists- true to automatically renamed CMIS folder if requested name already exists- Returns:
- the result map with id of created node
-
editCMISCollection
public Map<String,Object> editCMISCollection(String id, String url, String login, String password, String repoId)
Edits a CMIS folder (seeCMISRootResourcesCollection)- Parameters:
id- the id of CMIS folderurl- The url of CMIS repositorylogin- The user's login to access CMIS repositorypassword- The user's password to access CMIS repositoryrepoId- The id of CMIS repository- Returns:
- the result map with id of edited node
-
isCMISCollection
public boolean isCMISCollection(String id)
Determines if a object is aCMISRootResourcesCollection- Parameters:
id- The id of object- Returns:
- true if it is a CMIS root folder
-
getCMISProperties
public Map<String,String> getCMISProperties(String id)
Get the CMIS properties of collection- Parameters:
id- The id of CMIS collection- Returns:
- the CMIS properties to access CMIS repository
-
updateResource
public void updateResource(ModifiableResource resource, InputStream is, String fileName)
Updates resource input stream and metadata- Parameters:
resource- The resourceis- The resource input streamfileName- The file name
-
extractResourceMetadata
public void extractResourceMetadata(ModifiableResource resource, String mimeType)
Extract the resource's metadata and populate the object accordingly.- Parameters:
resource- the resource to populate.mimeType- the resource MIME type.
-
checkpoint
public void checkpoint(ModifiableResource resource)
Creates a new version- Parameters:
resource- the resource
-
createResource
public ModifiableResource createResource(ModifiableResourceCollection collection, String name)
Creates aModifiableResourceunder currentModifiableResourceCollection.- Parameters:
collection- the parentModifiableResourceCollectionname- the name of the child resource- Returns:
- the new resource created.
- Throws:
AmetysRepositoryException- if an error occurs.RepositoryIntegrityViolationException- if an object with the same name already exists and same name siblings is not allowed.
-
addComment
public Map<String,Object> addComment(String resourceId, String comment)
Add a comment to a resource- Parameters:
resourceId- The id of the resourcecomment- The comment- Returns:
- the result
-
_canAddComment
protected boolean _canAddComment(UserIdentity user, CommentableResource resource)
Indicates if an user can add a comment of a given resource- Parameters:
user- An user identityresource- The resource to comment- Returns:
- True if the user can add a comment
-
editComment
public Map<String,Object> editComment(String resourceId, String commentId, String comment)
Edit the comment of a resource- Parameters:
resourceId- The id of the resourcecommentId- The id of comment to editcomment- The comment- Returns:
- the result
-
_canEditComment
protected boolean _canEditComment(UserIdentity user, CommentableResource resource, JCRPost comment)
Indicates if an user can edit a comment of a given resource- Parameters:
user- An user identityresource- The resourcecomment- The comment to edit- Returns:
- True if the user can edit the comment
-
_setComment
protected void _setComment(JCRPost comment, String content)
Update the content of a comment- Parameters:
comment- The comment to updatecontent- The content as string
-
_getComment
protected String _getComment(JCRPost post) throws AmetysRepositoryException
Get the content of a comment as a String- Parameters:
post- the post- Returns:
- The content as String
- Throws:
AmetysRepositoryException- if failed to parse comment
-
_getCommentForEditing
protected String _getCommentForEditing(JCRPost post) throws AmetysRepositoryException
Get the content of a comment to edit as a String- Parameters:
post- the post- Returns:
- The content as String
- Throws:
AmetysRepositoryException- if failed to parse comment
-
deleteComment
public Map<String,Object> deleteComment(String resourceId, String commentId)
Delete the comment of a resource- Parameters:
resourceId- The id of the resourcecommentId- The id of comment to delete- Returns:
- the result
-
_canDeleteComment
protected boolean _canDeleteComment(UserIdentity user, CommentableResource resource, JCRPost comment)
Indicates if an user can delete a comment of a given resource- Parameters:
user- An user identityresource- The resourcecomment- The comment to edit- Returns:
- True if the user can edit the comment
-
getComments
public List<Map<String,Object>> getComments(String resourceId, boolean isEdition)
Get the comments of a resource- Parameters:
resourceId- The id of the resourceisEdition- true to get the comments in edit mode- Returns:
- The comments
-
getComment
public Map<String,Object> getComment(String commentId, boolean isEdition)
Get a comment of a resource- Parameters:
commentId- The id of the commentisEdition- true to get the comment in edit mode- Returns:
- The comments
-
_comment2json
protected Map<String,Object> _comment2json(JCRPost comment, boolean isEdition)
Get JSOn representation of a comment- Parameters:
comment- The commentisEdition- true to get the comment in edit mode- Returns:
- the comment as JSON
-
-