Class DefaultYellowpagesService
- java.lang.Object
-
- org.silverpeas.components.yellowpages.service.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
-
-
Constructor Summary
Constructors Constructor Description DefaultYellowpagesService()
-
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 subscribersvoid
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 NodePKString
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 Topicvoid
createInfoModel(org.silverpeas.core.contact.model.ContactPK contactPK, String modelId)
Create model info attached to a contactvoid
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 basketvoid
deleteContactFromTopic(org.silverpeas.core.contact.model.ContactPK contactPK, String fatherId)
Delete a path between contact and topicvoid
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 contactorg.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 idsList<org.silverpeas.core.admin.user.model.Group>
getGroups(org.silverpeas.core.node.model.NodePK pk)
GetsGroupState.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 collectionorg.silverpeas.core.node.model.NodeDetail
getSubTopicDetail(org.silverpeas.core.node.model.NodePK pk)
Return a subtopic to currentTopicList<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 topicvoid
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
-
-
-
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 interfaceYellowpagesService
- Parameters:
pk
- the id of the topic- Returns:
- a TopicDetail
- See Also:
TopicDetail
-
getTree
public List<org.silverpeas.core.node.model.NodeDetail> getTree(String instanceId)
- Specified by:
getTree
in interfaceYellowpagesService
-
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 interfaceYellowpagesService
- Parameters:
father
- the topic Id of the future fathersubTopic
- 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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of the contact- Returns:
- a ContactDetail
- See Also:
ContactDetail
-
getContactDetailsByLastName
public Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastName(org.silverpeas.core.contact.model.ContactPK pk, String query)
- Specified by:
getContactDetailsByLastName
in interfaceYellowpagesService
-
getContactDetailsByLastNameOrFirstName
public Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastNameOrFirstName(org.silverpeas.core.contact.model.ContactPK pk, String query)
- Specified by:
getContactDetailsByLastNameOrFirstName
in interfaceYellowpagesService
-
getContactDetailsByLastNameAndFirstName
public Collection<org.silverpeas.core.contact.model.ContactDetail> getContactDetailsByLastNameAndFirstName(org.silverpeas.core.contact.model.ContactPK pk, String lastName, String firstName)
- Specified by:
getContactDetailsByLastNameAndFirstName
in interfaceYellowpagesService
-
getAllContactDetails
public Collection<org.silverpeas.core.contact.model.ContactFatherDetail> getAllContactDetails(org.silverpeas.core.node.model.NodePK nodePK)
- Specified by:
getAllContactDetails
in interfaceYellowpagesService
-
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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- 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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of the contact to delete- See Also:
TopicDetail
-
emptyDZByUserId
public void emptyDZByUserId(String instanceId, String userId)
- Specified by:
emptyDZByUserId
in interfaceYellowpagesService
-
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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of the contactfatherId
- 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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of the contactfatherId
- 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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of the contactmodelId
- 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 interfaceYellowpagesService
- Parameters:
contactPK
- the id of a contactnodeId
- 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 interfaceYellowpagesService
-
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 interfaceYellowpagesService
- Parameters:
contactIds
- a collection of contact ids- Returns:
- a collection of ContactDetail
- See Also:
ContactDetail
-
getContactFathers
public Collection<org.silverpeas.core.node.model.NodePK> getContactFathers(org.silverpeas.core.contact.model.ContactPK contactPK)
- Specified by:
getContactFathers
in interfaceYellowpagesService
-
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
GetsGroupState.VALID
Group
hosted by the given node.- Specified by:
getGroups
in interfaceYellowpagesService
- Parameters:
pk
- the reference to a node.- Returns:
- a list of
GroupState.VALID
Group
instance.
-
addGroup
public void addGroup(String groupId, org.silverpeas.core.node.model.NodePK nodePK)
- Specified by:
addGroup
in interfaceYellowpagesService
-
removeGroup
public void removeGroup(String groupId)
- Specified by:
removeGroup
in interfaceYellowpagesService
-
removeGroup
public void removeGroup(String groupId, org.silverpeas.core.node.model.NodePK nodePK)
- Specified by:
removeGroup
in interfaceYellowpagesService
-
setModelUsed
public void setModelUsed(String[] models, String instanceId)
- Specified by:
setModelUsed
in interfaceYellowpagesService
-
getModelUsed
public Collection<String> getModelUsed(String instanceId)
- Specified by:
getModelUsed
in interfaceYellowpagesService
-
index
public void index(String instanceId)
- Specified by:
index
in interfaceYellowpagesService
-
-