Search in sources :

Example 6 with GadgetImpl

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

the class GadgetPersistenceImpl method toUnwrappedModel.

protected Gadget toUnwrappedModel(Gadget gadget) {
    if (gadget instanceof GadgetImpl) {
        return gadget;
    }
    GadgetImpl gadgetImpl = new GadgetImpl();
    gadgetImpl.setNew(gadget.isNew());
    gadgetImpl.setPrimaryKey(gadget.getPrimaryKey());
    gadgetImpl.setUuid(gadget.getUuid());
    gadgetImpl.setGadgetId(gadget.getGadgetId());
    gadgetImpl.setCompanyId(gadget.getCompanyId());
    gadgetImpl.setCreateDate(gadget.getCreateDate());
    gadgetImpl.setModifiedDate(gadget.getModifiedDate());
    gadgetImpl.setName(gadget.getName());
    gadgetImpl.setUrl(gadget.getUrl());
    gadgetImpl.setPortletCategoryNames(gadget.getPortletCategoryNames());
    return gadgetImpl;
}
Also used : GadgetImpl(com.liferay.opensocial.model.impl.GadgetImpl)

Example 7 with GadgetImpl

use of com.liferay.opensocial.model.impl.GadgetImpl 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 = ?.
 *
 * @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 8 with GadgetImpl

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

the class GadgetPersistenceImpl method filterFindByCompanyId_PrevAndNext.

/**
 * Returns the gadgets before and after the current gadget in the ordered set of gadgets that the user has permission to view where companyId = &#63;.
 *
 * @param gadgetId the primary key of the current gadget
 * @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[] filterFindByCompanyId_PrevAndNext(long gadgetId, long companyId, OrderByComparator orderByComparator) throws NoSuchGadgetException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled()) {
        return findByCompanyId_PrevAndNext(gadgetId, companyId, orderByComparator);
    }
    Gadget gadget = findByPrimaryKey(gadgetId);
    Session session = null;
    try {
        session = openSession();
        Gadget[] array = new GadgetImpl[3];
        array[0] = filterGetByCompanyId_PrevAndNext(session, gadget, companyId, orderByComparator, true);
        array[1] = gadget;
        array[2] = filterGetByCompanyId_PrevAndNext(session, gadget, 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 9 with GadgetImpl

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

the class ShindigUtil method getGadget.

public static com.liferay.opensocial.model.Gadget getGadget(PortletPreferences portletPreferences) throws Exception {
    String url = portletPreferences.getValue("url", StringPool.BLANK);
    if (Validator.isNull(url)) {
        return null;
    }
    com.liferay.opensocial.model.Gadget gadget = new GadgetImpl();
    GadgetSpec gadgetSpec = null;
    try {
        gadgetSpec = ShindigUtil.getGadgetSpec(url);
    } catch (Exception e) {
        throw new GadgetURLException(e);
    }
    ModulePrefs modulePrefs = gadgetSpec.getModulePrefs();
    gadget.setName(modulePrefs.getTitle());
    gadget.setUrl(url);
    return gadget;
}
Also used : GadgetSpec(org.apache.shindig.gadgets.spec.GadgetSpec) ModulePrefs(org.apache.shindig.gadgets.spec.ModulePrefs) GadgetURLException(com.liferay.opensocial.GadgetURLException) GadgetImpl(com.liferay.opensocial.model.impl.GadgetImpl) ProcessingException(org.apache.shindig.gadgets.process.ProcessingException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) GadgetURLException(com.liferay.opensocial.GadgetURLException)

Aggregations

GadgetImpl (com.liferay.opensocial.model.impl.GadgetImpl)9 Gadget (com.liferay.opensocial.model.Gadget)7 SystemException (com.liferay.portal.kernel.exception.SystemException)7 NoSuchGadgetException (com.liferay.opensocial.NoSuchGadgetException)6 Session (com.liferay.portal.kernel.dao.orm.Session)6 GadgetURLException (com.liferay.opensocial.GadgetURLException)1 PortalException (com.liferay.portal.kernel.exception.PortalException)1 ProcessingException (org.apache.shindig.gadgets.process.ProcessingException)1 GadgetSpec (org.apache.shindig.gadgets.spec.GadgetSpec)1 ModulePrefs (org.apache.shindig.gadgets.spec.ModulePrefs)1