Search in sources :

Example 26 with KBArticleImpl

use of com.liferay.knowledgebase.model.impl.KBArticleImpl in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method create.

/**
 * Creates a new k b article with the primary key. Does not add the k b article to the database.
 *
 * @param kbArticleId the primary key for the new k b article
 * @return the new k b article
 */
@Override
public KBArticle create(long kbArticleId) {
    KBArticle kbArticle = new KBArticleImpl();
    kbArticle.setNew(true);
    kbArticle.setPrimaryKey(kbArticleId);
    String uuid = PortalUUIDUtil.generate();
    kbArticle.setUuid(uuid);
    return kbArticle;
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) KBArticleImpl(com.liferay.knowledgebase.model.impl.KBArticleImpl)

Example 27 with KBArticleImpl

use of com.liferay.knowledgebase.model.impl.KBArticleImpl in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByR_G_PrevAndNext.

/**
 * Returns the k b articles before and after the current k b article in the ordered set where resourcePrimKey = ? and groupId = ?.
 *
 * @param kbArticleId the primary key of the current k b article
 * @param resourcePrimKey the resource prim key
 * @param groupId the group ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a k b article with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle[] findByR_G_PrevAndNext(long kbArticleId, long resourcePrimKey, long groupId, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = findByPrimaryKey(kbArticleId);
    Session session = null;
    try {
        session = openSession();
        KBArticle[] array = new KBArticleImpl[3];
        array[0] = getByR_G_PrevAndNext(session, kbArticle, resourcePrimKey, groupId, orderByComparator, true);
        array[1] = kbArticle;
        array[2] = getByR_G_PrevAndNext(session, kbArticle, resourcePrimKey, groupId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) KBArticleImpl(com.liferay.knowledgebase.model.impl.KBArticleImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 28 with KBArticleImpl

use of com.liferay.knowledgebase.model.impl.KBArticleImpl in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method filterFindByG_P_L_PrevAndNext.

/**
 * Returns the k b articles before and after the current k b article in the ordered set of k b articles that the user has permission to view where groupId = &#63; and parentResourcePrimKey = &#63; and latest = &#63;.
 *
 * @param kbArticleId the primary key of the current k b article
 * @param groupId the group ID
 * @param parentResourcePrimKey the parent resource prim key
 * @param latest the latest
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a k b article with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle[] filterFindByG_P_L_PrevAndNext(long kbArticleId, long groupId, long parentResourcePrimKey, boolean latest, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByG_P_L_PrevAndNext(kbArticleId, groupId, parentResourcePrimKey, latest, orderByComparator);
    }
    KBArticle kbArticle = findByPrimaryKey(kbArticleId);
    Session session = null;
    try {
        session = openSession();
        KBArticle[] array = new KBArticleImpl[3];
        array[0] = filterGetByG_P_L_PrevAndNext(session, kbArticle, groupId, parentResourcePrimKey, latest, orderByComparator, true);
        array[1] = kbArticle;
        array[2] = filterGetByG_P_L_PrevAndNext(session, kbArticle, groupId, parentResourcePrimKey, latest, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) KBArticleImpl(com.liferay.knowledgebase.model.impl.KBArticleImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 29 with KBArticleImpl

use of com.liferay.knowledgebase.model.impl.KBArticleImpl in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByR_M_PrevAndNext.

/**
 * Returns the k b articles before and after the current k b article in the ordered set where resourcePrimKey = &#63; and main = &#63;.
 *
 * @param kbArticleId the primary key of the current k b article
 * @param resourcePrimKey the resource prim key
 * @param main the main
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a k b article with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle[] findByR_M_PrevAndNext(long kbArticleId, long resourcePrimKey, boolean main, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = findByPrimaryKey(kbArticleId);
    Session session = null;
    try {
        session = openSession();
        KBArticle[] array = new KBArticleImpl[3];
        array[0] = getByR_M_PrevAndNext(session, kbArticle, resourcePrimKey, main, orderByComparator, true);
        array[1] = kbArticle;
        array[2] = getByR_M_PrevAndNext(session, kbArticle, resourcePrimKey, main, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) KBArticleImpl(com.liferay.knowledgebase.model.impl.KBArticleImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 30 with KBArticleImpl

use of com.liferay.knowledgebase.model.impl.KBArticleImpl in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByC_M_PrevAndNext.

/**
 * Returns the k b articles before and after the current k b article in the ordered set where companyId = &#63; and main = &#63;.
 *
 * @param kbArticleId the primary key of the current k b article
 * @param companyId the company ID
 * @param main the main
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a k b article with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle[] findByC_M_PrevAndNext(long kbArticleId, long companyId, boolean main, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = findByPrimaryKey(kbArticleId);
    Session session = null;
    try {
        session = openSession();
        KBArticle[] array = new KBArticleImpl[3];
        array[0] = getByC_M_PrevAndNext(session, kbArticle, companyId, main, orderByComparator, true);
        array[1] = kbArticle;
        array[2] = getByC_M_PrevAndNext(session, kbArticle, companyId, main, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) KBArticleImpl(com.liferay.knowledgebase.model.impl.KBArticleImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

KBArticleImpl (com.liferay.knowledgebase.model.impl.KBArticleImpl)46 KBArticle (com.liferay.knowledgebase.model.KBArticle)45 NoSuchArticleException (com.liferay.knowledgebase.NoSuchArticleException)44 Session (com.liferay.portal.kernel.dao.orm.Session)44 SystemException (com.liferay.portal.kernel.exception.SystemException)44