Interface PublicationService

    • Method Detail

      • getDetail

        PublicationDetail getDetail​(PublicationPK pubPK)
        Gets the publication with the specified identifying key.
        Parameters:
        pubPK - the identifying key of the publication to get.
        Returns:
        the publication corresponding to the given key. If no such publication exists with the specified key, then null is returned.
      • createPublication

        PublicationPK createPublication​(PublicationDetail detail)
        Creates in Silverpeas the specified publication. It persists it into the Silverpeas data source and a new identifier is set for this publication. A ResourceEvent.Type.CREATION event is sent once the publication is created.
        Parameters:
        detail - the detail on the publication to persist.
        Returns:
        the identifying key of the publication so that it can be retrieved later in the data source by this key.
      • movePublication

        void movePublication​(PublicationPK pubPK,
                             NodePK toFatherPK,
                             boolean indexIt)
        Moves the specified publication to the specified father and indexes or not it. The father can be either a node in the same component instance or a node in another component instance. No ResourceEvent.Type.MOVE event is sent; for doing please use one the move done the setDetail(PublicationDetail, boolean, ResourceEvent.Type) method by specifying the ResourceEvent.Type.MOVE event as last parameter.
        Parameters:
        pubPK - the identifying key of the publication to move.
        toFatherPK - the new father of the publication.
        indexIt - a boolean indicating if the publication must be indexed.
      • changePublicationOrder

        void changePublicationOrder​(PublicationPK pubPK,
                                    NodePK fatherPK,
                                    int direction)
        Change the order of the given publication among the others one for the specified father. Direction less than 0 means "up", otherwise it means "down".
        Parameters:
        pubPK - the identifying key of the publication to reorder.
        fatherPK - a father of the publication.
        direction - a direction of the reordering: a value less than 0 means "up", otherwise it means "down". Cannot be 0.
      • removePublication

        void removePublication​(PublicationPK pubPK)
        Removes the specified publication. The ResourceEvent.Type.DELETION event is sent once the publication is removed.
        Parameters:
        pubPK - the identifying key of the publication to remove.
      • setDetail

        void setDetail​(PublicationDetail detail)
        Updates the specified publication. The update date isn't updated in given the publication detail. The ResourceEvent.Type.UPDATE event is sent once the publication is updated.
        Parameters:
        detail - the detail of the publication from which it has to be updated.
      • setDetail

        void setDetail​(PublicationDetail detail,
                       boolean forceUpdateDate)
        Updates the specified publication and specify if the update date property of the publication detail has to be used as update date. The ResourceEvent.Type.UPDATE event is sent once the publication is updated.
        Parameters:
        detail - the detail of the publication from which it has to be updated.
        forceUpdateDate - a boolean indicating if the update date has to be set with date of this update.
      • setDetail

        void setDetail​(PublicationDetail detail,
                       boolean forceUpdateDate,
                       ResourceEvent.Type eventType)
        Updates the specified publication and specify if the update date property of the publication detail has to be used as update date. The kind of update is specified by the given event type: it is either a simple publication update or an update issuing from a publication move (some publication properties can require to be updated after a move but they aren't related to a publication modification).
        Parameters:
        detail - the detail of the publication from which it has to be updated.
        forceUpdateDate - a boolean indicating if the update date has to be set with date of this update.
        eventType - permit to precise to listener of publication modification the type of the update.
      • addFather

        void addFather​(PublicationPK pubPK,
                       NodePK fatherPK)
        Adds the specified father to the given publication. The publication will be then visible from this new father.
        Parameters:
        pubPK - the identifying key of the publication.
        fatherPK - the the identifying key of the new father.
      • removeFather

        void removeFather​(PublicationPK pubPK,
                          NodePK fatherPK)
        Removes the specified publication from the specified father. The publication won't be any more attached to the given father and hence it won't be visible any more from this father.
        Parameters:
        pubPK - the identifying key of the publication
        fatherPK - the identifying key of the father to detach.
      • removeFathers

        void removeFathers​(PublicationPK pubPK,
                           Collection<String> fatherIds)
        Removes the specified publication from all the specified father. The publication won't be any more attached to the given fathers and hence it won't be visible any more from these fathers.
        Parameters:
        pubPK - the identifying key of the publication
        fatherIds - a collection of identifying key of the fathers to detach.
      • removeAllFathers

        void removeAllFathers​(PublicationPK pubPK)
        Removes the specified publication from all fathers. This means the publication will become an orphan and it won't be visible from any fathers.
        Parameters:
        pubPK - the identifying key of the publication
      • getOrphanPublications

        Collection<PublicationDetail> getOrphanPublications​(String componentId)
        Gets all the publications that aren't attached to any father in the specified component instance.
        Parameters:
        componentId - the unique identifier of a component instance/
        Returns:
        a collection of orphan publications.
      • getAllFatherPKInSamePublicationComponentInstance

        List<NodePK> getAllFatherPKInSamePublicationComponentInstance​(PublicationPK pubPK)
        Gets the unique identifying key of all of the fathers of the specified publication and in the same component instance.
        Parameters:
        pubPK - the identifying key of the publication.
        Returns:
        a collection of NodePK instances, each of them identifying a node.
      • getAllLocationsByPublicationIds

        Map<String,​List<Location>> getAllLocationsByPublicationIds​(Collection<String> ids)
        Selects massively simple data about all locations (main or aliases).

        This method is designed for process performance needs.

        Parameters:
        ids - the instance ids aimed.
        Returns:
        a list of Location instances.
      • getAllLocations

        List<Location> getAllLocations​(PublicationPK pubPK)
        Gets all the locations of the specified publication whatever the component instance in which they are. By default, the original location of the publication is returned along with all of its aliases.
        Parameters:
        pubPK - the identifying key of the publication.
        Returns:
        a collection of the locations of the publication.
        See Also:
        Location
      • getLocationsInComponentInstance

        List<Location> getLocationsInComponentInstance​(PublicationPK pubPK,
                                                       String instanceId)
        Gets the locations of the specified publication in the given component instance.
        Parameters:
        pubPK - the identifying key of the publication.
        instanceId - the unique identifier of a component instance.
        Returns:
        a collection of Location objects or none if the publication has no locations in the given component instance.
        See Also:
        Location
      • getMainLocation

        Optional<Location> getMainLocation​(PublicationPK pubPK)
        Gets the main location of the specified publication. A publication has always one original location and any other locations should be an alias.
        Parameters:
        pubPK - the identifying key of the publication.
        Returns:
        the main location of the specified publication or nothing is the publication is orphaned (not attached to a father).
        See Also:
        Location
      • getAllAliases

        List<Location> getAllAliases​(PublicationPK pubPK)
        Gets all the aliases of the specified publication. The original location isn't returned among the aliases; to get also the original location, please look at the getAllLocations(PublicationPK) method.
        Parameters:
        pubPK - the identifying key of the publication.
        See Also:
        Location
      • setAliases

        Pair<Collection<Location>,​Collection<Location>> setAliases​(PublicationPK pubPK,
                                                                         List<Location> aliases)
        Sets the aliases of the specified publication. They replace the existing aliases of the publication. The IllegalArgumentException is throw if one of the location isn't an alias.
        Parameters:
        pubPK - the identifying key of the publication.
        aliases - the new aliases.
        Returns:
        a pair made up of firstly the added aliases and of secondly the removed aliases.
        See Also:
        Location
      • addAliases

        void addAliases​(PublicationPK pubPK,
                        List<Location> aliases)
        Adds the specified aliases of the specified publication. The IllegalArgumentException is throw if one of the location isn't an alias.
        Parameters:
        pubPK - the identifying key of the publication.
        aliases - the aliases to add to the existing ones.
        See Also:
        Location
      • getDetailsByFatherPK

        Collection<PublicationDetail> getDetailsByFatherPK​(NodePK fatherPK)
        Gets all the publications attached to the specified father.
        Parameters:
        fatherPK - the identifying key of the father.
        Returns:
        a collection of PublicationDetail instances.
      • getDetailsByFatherPK

        Collection<PublicationDetail> getDetailsByFatherPK​(NodePK fatherPK,
                                                           String sorting)
        Gets all the publications attached to the specified father ordered as indicated by the sorting directive.
        Parameters:
        fatherPK - the identifying key of the father.
        sorting - a sorting directive. Must be in the form of "P.[publication detail attribute] (DESC|ASC)"
        Returns:
        a collection of PublicationDetail instances.
      • getDetailsByFatherPK

        Collection<PublicationDetail> getDetailsByFatherPK​(NodePK fatherPK,
                                                           String sorting,
                                                           boolean filterOnVisibilityPeriod)
        Gets all the publications attached to the specified father, ordered as indicated by the sorting directive, according to the visibility.
        Parameters:
        fatherPK - the identifying key of the father.
        sorting - a sorting directive. Must be in the form of "P.[publication detail attribute] (DESC|ASC)"
        filterOnVisibilityPeriod - is the publications to get must be today visible.
        Returns:
        a collection of PublicationDetail instances.
      • getDetailsByFatherPK

        Collection<PublicationDetail> getDetailsByFatherPK​(NodePK fatherPK,
                                                           String sorting,
                                                           boolean filterOnVisibilityPeriod,
                                                           String userId)
        Gets all the publications attached to the specified father, ordered as indicated by the sorting directive, according to the visibility, and that was authored or updated by the specified user.
        Parameters:
        fatherPK - the identifying key of the father.
        sorting - a sorting directive. Must be in the form of "P.[publication detail attribute] (DESC|ASC)"
        filterOnVisibilityPeriod - is the publications to get must be today visible.
        userId - the unique identifier of the author or of an updater.
        Returns:
        a collection of PublicationDetail instances.
      • getDetailsNotInFatherPK

        Collection<PublicationDetail> getDetailsNotInFatherPK​(NodePK fatherPK)
        Gets all the publications that aren't attached to the specified father.
        Parameters:
        fatherPK - the identifying key of the father.
        Returns:
        a collection of PublicationDetail instances.
      • getDetailsNotInFatherPK

        Collection<PublicationDetail> getDetailsNotInFatherPK​(NodePK fatherPK,
                                                              String sorting)
        Gets all the publications that aren't attached to the specified father and ordered by the specified sorting directive.
        Parameters:
        fatherPK - the identifying key of the father.
        sorting - a sorting directive. Must be in the form of "P.[publication detail attribute] (DESC|ASC)"
        Returns:
        a collection of PublicationDetail instances.
      • deleteLink

        void deleteLink​(String id)
        Deletes the specified link between two publications.
        Parameters:
        id - the unique identifier of a link between two publications.
      • getAuthorizedPublicationsForUserByCriteria

        SilverpeasList<PublicationDetail> getAuthorizedPublicationsForUserByCriteria​(String userId,
                                                                                     PublicationCriteria criteria)
        Gets a list of authorized publications by applying given criteria.
        Parameters:
        userId - the identifier of the user for which access control MUST be verified.
        criteria - the criteria.
        Returns:
        a list of publications
      • getNbPubByFatherPath

        int getNbPubByFatherPath​(NodePK fatherPK,
                                 String fatherPath)
      • getDistributionTree

        Map<String,​Integer> getDistributionTree​(DistributionTreeCriteria criteria)
        Gets the tree of nodes with the number of publication per node.
        Parameters:
        criteria - criteria for delimiting the scope of the request.
        Returns:
        the tree of nodes with the number of publication per node
      • getMinimalDataByIds

        List<PublicationDetail> getMinimalDataByIds​(Collection<PublicationPK> ids)
        Selects massively simple data about publications.

        For now, only the following data are retrieved:

        • pubId
        • pubStatus
        • pubCloneId
        • pubCloneStatus
        • instanceId
        • pubBeginDate
        • pubEndDate
        • pubBeginHour
        • pubEndHour
        • pubcreatorid
        • pubupdaterid
        This method is designed for process performance needs.
        The result is not necessarily into same ordering as the one of given parameter.

        Parameters:
        ids - the instance ids aimed.
        Returns:
        a list of PublicationDetail instances.
      • getDetailByName

        PublicationDetail getDetailByName​(PublicationPK pubPK,
                                          String pubName)
        Looking for, in the instance identified by pubPK, a publication named pubName.
        Parameters:
        pubPK - the identifier of the instance
        pubName - the publication's name we are looking for
        Returns:
        the pubId if a publication already exists in this component's instance. null otherwise.
      • removeValidationSteps

        void removeValidationSteps​(PublicationPK pubPK)
      • changePublicationsOrder

        void changePublicationsOrder​(List<String> ids,
                                     NodePK nodePK)
      • resetPublicationsOrder

        void resetPublicationsOrder​(NodePK nodePK)
      • addLinks

        void addLinks​(PublicationPK pubPK,
                      List<ResourceReference> links)
        Updates the publication links
        Parameters:
        pubPK - publication identifier which you want to update links
        links - list of publication to link with current.
      • getSocialInformationsListOfMyContacts

        List<SocialInformationPublication> getSocialInformationsListOfMyContacts​(List<String> myContactsIds,
                                                                                 List<String> options,
                                                                                 Date begin,
                                                                                 Date end)
        get list of socialInformation of my contacts according to options and number of Item and the first Index
        Parameters:
        myContactsIds -
        options -
        begin -
        end -
        Returns:
      • getDraftsByUser

        Collection<PublicationDetail> getDraftsByUser​(String userId)
        get all publications of given user in state 'Draft'. It returns simple publications in state 'Draft' and cloned publications with a clone in state 'Draft'.
        Parameters:
        userId -
        Returns:
        all PublicationDetail in state 'Draft' according to given userId
      • removeUserFromTargetValidators

        List<PublicationDetail> removeUserFromTargetValidators​(String userId)
        Remove given userId from publication validators where it appears.
        Parameters:
        userId - id of the user to remove
        Returns:
        a List of PublicationPK on which userId have been removed to.