Search in sources :

Example 6 with NoSuchFolderException

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

the class KBFolderPersistenceImpl method findByG_P_Last.

/**
 * Returns the last k b folder in the ordered set where groupId = ? and parentKBFolderId = ?.
 *
 * @param groupId the group ID
 * @param parentKBFolderId the parent k b folder ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b folder
 * @throws com.liferay.knowledgebase.NoSuchFolderException if a matching k b folder could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBFolder findByG_P_Last(long groupId, long parentKBFolderId, OrderByComparator orderByComparator) throws NoSuchFolderException, SystemException {
    KBFolder kbFolder = fetchByG_P_Last(groupId, parentKBFolderId, orderByComparator);
    if (kbFolder != null) {
        return kbFolder;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("groupId=");
    msg.append(groupId);
    msg.append(", parentKBFolderId=");
    msg.append(parentKBFolderId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchFolderException(msg.toString());
}
Also used : KBFolder(com.liferay.knowledgebase.model.KBFolder) NoSuchFolderException(com.liferay.knowledgebase.NoSuchFolderException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 7 with NoSuchFolderException

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

the class KBFolderLocalServiceImpl method validateParent.

protected void validateParent(long parentResourceClassNameId, long parentResourcePrimKey) throws PortalException, SystemException {
    long kbFolderClassNameId = classNameLocalService.getClassNameId(KBFolderConstants.getClassName());
    KBFolder parentKBFolder = null;
    if (parentResourceClassNameId == kbFolderClassNameId) {
        if (parentResourcePrimKey == KBFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
            return;
        }
        parentKBFolder = kbFolderPersistence.fetchByPrimaryKey(parentResourcePrimKey);
    }
    if (parentKBFolder == null) {
        throw new NoSuchFolderException(String.format("No KB folder found with KB folder ID %", parentResourcePrimKey));
    }
}
Also used : KBFolder(com.liferay.knowledgebase.model.KBFolder) NoSuchFolderException(com.liferay.knowledgebase.NoSuchFolderException)

Example 8 with NoSuchFolderException

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

the class KBFolderPersistenceImpl method findByG_P_First.

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

Example 9 with NoSuchFolderException

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

the class KBFolderPersistenceImpl method filterFindByG_P_PrevAndNext.

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

Example 10 with NoSuchFolderException

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

the class KBFolderPersistenceImpl method findByUuid_PrevAndNext.

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

Aggregations

NoSuchFolderException (com.liferay.knowledgebase.NoSuchFolderException)15 KBFolder (com.liferay.knowledgebase.model.KBFolder)15 StringBundler (com.liferay.portal.kernel.util.StringBundler)9 KBFolderImpl (com.liferay.knowledgebase.model.impl.KBFolderImpl)5 Session (com.liferay.portal.kernel.dao.orm.Session)5 SystemException (com.liferay.portal.kernel.exception.SystemException)5