Search in sources :

Example 1 with OAuthToken

use of com.liferay.opensocial.model.OAuthToken in project liferay-ide by liferay.

the class OAuthTokenPersistenceImpl method findByG_S_First.

/**
 * Returns the first o auth token in the ordered set where gadgetKey = ? and serviceName = ?.
 *
 * @param gadgetKey the gadget key
 * @param serviceName the service name
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching o auth token
 * @throws com.liferay.opensocial.NoSuchOAuthTokenException if a matching o auth token could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthToken findByG_S_First(String gadgetKey, String serviceName, OrderByComparator orderByComparator) throws NoSuchOAuthTokenException, SystemException {
    OAuthToken oAuthToken = fetchByG_S_First(gadgetKey, serviceName, orderByComparator);
    if (oAuthToken != null) {
        return oAuthToken;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("gadgetKey=");
    msg.append(gadgetKey);
    msg.append(", serviceName=");
    msg.append(serviceName);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchOAuthTokenException(msg.toString());
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken) StringBundler(com.liferay.portal.kernel.util.StringBundler) NoSuchOAuthTokenException(com.liferay.opensocial.NoSuchOAuthTokenException)

Example 2 with OAuthToken

use of com.liferay.opensocial.model.OAuthToken in project liferay-ide by liferay.

the class OAuthTokenPersistenceImpl method findByU_G_S_M_T.

/**
 * Returns the o auth token where userId = &#63; and gadgetKey = &#63; and serviceName = &#63; and moduleId = &#63; and tokenName = &#63; or throws a {@link com.liferay.opensocial.NoSuchOAuthTokenException} if it could not be found.
 *
 * @param userId the user ID
 * @param gadgetKey the gadget key
 * @param serviceName the service name
 * @param moduleId the module ID
 * @param tokenName the token name
 * @return the matching o auth token
 * @throws com.liferay.opensocial.NoSuchOAuthTokenException if a matching o auth token could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthToken findByU_G_S_M_T(long userId, String gadgetKey, String serviceName, long moduleId, String tokenName) throws NoSuchOAuthTokenException, SystemException {
    OAuthToken oAuthToken = fetchByU_G_S_M_T(userId, gadgetKey, serviceName, moduleId, tokenName);
    if (oAuthToken == null) {
        StringBundler msg = new StringBundler(12);
        msg.append(_NO_SUCH_ENTITY_WITH_KEY);
        msg.append("userId=");
        msg.append(userId);
        msg.append(", gadgetKey=");
        msg.append(gadgetKey);
        msg.append(", serviceName=");
        msg.append(serviceName);
        msg.append(", moduleId=");
        msg.append(moduleId);
        msg.append(", tokenName=");
        msg.append(tokenName);
        msg.append(StringPool.CLOSE_CURLY_BRACE);
        if (_log.isWarnEnabled()) {
            _log.warn(msg.toString());
        }
        throw new NoSuchOAuthTokenException(msg.toString());
    }
    return oAuthToken;
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken) StringBundler(com.liferay.portal.kernel.util.StringBundler) NoSuchOAuthTokenException(com.liferay.opensocial.NoSuchOAuthTokenException)

Example 3 with OAuthToken

use of com.liferay.opensocial.model.OAuthToken in project liferay-ide by liferay.

the class OAuthTokenPersistenceImpl method findByG_S_Last.

/**
 * Returns the last o auth token in the ordered set where gadgetKey = &#63; and serviceName = &#63;.
 *
 * @param gadgetKey the gadget key
 * @param serviceName the service name
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching o auth token
 * @throws com.liferay.opensocial.NoSuchOAuthTokenException if a matching o auth token could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthToken findByG_S_Last(String gadgetKey, String serviceName, OrderByComparator orderByComparator) throws NoSuchOAuthTokenException, SystemException {
    OAuthToken oAuthToken = fetchByG_S_Last(gadgetKey, serviceName, orderByComparator);
    if (oAuthToken != null) {
        return oAuthToken;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("gadgetKey=");
    msg.append(gadgetKey);
    msg.append(", serviceName=");
    msg.append(serviceName);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchOAuthTokenException(msg.toString());
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken) StringBundler(com.liferay.portal.kernel.util.StringBundler) NoSuchOAuthTokenException(com.liferay.opensocial.NoSuchOAuthTokenException)

Example 4 with OAuthToken

use of com.liferay.opensocial.model.OAuthToken in project liferay-ide by liferay.

the class OAuthTokenPersistenceImpl method clearCache.

@Override
public void clearCache(List<OAuthToken> oAuthTokens) {
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    for (OAuthToken oAuthToken : oAuthTokens) {
        EntityCacheUtil.removeResult(OAuthTokenModelImpl.ENTITY_CACHE_ENABLED, OAuthTokenImpl.class, oAuthToken.getPrimaryKey());
        clearUniqueFindersCache(oAuthToken);
    }
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken)

Example 5 with OAuthToken

use of com.liferay.opensocial.model.OAuthToken in project liferay-ide by liferay.

the class LiferayOAuthStore method getTokenInfo.

public TokenInfo getTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName, String tokenName) throws GadgetException {
    OAuthToken oAuthToken = getOAuthToken(securityToken, serviceName, tokenName);
    if (oAuthToken == null) {
        return null;
    }
    TokenInfo tokenInfo = new TokenInfo(oAuthToken.getAccessToken(), oAuthToken.getTokenSecret(), oAuthToken.getSessionHandle(), oAuthToken.getExpiration());
    return tokenInfo;
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken)

Aggregations

OAuthToken (com.liferay.opensocial.model.OAuthToken)16 NoSuchOAuthTokenException (com.liferay.opensocial.NoSuchOAuthTokenException)9 SystemException (com.liferay.portal.kernel.exception.SystemException)7 StringBundler (com.liferay.portal.kernel.util.StringBundler)7 Session (com.liferay.portal.kernel.dao.orm.Session)6 OAuthTokenImpl (com.liferay.opensocial.model.impl.OAuthTokenImpl)4 Query (com.liferay.portal.kernel.dao.orm.Query)4 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)3 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)2 User (com.liferay.portal.model.User)1 Date (java.util.Date)1 GadgetException (org.apache.shindig.gadgets.GadgetException)1