Class AssetTagLocalServiceImpl

Object
com.liferay.portal.kernel.service.BaseLocalServiceImpl
com.liferay.portlet.asset.service.base.AssetTagLocalServiceBaseImpl
com.liferay.portlet.asset.service.impl.AssetTagLocalServiceImpl
All Implemented Interfaces:
com.liferay.asset.kernel.service.AssetTagLocalService, com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService, com.liferay.portal.kernel.service.BaseLocalService, com.liferay.portal.kernel.service.change.tracking.CTService<com.liferay.asset.kernel.model.AssetTag>, com.liferay.portal.kernel.service.PersistedModelLocalService

public class AssetTagLocalServiceImpl extends AssetTagLocalServiceBaseImpl
Provides the local service for accessing, adding, checking, deleting, merging, and updating asset tags.
Author:
Brian Wing Shun Chan, Alvaro del Castillo, Jorge Ferrer, Bruno Farache
  • Constructor Details

    • AssetTagLocalServiceImpl

      public AssetTagLocalServiceImpl()
  • Method Details

    • addTag

      @Indexable(type=REINDEX) public com.liferay.asset.kernel.model.AssetTag addTag(String externalReferenceCode, long userId, long groupId, String name, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
      Adds an asset tag.
      Parameters:
      externalReferenceCode -
      userId - the primary key of the user adding the asset tag
      groupId - the primary key of the group in which the asset tag is to be added
      name - the asset tag's name
      serviceContext - the service context to be applied
      Returns:
      the asset tag that was added
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkTags

      public List<com.liferay.asset.kernel.model.AssetTag> checkTags(long userId, com.liferay.portal.kernel.model.Group group, String[] names) throws com.liferay.portal.kernel.exception.PortalException
      Returns the asset tags matching the group and names, creating new asset tags matching the names if the group doesn't already have them.

      For each name, if an asset tag with the name doesn't already exist in the group, this method creates a new asset tag with the name in the group.

      Parameters:
      userId - the primary key of the user checking the asset tags
      group - the group in which to check the asset tags
      names - the asset tag names
      Returns:
      the asset tags matching the group and names and new asset tags matching the names that don't already exist in the group
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkTags

      public List<com.liferay.asset.kernel.model.AssetTag> checkTags(long userId, long groupId, String[] names) throws com.liferay.portal.kernel.exception.PortalException
      Returns the asset tags matching the group and names, creating new asset tags matching the names if the group doesn't already have them.
      Parameters:
      userId - the primary key of the user checking the asset tags
      groupId - the primary key of the group in which check the asset tags
      names - the asset tag names
      Returns:
      the asset tags matching the group and names and new asset tags matching the names that don't already exist in the group
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • decrementAssetCount

      @Indexable(type=REINDEX) public com.liferay.asset.kernel.model.AssetTag decrementAssetCount(long tagId, long classNameId) throws com.liferay.portal.kernel.exception.PortalException
      Decrements the number of assets to which the asset tag has been applied.
      Parameters:
      tagId - the primary key of the asset tag
      classNameId - the class name ID of the entity to which the asset tag had been applied
      Returns:
      the asset tag
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteGroupTags

      public void deleteGroupTags(long groupId) throws com.liferay.portal.kernel.exception.PortalException
      Deletes all asset tags in the group.
      Parameters:
      groupId - the primary key of the group in which to delete all asset tags
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteTag

      @SystemEvent(type=1) public void deleteTag(com.liferay.asset.kernel.model.AssetTag tag) throws com.liferay.portal.kernel.exception.PortalException
      Deletes the asset tag.
      Parameters:
      tag - the asset tag to be deleted
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteTag

      public void deleteTag(long tagId) throws com.liferay.portal.kernel.exception.PortalException
      Deletes the asset tag.
      Parameters:
      tagId - the primary key of the asset tag
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • fetchTag

      public com.liferay.asset.kernel.model.AssetTag fetchTag(long groupId, String name)
      Returns the asset tag with the name in the group.
      Parameters:
      groupId - the primary key of the group
      name - the asset tag's name
      Returns:
      the asset tag with the name in the group or null if it could not be found
    • getEntryTags

      public List<com.liferay.asset.kernel.model.AssetTag> getEntryTags(long entryId)
      Returns the asset tags of the asset entry.
      Parameters:
      entryId - the primary key of the asset entry
      Returns:
      the asset tags of the asset entry
    • getGroupsTags

      public List<com.liferay.asset.kernel.model.AssetTag> getGroupsTags(long[] groupIds)
      Returns the asset tags in the groups.
      Parameters:
      groupIds - the primary keys of the groups
      Returns:
      the asset tags in the groups
    • getGroupTags

      public List<com.liferay.asset.kernel.model.AssetTag> getGroupTags(long groupId)
      Returns the asset tags in the group.
      Parameters:
      groupId - the primary key of the group
      Returns:
      the asset tags in the group
    • getGroupTags

      public List<com.liferay.asset.kernel.model.AssetTag> getGroupTags(long groupId, int start, int end)
      Returns a range of all the asset tags in the group.
      Parameters:
      groupId - the primary key of the group
      start - the lower bound of the range of asset tags
      end - the upper bound of the range of asset tags (not inclusive)
      Returns:
      the range of matching asset tags
    • getGroupTags

      public List<com.liferay.asset.kernel.model.AssetTag> getGroupTags(long groupId, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<com.liferay.asset.kernel.model.AssetTag> orderByComparator)
      Returns a range of all the asset tags in the group.
      Parameters:
      groupId - the primary key of the group
      start - the lower bound of the range of asset tags
      end - the upper bound of the range of asset tags (not inclusive)
      orderByComparator - the comparator to order the asset tags (optionally null)
      Returns:
      the range of matching asset tags
    • getGroupTagsCount

      public int getGroupTagsCount(long groupId)
      Returns the number of asset tags in the group.
      Parameters:
      groupId - the primary key of the group
      Returns:
      the number of asset tags in the group
    • getTag

      public com.liferay.asset.kernel.model.AssetTag getTag(long tagId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the asset tag with the primary key.
      Parameters:
      tagId - the primary key of the asset tag
      Returns:
      the asset tag with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTag

      public com.liferay.asset.kernel.model.AssetTag getTag(long groupId, String name) throws com.liferay.portal.kernel.exception.PortalException
      Returns the asset tag with the name in the group.
      Parameters:
      groupId - the primary key of the group
      name - the name of the asset tag
      Returns:
      the asset tag with the name in the group
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTagIds

      public long[] getTagIds(long groupId, String[] names)
      Returns the primary keys of the asset tags with the names in the group.
      Parameters:
      groupId - the primary key of the group
      names - the names of the asset tags
      Returns:
      the primary keys of the asset tags with the names in the group
    • getTagIds

      public long[] getTagIds(long[] groupIds, String name)
      Returns the primary keys of the asset tags with the name in the groups.
      Parameters:
      groupIds - the primary keys of the groups
      name - the name of the asset tags
      Returns:
      the primary keys of the asset tags with the name in the groups
    • getTagIds

      public long[] getTagIds(long[] groupIds, String[] names)
      Returns the primary keys of the asset tags with the names in the groups.
      Parameters:
      groupIds - the primary keys of the groups
      names - the names of the asset tags
      Returns:
      the primary keys of the asset tags with the names in the groups
    • getTagIds

      public long[] getTagIds(String name)
      Returns the primary keys of the asset tags with the names.
      Parameters:
      name - the name of the asset tags
      Returns:
      the primary keys of the asset tags with the names
    • getTagNames

      public String[] getTagNames()
      Returns the names of all the asset tags.
      Returns:
      the names of all the asset tags
    • getTagNames

      public String[] getTagNames(long classNameId, long classPK)
      Returns the names of the asset tags of the entity.
      Parameters:
      classNameId - the class name ID of the entity
      classPK - the primary key of the entity
      Returns:
      the names of the asset tags of the entity
    • getTagNames

      public String[] getTagNames(String className, long classPK)
      Returns the names of the asset tags of the entity
      Parameters:
      className - the class name of the entity
      classPK - the primary key of the entity
      Returns:
      the names of the asset tags of the entity
    • getTags

      public List<com.liferay.asset.kernel.model.AssetTag> getTags()
      Returns all the asset tags.
      Returns:
      the asset tags
    • getTags

      public List<com.liferay.asset.kernel.model.AssetTag> getTags(long classNameId, long classPK)
      Returns the asset tags of the entity.
      Parameters:
      classNameId - the class name ID of the entity
      classPK - the primary key of the entity
      Returns:
      the asset tags of the entity
    • getTags

      public List<com.liferay.asset.kernel.model.AssetTag> getTags(long groupId, long classNameId, String name)
    • getTags

      public List<com.liferay.asset.kernel.model.AssetTag> getTags(long groupId, long classNameId, String name, int start, int end)
    • getTags

      @ThreadLocalCachable public List<com.liferay.asset.kernel.model.AssetTag> getTags(String className, long classPK)
      Returns the asset tags of the entity.
      Parameters:
      className - the class name of the entity
      classPK - the primary key of the entity
      Returns:
      the asset tags of the entity
    • getTagsSize

      public int getTagsSize(long groupId, long classNameId, String name)
    • hasTag

      public boolean hasTag(long groupId, String name)
      Returns true if the group contains an asset tag with the name.
      Parameters:
      groupId - the primary key of the group
      name - the name of the asset tag
      Returns:
      true if the group contains an asset tag with the name; false otherwise.
    • incrementAssetCount

      @BufferedIncrement(incrementClass=com.liferay.portal.kernel.increment.NumberIncrement.class) @Indexable(type=REINDEX) public com.liferay.asset.kernel.model.AssetTag incrementAssetCount(long tagId, long classNameId) throws com.liferay.portal.kernel.exception.PortalException
      Increments the number of assets to which the asset tag has been applied.
      Parameters:
      tagId - the primary key of the asset tag
      classNameId - the class name ID of the entity to which the asset tag is being applied
      Returns:
      the asset tag
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • mergeTags

      public void mergeTags(long fromTagId, long toTagId) throws com.liferay.portal.kernel.exception.PortalException
      Replaces all occurrences of the first asset tag with the second asset tag and deletes the first asset tag.
      Parameters:
      fromTagId - the primary key of the asset tag to be replaced
      toTagId - the primary key of the asset tag to apply to the asset entries of the other asset tag
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • search

      public List<com.liferay.asset.kernel.model.AssetTag> search(long groupId, String name, int start, int end)
      Returns the asset tags in the group whose names match the pattern.
      Parameters:
      groupId - the primary key of the group
      name - the pattern to match
      start - the lower bound of the range of asset tags
      end - the upper bound of the range of asset tags (not inclusive)
      Returns:
      the asset tags in the group whose names match the pattern
    • search

      public List<com.liferay.asset.kernel.model.AssetTag> search(long[] groupIds, String name, int start, int end)
      Returns the asset tags in the groups whose names match the pattern.
      Parameters:
      groupIds - the primary keys of the groups
      name - the pattern to match
      start - the lower bound of the range of asset tags
      end - the upper bound of the range of asset tags (not inclusive)
      Returns:
      the asset tags in the groups whose names match the pattern
    • searchTags

      public com.liferay.portal.kernel.search.BaseModelSearchResult<com.liferay.asset.kernel.model.AssetTag> searchTags(long[] groupIds, String name, int start, int end, com.liferay.portal.kernel.search.Sort sort) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • subscribeTag

      public void subscribeTag(long userId, long groupId, long tagId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • unsubscribeTag

      public void unsubscribeTag(long userId, long tagId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateTag

      @Indexable(type=REINDEX) public com.liferay.asset.kernel.model.AssetTag updateTag(String externalReferenceCode, long userId, long tagId, String name, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • buildSearchContext

      protected com.liferay.portal.kernel.search.SearchContext buildSearchContext(long companyId, long[] groupIds, String name, int start, int end, com.liferay.portal.kernel.search.Sort sort)
    • getTagNames

      protected String[] getTagNames(List<com.liferay.asset.kernel.model.AssetTag> tags)
    • getTags

      protected List<com.liferay.asset.kernel.model.AssetTag> getTags(com.liferay.portal.kernel.search.Hits hits) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • searchTags

      protected com.liferay.portal.kernel.search.BaseModelSearchResult<com.liferay.asset.kernel.model.AssetTag> searchTags(com.liferay.portal.kernel.search.SearchContext searchContext) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validate

      protected void validate(String name) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException