Liferay 7.0-ce-b4

com.liferay.portlet.social.service
Class SocialRelationLocalServiceUtil

java.lang.Object
  extended by com.liferay.portlet.social.service.SocialRelationLocalServiceUtil

@ProviderType
public class SocialRelationLocalServiceUtil
extends Object

Provides the local service utility for SocialRelation. This utility wraps SocialRelationLocalServiceImpl and is the primary 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.

See Also:
SocialRelationLocalService, SocialRelationLocalServiceBaseImpl, SocialRelationLocalServiceImpl
ServiceBuilder generated this class. Modifications in this class will be overwritten the next time it is generated.

Constructor Summary
SocialRelationLocalServiceUtil()
           
 
Method Summary
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 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialRelationLocalServiceUtil

public SocialRelationLocalServiceUtil()
Method Detail

addRelation

public static SocialRelation addRelation(long userId1,
                                         long userId2,
                                         int type)
                                  throws PortalException
Adds a social relation between the two users to the database.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
type - the type of the relation
Returns:
the social relation
Throws:
PortalException

addSocialRelation

public static SocialRelation addSocialRelation(SocialRelation socialRelation)
Adds the social relation to the database. Also notifies the appropriate model listeners.

Parameters:
socialRelation - the social relation
Returns:
the social relation that was added

createSocialRelation

public static SocialRelation createSocialRelation(long relationId)
Creates a new social relation with the primary key. Does not add the social relation to the database.

Parameters:
relationId - the primary key for the new social relation
Returns:
the new social relation

deletePersistedModel

public static PersistedModel deletePersistedModel(PersistedModel persistedModel)
                                           throws PortalException
Throws:
PortalException

deleteRelation

public static void deleteRelation(SocialRelation relation)
                           throws PortalException
Removes the relation (and its inverse in case of a bidirectional relation) from the database.

Parameters:
relation - the relation to be removed
Throws:
PortalException

deleteRelation

public static void deleteRelation(long relationId)
                           throws PortalException
Removes the relation (and its inverse in case of a bidirectional relation) from the database.

Parameters:
relationId - the primary key of the relation
Throws:
PortalException

deleteRelation

public static void deleteRelation(long userId1,
                                  long userId2,
                                  int type)
                           throws PortalException
Removes the matching relation (and its inverse in case of a bidirectional relation) from the database.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
type - the relation's type
Throws:
PortalException

deleteRelations

public static void deleteRelations(long userId)
Removes all relations involving the user from the database.

Parameters:
userId - the primary key of the user

deleteRelations

public static void deleteRelations(long userId1,
                                   long userId2)
                            throws PortalException
Removes all relations between User1 and User2.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
Throws:
PortalException

deleteSocialRelation

public static SocialRelation deleteSocialRelation(long relationId)
                                           throws PortalException
Deletes the social relation with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
relationId - the primary key of the social relation
Returns:
the social relation that was removed
Throws:
PortalException - if a social relation with the primary key could not be found

deleteSocialRelation

public static SocialRelation deleteSocialRelation(SocialRelation socialRelation)
Deletes the social relation from the database. Also notifies the appropriate model listeners.

Parameters:
socialRelation - the social relation
Returns:
the social relation that was removed

dynamicQuery

public static DynamicQuery dynamicQuery()

dynamicQuery

public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery)
Performs a dynamic query on the database and returns the matching rows.

Parameters:
dynamicQuery - the dynamic query
Returns:
the matching rows

dynamicQuery

public 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.

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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from SocialRelationModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
Returns:
the range of matching rows

dynamicQuery

public 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.

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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from SocialRelationModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching rows

dynamicQueryCount

public static long dynamicQueryCount(DynamicQuery dynamicQuery)
Returns the number of rows matching the dynamic query.

Parameters:
dynamicQuery - the dynamic query
Returns:
the number of rows matching the dynamic query

dynamicQueryCount

public static long dynamicQueryCount(DynamicQuery dynamicQuery,
                                     Projection projection)
Returns the number of rows matching the dynamic query.

Parameters:
dynamicQuery - the dynamic query
projection - the projection to apply to the query
Returns:
the number of rows matching the dynamic query

fetchSocialRelation

public static SocialRelation fetchSocialRelation(long relationId)

fetchSocialRelationByUuidAndCompanyId

public static SocialRelation fetchSocialRelationByUuidAndCompanyId(String uuid,
                                                                   long companyId)
Returns the social relation with the matching UUID and company.

Parameters:
uuid - the social relation's UUID
companyId - the primary key of the company
Returns:
the matching social relation, or null if a matching social relation could not be found

getActionableDynamicQuery

public static ActionableDynamicQuery getActionableDynamicQuery()

getIndexableActionableDynamicQuery

public static IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()

getInverseRelations

public 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.

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.

Parameters:
userId - the primary key of the user
type - the relation's type
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of matching relations

getInverseRelationsCount

public 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.

Parameters:
userId - the primary key of the user
type - the relation's type
Returns:
the number of matching relations

getOSGiServiceIdentifier

public static String getOSGiServiceIdentifier()
Returns the OSGi service identifier.

Returns:
the OSGi service identifier

getPersistedModel

public static PersistedModel getPersistedModel(Serializable primaryKeyObj)
                                        throws PortalException
Throws:
PortalException

getRelation

public static SocialRelation getRelation(long relationId)
                                  throws PortalException
Returns the relation identified by its primary key.

Parameters:
relationId - the primary key of the relation
Returns:
Returns the relation
Throws:
PortalException

getRelation

public static SocialRelation getRelation(long userId1,
                                         long userId2,
                                         int type)
                                  throws PortalException
Returns the relation of the given type between User1 and User2.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
type - the relation's type
Returns:
Returns the relation
Throws:
PortalException

getRelations

public 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.

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.

Parameters:
userId - the primary key of the user
type - the relation's type
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of relations

getRelations

public static List<SocialRelation> getRelations(long userId1,
                                                long userId2,
                                                int start,
                                                int end)
Returns a range of all the relations between User1 and User2.

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.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of relations

getRelationsCount

public 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.

Parameters:
userId - the primary key of the user
type - the relation's type
Returns:
the number of relations

getRelationsCount

public static int getRelationsCount(long userId1,
                                    long userId2)
Returns the number of relations between User1 and User2.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
Returns:
the number of relations

getSocialRelation

public static SocialRelation getSocialRelation(long relationId)
                                        throws PortalException
Returns the social relation with the primary key.

Parameters:
relationId - the primary key of the social relation
Returns:
the social relation
Throws:
PortalException - if a social relation with the primary key could not be found

getSocialRelationByUuidAndCompanyId

public static SocialRelation getSocialRelationByUuidAndCompanyId(String uuid,
                                                                 long companyId)
                                                          throws PortalException
Returns the social relation with the matching UUID and company.

Parameters:
uuid - the social relation's UUID
companyId - the primary key of the company
Returns:
the matching social relation
Throws:
PortalException - if a matching social relation could not be found

getSocialRelations

public static List<SocialRelation> getSocialRelations(int start,
                                                      int end)
Returns a range of all the social relations.

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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from SocialRelationModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
start - the lower bound of the range of social relations
end - the upper bound of the range of social relations (not inclusive)
Returns:
the range of social relations

getSocialRelationsCount

public static int getSocialRelationsCount()
Returns the number of social relations.

Returns:
the number of social relations

hasRelation

public 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.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
type - the relation's type
Returns:
true if the relation exists; false otherwise

isRelatable

public 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.

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.

Parameters:
userId1 - the user that is the subject of the relation
userId2 - the user at the other end of the relation
type - the relation's type
Returns:
true if the two users can be in a new relation of the given type; false otherwise

updateSocialRelation

public static SocialRelation updateSocialRelation(SocialRelation socialRelation)
Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
socialRelation - the social relation
Returns:
the social relation that was updated

getService

public static SocialRelationLocalService getService()

Liferay 7.0-ce-b4