Example usage for com.liferay.portal.kernel.dao.orm WildcardMode TRAILING

List of usage examples for com.liferay.portal.kernel.dao.orm WildcardMode TRAILING

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm WildcardMode TRAILING.

Prototype

WildcardMode TRAILING

To view the source code for com.liferay.portal.kernel.dao.orm WildcardMode TRAILING.

Click Source Link

Usage

From source file:com.liferay.mentions.internal.util.DefaultMentionsUserFinder.java

License:Open Source License

@Override
public List<User> getUsers(long companyId, long userId, String query,
        SocialInteractionsConfiguration socialInteractionsConfiguration) throws PortalException {

    if (socialInteractionsConfiguration.isSocialInteractionsAnyUserEnabled()) {

        LinkedHashMap<String, Object> params = new LinkedHashMap<>();

        params.put("wildcardMode", WildcardMode.TRAILING);

        return _userLocalService.search(companyId, query, WorkflowConstants.STATUS_APPROVED, params, 0,
                _MAX_USERS, new UserScreenNameComparator());
    }//from   w  w  w .  jav  a 2s .  c  o  m

    User user = _userLocalService.getUser(userId);

    int[] types = { SocialRelationConstants.TYPE_BI_FRIEND };

    if (socialInteractionsConfiguration.isSocialInteractionsFriendsEnabled()
            && socialInteractionsConfiguration.isSocialInteractionsSitesEnabled()) {

        return _userLocalService.searchSocial(user.getGroupIds(), userId, types, query, 0, _MAX_USERS);
    }

    if (socialInteractionsConfiguration.isSocialInteractionsSitesEnabled()) {

        return _userLocalService.searchSocial(companyId, user.getGroupIds(), query, 0, _MAX_USERS);
    }

    if (socialInteractionsConfiguration.isSocialInteractionsFriendsEnabled()) {

        return _userLocalService.searchSocial(userId, types, query, 0, _MAX_USERS);
    }

    return Collections.emptyList();
}

From source file:com.liferay.mentions.util.DefaultMentionsUserFinderImpl.java

License:Open Source License

@Override
public List<User> getUsers(long companyId, long userId, String query,
        SocialInteractionsConfiguration socialInteractionsConfiguration) throws PortalException {

    if (socialInteractionsConfiguration.isSocialInteractionsAnyUserEnabled()) {

        LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();

        params.put("wildcardMode", WildcardMode.TRAILING);

        return UserLocalServiceUtil.search(companyId, query, WorkflowConstants.STATUS_APPROVED, params, 0,
                _MAX_USERS, new UserScreenNameComparator());
    }/*from w  w w.  j  a va 2  s.c  o  m*/

    User user = UserLocalServiceUtil.getUser(userId);

    int[] types = socialInteractionsConfiguration.getSocialInteractionsSocialRelationTypesArray();

    if (socialInteractionsConfiguration.isSocialInteractionsSocialRelationTypesEnabled()
            && socialInteractionsConfiguration.isSocialInteractionsSitesEnabled()) {

        return UserLocalServiceUtil.searchSocial(user.getGroupIds(), userId, types, query, QueryUtil.ALL_POS,
                QueryUtil.ALL_POS);
    }

    if (socialInteractionsConfiguration.isSocialInteractionsSitesEnabled()) {

        return UserLocalServiceUtil.searchSocial(companyId, user.getGroupIds(), query, QueryUtil.ALL_POS,
                QueryUtil.ALL_POS);
    }

    if (socialInteractionsConfiguration.isSocialInteractionsSocialRelationTypesEnabled()) {

        return UserLocalServiceUtil.searchSocial(userId, types, query, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
    }

    return Collections.emptyList();
}