Search in sources :

Example 91 with NoSuchArticleException

use of com.liferay.knowledgebase.NoSuchArticleException in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByP_L_First.

/**
 * Returns the first k b article in the ordered set where parentResourcePrimKey = ? and latest = ?.
 *
 * @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 first matching k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a matching k b article could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle findByP_L_First(long parentResourcePrimKey, boolean latest, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = fetchByP_L_First(parentResourcePrimKey, latest, orderByComparator);
    if (kbArticle != null) {
        return kbArticle;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("parentResourcePrimKey=");
    msg.append(parentResourcePrimKey);
    msg.append(", latest=");
    msg.append(latest);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchArticleException(msg.toString());
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 92 with NoSuchArticleException

use of com.liferay.knowledgebase.NoSuchArticleException in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByUUID_G.

/**
 * Returns the k b article where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.knowledgebase.NoSuchArticleException} if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a matching k b article could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle findByUUID_G(String uuid, long groupId) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = fetchByUUID_G(uuid, groupId);
    if (kbArticle == null) {
        StringBundler msg = new StringBundler(6);
        msg.append(_NO_SUCH_ENTITY_WITH_KEY);
        msg.append("uuid=");
        msg.append(uuid);
        msg.append(", groupId=");
        msg.append(groupId);
        msg.append(StringPool.CLOSE_CURLY_BRACE);
        if (_log.isWarnEnabled()) {
            _log.warn(msg.toString());
        }
        throw new NoSuchArticleException(msg.toString());
    }
    return kbArticle;
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 93 with NoSuchArticleException

use of com.liferay.knowledgebase.NoSuchArticleException in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method filterFindByR_G_M_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 resourcePrimKey = &#63; and groupId = &#63; and main = &#63;.
 *
 * @param kbArticleId the primary key of the current k b article
 * @param resourcePrimKey the resource prim key
 * @param groupId the group 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[] filterFindByR_G_M_PrevAndNext(long kbArticleId, long resourcePrimKey, long groupId, boolean main, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByR_G_M_PrevAndNext(kbArticleId, resourcePrimKey, groupId, main, orderByComparator);
    }
    KBArticle kbArticle = findByPrimaryKey(kbArticleId);
    Session session = null;
    try {
        session = openSession();
        KBArticle[] array = new KBArticleImpl[3];
        array[0] = filterGetByR_G_M_PrevAndNext(session, kbArticle, resourcePrimKey, groupId, main, orderByComparator, true);
        array[1] = kbArticle;
        array[2] = filterGetByR_G_M_PrevAndNext(session, kbArticle, resourcePrimKey, groupId, 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 94 with NoSuchArticleException

use of com.liferay.knowledgebase.NoSuchArticleException in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByUuid_Last.

/**
 * Returns the last k b article in the ordered set where uuid = &#63;.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a matching k b article could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle findByUuid_Last(String uuid, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = fetchByUuid_Last(uuid, orderByComparator);
    if (kbArticle != null) {
        return kbArticle;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchArticleException(msg.toString());
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 95 with NoSuchArticleException

use of com.liferay.knowledgebase.NoSuchArticleException in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method findByP_S_Last.

/**
 * Returns the last k b article in the ordered set where parentResourcePrimKey = &#63; and status = &#63;.
 *
 * @param parentResourcePrimKey the parent resource prim key
 * @param status the status
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b article
 * @throws com.liferay.knowledgebase.NoSuchArticleException if a matching k b article could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBArticle findByP_S_Last(long parentResourcePrimKey, int status, OrderByComparator orderByComparator) throws NoSuchArticleException, SystemException {
    KBArticle kbArticle = fetchByP_S_Last(parentResourcePrimKey, status, orderByComparator);
    if (kbArticle != null) {
        return kbArticle;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("parentResourcePrimKey=");
    msg.append(parentResourcePrimKey);
    msg.append(", status=");
    msg.append(status);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchArticleException(msg.toString());
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Aggregations

NoSuchArticleException (com.liferay.knowledgebase.NoSuchArticleException)111 KBArticle (com.liferay.knowledgebase.model.KBArticle)111 StringBundler (com.liferay.portal.kernel.util.StringBundler)58 SystemException (com.liferay.portal.kernel.exception.SystemException)48 KBArticleImpl (com.liferay.knowledgebase.model.impl.KBArticleImpl)45 Session (com.liferay.portal.kernel.dao.orm.Session)45 NoSuchCommentException (com.liferay.knowledgebase.NoSuchCommentException)5 NoSuchSubscriptionException (com.liferay.portal.NoSuchSubscriptionException)5 PrincipalException (com.liferay.portal.security.auth.PrincipalException)5 IOException (java.io.IOException)5 PortletException (javax.portlet.PortletException)5 PortalException (com.liferay.portal.kernel.exception.PortalException)3 KBArticleImportException (com.liferay.knowledgebase.KBArticleImportException)1 KBTemplateContentException (com.liferay.knowledgebase.KBTemplateContentException)1 KBTemplateTitleException (com.liferay.knowledgebase.KBTemplateTitleException)1 NoSuchTemplateException (com.liferay.knowledgebase.NoSuchTemplateException)1 KBTemplate (com.liferay.knowledgebase.model.KBTemplate)1 WindowStateException (javax.portlet.WindowStateException)1