Search in sources :

Example 1 with KBTemplateImpl

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

the class KBTemplatePersistenceImpl method findByUuid_C_PrevAndNext.

/**
 * Returns the k b templates before and after the current k b template in the ordered set where uuid = ? and companyId = ?.
 *
 * @param kbTemplateId the primary key of the current k b template
 * @param uuid the uuid
 * @param companyId the company 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[] findByUuid_C_PrevAndNext(long kbTemplateId, String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchTemplateException, SystemException {
    KBTemplate kbTemplate = findByPrimaryKey(kbTemplateId);
    Session session = null;
    try {
        session = openSession();
        KBTemplate[] array = new KBTemplateImpl[3];
        array[0] = getByUuid_C_PrevAndNext(session, kbTemplate, uuid, companyId, orderByComparator, true);
        array[1] = kbTemplate;
        array[2] = getByUuid_C_PrevAndNext(session, kbTemplate, uuid, companyId, 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 2 with KBTemplateImpl

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

the class KBTemplatePersistenceImpl method toUnwrappedModel.

protected KBTemplate toUnwrappedModel(KBTemplate kbTemplate) {
    if (kbTemplate instanceof KBTemplateImpl) {
        return kbTemplate;
    }
    KBTemplateImpl kbTemplateImpl = new KBTemplateImpl();
    kbTemplateImpl.setNew(kbTemplate.isNew());
    kbTemplateImpl.setPrimaryKey(kbTemplate.getPrimaryKey());
    kbTemplateImpl.setUuid(kbTemplate.getUuid());
    kbTemplateImpl.setKbTemplateId(kbTemplate.getKbTemplateId());
    kbTemplateImpl.setGroupId(kbTemplate.getGroupId());
    kbTemplateImpl.setCompanyId(kbTemplate.getCompanyId());
    kbTemplateImpl.setUserId(kbTemplate.getUserId());
    kbTemplateImpl.setUserName(kbTemplate.getUserName());
    kbTemplateImpl.setCreateDate(kbTemplate.getCreateDate());
    kbTemplateImpl.setModifiedDate(kbTemplate.getModifiedDate());
    kbTemplateImpl.setTitle(kbTemplate.getTitle());
    kbTemplateImpl.setContent(kbTemplate.getContent());
    return kbTemplateImpl;
}
Also used : KBTemplateImpl(com.liferay.knowledgebase.model.impl.KBTemplateImpl)

Example 3 with KBTemplateImpl

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

the class KBTemplatePersistenceImpl method create.

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

Example 4 with KBTemplateImpl

use of com.liferay.knowledgebase.model.impl.KBTemplateImpl 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 5 with KBTemplateImpl

use of com.liferay.knowledgebase.model.impl.KBTemplateImpl 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)

Aggregations

KBTemplateImpl (com.liferay.knowledgebase.model.impl.KBTemplateImpl)6 KBTemplate (com.liferay.knowledgebase.model.KBTemplate)5 NoSuchTemplateException (com.liferay.knowledgebase.NoSuchTemplateException)4 Session (com.liferay.portal.kernel.dao.orm.Session)4 SystemException (com.liferay.portal.kernel.exception.SystemException)4