Search in sources :

Example 41 with KBComment

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

the class KBCommentPersistenceImpl method findByC_C_S_Last.

/**
 * Returns the last k b comment in the ordered set where classNameId = ? and classPK = ? and status = ?.
 *
 * @param classNameId the class name ID
 * @param classPK the class p k
 * @param status the status
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b comment
 * @throws com.liferay.knowledgebase.NoSuchCommentException if a matching k b comment could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBComment findByC_C_S_Last(long classNameId, long classPK, int status, OrderByComparator orderByComparator) throws NoSuchCommentException, SystemException {
    KBComment kbComment = fetchByC_C_S_Last(classNameId, classPK, status, orderByComparator);
    if (kbComment != null) {
        return kbComment;
    }
    StringBundler msg = new StringBundler(8);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("classNameId=");
    msg.append(classNameId);
    msg.append(", classPK=");
    msg.append(classPK);
    msg.append(", status=");
    msg.append(status);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchCommentException(msg.toString());
}
Also used : KBComment(com.liferay.knowledgebase.model.KBComment) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 42 with KBComment

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

the class KBCommentPersistenceImpl method findByG_S_First.

/**
 * Returns the first k b comment in the ordered set where groupId = &#63; and status = &#63;.
 *
 * @param groupId the group ID
 * @param status the status
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching k b comment
 * @throws com.liferay.knowledgebase.NoSuchCommentException if a matching k b comment could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBComment findByG_S_First(long groupId, int status, OrderByComparator orderByComparator) throws NoSuchCommentException, SystemException {
    KBComment kbComment = fetchByG_S_First(groupId, status, orderByComparator);
    if (kbComment != null) {
        return kbComment;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("groupId=");
    msg.append(groupId);
    msg.append(", status=");
    msg.append(status);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchCommentException(msg.toString());
}
Also used : KBComment(com.liferay.knowledgebase.model.KBComment) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 43 with KBComment

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

the class KBCommentPersistenceImpl method create.

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

Example 44 with KBComment

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

the class KBCommentPersistenceImpl method findByG_C_Last.

/**
 * Returns the last k b comment in the ordered set where groupId = &#63; and classNameId = &#63;.
 *
 * @param groupId the group ID
 * @param classNameId the class name ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b comment
 * @throws com.liferay.knowledgebase.NoSuchCommentException if a matching k b comment could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBComment findByG_C_Last(long groupId, long classNameId, OrderByComparator orderByComparator) throws NoSuchCommentException, SystemException {
    KBComment kbComment = fetchByG_C_Last(groupId, classNameId, orderByComparator);
    if (kbComment != null) {
        return kbComment;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("groupId=");
    msg.append(groupId);
    msg.append(", classNameId=");
    msg.append(classNameId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchCommentException(msg.toString());
}
Also used : KBComment(com.liferay.knowledgebase.model.KBComment) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 45 with KBComment

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

the class KBCommentPersistenceImpl method findByGroupId_PrevAndNext.

/**
 * Returns the k b comments before and after the current k b comment in the ordered set where groupId = &#63;.
 *
 * @param kbCommentId the primary key of the current k b comment
 * @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 comment
 * @throws com.liferay.knowledgebase.NoSuchCommentException if a k b comment with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBComment[] findByGroupId_PrevAndNext(long kbCommentId, long groupId, OrderByComparator orderByComparator) throws NoSuchCommentException, SystemException {
    KBComment kbComment = findByPrimaryKey(kbCommentId);
    Session session = null;
    try {
        session = openSession();
        KBComment[] array = new KBCommentImpl[3];
        array[0] = getByGroupId_PrevAndNext(session, kbComment, groupId, orderByComparator, true);
        array[1] = kbComment;
        array[2] = getByGroupId_PrevAndNext(session, kbComment, groupId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : KBComment(com.liferay.knowledgebase.model.KBComment) KBCommentImpl(com.liferay.knowledgebase.model.impl.KBCommentImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

KBComment (com.liferay.knowledgebase.model.KBComment)60 NoSuchCommentException (com.liferay.knowledgebase.NoSuchCommentException)38 StringBundler (com.liferay.portal.kernel.util.StringBundler)36 Session (com.liferay.portal.kernel.dao.orm.Session)21 SystemException (com.liferay.portal.kernel.exception.SystemException)21 Query (com.liferay.portal.kernel.dao.orm.Query)19 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)18 KBCommentImpl (com.liferay.knowledgebase.model.impl.KBCommentImpl)11 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)11 ArrayList (java.util.ArrayList)11 List (java.util.List)11 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)9 JSONObject (com.liferay.portal.kernel.json.JSONObject)2 ServiceContext (com.liferay.portal.service.ServiceContext)2 KBArticle (com.liferay.knowledgebase.model.KBArticle)1 KBTemplate (com.liferay.knowledgebase.model.KBTemplate)1 User (com.liferay.portal.model.User)1 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)1 Date (java.util.Date)1 Map (java.util.Map)1