use of com.liferay.opensocial.NoSuchOAuthTokenException 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());
}
use of com.liferay.opensocial.NoSuchOAuthTokenException in project liferay-ide by liferay.
the class OAuthTokenPersistenceImpl method findByU_G_S_M_T.
/**
* Returns the o auth token where userId = ? and gadgetKey = ? and serviceName = ? and moduleId = ? and tokenName = ? 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;
}
use of com.liferay.opensocial.NoSuchOAuthTokenException 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 = ? 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 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());
}
use of com.liferay.opensocial.NoSuchOAuthTokenException in project liferay-ide by liferay.
the class OAuthTokenPersistenceImpl method remove.
/**
* Removes the o auth token with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param primaryKey the primary key of the o auth token
* @return the o auth token that was removed
* @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 remove(Serializable primaryKey) throws NoSuchOAuthTokenException, SystemException {
Session session = null;
try {
session = openSession();
OAuthToken oAuthToken = (OAuthToken) session.get(OAuthTokenImpl.class, primaryKey);
if (oAuthToken == null) {
if (_log.isWarnEnabled()) {
_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchOAuthTokenException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
return remove(oAuthToken);
} catch (NoSuchOAuthTokenException nsee) {
throw nsee;
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
use of com.liferay.opensocial.NoSuchOAuthTokenException 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);
}
}
Aggregations