Class DefaultMyLinksService
- java.lang.Object
-
- org.silverpeas.core.mylinks.service.DefaultMyLinksService
-
- All Implemented Interfaces:
ComponentInstanceDeletion
,MyLinksService
@Singleton public class DefaultMyLinksService extends Object implements MyLinksService, ComponentInstanceDeletion
-
-
Constructor Summary
Constructors Constructor Description DefaultMyLinksService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CategoryDetail
createCategory(CategoryDetail category)
Creates a new category from the data given by theCategoryDetail
parameter.LinkDetail
createLink(LinkDetail link)
Creates a new link from the data given by theLinkDetail
parameter.void
delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance.void
deleteCategories(String[] categoryIds)
Deletes the categories referenced by the given identifiers.void
deleteLinks(String[] links)
Deletes the links referenced by the given identifiers.void
deleteUserData(String userId)
Deletes all the data associated to a user.List<CategoryDetail>
getAllCategoriesByUser(String userId)
Gets all the categories associated to the user represented by the given id.
The result list is sorted byCategoryDetailComparator
.List<LinkDetail>
getAllLinks(String userId)
List<LinkDetail>
getAllLinksByInstance(String instanceId)
Gets all the links associated to the component instance represented by the given id.
The result list is sorted byLinkDetailComparator
.List<LinkDetail>
getAllLinksByObject(String instanceId, String objectId)
Gets all the links associated to the resource represented by the given objectId and hosted into component instance represented by instanceId parameter.
The result list is sorted byLinkDetailComparator
.List<LinkDetail>
getAllLinksByUser(String userId)
Gets all the links associated to the user represented by the given id.
The result list is sorted byLinkDetailComparator
.CategoryDetail
getCategory(String categoryId)
Gets aCategoryDetail
from its identifier.LinkDetail
getLink(String linkId)
Gets aLinkDetail
from its identifier.CategoryDetail
updateCategory(CategoryDetail category)
Updates a category with the givenCategoryDetail
data.LinkDetail
updateLink(LinkDetail link)
Updates a link with the givenLinkDetail
data.
-
-
-
Method Detail
-
delete
public void delete(String componentInstanceId)
Description copied from interface:ComponentInstanceDeletion
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
deleteUserData
public void deleteUserData(String userId)
Description copied from interface:MyLinksService
Deletes all the data associated to a user.Data associated to a user are those with column userid filled with the given identifier and not linked to links which instanceid or objectid is filled.
- Specified by:
deleteUserData
in interfaceMyLinksService
- Parameters:
userId
- a user identifier.
-
getAllCategoriesByUser
public List<CategoryDetail> getAllCategoriesByUser(String userId)
Description copied from interface:MyLinksService
Gets all the categories associated to the user represented by the given id.
The result list is sorted byCategoryDetailComparator
.- Specified by:
getAllCategoriesByUser
in interfaceMyLinksService
- Parameters:
userId
- a user identifier.- Returns:
- a sorted list of category, empty if no category found.
-
createCategory
public CategoryDetail createCategory(CategoryDetail category)
Description copied from interface:MyLinksService
Creates a new category from the data given by theCategoryDetail
parameter.- Specified by:
createCategory
in interfaceMyLinksService
- Parameters:
category
- the data to register.- Returns:
- a new instance representing the data saved into database.
-
getCategory
public CategoryDetail getCategory(String categoryId)
Description copied from interface:MyLinksService
Gets aCategoryDetail
from its identifier.- Specified by:
getCategory
in interfaceMyLinksService
- Parameters:
categoryId
- a category identifier.- Returns:
- a
CategoryDetail
instance, or null if no data.
-
deleteCategories
public void deleteCategories(String[] categoryIds)
Description copied from interface:MyLinksService
Deletes the categories referenced by the given identifiers.- Specified by:
deleteCategories
in interfaceMyLinksService
- Parameters:
categoryIds
- the category identifiers.
-
updateCategory
public CategoryDetail updateCategory(CategoryDetail category)
Description copied from interface:MyLinksService
Updates a category with the givenCategoryDetail
data.- Specified by:
updateCategory
in interfaceMyLinksService
- Parameters:
category
- the data to update.- Returns:
- the updated data.
-
getAllLinks
public List<LinkDetail> getAllLinks(String userId)
- Specified by:
getAllLinks
in interfaceMyLinksService
- See Also:
MyLinksService.getAllLinksByUser(String)
-
getAllLinksByUser
public List<LinkDetail> getAllLinksByUser(String userId)
Description copied from interface:MyLinksService
Gets all the links associated to the user represented by the given id.
The result list is sorted byLinkDetailComparator
.- Specified by:
getAllLinksByUser
in interfaceMyLinksService
- Parameters:
userId
- a user identifier.- Returns:
- a sorted list of links, empty if no link found.
-
getAllLinksByInstance
public List<LinkDetail> getAllLinksByInstance(String instanceId)
Description copied from interface:MyLinksService
Gets all the links associated to the component instance represented by the given id.
The result list is sorted byLinkDetailComparator
.- Specified by:
getAllLinksByInstance
in interfaceMyLinksService
- Parameters:
instanceId
- a component instance identifier.- Returns:
- a sorted list of links, empty if no link found.
-
getAllLinksByObject
public List<LinkDetail> getAllLinksByObject(String instanceId, String objectId)
Description copied from interface:MyLinksService
Gets all the links associated to the resource represented by the given objectId and hosted into component instance represented by instanceId parameter.
The result list is sorted byLinkDetailComparator
.- Specified by:
getAllLinksByObject
in interfaceMyLinksService
- Parameters:
instanceId
- a component instance identifier.objectId
- an identifier of an object.- Returns:
- a sorted list of links, empty if no link found.
-
createLink
public LinkDetail createLink(LinkDetail link)
Description copied from interface:MyLinksService
Creates a new link from the data given by theLinkDetail
parameter.- Specified by:
createLink
in interfaceMyLinksService
- Parameters:
link
- the data to register.- Returns:
- a new instance representing the data saved into database.
-
deleteLinks
public void deleteLinks(String[] links)
Description copied from interface:MyLinksService
Deletes the links referenced by the given identifiers.- Specified by:
deleteLinks
in interfaceMyLinksService
- Parameters:
links
- the link identifiers.
-
updateLink
public LinkDetail updateLink(LinkDetail link)
Description copied from interface:MyLinksService
Updates a link with the givenLinkDetail
data.- Specified by:
updateLink
in interfaceMyLinksService
- Parameters:
link
- the data to update.- Returns:
- the updated data.
-
getLink
public LinkDetail getLink(String linkId)
Description copied from interface:MyLinksService
Gets aLinkDetail
from its identifier.- Specified by:
getLink
in interfaceMyLinksService
- Parameters:
linkId
- a link identifier.- Returns:
- a
LinkDetail
instance, or null if no data.
-
-