Search in sources :

Example 6 with NoSuchTemplateException

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

the class KBTemplateLocalServiceImpl method deleteKBTemplates.

@Override
public void deleteKBTemplates(long[] kbTemplateIds) throws PortalException, SystemException {
    for (long kbTemplateId : kbTemplateIds) {
        KBTemplate kbTemplate = null;
        try {
            kbTemplate = kbTemplatePersistence.findByPrimaryKey(kbTemplateId);
        } catch (NoSuchTemplateException nste) {
            continue;
        }
        kbTemplateLocalService.deleteKBTemplate(kbTemplate);
    }
}
Also used : NoSuchTemplateException(com.liferay.knowledgebase.NoSuchTemplateException) KBTemplate(com.liferay.knowledgebase.model.KBTemplate)

Example 7 with NoSuchTemplateException

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

the class KBTemplatePersistenceImpl method findByUuid_C_Last.

/**
 * Returns the last k b template in the ordered set where uuid = ? and companyId = ?.
 *
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching k b template
 * @throws com.liferay.knowledgebase.NoSuchTemplateException if a matching k b template could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public KBTemplate findByUuid_C_Last(String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchTemplateException, SystemException {
    KBTemplate kbTemplate = fetchByUuid_C_Last(uuid, companyId, orderByComparator);
    if (kbTemplate != null) {
        return kbTemplate;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append(", companyId=");
    msg.append(companyId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchTemplateException(msg.toString());
}
Also used : NoSuchTemplateException(com.liferay.knowledgebase.NoSuchTemplateException) KBTemplate(com.liferay.knowledgebase.model.KBTemplate) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 8 with NoSuchTemplateException

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

the class KBTemplatePersistenceImpl method findByUuid_PrevAndNext.

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

Example 9 with NoSuchTemplateException

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

the class KBTemplatePersistenceImpl method findByGroupId_PrevAndNext.

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

Example 10 with NoSuchTemplateException

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

the class KBTemplatePersistenceImpl method findByGroupId_First.

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

Aggregations

NoSuchTemplateException (com.liferay.knowledgebase.NoSuchTemplateException)14 KBTemplate (com.liferay.knowledgebase.model.KBTemplate)14 StringBundler (com.liferay.portal.kernel.util.StringBundler)7 SystemException (com.liferay.portal.kernel.exception.SystemException)6 KBTemplateImpl (com.liferay.knowledgebase.model.impl.KBTemplateImpl)5 Session (com.liferay.portal.kernel.dao.orm.Session)5 KBArticleImportException (com.liferay.knowledgebase.KBArticleImportException)1 KBTemplateContentException (com.liferay.knowledgebase.KBTemplateContentException)1 KBTemplateTitleException (com.liferay.knowledgebase.KBTemplateTitleException)1 NoSuchArticleException (com.liferay.knowledgebase.NoSuchArticleException)1 NoSuchCommentException (com.liferay.knowledgebase.NoSuchCommentException)1 KBArticle (com.liferay.knowledgebase.model.KBArticle)1 NoSuchSubscriptionException (com.liferay.portal.NoSuchSubscriptionException)1 PortalException (com.liferay.portal.kernel.exception.PortalException)1 PrincipalException (com.liferay.portal.security.auth.PrincipalException)1 IOException (java.io.IOException)1 PortletException (javax.portlet.PortletException)1 WindowStateException (javax.portlet.WindowStateException)1