Search in sources :

Example 1 with NoSuchOAuthConsumerException

use of com.liferay.opensocial.NoSuchOAuthConsumerException in project liferay-ide by liferay.

the class OAuthConsumerPersistenceImpl method findByGadgetKey_PrevAndNext.

/**
 * Returns the o auth consumers before and after the current o auth consumer in the ordered set where gadgetKey = ?.
 *
 * @param oAuthConsumerId the primary key of the current o auth consumer
 * @param gadgetKey the gadget key
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next o auth consumer
 * @throws com.liferay.opensocial.NoSuchOAuthConsumerException if a o auth consumer with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthConsumer[] findByGadgetKey_PrevAndNext(long oAuthConsumerId, String gadgetKey, OrderByComparator orderByComparator) throws NoSuchOAuthConsumerException, SystemException {
    OAuthConsumer oAuthConsumer = findByPrimaryKey(oAuthConsumerId);
    Session session = null;
    try {
        session = openSession();
        OAuthConsumer[] array = new OAuthConsumerImpl[3];
        array[0] = getByGadgetKey_PrevAndNext(session, oAuthConsumer, gadgetKey, orderByComparator, true);
        array[1] = oAuthConsumer;
        array[2] = getByGadgetKey_PrevAndNext(session, oAuthConsumer, gadgetKey, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : OAuthConsumerImpl(com.liferay.opensocial.model.impl.OAuthConsumerImpl) OAuthConsumer(com.liferay.opensocial.model.OAuthConsumer) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchOAuthConsumerException(com.liferay.opensocial.NoSuchOAuthConsumerException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 2 with NoSuchOAuthConsumerException

use of com.liferay.opensocial.NoSuchOAuthConsumerException in project liferay-ide by liferay.

the class OAuthConsumerPersistenceImpl method findByGadgetKey_Last.

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

Example 3 with NoSuchOAuthConsumerException

use of com.liferay.opensocial.NoSuchOAuthConsumerException in project liferay-ide by liferay.

the class OAuthConsumerPersistenceImpl method findByG_S.

/**
 * Returns the o auth consumer where gadgetKey = &#63; and serviceName = &#63; or throws a {@link com.liferay.opensocial.NoSuchOAuthConsumerException} if it could not be found.
 *
 * @param gadgetKey the gadget key
 * @param serviceName the service name
 * @return the matching o auth consumer
 * @throws com.liferay.opensocial.NoSuchOAuthConsumerException if a matching o auth consumer could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthConsumer findByG_S(String gadgetKey, String serviceName) throws NoSuchOAuthConsumerException, SystemException {
    OAuthConsumer oAuthConsumer = fetchByG_S(gadgetKey, serviceName);
    if (oAuthConsumer == null) {
        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);
        if (_log.isWarnEnabled()) {
            _log.warn(msg.toString());
        }
        throw new NoSuchOAuthConsumerException(msg.toString());
    }
    return oAuthConsumer;
}
Also used : NoSuchOAuthConsumerException(com.liferay.opensocial.NoSuchOAuthConsumerException) OAuthConsumer(com.liferay.opensocial.model.OAuthConsumer) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 4 with NoSuchOAuthConsumerException

use of com.liferay.opensocial.NoSuchOAuthConsumerException in project liferay-ide by liferay.

the class OAuthConsumerPersistenceImpl method remove.

/**
 * Removes the o auth consumer with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param primaryKey the primary key of the o auth consumer
 * @return the o auth consumer that was removed
 * @throws com.liferay.opensocial.NoSuchOAuthConsumerException if a o auth consumer with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthConsumer remove(Serializable primaryKey) throws NoSuchOAuthConsumerException, SystemException {
    Session session = null;
    try {
        session = openSession();
        OAuthConsumer oAuthConsumer = (OAuthConsumer) session.get(OAuthConsumerImpl.class, primaryKey);
        if (oAuthConsumer == null) {
            if (_log.isWarnEnabled()) {
                _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
            }
            throw new NoSuchOAuthConsumerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }
        return remove(oAuthConsumer);
    } catch (NoSuchOAuthConsumerException nsee) {
        throw nsee;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : OAuthConsumerImpl(com.liferay.opensocial.model.impl.OAuthConsumerImpl) NoSuchOAuthConsumerException(com.liferay.opensocial.NoSuchOAuthConsumerException) OAuthConsumer(com.liferay.opensocial.model.OAuthConsumer) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchOAuthConsumerException(com.liferay.opensocial.NoSuchOAuthConsumerException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 5 with NoSuchOAuthConsumerException

use of com.liferay.opensocial.NoSuchOAuthConsumerException in project liferay-ide by liferay.

the class OAuthConsumerPersistenceImpl method findByGadgetKey_First.

/**
 * Returns the first o auth consumer in the ordered set where gadgetKey = &#63;.
 *
 * @param gadgetKey the gadget key
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching o auth consumer
 * @throws com.liferay.opensocial.NoSuchOAuthConsumerException if a matching o auth consumer could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public OAuthConsumer findByGadgetKey_First(String gadgetKey, OrderByComparator orderByComparator) throws NoSuchOAuthConsumerException, SystemException {
    OAuthConsumer oAuthConsumer = fetchByGadgetKey_First(gadgetKey, orderByComparator);
    if (oAuthConsumer != null) {
        return oAuthConsumer;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("gadgetKey=");
    msg.append(gadgetKey);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchOAuthConsumerException(msg.toString());
}
Also used : NoSuchOAuthConsumerException(com.liferay.opensocial.NoSuchOAuthConsumerException) OAuthConsumer(com.liferay.opensocial.model.OAuthConsumer) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Aggregations

NoSuchOAuthConsumerException (com.liferay.opensocial.NoSuchOAuthConsumerException)5 OAuthConsumer (com.liferay.opensocial.model.OAuthConsumer)5 StringBundler (com.liferay.portal.kernel.util.StringBundler)3 OAuthConsumerImpl (com.liferay.opensocial.model.impl.OAuthConsumerImpl)2 Session (com.liferay.portal.kernel.dao.orm.Session)2 SystemException (com.liferay.portal.kernel.exception.SystemException)2