Class DefaultYellowpagesService

  • All Implemented Interfaces:
    YellowpagesService

    @Service
    public class DefaultYellowpagesService
    extends Object
    implements YellowpagesService
    This is the Yellowpages Service layer to manage the yellow page application.
    Author:
    Nicolas Eysseric
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addContactToTopic​(org.silverpeas.core.contact.model.ContactPK contactPK, String fatherId)
      Add a contact to a topic and send email alerts to topic subscribers
      void addGroup​(String groupId, org.silverpeas.core.node.model.NodePK nodePK)  
      List<org.silverpeas.core.node.model.NodeDetail> addGroup​(List<org.silverpeas.core.node.model.NodeDetail> tree, org.silverpeas.core.admin.user.model.Group group, int level)  
      org.silverpeas.core.node.model.NodePK addToTopic​(org.silverpeas.core.node.model.NodeDetail father, org.silverpeas.core.node.model.NodeDetail subTopic)
      Add a subtopic to a topic - If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
      String createContact​(org.silverpeas.core.contact.model.Contact contact, org.silverpeas.core.node.model.NodePK nodePK)
      Create a new Contact (only the header - parameters) to the current Topic
      void createInfoModel​(org.silverpeas.core.contact.model.ContactPK contactPK, String modelId)
      Create model info attached to a contact
      void deleteContact​(org.silverpeas.core.contact.model.ContactPK contactPK, org.silverpeas.core.node.model.NodePK nodePK)
      Delete a contact If this contact is in the basket or in the DZ, it's deleted from the database Else it only send to the basket
      void deleteContactFromTopic​(org.silverpeas.core.contact.model.ContactPK contactPK, String fatherId)
      Delete a path between contact and topic
      void deleteTopic​(org.silverpeas.core.node.model.NodePK pkToDelete)
      Delete a topic and all descendants.
      void emptyDZByUserId​(String instanceId, String userId)  
      Collection<org.silverpeas.core.contact.model.ContactFatherDetail> getAllContactDetails​(org.silverpeas.core.node.model.NodePK nodePK)  
      org.silverpeas.core.contact.model.CompleteContact getCompleteContact​(org.silverpeas.core.contact.model.ContactPK contactPK)  
      org.silverpeas.core.contact.model.CompleteContact getCompleteContactInNode​(org.silverpeas.core.contact.model.ContactPK contactPK, String nodeId)
      Return all info of a contact
      org.silverpeas.core.contact.model.ContactDetail getContactDetail​(org.silverpeas.core.contact.model.ContactPK contactPK)
      Return the detail of a contact (only the Header)
      Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastName​(org.silverpeas.core.contact.model.ContactPK pk, String query)  
      Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastNameAndFirstName​(org.silverpeas.core.contact.model.ContactPK pk, String lastName, String firstName)  
      Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastNameOrFirstName​(org.silverpeas.core.contact.model.ContactPK pk, String query)  
      Collection<org.silverpeas.core.node.model.NodePK> getContactFathers​(org.silverpeas.core.contact.model.ContactPK contactPK)  
      Collection<UserContact> getContacts​(Collection<String> contactIds, String instanceId)
      Return a collection of ContactDetail throught a collection of contact ids
      List<org.silverpeas.core.admin.user.model.Group> getGroups​(org.silverpeas.core.node.model.NodePK pk)
      Gets GroupState.VALID Group hosted by the given node.
      Collection<String> getModelUsed​(String instanceId)  
      List<Collection<org.silverpeas.core.node.model.NodeDetail>> getPathList​(org.silverpeas.core.contact.model.ContactPK contactPK)
      Return list of all path to this contact - it's a Collection of NodeDetail collection
      org.silverpeas.core.node.model.NodeDetail getSubTopicDetail​(org.silverpeas.core.node.model.NodePK pk)
      Return a subtopic to currentTopic
      List<org.silverpeas.core.node.model.NodeDetail> getTree​(String instanceId)  
      TopicDetail goTo​(org.silverpeas.core.node.model.NodePK pk, String userId)
      Return a the detail of a topic
      void index​(String instanceId)  
      void removeGroup​(String groupId)  
      void removeGroup​(String groupId, org.silverpeas.core.node.model.NodePK nodePK)  
      void setModelUsed​(String[] models, String instanceId)  
      void unreferenceOrphanContacts​(org.silverpeas.core.contact.model.ContactPK contactPK)  
      void updateContact​(org.silverpeas.core.contact.model.Contact contactDetail)
      Update a contact (only the header - parameters)
      org.silverpeas.core.node.model.NodePK updateTopic​(org.silverpeas.core.node.model.NodeDetail topic)
      Update a subtopic to currentTopic and alert users - If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
    • Constructor Detail

      • DefaultYellowpagesService

        public DefaultYellowpagesService()
    • Method Detail

      • goTo

        public TopicDetail goTo​(org.silverpeas.core.node.model.NodePK pk,
                                String userId)
        Return a the detail of a topic
        Specified by:
        goTo in interface YellowpagesService
        Parameters:
        pk - the id of the topic
        Returns:
        a TopicDetail
        See Also:
        TopicDetail
      • addGroup

        public List<org.silverpeas.core.node.model.NodeDetail> addGroup​(List<org.silverpeas.core.node.model.NodeDetail> tree,
                                                                        org.silverpeas.core.admin.user.model.Group group,
                                                                        int level)
      • addToTopic

        public org.silverpeas.core.node.model.NodePK addToTopic​(org.silverpeas.core.node.model.NodeDetail father,
                                                                org.silverpeas.core.node.model.NodeDetail subTopic)
        Add a subtopic to a topic - If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
        Specified by:
        addToTopic in interface YellowpagesService
        Parameters:
        father - the topic Id of the future father
        subTopic - the NodeDetail of the new sub topic
        Returns:
        If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
        See Also:
        NodeDetail, NodePK
      • updateTopic

        public org.silverpeas.core.node.model.NodePK updateTopic​(org.silverpeas.core.node.model.NodeDetail topic)
        Update a subtopic to currentTopic and alert users - If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
        Specified by:
        updateTopic in interface YellowpagesService
        Parameters:
        topic - the NodeDetail of the updated sub topic
        Returns:
        If a subtopic of same name already exists a NodePK with id=-1 is returned else the new topic NodePK
        See Also:
        NodeDetail, NodePK
      • getSubTopicDetail

        public org.silverpeas.core.node.model.NodeDetail getSubTopicDetail​(org.silverpeas.core.node.model.NodePK pk)
        Description copied from interface: YellowpagesService
        Return a subtopic to currentTopic
        Specified by:
        getSubTopicDetail in interface YellowpagesService
        Parameters:
        pk - the id of the researched topic
        Returns:
        the detail of the specified topic
        See Also:
        NodeDetail
      • deleteTopic

        public void deleteTopic​(org.silverpeas.core.node.model.NodePK pkToDelete)
        Delete a topic and all descendants. Delete all links between descendants and contacts. This contacts will be visible in the Declassified zone. Delete All subscriptions and favorites on this topics and all descendants
        Specified by:
        deleteTopic in interface YellowpagesService
        Parameters:
        pkToDelete - the id of the topic to delete
      • getContactDetail

        public org.silverpeas.core.contact.model.ContactDetail getContactDetail​(org.silverpeas.core.contact.model.ContactPK contactPK)
        Return the detail of a contact (only the Header)
        Specified by:
        getContactDetail in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact
        Returns:
        a ContactDetail
        See Also:
        ContactDetail
      • getPathList

        public List<Collection<org.silverpeas.core.node.model.NodeDetail>> getPathList​(org.silverpeas.core.contact.model.ContactPK contactPK)
        Return list of all path to this contact - it's a Collection of NodeDetail collection
        Specified by:
        getPathList in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact
        Returns:
        a Collection of NodeDetail collection
        See Also:
        NodeDetail
      • createContact

        public String createContact​(org.silverpeas.core.contact.model.Contact contact,
                                    org.silverpeas.core.node.model.NodePK nodePK)
        Create a new Contact (only the header - parameters) to the current Topic
        Specified by:
        createContact in interface YellowpagesService
        Parameters:
        contact - a contact
        Returns:
        the id of the new contact
        See Also:
        Contact
      • updateContact

        public void updateContact​(org.silverpeas.core.contact.model.Contact contactDetail)
        Update a contact (only the header - parameters)
        Specified by:
        updateContact in interface YellowpagesService
        Parameters:
        contactDetail - a ContactDetail
        See Also:
        Contact
      • deleteContact

        public void deleteContact​(org.silverpeas.core.contact.model.ContactPK contactPK,
                                  org.silverpeas.core.node.model.NodePK nodePK)
        Delete a contact If this contact is in the basket or in the DZ, it's deleted from the database Else it only send to the basket
        Specified by:
        deleteContact in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact to delete
        See Also:
        TopicDetail
      • addContactToTopic

        public void addContactToTopic​(org.silverpeas.core.contact.model.ContactPK contactPK,
                                      String fatherId)
        Add a contact to a topic and send email alerts to topic subscribers
        Specified by:
        addContactToTopic in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact
        fatherId - the id of the topic
      • deleteContactFromTopic

        public void deleteContactFromTopic​(org.silverpeas.core.contact.model.ContactPK contactPK,
                                           String fatherId)
        Delete a path between contact and topic
        Specified by:
        deleteContactFromTopic in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact
        fatherId - the id of the topic
      • createInfoModel

        public void createInfoModel​(org.silverpeas.core.contact.model.ContactPK contactPK,
                                    String modelId)
        Create model info attached to a contact
        Specified by:
        createInfoModel in interface YellowpagesService
        Parameters:
        contactPK - the id of the contact
        modelId - the id of the selected model
      • getCompleteContactInNode

        public org.silverpeas.core.contact.model.CompleteContact getCompleteContactInNode​(org.silverpeas.core.contact.model.ContactPK contactPK,
                                                                                          String nodeId)
        Return all info of a contact
        Specified by:
        getCompleteContactInNode in interface YellowpagesService
        Parameters:
        contactPK - the id of a contact
        nodeId - the id of the node
        Returns:
        a CompleteContact
        See Also:
        CompleteContact
      • getCompleteContact

        public org.silverpeas.core.contact.model.CompleteContact getCompleteContact​(org.silverpeas.core.contact.model.ContactPK contactPK)
        Specified by:
        getCompleteContact in interface YellowpagesService
      • getContacts

        public Collection<UserContact> getContacts​(Collection<String> contactIds,
                                                   String instanceId)
        Return a collection of ContactDetail throught a collection of contact ids
        Specified by:
        getContacts in interface YellowpagesService
        Parameters:
        contactIds - a collection of contact ids
        Returns:
        a collection of ContactDetail
        See Also:
        ContactDetail
      • unreferenceOrphanContacts

        public void unreferenceOrphanContacts​(org.silverpeas.core.contact.model.ContactPK contactPK)
      • getGroups

        public List<org.silverpeas.core.admin.user.model.Group> getGroups​(org.silverpeas.core.node.model.NodePK pk)
        Description copied from interface: YellowpagesService
        Gets GroupState.VALID Group hosted by the given node.
        Specified by:
        getGroups in interface YellowpagesService
        Parameters:
        pk - the reference to a node.
        Returns:
        a list of GroupState.VALID Group instance.