Class KmeliaPublication
- java.lang.Object
-
- org.silverpeas.components.kmelia.model.KmeliaPublication
-
- All Implemented Interfaces:
Serializable,org.silverpeas.core.contribution.model.Contribution,org.silverpeas.core.contribution.model.I18nContribution,org.silverpeas.core.contribution.model.SilverpeasContent,org.silverpeas.core.contribution.model.WithPermanentLink,org.silverpeas.core.contribution.model.WithThumbnail,org.silverpeas.core.i18n.LocalizedResource,org.silverpeas.core.i18n.Translatable,org.silverpeas.core.Identifiable,org.silverpeas.core.Instance<org.silverpeas.core.contribution.model.Contribution>,org.silverpeas.core.Nameable,org.silverpeas.core.security.Securable,org.silverpeas.core.SilverpeasResource
public class KmeliaPublication extends Object implements org.silverpeas.core.contribution.model.I18nContribution, org.silverpeas.core.contribution.model.SilverpeasContent, org.silverpeas.core.contribution.model.WithPermanentLink, org.silverpeas.core.contribution.model.WithThumbnail
A publication as defined in a Kmelia component. A publication in Kmelia is a publication that is always in a given topic (the father of the publication), and that can be positioned in the PDC, can have attachments, and can be commented.In Kmelia, a publication can be in one or more topics. In such a case, a Kmelia publication that is in a topic other that the original one is said to be an alias of the publication in the original topic: any changes are done in the true publication.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KmeliaPublicationaKmeliaPublicationFromCompleteDetail(org.silverpeas.core.contribution.publication.model.CompletePublication detail)Gets the Kmelia publication from the specified complete publication detail.booleancanBeAccessedBy(org.silverpeas.core.admin.user.model.User user)Is the specified user can access this publication?booleanequals(Object obj)static KmeliaPublicationfromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail)Gets the Kmelia publication from the specified publication detail.static KmeliaPublicationfromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail, org.silverpeas.core.node.model.NodePK fatherPK)Gets the Kmelia publication in the given topic from the specified publication detail.static KmeliaPublicationfromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail, org.silverpeas.core.node.model.NodePK fatherPK, Map<String,List<org.silverpeas.core.contribution.publication.model.Location>> locationCache)Gets the Kmelia publication in the given topic from the specified publication detail.List<org.silverpeas.core.comment.model.Comment>getComments()Gets the comments on this publication.org.silverpeas.core.contribution.publication.model.CompletePublicationgetCompleteDetail()Gets the complete detail about this publication.StringgetComponentInstanceId()StringgetContributionType()DategetCreationDate()org.silverpeas.core.admin.user.model.UsergetCreator()Gets the creator of this publication (the initial author).StringgetDescription()org.silverpeas.core.contribution.publication.model.PublicationDetailgetDetail()Gets the details about this publication.StringgetId()Gets the unique identifier of this publication.org.silverpeas.core.contribution.model.ContributionIdentifiergetIdentifier()DategetLastUpdateDate()org.silverpeas.core.admin.user.model.UsergetLastUpdater()Gets the user that has lastly modified this publication.org.silverpeas.core.contribution.publication.model.LocationgetLocation()org.silverpeas.core.contribution.model.ContributionModelgetModel()intgetNbAccess()intgetNumberOfComments()Get the number of comments on this publicationOptional<org.silverpeas.core.contribution.publication.model.Location>getOriginalLocation(String userId)Gets the original location of this alias according to the access right the of the specified user.List<org.silverpeas.core.pdc.pdc.model.ClassifyPosition>getPDCPositions()Gets the positions in the PDC of this publication.StringgetPermalink()org.silverpeas.core.contribution.publication.model.PublicationPKgetPk()Gets the primary key of this publication.Optional<org.silverpeas.core.contribution.publication.model.PublicationPath>getResourcePath()StringgetSilverpeasContentId()org.silverpeas.core.contribution.model.ThumbnailgetThumbnail()StringgetTitle()org.silverpeas.core.i18n.ResourceTranslationgetTranslation(String language)StringgetURL()Gets the complete URL at which this publication is located.ValidatorsListgetValidators()inthashCode()booleanisAlias()Is this publication an alias of an existing Kmelia publication?booleanisRead()booleanisVisible()Is this publication visible?voidsetAsRead()static KmeliaPublicationwithPK(org.silverpeas.core.contribution.publication.model.PublicationPK pk)Gets the Kmelia publication with the specified primary key identifying it uniquely.static KmeliaPublicationwithPK(org.silverpeas.core.contribution.publication.model.PublicationPK pk, org.silverpeas.core.node.model.NodePK fatherPk)Gets the Kmelia publication with the specified primary key and that is in the topic specified by its primary key.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.contribution.model.Contribution
getName, isIndexable
-
-
-
-
Method Detail
-
withPK
public static KmeliaPublication withPK(org.silverpeas.core.contribution.publication.model.PublicationPK pk)
Gets the Kmelia publication with the specified primary key identifying it uniquely. If no such publication exists with the specified key, then the runtime exceptionKmeliaRuntimeExceptionis thrown. The publication is by default the original one and hence not an alias.- Parameters:
pk- the primary key of the publication to get.- Returns:
- the Kmelia publication matching the primary key.
-
withPK
public static KmeliaPublication withPK(org.silverpeas.core.contribution.publication.model.PublicationPK pk, org.silverpeas.core.node.model.NodePK fatherPk)
Gets the Kmelia publication with the specified primary key and that is in the topic specified by its primary key. If no such publication exists with the specified key or if the publication has no such father, then the runtime exceptionKmeliaRuntimeExceptionis thrown.- Parameters:
pk- the primary key of the publication to get.fatherPk- the primary key of the topic that is the father of the publication.- Returns:
- the Kmelia publication matching the primary key.
-
getLocation
public org.silverpeas.core.contribution.publication.model.Location getLocation()
-
fromDetail
public static KmeliaPublication fromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail)
Gets the Kmelia publication from the specified publication detail. The publication is by default the original one and not an alias.- Parameters:
detail- the detail about the publication to get.- Returns:
- the Kmelia publication matching the specified publication detail.
-
fromDetail
public static KmeliaPublication fromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail, org.silverpeas.core.node.model.NodePK fatherPK)
Gets the Kmelia publication in the given topic from the specified publication detail.- Parameters:
detail- the detail about the publication to get.fatherPK- the primary key of the topic that is father of the publication to get.- Returns:
- the Kmelia publication matching the specified publication detail.
-
fromDetail
public static KmeliaPublication fromDetail(org.silverpeas.core.contribution.publication.model.PublicationDetail detail, org.silverpeas.core.node.model.NodePK fatherPK, Map<String,List<org.silverpeas.core.contribution.publication.model.Location>> locationCache)
Gets the Kmelia publication in the given topic from the specified publication detail.- Parameters:
detail- the detail about the publication to get.fatherPK- the primary key of the topic that is father of the publication to get.locationCache- cache of locations already loaded.- Returns:
- the Kmelia publication matching the specified publication detail.
-
aKmeliaPublicationFromCompleteDetail
public static KmeliaPublication aKmeliaPublicationFromCompleteDetail(org.silverpeas.core.contribution.publication.model.CompletePublication detail)
Gets the Kmelia publication from the specified complete publication detail. The publication is by default the original one and not an alias.- Parameters:
detail- the complete detail about the publication to get.- Returns:
- the Kmelia publication matching the specified complete publication detail.
-
isRead
public boolean isRead()
-
setAsRead
public void setAsRead()
-
isAlias
public boolean isAlias()
Is this publication an alias of an existing Kmelia publication?- Returns:
- true if this publication is an alias, false otherwise.
-
isVisible
public boolean isVisible()
Is this publication visible?- Returns:
- true if this publication is visible, false otherwise.
-
getPk
public org.silverpeas.core.contribution.publication.model.PublicationPK getPk()
Gets the primary key of this publication.- Returns:
- the publication primary key.
-
getId
public String getId()
Gets the unique identifier of this publication.- Specified by:
getIdin interfaceorg.silverpeas.core.Identifiable- Specified by:
getIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent- Returns:
- the unique identifier of this publication.
-
getURL
public String getURL()
Gets the complete URL at which this publication is located.- Returns:
- the publication URL.
-
getDetail
public org.silverpeas.core.contribution.publication.model.PublicationDetail getDetail()
Gets the details about this publication.- Returns:
- the publication details.
-
getCompleteDetail
public org.silverpeas.core.contribution.publication.model.CompletePublication getCompleteDetail()
Gets the complete detail about this publication.- Returns:
- the publication complete details.
-
getCreator
public org.silverpeas.core.admin.user.model.User getCreator()
Gets the creator of this publication (the initial author).- Specified by:
getCreatorin interfaceorg.silverpeas.core.SilverpeasResource- Returns:
- the detail about the creator of this publication.
-
getLastUpdater
public org.silverpeas.core.admin.user.model.User getLastUpdater()
Gets the user that has lastly modified this publication. He's the last one that has worked on this publication. If this publication was not modified since its creation, the creator is returned as he's the last user that has worked on this publication.- Specified by:
getLastUpdaterin interfaceorg.silverpeas.core.SilverpeasResource- Returns:
- the detail about the last modifier of this publication.
-
getComments
public List<org.silverpeas.core.comment.model.Comment> getComments()
Gets the comments on this publication.- Returns:
- an unmodifiable list with the comments on this publication.
-
getPDCPositions
public List<org.silverpeas.core.pdc.pdc.model.ClassifyPosition> getPDCPositions()
Gets the positions in the PDC of this publication.- Returns:
- an unmodifiable list with the PDC positions of this publication.
-
getNbAccess
public int getNbAccess()
-
getComponentInstanceId
public String getComponentInstanceId()
- Specified by:
getComponentInstanceIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent
-
getSilverpeasContentId
public String getSilverpeasContentId()
- Specified by:
getSilverpeasContentIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent
-
getCreationDate
public Date getCreationDate()
- Specified by:
getCreationDatein interfaceorg.silverpeas.core.SilverpeasResource
-
getLastUpdateDate
public Date getLastUpdateDate()
- Specified by:
getLastUpdateDatein interfaceorg.silverpeas.core.SilverpeasResource
-
getTitle
public String getTitle()
- Specified by:
getTitlein interfaceorg.silverpeas.core.contribution.model.Contribution
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getDescriptionin interfaceorg.silverpeas.core.Nameable
-
getContributionType
public String getContributionType()
- Specified by:
getContributionTypein interfaceorg.silverpeas.core.contribution.model.Contribution
-
getResourcePath
public Optional<org.silverpeas.core.contribution.publication.model.PublicationPath> getResourcePath()
- Specified by:
getResourcePathin interfaceorg.silverpeas.core.contribution.model.Contribution
-
canBeAccessedBy
public boolean canBeAccessedBy(org.silverpeas.core.admin.user.model.User user)
Is the specified user can access this publication? A user can access a publication if he has enough rights to access both the Kmelia instance in which is managed this publication and the topics to which this publication belongs to.- Specified by:
canBeAccessedByin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
canBeAccessedByin interfaceorg.silverpeas.core.security.Securable- Parameters:
user- a user in Silverpeas.- Returns:
- true if the user can access this publication, false otherwise.
-
getNumberOfComments
public int getNumberOfComments()
Get the number of comments on this publication- Returns:
- the number.
-
getOriginalLocation
public Optional<org.silverpeas.core.contribution.publication.model.Location> getOriginalLocation(String userId)
Gets the original location of this alias according to the access right the of the specified user. If this location isn't an alias, then returns itself. If the user has no access right to the original location, then returns nothing. If no original location can be found, whatever the access right of the user, aKmeliaRuntimeExceptionis thrown.- Parameters:
userId- the unique identifier of the user for which the access right on the original location has to be checked.- Returns:
- either the original location (itself if this location is already the original one) or nothing whether the given user has no access right on it.
-
getValidators
public ValidatorsList getValidators()
-
getPermalink
public String getPermalink()
- Specified by:
getPermalinkin interfaceorg.silverpeas.core.contribution.model.WithPermanentLink
-
getThumbnail
public org.silverpeas.core.contribution.model.Thumbnail getThumbnail()
- Specified by:
getThumbnailin interfaceorg.silverpeas.core.contribution.model.WithThumbnail
-
getIdentifier
public org.silverpeas.core.contribution.model.ContributionIdentifier getIdentifier()
- Specified by:
getIdentifierin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getIdentifierin interfaceorg.silverpeas.core.contribution.model.I18nContribution- Specified by:
getIdentifierin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent- Specified by:
getIdentifierin interfaceorg.silverpeas.core.SilverpeasResource
-
getTranslation
public org.silverpeas.core.i18n.ResourceTranslation getTranslation(String language)
- Specified by:
getTranslationin interfaceorg.silverpeas.core.i18n.LocalizedResource- Specified by:
getTranslationin interfaceorg.silverpeas.core.i18n.Translatable
-
getModel
public org.silverpeas.core.contribution.model.ContributionModel getModel()
- Specified by:
getModelin interfaceorg.silverpeas.core.contribution.model.Contribution
-
-