public final class PSComment extends Object implements PSEntity
Modifier and Type | Class and Description |
---|---|
static class |
PSComment.Attachment
An attachment to the comment.
|
static class |
PSComment.Author
The author of a comment.
|
static class |
PSComment.Context
The context of the comment which may be either a group or a URI.
|
Constructor and Description |
---|
PSComment() |
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(PSDocument document)
Adds the specified document as an attachment.
|
void |
addAttachment(PSDocument document,
String fragment)
Adds the specified document as an attachment.
|
EntityValidity |
checkValid()
Determines whether this object is valid based on known PageSeeder constraints.
|
PSMember |
getAssignedTo() |
List<PSComment.Attachment> |
getAttachments() |
PSComment.Author |
getAuthor() |
String |
getContent() |
PSComment.Context |
getContext() |
Date |
getDue() |
Long |
getId() |
String |
getIdentifier()
Returns the identifier to use when connecting to PageSeeder based on the ID available.
|
String |
getKey() |
List<String> |
getLabels() |
String |
getLabelsAsString() |
String |
getMediaType() |
String |
getPriority() |
Map<String,String> |
getProperties() |
String |
getPropertiesAsString() |
String |
getStatus() |
String |
getTitle() |
String |
getType() |
boolean |
hasAttachments() |
boolean |
hasLabels() |
boolean |
hasProperties() |
boolean |
isIdentifiable()
Determines whether the entity can be identified in PageSeeder.
|
boolean |
isValid()
Determines whether the entity is valid based on known PageSeeder constraints.
|
void |
setAssignedto(PSMember assignedto) |
void |
setAttachments(List<PSComment.Attachment> attachments) |
void |
setAuthor(PSComment.Author author)
Sets the author directly.
|
void |
setAuthor(PSMember member)
Sets the author as a PageSeeder member.
|
void |
setAuthor(String name,
String email)
Sets the author as an external user.
|
void |
setContent(String content) |
void |
setContext(PSDocument document)
Set the context as a document.
|
void |
setContext(PSDocument document,
String fragment)
Set the context as a document fragment.
|
void |
setContext(PSExternalURI externaluri)
Set the context as an external URI.
|
void |
setContext(PSExternalURI externaluri,
String fragment)
Set the context as an external URI fragment.
|
void |
setContext(PSGroup group)
Set the context as a group.
|
void |
setDue(Date due) |
void |
setId(Long id) |
void |
setLabels(List<String> labels) |
void |
setLabels(String labels) |
void |
setMediaType(String mediatype) |
void |
setPriority(String priority) |
void |
setProperties(Map<String,String> properties) |
void |
setProperties(String properties) |
void |
setStatus(String status) |
void |
setTitle(String title) |
void |
setType(String type) |
String |
toString() |
public String getTitle()
public String getContent()
public String getMediaType()
public String getType()
public void setId(Long id)
id
- the id to setpublic void setTitle(String title)
title
- the title to setpublic void setContent(String content)
content
- the content to setpublic void setMediaType(String mediatype)
mediatype
- the mediatype to setpublic void setType(String type)
type
- the type to setpublic boolean hasAttachments()
public List<PSComment.Attachment> getAttachments()
public void addAttachment(PSDocument document)
document
- The document to attach to the comment.public void addAttachment(PSDocument document, String fragment)
document
- The document to attach to the comment.fragment
- The fragment ID of where the comment is attached (null
for default fragment)public void setAttachments(List<PSComment.Attachment> attachments)
attachments
- the attachments to setpublic boolean hasLabels()
public String getLabelsAsString()
public void setLabels(String labels)
labels
- The labels as a comma-separated list.public boolean hasProperties()
public String getPropertiesAsString()
public void setProperties(Map<String,String> properties)
properties
- the properties to setpublic void setProperties(String properties)
properties
- the properties to setpublic PSComment.Author getAuthor()
public void setAuthor(PSComment.Author author)
author
- the author to setpublic void setAuthor(PSMember member)
Implementation note: This method creates a new Author
instance.
member
- the member to set as the authorpublic void setAuthor(String name, String email)
Implementation note: This method creates a new Author
instance.
name
- the name of the authoremail
- the email of the authorpublic PSComment.Context getContext()
public void setContext(PSGroup group)
Implementation note: This method creates a new context instance.
group
- The group to use as context.public void setContext(PSDocument document)
Implementation note: This method creates a new context instance.
document
- The document to use as contextpublic void setContext(PSExternalURI externaluri)
Implementation note: This method creates a new context instance.
externaluri
- The external URI to use as contextpublic void setContext(PSDocument document, String fragment)
Implementation note: This method creates a new context instance.
document
- The documentfragment
- The document fragment to use as contextpublic void setContext(PSExternalURI externaluri, String fragment)
Implementation note: This method creates a new context instance.
externaluri
- The external URI to use as contextfragment
- The external URI fragment to use as contextpublic String getStatus()
public String getPriority()
public PSMember getAssignedTo()
public Date getDue()
public void setStatus(String status)
status
- the status to setpublic void setPriority(String priority)
priority
- the priority to setpublic void setAssignedto(PSMember assignedto)
assignedto
- the assignedto to setpublic void setDue(Date due)
due
- the due to setpublic String getKey()
public boolean isValid()
PSEntity
public boolean isIdentifiable()
PSEntity
To be identifiable, the entity must have either a private id or a public id.
If the public ID does not correspond to a single attribute in PageSeeder, then a combination of attributes may be used to determine whether it is possible to identify the entity.
isIdentifiable
in interface PSEntity
true
if the object can be identified in PageSeeder;
false
if it is not possible to identify the entity form its attributes or keys.public String getIdentifier()
PSEntity
When both the private and public identifier are available, the private identifier takes precedence over the public one.
When the public identifier cannot be used on its own, then only the private ID is returned.
In general, if the PSEntity.isIdentifiable()
method return true
, this
method should return a value. When it is not the case, it should be clearly documented.
getIdentifier
in interface PSEntity
public EntityValidity checkValid()
PSEntity
checkValid
in interface PSEntity
true
if the object is intrinsically valid based on its internal values;
false
if any of its attributes violates a PageSeeder constraint.Copyright © 2016 Allette Systems. All rights reserved.