public class SocialRelationLocalServiceUtil
extends Object
com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl
and
is an access point for service operations in application layer code running
on the local server. Methods of this service will not have security checks
based on the propagated JAAS credentials because this service can only be
accessed from within the same VM.SocialRelationLocalService
Constructor and Description |
---|
SocialRelationLocalServiceUtil() |
Modifier and Type | Method and Description |
---|---|
static SocialRelation |
addRelation(long userId1,
long userId2,
int type)
Adds a social relation between the two users to the database.
|
static SocialRelation |
addSocialRelation(SocialRelation socialRelation)
Adds the social relation to the database.
|
static PersistedModel |
createPersistedModel(Serializable primaryKeyObj) |
static SocialRelation |
createSocialRelation(long relationId)
Creates a new social relation with the primary key.
|
static PersistedModel |
deletePersistedModel(PersistedModel persistedModel) |
static void |
deleteRelation(long relationId)
Removes the relation (and its inverse in case of a bidirectional
relation) from the database.
|
static void |
deleteRelation(long userId1,
long userId2,
int type)
Removes the matching relation (and its inverse in case of a bidirectional
relation) from the database.
|
static void |
deleteRelation(SocialRelation relation)
Removes the relation (and its inverse in case of a bidirectional
relation) from the database.
|
static void |
deleteRelations(long userId)
Removes all relations involving the user from the database.
|
static void |
deleteRelations(long userId1,
long userId2)
Removes all relations between User1 and User2.
|
static SocialRelation |
deleteSocialRelation(long relationId)
Deletes the social relation with the primary key from the database.
|
static SocialRelation |
deleteSocialRelation(SocialRelation socialRelation)
Deletes the social relation from the database.
|
static <T> T |
dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) |
static DynamicQuery |
dynamicQuery() |
static <T> List<T> |
dynamicQuery(DynamicQuery dynamicQuery)
Performs a dynamic query on the database and returns the matching rows.
|
static <T> List<T> |
dynamicQuery(DynamicQuery dynamicQuery,
int start,
int end)
Performs a dynamic query on the database and returns a range of the matching rows.
|
static <T> List<T> |
dynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator<T> orderByComparator)
Performs a dynamic query on the database and returns an ordered range of the matching rows.
|
static long |
dynamicQueryCount(DynamicQuery dynamicQuery)
Returns the number of rows matching the dynamic query.
|
static long |
dynamicQueryCount(DynamicQuery dynamicQuery,
Projection projection)
Returns the number of rows matching the dynamic query.
|
static SocialRelation |
fetchSocialRelation(long relationId) |
static SocialRelation |
fetchSocialRelationByUuidAndCompanyId(String uuid,
long companyId)
Returns the social relation with the matching UUID and company.
|
static ActionableDynamicQuery |
getActionableDynamicQuery() |
static IndexableActionableDynamicQuery |
getIndexableActionableDynamicQuery() |
static List<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.
|
static 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.
|
static String |
getOSGiServiceIdentifier()
Returns the OSGi service identifier.
|
static PersistedModel |
getPersistedModel(Serializable primaryKeyObj) |
static SocialRelation |
getRelation(long relationId)
Returns the relation identified by its primary key.
|
static SocialRelation |
getRelation(long userId1,
long userId2,
int type)
Returns the relation of the given type between User1 and User2.
|
static List<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.
|
static List<SocialRelation> |
getRelations(long userId1,
long userId2,
int start,
int end)
Returns a range of all the relations between User1 and User2.
|
static int |
getRelationsCount(long userId,
int type)
Returns the number of relations of the given type where the user is the
subject of the relation.
|
static int |
getRelationsCount(long userId1,
long userId2)
Returns the number of relations between User1 and User2.
|
static SocialRelationLocalService |
getService() |
static SocialRelation |
getSocialRelation(long relationId)
Returns the social relation with the primary key.
|
static SocialRelation |
getSocialRelationByUuidAndCompanyId(String uuid,
long companyId)
Returns the social relation with the matching UUID and company.
|
static List<SocialRelation> |
getSocialRelations(int start,
int end)
Returns a range of all the social relations.
|
static int |
getSocialRelationsCount()
Returns the number of social relations.
|
static 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. |
static 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. |
static SocialRelation |
updateSocialRelation(SocialRelation socialRelation)
Updates the social relation in the database or adds it if it does not yet exist.
|
public static SocialRelation addRelation(long userId1, long userId2, int type) throws PortalException
userId1
- the user that is the subject of the relationuserId2
- the user at the other end of the relationtype
- the type of the relationPortalException
public static SocialRelation addSocialRelation(SocialRelation socialRelation)
Important: Inspect SocialRelationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
socialRelation
- the social relationpublic static PersistedModel createPersistedModel(Serializable primaryKeyObj) throws PortalException
PortalException
public static SocialRelation createSocialRelation(long relationId)
relationId
- the primary key for the new social relationpublic static PersistedModel deletePersistedModel(PersistedModel persistedModel) throws PortalException
PortalException
public static void deleteRelation(long relationId) throws PortalException
relationId
- the primary key of the relationPortalException
public static void deleteRelation(long userId1, long userId2, int type) throws PortalException
userId1
- the user that is the subject of the relationuserId2
- the user at the other end of the relationtype
- the relation's typePortalException
public static void deleteRelation(SocialRelation relation) throws PortalException
relation
- the relation to be removedPortalException
public static void deleteRelations(long userId)
userId
- the primary key of the userpublic static void deleteRelations(long userId1, long userId2) throws PortalException
userId1
- the user that is the subject of the relationuserId2
- the user at the other end of the relationPortalException
public static SocialRelation deleteSocialRelation(long relationId) throws PortalException
Important: Inspect SocialRelationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
relationId
- the primary key of the social relationPortalException
- if a social relation with the primary key could not be foundpublic static SocialRelation deleteSocialRelation(SocialRelation socialRelation)
Important: Inspect SocialRelationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
socialRelation
- the social relationpublic static <T> T dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery)
public static DynamicQuery dynamicQuery()
public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portlet.social.model.impl.SocialRelationModelImpl
.
dynamicQuery
- the dynamic querystart
- the lower bound of the range of model instancesend
- the upper bound of the range of model instances (not inclusive)public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator)
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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portlet.social.model.impl.SocialRelationModelImpl
.
dynamicQuery
- the dynamic querystart
- the lower bound of the range of model instancesend
- the upper bound of the range of model instances (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static long dynamicQueryCount(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static long dynamicQueryCount(DynamicQuery dynamicQuery, Projection projection)
dynamicQuery
- the dynamic queryprojection
- the projection to apply to the querypublic static SocialRelation fetchSocialRelation(long relationId)
public static SocialRelation fetchSocialRelationByUuidAndCompanyId(String uuid, long companyId)
uuid
- the social relation's UUIDcompanyId
- the primary key of the companynull
if a matching social relation could not be foundpublic static ActionableDynamicQuery getActionableDynamicQuery()
public static IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()
public static List<SocialRelation> getInverseRelations(long userId, int type, int start, int end)
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)public static int getInverseRelationsCount(long userId, int type)
userId
- the primary key of the usertype
- the relation's typepublic static String getOSGiServiceIdentifier()
public static PersistedModel getPersistedModel(Serializable primaryKeyObj) throws PortalException
PortalException
public static SocialRelation getRelation(long relationId) throws PortalException
relationId
- the primary key of the relationPortalException
public static SocialRelation getRelation(long userId1, long userId2, int type) throws PortalException
userId1
- the user that is the subject of the relationuserId2
- the user at the other end of the relationtype
- the relation's typePortalException
public static List<SocialRelation> getRelations(long userId, int type, int start, int end)
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)public static List<SocialRelation> getRelations(long userId1, long userId2, int start, int end)
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)public static int getRelationsCount(long userId, int type)
userId
- the primary key of the usertype
- the relation's typepublic static int getRelationsCount(long userId1, long userId2)
userId1
- the user that is the subject of the relationuserId2
- the user at the other end of the relationpublic static SocialRelation getSocialRelation(long relationId) throws PortalException
relationId
- the primary key of the social relationPortalException
- if a social relation with the primary key could not be foundpublic static SocialRelation getSocialRelationByUuidAndCompanyId(String uuid, long companyId) throws PortalException
uuid
- the social relation's UUIDcompanyId
- the primary key of the companyPortalException
- if a matching social relation could not be foundpublic static List<SocialRelation> getSocialRelations(int start, int end)
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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portlet.social.model.impl.SocialRelationModelImpl
.
start
- the lower bound of the range of social relationsend
- the upper bound of the range of social relations (not inclusive)public static int getSocialRelationsCount()
public static boolean hasRelation(long userId1, long userId2, int type)
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
otherwisepublic static boolean isRelatable(long userId1, long userId2, int type)
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
otherwisepublic static SocialRelation updateSocialRelation(SocialRelation socialRelation)
Important: Inspect SocialRelationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
socialRelation
- the social relationpublic static SocialRelationLocalService getService()