public class SocialRelationLocalServiceImpl extends SocialRelationLocalServiceBaseImpl
Relations between users can be unidirectional or bidirectional. The type of relation is determined by an integer constant. Some example relations are co-worker, friend, romantic partner, sibling, spouse, child, enemy, follower, parent, subordinate, supervisor.
The two users participating in the relation are designated as User1 and User2. In case of unidirectional relations User1 should always be the subject of the relation. You can use the following English sentence to find out which user to use as User1 and which to use as User2:
User1 is <relation> of User2 (e.g. User1 is parent of User2; User1 is supervisor of User2)
For bidirectional relations, the service automatically generates the inverse relation.
counterLocalService, persistedModelLocalServiceRegistry, resourceLocalService, socialActivityAchievementLocalService, socialActivityAchievementPersistence, socialActivityCounterFinder, socialActivityCounterLocalService, socialActivityCounterPersistence, socialActivityFinder, socialActivityInterpreterLocalService, socialActivityLimitLocalService, socialActivityLimitPersistence, socialActivityLocalService, socialActivityPersistence, socialActivityService, socialActivitySetFinder, socialActivitySetLocalService, socialActivitySetPersistence, socialActivitySettingLocalService, socialActivitySettingPersistence, socialActivitySettingService, socialRelationLocalService, socialRelationPersistence, socialRequestInterpreterLocalService, socialRequestLocalService, socialRequestPersistence, socialRequestService, userFinder, userLocalService, userPersistence, userService| Constructor and Description |
|---|
SocialRelationLocalServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
com.liferay.portlet.social.model.SocialRelation |
addRelation(long userId1,
long userId2,
int type)
Adds a social relation between the two users to the database.
|
void |
deleteRelation(long relationId)
Removes the relation (and its inverse in case of a bidirectional
relation) from the database.
|
void |
deleteRelation(long userId1,
long userId2,
int type)
Removes the matching relation (and its inverse in case of a bidirectional
relation) from the database.
|
void |
deleteRelation(com.liferay.portlet.social.model.SocialRelation relation)
Removes the relation (and its inverse in case of a bidirectional
relation) from the database.
|
void |
deleteRelations(long userId)
Removes all relations involving the user from the database.
|
void |
deleteRelations(long userId1,
long userId2)
Removes all relations between User1 and User2.
|
java.util.List<com.liferay.portlet.social.model.SocialRelation> |
getInverseRelations(long userId,
int type,
int start,
int end)
Returns a range of all the inverse relations of the given type for which
the user is User2 of the relation.
|
int |
getInverseRelationsCount(long userId,
int type)
Returns the number of inverse relations of the given type for which the
user is User2 of the relation.
|
com.liferay.portlet.social.model.SocialRelation |
getRelation(long relationId)
Returns the relation identified by its primary key.
|
com.liferay.portlet.social.model.SocialRelation |
getRelation(long userId1,
long userId2,
int type)
Returns the relation of the given type between User1 and User2.
|
java.util.List<com.liferay.portlet.social.model.SocialRelation> |
getRelations(long userId,
int type,
int start,
int end)
Returns a range of all the relations of the given type where the user is
the subject of the relation.
|
java.util.List<com.liferay.portlet.social.model.SocialRelation> |
getRelations(long userId1,
long userId2,
int start,
int end)
Returns a range of all the relations between User1 and User2.
|
int |
getRelationsCount(long userId,
int type)
Returns the number of relations of the given type where the user is the
subject of the relation.
|
int |
getRelationsCount(long userId1,
long userId2)
Returns the number of relations between User1 and User2.
|
boolean |
hasRelation(long userId1,
long userId2,
int type)
Returns
true if a relation of the given type exists where
the user with primary key userId1 is User1 of the relation
and the user with the primary key userId2 is User2 of the
relation. |
boolean |
isRelatable(long userId1,
long userId2,
int type)
Returns
true if the users can be in a relation of the given
type where the user with primary key userId1 is User1 of the
relation and the user with the primary key userId2 is User2
of the relation. |
addSocialRelation, afterPropertiesSet, createSocialRelation, deleteSocialRelation, deleteSocialRelation, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchSocialRelation, fetchSocialRelationByUuidAndCompanyId, getBeanIdentifier, getCounterLocalService, getModelClass, getModelClassName, getPersistedModel, getResourceLocalService, getSocialActivityAchievementLocalService, getSocialActivityAchievementPersistence, getSocialActivityCounterFinder, getSocialActivityCounterLocalService, getSocialActivityCounterPersistence, getSocialActivityFinder, getSocialActivityInterpreterLocalService, getSocialActivityLimitLocalService, getSocialActivityLimitPersistence, getSocialActivityLocalService, getSocialActivityPersistence, getSocialActivityService, getSocialActivitySetFinder, getSocialActivitySetLocalService, getSocialActivitySetPersistence, getSocialActivitySettingLocalService, getSocialActivitySettingPersistence, getSocialActivitySettingService, getSocialRelation, getSocialRelationByUuidAndCompanyId, getSocialRelationLocalService, getSocialRelationPersistence, getSocialRelations, getSocialRelationsCount, getSocialRequestInterpreterLocalService, getSocialRequestLocalService, getSocialRequestPersistence, getSocialRequestService, getUserFinder, getUserLocalService, getUserPersistence, getUserService, runSQL, setBeanIdentifier, setCounterLocalService, setResourceLocalService, setSocialActivityAchievementLocalService, setSocialActivityAchievementPersistence, setSocialActivityCounterFinder, setSocialActivityCounterLocalService, setSocialActivityCounterPersistence, setSocialActivityFinder, setSocialActivityInterpreterLocalService, setSocialActivityLimitLocalService, setSocialActivityLimitPersistence, setSocialActivityLocalService, setSocialActivityPersistence, setSocialActivityService, setSocialActivitySetFinder, setSocialActivitySetLocalService, setSocialActivitySetPersistence, setSocialActivitySettingLocalService, setSocialActivitySettingPersistence, setSocialActivitySettingService, setSocialRelationLocalService, setSocialRelationPersistence, setSocialRequestInterpreterLocalService, setSocialRequestLocalService, setSocialRequestPersistence, setSocialRequestService, setUserFinder, setUserLocalService, setUserPersistence, setUserService, updateSocialRelationpublic com.liferay.portlet.social.model.SocialRelation addRelation(long userId1,
long userId2,
int type)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationtype - the type of the relationcom.liferay.portal.kernel.exception.PortalException - if the users could not be found, if the users
were not from the same company, or if either of the users was the
default usercom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic void deleteRelation(long relationId)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
relationId - the primary key of the relationcom.liferay.portal.kernel.exception.PortalException - if the relation could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic void deleteRelation(long userId1,
long userId2,
int type)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationtype - the relation's typecom.liferay.portal.kernel.exception.PortalException - if the relation or its inverse relation (if
applicable) could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic void deleteRelation(com.liferay.portlet.social.model.SocialRelation relation)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
relation - the relation to be removedcom.liferay.portal.kernel.exception.PortalException - if the relation is bidirectional and its inverse
relation could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic void deleteRelations(long userId)
throws com.liferay.portal.kernel.exception.SystemException
userId - the primary key of the usercom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic void deleteRelations(long userId1,
long userId2)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationcom.liferay.portal.kernel.exception.PortalException - if the inverse relation could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations(long userId,
int type,
int start,
int end)
throws com.liferay.portal.kernel.exception.SystemException
Useful when paginating results. Returns a maximum of end -
start instances. start and end are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end to QueryUtil.ALL_POS will return the full
result set.
userId - the primary key of the usertype - the relation's typestart - the lower bound of the range of resultsend - the upper bound of the range of results (not inclusive)com.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic int getInverseRelationsCount(long userId,
int type)
throws com.liferay.portal.kernel.exception.SystemException
userId - the primary key of the usertype - the relation's typecom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic com.liferay.portlet.social.model.SocialRelation getRelation(long relationId)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
relationId - the primary key of the relationcom.liferay.portal.kernel.exception.PortalException - if the relation could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic com.liferay.portlet.social.model.SocialRelation getRelation(long userId1,
long userId2,
int type)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationtype - the relation's typecom.liferay.portal.kernel.exception.PortalException - if the relation could not be foundcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations(long userId,
int type,
int start,
int end)
throws com.liferay.portal.kernel.exception.SystemException
Useful when paginating results. Returns a maximum of end -
start instances. start and end are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end to QueryUtil.ALL_POS will return the full
result set.
userId - the primary key of the usertype - the relation's typestart - the lower bound of the range of resultsend - the upper bound of the range of results (not inclusive)com.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations(long userId1,
long userId2,
int start,
int end)
throws com.liferay.portal.kernel.exception.SystemException
Useful when paginating results. Returns a maximum of end -
start instances. start and end are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end to QueryUtil.ALL_POS will return the full
result set.
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationstart - the lower bound of the range of resultsend - the upper bound of the range of results (not inclusive)com.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic int getRelationsCount(long userId,
int type)
throws com.liferay.portal.kernel.exception.SystemException
userId - the primary key of the usertype - the relation's typecom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic int getRelationsCount(long userId1,
long userId2)
throws com.liferay.portal.kernel.exception.SystemException
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationcom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic boolean hasRelation(long userId1,
long userId2,
int type)
throws com.liferay.portal.kernel.exception.SystemException
true if a relation of the given type exists where
the user with primary key userId1 is User1 of the relation
and the user with the primary key userId2 is User2 of the
relation.userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationtype - the relation's typetrue if the relation exists; false
otherwisecom.liferay.portal.kernel.exception.SystemException - if a system exception occurredpublic boolean isRelatable(long userId1,
long userId2,
int type)
throws com.liferay.portal.kernel.exception.SystemException
true if the users can be in a relation of the given
type where the user with primary key userId1 is User1 of the
relation and the user with the primary key userId2 is User2
of the relation.
This method returns false if User1 and User2 are the same,
if either user is the default user, or if a matching relation already
exists.
userId1 - the user that is the subject of the relationuserId2 - the user at the other end of the relationtype - the relation's typetrue if the two users can be in a new relation of
the given type; false otherwisecom.liferay.portal.kernel.exception.SystemException - if a system exception occurred