Search in sources :

Example 6 with NoSuchGadgetException

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

the class GadgetPersistenceImpl method filterFindByUuid_C_PrevAndNext.

/**
 * Returns the gadgets before and after the current gadget in the ordered set of gadgets that the user has permission to view where uuid = ? and companyId = ?.
 *
 * @param gadgetId the primary key of the current gadget
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next gadget
 * @throws com.liferay.opensocial.NoSuchGadgetException if a gadget with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Gadget[] filterFindByUuid_C_PrevAndNext(long gadgetId, String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchGadgetException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled()) {
        return findByUuid_C_PrevAndNext(gadgetId, uuid, companyId, orderByComparator);
    }
    Gadget gadget = findByPrimaryKey(gadgetId);
    Session session = null;
    try {
        session = openSession();
        Gadget[] array = new GadgetImpl[3];
        array[0] = filterGetByUuid_C_PrevAndNext(session, gadget, uuid, companyId, orderByComparator, true);
        array[1] = gadget;
        array[2] = filterGetByUuid_C_PrevAndNext(session, gadget, uuid, companyId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Gadget(com.liferay.opensocial.model.Gadget) GadgetImpl(com.liferay.opensocial.model.impl.GadgetImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 7 with NoSuchGadgetException

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

the class GadgetPersistenceImpl method findByCompanyId_Last.

/**
 * Returns the last gadget in the ordered set where companyId = &#63;.
 *
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching gadget
 * @throws com.liferay.opensocial.NoSuchGadgetException if a matching gadget could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Gadget findByCompanyId_Last(long companyId, OrderByComparator orderByComparator) throws NoSuchGadgetException, SystemException {
    Gadget gadget = fetchByCompanyId_Last(companyId, orderByComparator);
    if (gadget != null) {
        return gadget;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("companyId=");
    msg.append(companyId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchGadgetException(msg.toString());
}
Also used : Gadget(com.liferay.opensocial.model.Gadget) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 8 with NoSuchGadgetException

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

the class GadgetPersistenceImpl method remove.

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

Example 9 with NoSuchGadgetException

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

the class GadgetPersistenceImpl method findByUuid_PrevAndNext.

/**
 * Returns the gadgets before and after the current gadget in the ordered set where uuid = &#63;.
 *
 * @param gadgetId the primary key of the current gadget
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next gadget
 * @throws com.liferay.opensocial.NoSuchGadgetException if a gadget with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Gadget[] findByUuid_PrevAndNext(long gadgetId, String uuid, OrderByComparator orderByComparator) throws NoSuchGadgetException, SystemException {
    Gadget gadget = findByPrimaryKey(gadgetId);
    Session session = null;
    try {
        session = openSession();
        Gadget[] array = new GadgetImpl[3];
        array[0] = getByUuid_PrevAndNext(session, gadget, uuid, orderByComparator, true);
        array[1] = gadget;
        array[2] = getByUuid_PrevAndNext(session, gadget, uuid, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Gadget(com.liferay.opensocial.model.Gadget) GadgetImpl(com.liferay.opensocial.model.impl.GadgetImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 10 with NoSuchGadgetException

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

the class GadgetPersistenceImpl method findByUuid_C_First.

/**
 * Returns the first gadget in the ordered set where uuid = &#63; and companyId = &#63;.
 *
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching gadget
 * @throws com.liferay.opensocial.NoSuchGadgetException if a matching gadget could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Gadget findByUuid_C_First(String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchGadgetException, SystemException {
    Gadget gadget = fetchByUuid_C_First(uuid, companyId, orderByComparator);
    if (gadget != null) {
        return gadget;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append(", companyId=");
    msg.append(companyId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchGadgetException(msg.toString());
}
Also used : Gadget(com.liferay.opensocial.model.Gadget) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Aggregations

NoSuchGadgetException (com.liferay.opensocial.NoSuchGadgetException)14 Gadget (com.liferay.opensocial.model.Gadget)14 GadgetImpl (com.liferay.opensocial.model.impl.GadgetImpl)7 Session (com.liferay.portal.kernel.dao.orm.Session)7 SystemException (com.liferay.portal.kernel.exception.SystemException)7 StringBundler (com.liferay.portal.kernel.util.StringBundler)7