Package org.exoplatform.social.metadata
Interface MetadataService
-
public interface MetadataServiceA Service to manage Metadata of any content of any type in eXo Platform. This Service will allow to store additional Metadata to contents without defining additional Services or Storage layers to allow to extends content definition
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMetadataPlugin(MetadataInitPlugin metadataInitPlugin)Save a newMetadatavoidaddMetadataTypePlugin(MetadataTypePlugin metadataTypePlugin)Registers a newMetadataTypeintcountMetadataItemsByMetadataTypeAndCreator(String metadataTypeName, long creatorId)Count the size of metadata items to a givenMetadatatype,MetadataItemcreatorIdMetadatacreateMetadata(Metadata metadata, long userIdentityId)Creates a newMetadataobjectMetadataItemcreateMetadataItem(MetadataObject metadataObject, MetadataKey metadataKey, long userIdentityId)Creates a new Metadata Item.MetadataItemcreateMetadataItem(MetadataObject metadataObject, MetadataKey metadataKey, Map<String,String> properties, long userIdentityId)Creates a new Metadata Item.MetadatadeleteMetadataById(long metadataId)intdeleteMetadataBySpaceId(long spaceId)Deletes allMetadataItemby a givenSpaceidentifierintdeleteMetadataBySpaceIdAndAudienceId(long spaceId, long audienceId)MetadataItemdeleteMetadataItem(long itemId, boolean broadcast)MetadataItemdeleteMetadataItem(long itemId, long userIdentityId)voiddeleteMetadataItemsByMetadataTypeAndObject(String metadataType, MetadataObject object)Deletes Metadata items for a givenMetadatatype, objectId and objectType.voiddeleteMetadataItemsByObject(MetadataObject object)Deletes Metadata items for a givenMetadataItemobjectId and objectType.voiddeleteMetadataItemsByParentObject(MetadataObject object)Deletes Metadata items for a givenMetadataItemparentObjectId and objectType.List<String>findMetadataNamesByAudiences(String term, String metadataTypeName, Set<Long> audienceIds, long limit)List<String>findMetadataNamesByCreator(String term, String metadataTypeName, long creatorId, long limit)List<String>findMetadataNamesByUserAndQuery(String term, String metadataTypeName, Set<Long> audienceIds, long creatorId, long limit)MetadatagetMetadataByKey(MetadataKey metadataKey)Retrieves aMetadataidentified by a unique constraint for 'Metadata Type', 'Metadata Name' and 'Metadata Audience'.List<MetadataItem>getMetadataItemsByMetadataAndObject(MetadataKey metadataKey, MetadataObject object)Retrieves the list of Metadata items attached to aMetadataKeyand an object identified by its name and identifierList<MetadataItem>getMetadataItemsByMetadataNameAndTypeAndObject(String metadataName, String metadataTypeName, String objectType, long offset, long limit)Retrieves the Metadata item attached to a givenMetadataname, type andMetadataItemobject typeList<MetadataItem>getMetadataItemsByMetadataNameAndTypeAndObjectAndMetadataItemProperty(String metadataName, String metadataTypeName, String objectType, String propertyKey, String propertyValue, long offset, long limit)Retrieves the Metadata item attached to a givenMetadataname, type,MetadataItemobject type andMetadataItempropertyList<MetadataItem>getMetadataItemsByMetadataTypeAndCreator(String metadataTypeName, long creatorId, long offset, long limit)Retrieves the Metadata item attached to a givenMetadatatype,MetadataItemcreatorIdList<MetadataItem>getMetadataItemsByMetadataTypeAndObject(String metadataType, MetadataObject object)Retrieves the list of Metadata items attached to a givenMetadatatype and an object identified by its name and identifierList<MetadataItem>getMetadataItemsByObject(MetadataObject object)Retrieves the list of Metadata attached to an object identified by its name and identifierSet<String>getMetadataNamesByObject(MetadataObject object)List<String>getMetadataObjectIds(String metadataType, String metadataName, String objectType, long offset, long limit)Retieves a list of object identifiers switch Metadata type, name and objectTypeList<Metadata>getMetadatas(String metadataTypeName, long limit)List<Metadata>getMetadatasByProperty(String propertyKey, String propertyValue, long limit)MetadataTypegetMetadataTypeByName(String name)Retrieves a registeredMetadataTypeby nameMetadataTypePlugingetMetadataTypePluginByName(String name)Retrieves a registeredMetadataTypePluginby nameList<MetadataType>getMetadataTypes()List<MetadataItem>shareMetadataItemsByObject(MetadataObject sourceObject, String targetObjectId, long audienceId, long creatorId)Shares/copy theMetadataItemlist of a shared object to the newly created object.MetadataupdateMetadata(Metadata metadata, long userIdentityId)Updates aMetadataobject
-
-
-
Method Detail
-
createMetadata
Metadata createMetadata(Metadata metadata, long userIdentityId)
Creates a newMetadataobject
-
updateMetadata
Metadata updateMetadata(Metadata metadata, long userIdentityId)
Updates aMetadataobject
-
deleteMetadataById
Metadata deleteMetadataById(long metadataId)
-
deleteMetadataBySpaceId
int deleteMetadataBySpaceId(long spaceId)
Deletes allMetadataItemby a givenSpaceidentifier- Parameters:
spaceId-Spacetechnical identifier- Returns:
- deleted items count
-
deleteMetadataBySpaceIdAndAudienceId
int deleteMetadataBySpaceIdAndAudienceId(long spaceId, long audienceId)- Parameters:
spaceId-audienceId-- Returns:
- deleted items count
-
getMetadataByKey
Metadata getMetadataByKey(MetadataKey metadataKey)
Retrieves aMetadataidentified by a unique constraint for 'Metadata Type', 'Metadata Name' and 'Metadata Audience'.- Parameters:
metadataKey-MetadataKeythat containsMetadataTypenameMetadataname andMetadataaudience- Returns:
Metadataif found, else null
-
createMetadataItem
MetadataItem createMetadataItem(MetadataObject metadataObject, MetadataKey metadataKey, long userIdentityId) throws ObjectAlreadyExistsException
Creates a new Metadata Item. When the metadata with the designated key doesn't exists, it will create a new one- Parameters:
metadataObject- object to storemetadataKey-MetadataKeythat containsMetadataTypenameMetadataname andMetadataaudienceuserIdentityId-Identitytechnical identifier designating the user making the operation- Returns:
- Created
MetadataItem - Throws:
ObjectAlreadyExistsException- when theMetadataTypePlugindoesn't allow multiple objects perMetadataand an object is already associated to the designatedMetadata
-
createMetadataItem
MetadataItem createMetadataItem(MetadataObject metadataObject, MetadataKey metadataKey, Map<String,String> properties, long userIdentityId) throws ObjectAlreadyExistsException
Creates a new Metadata Item. When the metadata with the designated key doesn't exists, it will create a new one- Parameters:
metadataObject- object to storemetadataKey-MetadataKeythat containsMetadataTypenameMetadataname andMetadataaudienceproperties-Mapproperties ofMetadataItemuserIdentityId-Identitytechnical identifier designating the user making the operation- Returns:
- Created
MetadataItem - Throws:
ObjectAlreadyExistsException- when theMetadataTypePlugindoesn't allow multiple objects perMetadataand an object is already associated to the designatedMetadata
-
deleteMetadataItem
MetadataItem deleteMetadataItem(long itemId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException
- Parameters:
itemId-MetadataItemtechnical identifieruserIdentityId-Identitytechnical identifier designating the user making the operation- Returns:
- Deleted
MetadataItem - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theMetadataItemisn't found
-
deleteMetadataItem
MetadataItem deleteMetadataItem(long itemId, boolean broadcast) throws org.exoplatform.commons.exception.ObjectNotFoundException
- Parameters:
itemId-MetadataItemtechnical identifierbroadcast- whether broadcast event after deleting or not- Returns:
- Deleted
MetadataItem - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theMetadataItemisn't found
-
deleteMetadataItemsByObject
void deleteMetadataItemsByObject(MetadataObject object)
Deletes Metadata items for a givenMetadataItemobjectId and objectType. This is generally called when the associated object has been removed (activity removed, comment removed ...)- Parameters:
object-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).
-
deleteMetadataItemsByMetadataTypeAndObject
void deleteMetadataItemsByMetadataTypeAndObject(String metadataType, MetadataObject object)
Deletes Metadata items for a givenMetadatatype, objectId and objectType. This is generally called when the associated object has been removed (activity removed, comment removed ...)- Parameters:
metadataType-Metadatatypeobject-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).
-
shareMetadataItemsByObject
List<MetadataItem> shareMetadataItemsByObject(MetadataObject sourceObject, String targetObjectId, long audienceId, long creatorId)
Shares/copy theMetadataItemlist of a shared object to the newly created object.- Parameters:
sourceObject-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).targetObjectId- target content that will receive the metadata itemsaudienceId- targeted audienceIdentityidentifiercreatorId-Identityidentifier of user sharing object- Returns:
- newly created
MetadataItemassociated to targetObjectId
-
getMetadataNamesByObject
Set<String> getMetadataNamesByObject(MetadataObject object)
-
getMetadataItemsByObject
List<MetadataItem> getMetadataItemsByObject(MetadataObject object)
Retrieves the list of Metadata attached to an object identified by its name and identifier- Parameters:
object-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).- Returns:
Listof linkedMetadataItem
-
getMetadataItemsByMetadataTypeAndObject
List<MetadataItem> getMetadataItemsByMetadataTypeAndObject(String metadataType, MetadataObject object)
Retrieves the list of Metadata items attached to a givenMetadatatype and an object identified by its name and identifier- Parameters:
metadataType-Metadatatypeobject-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).- Returns:
Listof linkedMetadataItem
-
getMetadataItemsByMetadataNameAndTypeAndObject
List<MetadataItem> getMetadataItemsByMetadataNameAndTypeAndObject(String metadataName, String metadataTypeName, String objectType, long offset, long limit)
Retrieves the Metadata item attached to a givenMetadataname, type andMetadataItemobject type- Parameters:
metadataName-MetadatanamemetadataTypeName-Metadatatype nameobjectType- objectTypeMetadataItemobjectTypeoffset- offset of ids to retrievelimit- limit of ids to retrieve- Returns:
Listof linkedMetadataItem
-
getMetadataItemsByMetadataNameAndTypeAndObjectAndMetadataItemProperty
List<MetadataItem> getMetadataItemsByMetadataNameAndTypeAndObjectAndMetadataItemProperty(String metadataName, String metadataTypeName, String objectType, String propertyKey, String propertyValue, long offset, long limit)
Retrieves the Metadata item attached to a givenMetadataname, type,MetadataItemobject type andMetadataItemproperty- Parameters:
metadataName-MetadatanamemetadataTypeName-Metadatatype nameobjectType- objectTypeMetadataItemobjectTypepropertyKey-MetadataItemproperty keypropertyValue-MetadataItemproperty valueoffset- offset of ids to retrievelimit- limit of ids to retrieve- Returns:
Listof linkedMetadataItem
-
getMetadataItemsByMetadataTypeAndCreator
List<MetadataItem> getMetadataItemsByMetadataTypeAndCreator(String metadataTypeName, long creatorId, long offset, long limit)
Retrieves the Metadata item attached to a givenMetadatatype,MetadataItemcreatorId- Parameters:
metadataTypeName-MetadatatypecreatorId-MetadataItemcreatorIdoffset- offset of ids to retrievelimit- limit of ids to retrieve- Returns:
Listof linkedMetadataItem
-
countMetadataItemsByMetadataTypeAndCreator
int countMetadataItemsByMetadataTypeAndCreator(String metadataTypeName, long creatorId)
Count the size of metadata items to a givenMetadatatype,MetadataItemcreatorId- Parameters:
metadataTypeName-MetadatatypecreatorId-MetadataItemcreatorId- Returns:
- integer
-
getMetadataItemsByMetadataAndObject
List<MetadataItem> getMetadataItemsByMetadataAndObject(MetadataKey metadataKey, MetadataObject object)
Retrieves the list of Metadata items attached to aMetadataKeyand an object identified by its name and identifier- Parameters:
metadataKey-MetadataKeythat containsMetadataTypenameMetadataname andMetadataaudienceobject-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and an objectId (the object technical identifier. In general we use here the DB identifier of the object).- Returns:
Listof linkedMetadataItem
-
getMetadataObjectIds
List<String> getMetadataObjectIds(String metadataType, String metadataName, String objectType, long offset, long limit)
Retieves a list of object identifiers switch Metadata type, name and objectType- Parameters:
metadataType-MetadatatypemetadataName-MetadatanameobjectType-MetadataItemobjectTypeoffset- offset of ids to retrievelimit- limit of ids to retrieve- Returns:
Listof associated objects ordered byMetadataItemcreationDate desc
-
addMetadataTypePlugin
void addMetadataTypePlugin(MetadataTypePlugin metadataTypePlugin)
Registers a newMetadataType- Parameters:
metadataTypePlugin- aComponentPlugindefiningMetadataTypeto register
-
addMetadataPlugin
void addMetadataPlugin(MetadataInitPlugin metadataInitPlugin)
Save a newMetadata- Parameters:
metadataInitPlugin- aComponentPlugindefiningMetadatato save
-
getMetadataTypePluginByName
MetadataTypePlugin getMetadataTypePluginByName(String name)
Retrieves a registeredMetadataTypePluginby name- Parameters:
name-MetadataTypename- Returns:
MetadataTypePlugin
-
getMetadataTypeByName
MetadataType getMetadataTypeByName(String name)
Retrieves a registeredMetadataTypeby name- Parameters:
name-MetadataTypename- Returns:
MetadataType
-
getMetadataTypes
List<MetadataType> getMetadataTypes()
- Returns:
Listof ManagedMetadataType
-
getMetadatasByProperty
List<Metadata> getMetadatasByProperty(String propertyKey, String propertyValue, long limit)
-
deleteMetadataItemsByParentObject
void deleteMetadataItemsByParentObject(MetadataObject object)
Deletes Metadata items for a givenMetadataItemparentObjectId and objectType. This is generally called when the associated parent object has been removed (activity removed bu example, its comments metadata items has to be deleted as well)- Parameters:
object-MetadataObjectthat defines an objectType (an object type identifier like, ACTIVITY, COMMENT, NOTE, FILE ...) and a parentObjectId (the object technical identifier. In general we use here the DB identifier of the object).
-
findMetadataNamesByAudiences
List<String> findMetadataNamesByAudiences(String term, String metadataTypeName, Set<Long> audienceIds, long limit)
-
findMetadataNamesByCreator
List<String> findMetadataNamesByCreator(String term, String metadataTypeName, long creatorId, long limit)
- Parameters:
term- Search query matchingMetadatanamemetadataTypeName-MetadataTypenamecreatorId-Identityidentifier of creatorlimit- limit of results to retrieve- Returns:
ListofMetadatanames
-
-