Search in sources :

Example 1 with OAuthTokenImpl

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

the class OAuthTokenPersistenceImpl method create.

/**
 * Creates a new o auth token with the primary key. Does not add the o auth token to the database.
 *
 * @param oAuthTokenId the primary key for the new o auth token
 * @return the new o auth token
 */
@Override
public OAuthToken create(long oAuthTokenId) {
    OAuthToken oAuthToken = new OAuthTokenImpl();
    oAuthToken.setNew(true);
    oAuthToken.setPrimaryKey(oAuthTokenId);
    return oAuthToken;
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken) OAuthTokenImpl(com.liferay.opensocial.model.impl.OAuthTokenImpl)

Example 2 with OAuthTokenImpl

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

the class OAuthTokenPersistenceImpl method toUnwrappedModel.

protected OAuthToken toUnwrappedModel(OAuthToken oAuthToken) {
    if (oAuthToken instanceof OAuthTokenImpl) {
        return oAuthToken;
    }
    OAuthTokenImpl oAuthTokenImpl = new OAuthTokenImpl();
    oAuthTokenImpl.setNew(oAuthToken.isNew());
    oAuthTokenImpl.setPrimaryKey(oAuthToken.getPrimaryKey());
    oAuthTokenImpl.setOAuthTokenId(oAuthToken.getOAuthTokenId());
    oAuthTokenImpl.setCompanyId(oAuthToken.getCompanyId());
    oAuthTokenImpl.setUserId(oAuthToken.getUserId());
    oAuthTokenImpl.setUserName(oAuthToken.getUserName());
    oAuthTokenImpl.setCreateDate(oAuthToken.getCreateDate());
    oAuthTokenImpl.setModifiedDate(oAuthToken.getModifiedDate());
    oAuthTokenImpl.setGadgetKey(oAuthToken.getGadgetKey());
    oAuthTokenImpl.setServiceName(oAuthToken.getServiceName());
    oAuthTokenImpl.setModuleId(oAuthToken.getModuleId());
    oAuthTokenImpl.setAccessToken(oAuthToken.getAccessToken());
    oAuthTokenImpl.setTokenName(oAuthToken.getTokenName());
    oAuthTokenImpl.setTokenSecret(oAuthToken.getTokenSecret());
    oAuthTokenImpl.setSessionHandle(oAuthToken.getSessionHandle());
    oAuthTokenImpl.setExpiration(oAuthToken.getExpiration());
    return oAuthTokenImpl;
}
Also used : OAuthTokenImpl(com.liferay.opensocial.model.impl.OAuthTokenImpl)

Example 3 with OAuthTokenImpl

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

the class OAuthTokenPersistenceImpl method findByG_S_PrevAndNext.

/**
 * Returns the o auth tokens before and after the current o auth token in the ordered set where gadgetKey = ? and serviceName = ?.
 *
 * @param oAuthTokenId the primary key of the current o auth token
 * @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 previous, current, and next o auth token
 * @throws com.liferay.opensocial.NoSuchOAuthTokenException if a o auth token with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthToken[] findByG_S_PrevAndNext(long oAuthTokenId, String gadgetKey, String serviceName, OrderByComparator orderByComparator) throws NoSuchOAuthTokenException, SystemException {
    OAuthToken oAuthToken = findByPrimaryKey(oAuthTokenId);
    Session session = null;
    try {
        session = openSession();
        OAuthToken[] array = new OAuthTokenImpl[3];
        array[0] = getByG_S_PrevAndNext(session, oAuthToken, gadgetKey, serviceName, orderByComparator, true);
        array[1] = oAuthToken;
        array[2] = getByG_S_PrevAndNext(session, oAuthToken, gadgetKey, serviceName, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : OAuthToken(com.liferay.opensocial.model.OAuthToken) OAuthTokenImpl(com.liferay.opensocial.model.impl.OAuthTokenImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchOAuthTokenException(com.liferay.opensocial.NoSuchOAuthTokenException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

OAuthTokenImpl (com.liferay.opensocial.model.impl.OAuthTokenImpl)3 OAuthToken (com.liferay.opensocial.model.OAuthToken)2 NoSuchOAuthTokenException (com.liferay.opensocial.NoSuchOAuthTokenException)1 Session (com.liferay.portal.kernel.dao.orm.Session)1 SystemException (com.liferay.portal.kernel.exception.SystemException)1