0001: /**
0002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
0003: *
0004: * Permission is hereby granted, free of charge, to any person obtaining a copy
0005: * of this software and associated documentation files (the "Software"), to deal
0006: * in the Software without restriction, including without limitation the rights
0007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0008: * copies of the Software, and to permit persons to whom the Software is
0009: * furnished to do so, subject to the following conditions:
0010: *
0011: * The above copyright notice and this permission notice shall be included in
0012: * all copies or substantial portions of the Software.
0013: *
0014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0020: * SOFTWARE.
0021: */package com.liferay.portlet.blogs.service.persistence;
0022:
0023: import com.liferay.portal.SystemException;
0024: import com.liferay.portal.kernel.dao.DynamicQuery;
0025: import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
0026: import com.liferay.portal.kernel.util.GetterUtil;
0027: import com.liferay.portal.kernel.util.OrderByComparator;
0028: import com.liferay.portal.kernel.util.StringMaker;
0029: import com.liferay.portal.kernel.util.StringPool;
0030: import com.liferay.portal.kernel.util.Validator;
0031: import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
0032: import com.liferay.portal.model.ModelListener;
0033: import com.liferay.portal.service.persistence.BasePersistence;
0034: import com.liferay.portal.spring.hibernate.FinderCache;
0035: import com.liferay.portal.spring.hibernate.HibernateUtil;
0036: import com.liferay.portal.util.PropsUtil;
0037:
0038: import com.liferay.portlet.blogs.NoSuchEntryException;
0039: import com.liferay.portlet.blogs.model.BlogsEntry;
0040: import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
0041: import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
0042:
0043: import com.liferay.util.dao.hibernate.QueryUtil;
0044:
0045: import org.apache.commons.logging.Log;
0046: import org.apache.commons.logging.LogFactory;
0047:
0048: import org.hibernate.Query;
0049: import org.hibernate.Session;
0050:
0051: import java.util.Collections;
0052: import java.util.Iterator;
0053: import java.util.List;
0054:
0055: /**
0056: * <a href="BlogsEntryPersistenceImpl.java.html"><b><i>View Source</i></b></a>
0057: *
0058: * @author Brian Wing Shun Chan
0059: *
0060: */
0061: public class BlogsEntryPersistenceImpl extends BasePersistence
0062: implements BlogsEntryPersistence {
0063: public BlogsEntry create(long entryId) {
0064: BlogsEntry blogsEntry = new BlogsEntryImpl();
0065:
0066: blogsEntry.setNew(true);
0067: blogsEntry.setPrimaryKey(entryId);
0068:
0069: String uuid = PortalUUIDUtil.generate();
0070:
0071: blogsEntry.setUuid(uuid);
0072:
0073: return blogsEntry;
0074: }
0075:
0076: public BlogsEntry remove(long entryId) throws NoSuchEntryException,
0077: SystemException {
0078: Session session = null;
0079:
0080: try {
0081: session = openSession();
0082:
0083: BlogsEntry blogsEntry = (BlogsEntry) session.get(
0084: BlogsEntryImpl.class, new Long(entryId));
0085:
0086: if (blogsEntry == null) {
0087: if (_log.isWarnEnabled()) {
0088: _log
0089: .warn("No BlogsEntry exists with the primary key "
0090: + entryId);
0091: }
0092:
0093: throw new NoSuchEntryException(
0094: "No BlogsEntry exists with the primary key "
0095: + entryId);
0096: }
0097:
0098: return remove(blogsEntry);
0099: } catch (NoSuchEntryException nsee) {
0100: throw nsee;
0101: } catch (Exception e) {
0102: throw HibernateUtil.processException(e);
0103: } finally {
0104: closeSession(session);
0105: }
0106: }
0107:
0108: public BlogsEntry remove(BlogsEntry blogsEntry)
0109: throws SystemException {
0110: ModelListener listener = _getListener();
0111:
0112: if (listener != null) {
0113: listener.onBeforeRemove(blogsEntry);
0114: }
0115:
0116: blogsEntry = removeImpl(blogsEntry);
0117:
0118: if (listener != null) {
0119: listener.onAfterRemove(blogsEntry);
0120: }
0121:
0122: return blogsEntry;
0123: }
0124:
0125: protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
0126: throws SystemException {
0127: Session session = null;
0128:
0129: try {
0130: session = openSession();
0131:
0132: session.delete(blogsEntry);
0133:
0134: session.flush();
0135:
0136: return blogsEntry;
0137: } catch (Exception e) {
0138: throw HibernateUtil.processException(e);
0139: } finally {
0140: closeSession(session);
0141:
0142: FinderCache.clearCache(BlogsEntry.class.getName());
0143: }
0144: }
0145:
0146: public BlogsEntry update(BlogsEntry blogsEntry)
0147: throws SystemException {
0148: return update(blogsEntry, false);
0149: }
0150:
0151: public BlogsEntry update(BlogsEntry blogsEntry, boolean merge)
0152: throws SystemException {
0153: ModelListener listener = _getListener();
0154:
0155: boolean isNew = blogsEntry.isNew();
0156:
0157: if (listener != null) {
0158: if (isNew) {
0159: listener.onBeforeCreate(blogsEntry);
0160: } else {
0161: listener.onBeforeUpdate(blogsEntry);
0162: }
0163: }
0164:
0165: blogsEntry = updateImpl(blogsEntry, merge);
0166:
0167: if (listener != null) {
0168: if (isNew) {
0169: listener.onAfterCreate(blogsEntry);
0170: } else {
0171: listener.onAfterUpdate(blogsEntry);
0172: }
0173: }
0174:
0175: return blogsEntry;
0176: }
0177:
0178: public BlogsEntry updateImpl(
0179: com.liferay.portlet.blogs.model.BlogsEntry blogsEntry,
0180: boolean merge) throws SystemException {
0181: if (Validator.isNull(blogsEntry.getUuid())) {
0182: String uuid = PortalUUIDUtil.generate();
0183:
0184: blogsEntry.setUuid(uuid);
0185: }
0186:
0187: Session session = null;
0188:
0189: try {
0190: session = openSession();
0191:
0192: if (merge) {
0193: session.merge(blogsEntry);
0194: } else {
0195: if (blogsEntry.isNew()) {
0196: session.save(blogsEntry);
0197: }
0198: }
0199:
0200: session.flush();
0201:
0202: blogsEntry.setNew(false);
0203:
0204: return blogsEntry;
0205: } catch (Exception e) {
0206: throw HibernateUtil.processException(e);
0207: } finally {
0208: closeSession(session);
0209:
0210: FinderCache.clearCache(BlogsEntry.class.getName());
0211: }
0212: }
0213:
0214: public BlogsEntry findByPrimaryKey(long entryId)
0215: throws NoSuchEntryException, SystemException {
0216: BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
0217:
0218: if (blogsEntry == null) {
0219: if (_log.isWarnEnabled()) {
0220: _log.warn("No BlogsEntry exists with the primary key "
0221: + entryId);
0222: }
0223:
0224: throw new NoSuchEntryException(
0225: "No BlogsEntry exists with the primary key "
0226: + entryId);
0227: }
0228:
0229: return blogsEntry;
0230: }
0231:
0232: public BlogsEntry fetchByPrimaryKey(long entryId)
0233: throws SystemException {
0234: Session session = null;
0235:
0236: try {
0237: session = openSession();
0238:
0239: return (BlogsEntry) session.get(BlogsEntryImpl.class,
0240: new Long(entryId));
0241: } catch (Exception e) {
0242: throw HibernateUtil.processException(e);
0243: } finally {
0244: closeSession(session);
0245: }
0246: }
0247:
0248: public List findByUuid(String uuid) throws SystemException {
0249: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0250: String finderClassName = BlogsEntry.class.getName();
0251: String finderMethodName = "findByUuid";
0252: String[] finderParams = new String[] { String.class.getName() };
0253: Object[] finderArgs = new Object[] { uuid };
0254:
0255: Object result = null;
0256:
0257: if (finderClassNameCacheEnabled) {
0258: result = FinderCache.getResult(finderClassName,
0259: finderMethodName, finderParams, finderArgs,
0260: getSessionFactory());
0261: }
0262:
0263: if (result == null) {
0264: Session session = null;
0265:
0266: try {
0267: session = openSession();
0268:
0269: StringMaker query = new StringMaker();
0270:
0271: query
0272: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0273:
0274: if (uuid == null) {
0275: query.append("uuid_ IS NULL");
0276: } else {
0277: query.append("uuid_ = ?");
0278: }
0279:
0280: query.append(" ");
0281:
0282: query.append("ORDER BY ");
0283:
0284: query.append("displayDate DESC");
0285:
0286: Query q = session.createQuery(query.toString());
0287:
0288: int queryPos = 0;
0289:
0290: if (uuid != null) {
0291: q.setString(queryPos++, uuid);
0292: }
0293:
0294: List list = q.list();
0295:
0296: FinderCache.putResult(finderClassNameCacheEnabled,
0297: finderClassName, finderMethodName,
0298: finderParams, finderArgs, list);
0299:
0300: return list;
0301: } catch (Exception e) {
0302: throw HibernateUtil.processException(e);
0303: } finally {
0304: closeSession(session);
0305: }
0306: } else {
0307: return (List) result;
0308: }
0309: }
0310:
0311: public List findByUuid(String uuid, int begin, int end)
0312: throws SystemException {
0313: return findByUuid(uuid, begin, end, null);
0314: }
0315:
0316: public List findByUuid(String uuid, int begin, int end,
0317: OrderByComparator obc) throws SystemException {
0318: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0319: String finderClassName = BlogsEntry.class.getName();
0320: String finderMethodName = "findByUuid";
0321: String[] finderParams = new String[] { String.class.getName(),
0322:
0323: "java.lang.Integer", "java.lang.Integer",
0324: "com.liferay.portal.kernel.util.OrderByComparator" };
0325: Object[] finderArgs = new Object[] { uuid,
0326:
0327: String.valueOf(begin), String.valueOf(end), String.valueOf(obc) };
0328:
0329: Object result = null;
0330:
0331: if (finderClassNameCacheEnabled) {
0332: result = FinderCache.getResult(finderClassName,
0333: finderMethodName, finderParams, finderArgs,
0334: getSessionFactory());
0335: }
0336:
0337: if (result == null) {
0338: Session session = null;
0339:
0340: try {
0341: session = openSession();
0342:
0343: StringMaker query = new StringMaker();
0344:
0345: query
0346: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0347:
0348: if (uuid == null) {
0349: query.append("uuid_ IS NULL");
0350: } else {
0351: query.append("uuid_ = ?");
0352: }
0353:
0354: query.append(" ");
0355:
0356: if (obc != null) {
0357: query.append("ORDER BY ");
0358: query.append(obc.getOrderBy());
0359: }
0360:
0361: else {
0362: query.append("ORDER BY ");
0363:
0364: query.append("displayDate DESC");
0365: }
0366:
0367: Query q = session.createQuery(query.toString());
0368:
0369: int queryPos = 0;
0370:
0371: if (uuid != null) {
0372: q.setString(queryPos++, uuid);
0373: }
0374:
0375: List list = QueryUtil.list(q, getDialect(), begin, end);
0376:
0377: FinderCache.putResult(finderClassNameCacheEnabled,
0378: finderClassName, finderMethodName,
0379: finderParams, finderArgs, list);
0380:
0381: return list;
0382: } catch (Exception e) {
0383: throw HibernateUtil.processException(e);
0384: } finally {
0385: closeSession(session);
0386: }
0387: } else {
0388: return (List) result;
0389: }
0390: }
0391:
0392: public BlogsEntry findByUuid_First(String uuid,
0393: OrderByComparator obc) throws NoSuchEntryException,
0394: SystemException {
0395: List list = findByUuid(uuid, 0, 1, obc);
0396:
0397: if (list.size() == 0) {
0398: StringMaker msg = new StringMaker();
0399:
0400: msg.append("No BlogsEntry exists with the key {");
0401:
0402: msg.append("uuid=" + uuid);
0403:
0404: msg.append(StringPool.CLOSE_CURLY_BRACE);
0405:
0406: throw new NoSuchEntryException(msg.toString());
0407: } else {
0408: return (BlogsEntry) list.get(0);
0409: }
0410: }
0411:
0412: public BlogsEntry findByUuid_Last(String uuid, OrderByComparator obc)
0413: throws NoSuchEntryException, SystemException {
0414: int count = countByUuid(uuid);
0415:
0416: List list = findByUuid(uuid, count - 1, count, obc);
0417:
0418: if (list.size() == 0) {
0419: StringMaker msg = new StringMaker();
0420:
0421: msg.append("No BlogsEntry exists with the key {");
0422:
0423: msg.append("uuid=" + uuid);
0424:
0425: msg.append(StringPool.CLOSE_CURLY_BRACE);
0426:
0427: throw new NoSuchEntryException(msg.toString());
0428: } else {
0429: return (BlogsEntry) list.get(0);
0430: }
0431: }
0432:
0433: public BlogsEntry[] findByUuid_PrevAndNext(long entryId,
0434: String uuid, OrderByComparator obc)
0435: throws NoSuchEntryException, SystemException {
0436: BlogsEntry blogsEntry = findByPrimaryKey(entryId);
0437:
0438: int count = countByUuid(uuid);
0439:
0440: Session session = null;
0441:
0442: try {
0443: session = openSession();
0444:
0445: StringMaker query = new StringMaker();
0446:
0447: query
0448: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0449:
0450: if (uuid == null) {
0451: query.append("uuid_ IS NULL");
0452: } else {
0453: query.append("uuid_ = ?");
0454: }
0455:
0456: query.append(" ");
0457:
0458: if (obc != null) {
0459: query.append("ORDER BY ");
0460: query.append(obc.getOrderBy());
0461: }
0462:
0463: else {
0464: query.append("ORDER BY ");
0465:
0466: query.append("displayDate DESC");
0467: }
0468:
0469: Query q = session.createQuery(query.toString());
0470:
0471: int queryPos = 0;
0472:
0473: if (uuid != null) {
0474: q.setString(queryPos++, uuid);
0475: }
0476:
0477: Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
0478: blogsEntry);
0479:
0480: BlogsEntry[] array = new BlogsEntryImpl[3];
0481:
0482: array[0] = (BlogsEntry) objArray[0];
0483: array[1] = (BlogsEntry) objArray[1];
0484: array[2] = (BlogsEntry) objArray[2];
0485:
0486: return array;
0487: } catch (Exception e) {
0488: throw HibernateUtil.processException(e);
0489: } finally {
0490: closeSession(session);
0491: }
0492: }
0493:
0494: public BlogsEntry findByUUID_G(String uuid, long groupId)
0495: throws NoSuchEntryException, SystemException {
0496: BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
0497:
0498: if (blogsEntry == null) {
0499: StringMaker msg = new StringMaker();
0500:
0501: msg.append("No BlogsEntry exists with the key {");
0502:
0503: msg.append("uuid=" + uuid);
0504:
0505: msg.append(", ");
0506: msg.append("groupId=" + groupId);
0507:
0508: msg.append(StringPool.CLOSE_CURLY_BRACE);
0509:
0510: if (_log.isWarnEnabled()) {
0511: _log.warn(msg.toString());
0512: }
0513:
0514: throw new NoSuchEntryException(msg.toString());
0515: }
0516:
0517: return blogsEntry;
0518: }
0519:
0520: public BlogsEntry fetchByUUID_G(String uuid, long groupId)
0521: throws SystemException {
0522: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0523: String finderClassName = BlogsEntry.class.getName();
0524: String finderMethodName = "fetchByUUID_G";
0525: String[] finderParams = new String[] { String.class.getName(),
0526: Long.class.getName() };
0527: Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
0528:
0529: Object result = null;
0530:
0531: if (finderClassNameCacheEnabled) {
0532: result = FinderCache.getResult(finderClassName,
0533: finderMethodName, finderParams, finderArgs,
0534: getSessionFactory());
0535: }
0536:
0537: if (result == null) {
0538: Session session = null;
0539:
0540: try {
0541: session = openSession();
0542:
0543: StringMaker query = new StringMaker();
0544:
0545: query
0546: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0547:
0548: if (uuid == null) {
0549: query.append("uuid_ IS NULL");
0550: } else {
0551: query.append("uuid_ = ?");
0552: }
0553:
0554: query.append(" AND ");
0555:
0556: query.append("groupId = ?");
0557:
0558: query.append(" ");
0559:
0560: query.append("ORDER BY ");
0561:
0562: query.append("displayDate DESC");
0563:
0564: Query q = session.createQuery(query.toString());
0565:
0566: int queryPos = 0;
0567:
0568: if (uuid != null) {
0569: q.setString(queryPos++, uuid);
0570: }
0571:
0572: q.setLong(queryPos++, groupId);
0573:
0574: List list = q.list();
0575:
0576: FinderCache.putResult(finderClassNameCacheEnabled,
0577: finderClassName, finderMethodName,
0578: finderParams, finderArgs, list);
0579:
0580: if (list.size() == 0) {
0581: return null;
0582: } else {
0583: return (BlogsEntry) list.get(0);
0584: }
0585: } catch (Exception e) {
0586: throw HibernateUtil.processException(e);
0587: } finally {
0588: closeSession(session);
0589: }
0590: } else {
0591: List list = (List) result;
0592:
0593: if (list.size() == 0) {
0594: return null;
0595: } else {
0596: return (BlogsEntry) list.get(0);
0597: }
0598: }
0599: }
0600:
0601: public List findByGroupId(long groupId) throws SystemException {
0602: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0603: String finderClassName = BlogsEntry.class.getName();
0604: String finderMethodName = "findByGroupId";
0605: String[] finderParams = new String[] { Long.class.getName() };
0606: Object[] finderArgs = new Object[] { new Long(groupId) };
0607:
0608: Object result = null;
0609:
0610: if (finderClassNameCacheEnabled) {
0611: result = FinderCache.getResult(finderClassName,
0612: finderMethodName, finderParams, finderArgs,
0613: getSessionFactory());
0614: }
0615:
0616: if (result == null) {
0617: Session session = null;
0618:
0619: try {
0620: session = openSession();
0621:
0622: StringMaker query = new StringMaker();
0623:
0624: query
0625: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0626:
0627: query.append("groupId = ?");
0628:
0629: query.append(" ");
0630:
0631: query.append("ORDER BY ");
0632:
0633: query.append("displayDate DESC");
0634:
0635: Query q = session.createQuery(query.toString());
0636:
0637: int queryPos = 0;
0638:
0639: q.setLong(queryPos++, groupId);
0640:
0641: List list = q.list();
0642:
0643: FinderCache.putResult(finderClassNameCacheEnabled,
0644: finderClassName, finderMethodName,
0645: finderParams, finderArgs, list);
0646:
0647: return list;
0648: } catch (Exception e) {
0649: throw HibernateUtil.processException(e);
0650: } finally {
0651: closeSession(session);
0652: }
0653: } else {
0654: return (List) result;
0655: }
0656: }
0657:
0658: public List findByGroupId(long groupId, int begin, int end)
0659: throws SystemException {
0660: return findByGroupId(groupId, begin, end, null);
0661: }
0662:
0663: public List findByGroupId(long groupId, int begin, int end,
0664: OrderByComparator obc) throws SystemException {
0665: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0666: String finderClassName = BlogsEntry.class.getName();
0667: String finderMethodName = "findByGroupId";
0668: String[] finderParams = new String[] { Long.class.getName(),
0669:
0670: "java.lang.Integer", "java.lang.Integer",
0671: "com.liferay.portal.kernel.util.OrderByComparator" };
0672: Object[] finderArgs = new Object[] { new Long(groupId),
0673:
0674: String.valueOf(begin), String.valueOf(end), String.valueOf(obc) };
0675:
0676: Object result = null;
0677:
0678: if (finderClassNameCacheEnabled) {
0679: result = FinderCache.getResult(finderClassName,
0680: finderMethodName, finderParams, finderArgs,
0681: getSessionFactory());
0682: }
0683:
0684: if (result == null) {
0685: Session session = null;
0686:
0687: try {
0688: session = openSession();
0689:
0690: StringMaker query = new StringMaker();
0691:
0692: query
0693: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0694:
0695: query.append("groupId = ?");
0696:
0697: query.append(" ");
0698:
0699: if (obc != null) {
0700: query.append("ORDER BY ");
0701: query.append(obc.getOrderBy());
0702: }
0703:
0704: else {
0705: query.append("ORDER BY ");
0706:
0707: query.append("displayDate DESC");
0708: }
0709:
0710: Query q = session.createQuery(query.toString());
0711:
0712: int queryPos = 0;
0713:
0714: q.setLong(queryPos++, groupId);
0715:
0716: List list = QueryUtil.list(q, getDialect(), begin, end);
0717:
0718: FinderCache.putResult(finderClassNameCacheEnabled,
0719: finderClassName, finderMethodName,
0720: finderParams, finderArgs, list);
0721:
0722: return list;
0723: } catch (Exception e) {
0724: throw HibernateUtil.processException(e);
0725: } finally {
0726: closeSession(session);
0727: }
0728: } else {
0729: return (List) result;
0730: }
0731: }
0732:
0733: public BlogsEntry findByGroupId_First(long groupId,
0734: OrderByComparator obc) throws NoSuchEntryException,
0735: SystemException {
0736: List list = findByGroupId(groupId, 0, 1, obc);
0737:
0738: if (list.size() == 0) {
0739: StringMaker msg = new StringMaker();
0740:
0741: msg.append("No BlogsEntry exists with the key {");
0742:
0743: msg.append("groupId=" + groupId);
0744:
0745: msg.append(StringPool.CLOSE_CURLY_BRACE);
0746:
0747: throw new NoSuchEntryException(msg.toString());
0748: } else {
0749: return (BlogsEntry) list.get(0);
0750: }
0751: }
0752:
0753: public BlogsEntry findByGroupId_Last(long groupId,
0754: OrderByComparator obc) throws NoSuchEntryException,
0755: SystemException {
0756: int count = countByGroupId(groupId);
0757:
0758: List list = findByGroupId(groupId, count - 1, count, obc);
0759:
0760: if (list.size() == 0) {
0761: StringMaker msg = new StringMaker();
0762:
0763: msg.append("No BlogsEntry exists with the key {");
0764:
0765: msg.append("groupId=" + groupId);
0766:
0767: msg.append(StringPool.CLOSE_CURLY_BRACE);
0768:
0769: throw new NoSuchEntryException(msg.toString());
0770: } else {
0771: return (BlogsEntry) list.get(0);
0772: }
0773: }
0774:
0775: public BlogsEntry[] findByGroupId_PrevAndNext(long entryId,
0776: long groupId, OrderByComparator obc)
0777: throws NoSuchEntryException, SystemException {
0778: BlogsEntry blogsEntry = findByPrimaryKey(entryId);
0779:
0780: int count = countByGroupId(groupId);
0781:
0782: Session session = null;
0783:
0784: try {
0785: session = openSession();
0786:
0787: StringMaker query = new StringMaker();
0788:
0789: query
0790: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0791:
0792: query.append("groupId = ?");
0793:
0794: query.append(" ");
0795:
0796: if (obc != null) {
0797: query.append("ORDER BY ");
0798: query.append(obc.getOrderBy());
0799: }
0800:
0801: else {
0802: query.append("ORDER BY ");
0803:
0804: query.append("displayDate DESC");
0805: }
0806:
0807: Query q = session.createQuery(query.toString());
0808:
0809: int queryPos = 0;
0810:
0811: q.setLong(queryPos++, groupId);
0812:
0813: Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
0814: blogsEntry);
0815:
0816: BlogsEntry[] array = new BlogsEntryImpl[3];
0817:
0818: array[0] = (BlogsEntry) objArray[0];
0819: array[1] = (BlogsEntry) objArray[1];
0820: array[2] = (BlogsEntry) objArray[2];
0821:
0822: return array;
0823: } catch (Exception e) {
0824: throw HibernateUtil.processException(e);
0825: } finally {
0826: closeSession(session);
0827: }
0828: }
0829:
0830: public List findByCompanyId(long companyId) throws SystemException {
0831: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0832: String finderClassName = BlogsEntry.class.getName();
0833: String finderMethodName = "findByCompanyId";
0834: String[] finderParams = new String[] { Long.class.getName() };
0835: Object[] finderArgs = new Object[] { new Long(companyId) };
0836:
0837: Object result = null;
0838:
0839: if (finderClassNameCacheEnabled) {
0840: result = FinderCache.getResult(finderClassName,
0841: finderMethodName, finderParams, finderArgs,
0842: getSessionFactory());
0843: }
0844:
0845: if (result == null) {
0846: Session session = null;
0847:
0848: try {
0849: session = openSession();
0850:
0851: StringMaker query = new StringMaker();
0852:
0853: query
0854: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0855:
0856: query.append("companyId = ?");
0857:
0858: query.append(" ");
0859:
0860: query.append("ORDER BY ");
0861:
0862: query.append("displayDate DESC");
0863:
0864: Query q = session.createQuery(query.toString());
0865:
0866: int queryPos = 0;
0867:
0868: q.setLong(queryPos++, companyId);
0869:
0870: List list = q.list();
0871:
0872: FinderCache.putResult(finderClassNameCacheEnabled,
0873: finderClassName, finderMethodName,
0874: finderParams, finderArgs, list);
0875:
0876: return list;
0877: } catch (Exception e) {
0878: throw HibernateUtil.processException(e);
0879: } finally {
0880: closeSession(session);
0881: }
0882: } else {
0883: return (List) result;
0884: }
0885: }
0886:
0887: public List findByCompanyId(long companyId, int begin, int end)
0888: throws SystemException {
0889: return findByCompanyId(companyId, begin, end, null);
0890: }
0891:
0892: public List findByCompanyId(long companyId, int begin, int end,
0893: OrderByComparator obc) throws SystemException {
0894: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
0895: String finderClassName = BlogsEntry.class.getName();
0896: String finderMethodName = "findByCompanyId";
0897: String[] finderParams = new String[] { Long.class.getName(),
0898:
0899: "java.lang.Integer", "java.lang.Integer",
0900: "com.liferay.portal.kernel.util.OrderByComparator" };
0901: Object[] finderArgs = new Object[] { new Long(companyId),
0902:
0903: String.valueOf(begin), String.valueOf(end), String.valueOf(obc) };
0904:
0905: Object result = null;
0906:
0907: if (finderClassNameCacheEnabled) {
0908: result = FinderCache.getResult(finderClassName,
0909: finderMethodName, finderParams, finderArgs,
0910: getSessionFactory());
0911: }
0912:
0913: if (result == null) {
0914: Session session = null;
0915:
0916: try {
0917: session = openSession();
0918:
0919: StringMaker query = new StringMaker();
0920:
0921: query
0922: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
0923:
0924: query.append("companyId = ?");
0925:
0926: query.append(" ");
0927:
0928: if (obc != null) {
0929: query.append("ORDER BY ");
0930: query.append(obc.getOrderBy());
0931: }
0932:
0933: else {
0934: query.append("ORDER BY ");
0935:
0936: query.append("displayDate DESC");
0937: }
0938:
0939: Query q = session.createQuery(query.toString());
0940:
0941: int queryPos = 0;
0942:
0943: q.setLong(queryPos++, companyId);
0944:
0945: List list = QueryUtil.list(q, getDialect(), begin, end);
0946:
0947: FinderCache.putResult(finderClassNameCacheEnabled,
0948: finderClassName, finderMethodName,
0949: finderParams, finderArgs, list);
0950:
0951: return list;
0952: } catch (Exception e) {
0953: throw HibernateUtil.processException(e);
0954: } finally {
0955: closeSession(session);
0956: }
0957: } else {
0958: return (List) result;
0959: }
0960: }
0961:
0962: public BlogsEntry findByCompanyId_First(long companyId,
0963: OrderByComparator obc) throws NoSuchEntryException,
0964: SystemException {
0965: List list = findByCompanyId(companyId, 0, 1, obc);
0966:
0967: if (list.size() == 0) {
0968: StringMaker msg = new StringMaker();
0969:
0970: msg.append("No BlogsEntry exists with the key {");
0971:
0972: msg.append("companyId=" + companyId);
0973:
0974: msg.append(StringPool.CLOSE_CURLY_BRACE);
0975:
0976: throw new NoSuchEntryException(msg.toString());
0977: } else {
0978: return (BlogsEntry) list.get(0);
0979: }
0980: }
0981:
0982: public BlogsEntry findByCompanyId_Last(long companyId,
0983: OrderByComparator obc) throws NoSuchEntryException,
0984: SystemException {
0985: int count = countByCompanyId(companyId);
0986:
0987: List list = findByCompanyId(companyId, count - 1, count, obc);
0988:
0989: if (list.size() == 0) {
0990: StringMaker msg = new StringMaker();
0991:
0992: msg.append("No BlogsEntry exists with the key {");
0993:
0994: msg.append("companyId=" + companyId);
0995:
0996: msg.append(StringPool.CLOSE_CURLY_BRACE);
0997:
0998: throw new NoSuchEntryException(msg.toString());
0999: } else {
1000: return (BlogsEntry) list.get(0);
1001: }
1002: }
1003:
1004: public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
1005: long companyId, OrderByComparator obc)
1006: throws NoSuchEntryException, SystemException {
1007: BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1008:
1009: int count = countByCompanyId(companyId);
1010:
1011: Session session = null;
1012:
1013: try {
1014: session = openSession();
1015:
1016: StringMaker query = new StringMaker();
1017:
1018: query
1019: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1020:
1021: query.append("companyId = ?");
1022:
1023: query.append(" ");
1024:
1025: if (obc != null) {
1026: query.append("ORDER BY ");
1027: query.append(obc.getOrderBy());
1028: }
1029:
1030: else {
1031: query.append("ORDER BY ");
1032:
1033: query.append("displayDate DESC");
1034: }
1035:
1036: Query q = session.createQuery(query.toString());
1037:
1038: int queryPos = 0;
1039:
1040: q.setLong(queryPos++, companyId);
1041:
1042: Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1043: blogsEntry);
1044:
1045: BlogsEntry[] array = new BlogsEntryImpl[3];
1046:
1047: array[0] = (BlogsEntry) objArray[0];
1048: array[1] = (BlogsEntry) objArray[1];
1049: array[2] = (BlogsEntry) objArray[2];
1050:
1051: return array;
1052: } catch (Exception e) {
1053: throw HibernateUtil.processException(e);
1054: } finally {
1055: closeSession(session);
1056: }
1057: }
1058:
1059: public List findByG_U(long groupId, long userId)
1060: throws SystemException {
1061: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1062: String finderClassName = BlogsEntry.class.getName();
1063: String finderMethodName = "findByG_U";
1064: String[] finderParams = new String[] { Long.class.getName(),
1065: Long.class.getName() };
1066: Object[] finderArgs = new Object[] { new Long(groupId),
1067: new Long(userId) };
1068:
1069: Object result = null;
1070:
1071: if (finderClassNameCacheEnabled) {
1072: result = FinderCache.getResult(finderClassName,
1073: finderMethodName, finderParams, finderArgs,
1074: getSessionFactory());
1075: }
1076:
1077: if (result == null) {
1078: Session session = null;
1079:
1080: try {
1081: session = openSession();
1082:
1083: StringMaker query = new StringMaker();
1084:
1085: query
1086: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1087:
1088: query.append("groupId = ?");
1089:
1090: query.append(" AND ");
1091:
1092: query.append("userId = ?");
1093:
1094: query.append(" ");
1095:
1096: query.append("ORDER BY ");
1097:
1098: query.append("displayDate DESC");
1099:
1100: Query q = session.createQuery(query.toString());
1101:
1102: int queryPos = 0;
1103:
1104: q.setLong(queryPos++, groupId);
1105:
1106: q.setLong(queryPos++, userId);
1107:
1108: List list = q.list();
1109:
1110: FinderCache.putResult(finderClassNameCacheEnabled,
1111: finderClassName, finderMethodName,
1112: finderParams, finderArgs, list);
1113:
1114: return list;
1115: } catch (Exception e) {
1116: throw HibernateUtil.processException(e);
1117: } finally {
1118: closeSession(session);
1119: }
1120: } else {
1121: return (List) result;
1122: }
1123: }
1124:
1125: public List findByG_U(long groupId, long userId, int begin, int end)
1126: throws SystemException {
1127: return findByG_U(groupId, userId, begin, end, null);
1128: }
1129:
1130: public List findByG_U(long groupId, long userId, int begin,
1131: int end, OrderByComparator obc) throws SystemException {
1132: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1133: String finderClassName = BlogsEntry.class.getName();
1134: String finderMethodName = "findByG_U";
1135: String[] finderParams = new String[] { Long.class.getName(),
1136: Long.class.getName(),
1137:
1138: "java.lang.Integer", "java.lang.Integer",
1139: "com.liferay.portal.kernel.util.OrderByComparator" };
1140: Object[] finderArgs = new Object[] { new Long(groupId),
1141: new Long(userId),
1142:
1143: String.valueOf(begin), String.valueOf(end),
1144: String.valueOf(obc) };
1145:
1146: Object result = null;
1147:
1148: if (finderClassNameCacheEnabled) {
1149: result = FinderCache.getResult(finderClassName,
1150: finderMethodName, finderParams, finderArgs,
1151: getSessionFactory());
1152: }
1153:
1154: if (result == null) {
1155: Session session = null;
1156:
1157: try {
1158: session = openSession();
1159:
1160: StringMaker query = new StringMaker();
1161:
1162: query
1163: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1164:
1165: query.append("groupId = ?");
1166:
1167: query.append(" AND ");
1168:
1169: query.append("userId = ?");
1170:
1171: query.append(" ");
1172:
1173: if (obc != null) {
1174: query.append("ORDER BY ");
1175: query.append(obc.getOrderBy());
1176: }
1177:
1178: else {
1179: query.append("ORDER BY ");
1180:
1181: query.append("displayDate DESC");
1182: }
1183:
1184: Query q = session.createQuery(query.toString());
1185:
1186: int queryPos = 0;
1187:
1188: q.setLong(queryPos++, groupId);
1189:
1190: q.setLong(queryPos++, userId);
1191:
1192: List list = QueryUtil.list(q, getDialect(), begin, end);
1193:
1194: FinderCache.putResult(finderClassNameCacheEnabled,
1195: finderClassName, finderMethodName,
1196: finderParams, finderArgs, list);
1197:
1198: return list;
1199: } catch (Exception e) {
1200: throw HibernateUtil.processException(e);
1201: } finally {
1202: closeSession(session);
1203: }
1204: } else {
1205: return (List) result;
1206: }
1207: }
1208:
1209: public BlogsEntry findByG_U_First(long groupId, long userId,
1210: OrderByComparator obc) throws NoSuchEntryException,
1211: SystemException {
1212: List list = findByG_U(groupId, userId, 0, 1, obc);
1213:
1214: if (list.size() == 0) {
1215: StringMaker msg = new StringMaker();
1216:
1217: msg.append("No BlogsEntry exists with the key {");
1218:
1219: msg.append("groupId=" + groupId);
1220:
1221: msg.append(", ");
1222: msg.append("userId=" + userId);
1223:
1224: msg.append(StringPool.CLOSE_CURLY_BRACE);
1225:
1226: throw new NoSuchEntryException(msg.toString());
1227: } else {
1228: return (BlogsEntry) list.get(0);
1229: }
1230: }
1231:
1232: public BlogsEntry findByG_U_Last(long groupId, long userId,
1233: OrderByComparator obc) throws NoSuchEntryException,
1234: SystemException {
1235: int count = countByG_U(groupId, userId);
1236:
1237: List list = findByG_U(groupId, userId, count - 1, count, obc);
1238:
1239: if (list.size() == 0) {
1240: StringMaker msg = new StringMaker();
1241:
1242: msg.append("No BlogsEntry exists with the key {");
1243:
1244: msg.append("groupId=" + groupId);
1245:
1246: msg.append(", ");
1247: msg.append("userId=" + userId);
1248:
1249: msg.append(StringPool.CLOSE_CURLY_BRACE);
1250:
1251: throw new NoSuchEntryException(msg.toString());
1252: } else {
1253: return (BlogsEntry) list.get(0);
1254: }
1255: }
1256:
1257: public BlogsEntry[] findByG_U_PrevAndNext(long entryId,
1258: long groupId, long userId, OrderByComparator obc)
1259: throws NoSuchEntryException, SystemException {
1260: BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1261:
1262: int count = countByG_U(groupId, userId);
1263:
1264: Session session = null;
1265:
1266: try {
1267: session = openSession();
1268:
1269: StringMaker query = new StringMaker();
1270:
1271: query
1272: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1273:
1274: query.append("groupId = ?");
1275:
1276: query.append(" AND ");
1277:
1278: query.append("userId = ?");
1279:
1280: query.append(" ");
1281:
1282: if (obc != null) {
1283: query.append("ORDER BY ");
1284: query.append(obc.getOrderBy());
1285: }
1286:
1287: else {
1288: query.append("ORDER BY ");
1289:
1290: query.append("displayDate DESC");
1291: }
1292:
1293: Query q = session.createQuery(query.toString());
1294:
1295: int queryPos = 0;
1296:
1297: q.setLong(queryPos++, groupId);
1298:
1299: q.setLong(queryPos++, userId);
1300:
1301: Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1302: blogsEntry);
1303:
1304: BlogsEntry[] array = new BlogsEntryImpl[3];
1305:
1306: array[0] = (BlogsEntry) objArray[0];
1307: array[1] = (BlogsEntry) objArray[1];
1308: array[2] = (BlogsEntry) objArray[2];
1309:
1310: return array;
1311: } catch (Exception e) {
1312: throw HibernateUtil.processException(e);
1313: } finally {
1314: closeSession(session);
1315: }
1316: }
1317:
1318: public BlogsEntry findByG_UT(long groupId, String urlTitle)
1319: throws NoSuchEntryException, SystemException {
1320: BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
1321:
1322: if (blogsEntry == null) {
1323: StringMaker msg = new StringMaker();
1324:
1325: msg.append("No BlogsEntry exists with the key {");
1326:
1327: msg.append("groupId=" + groupId);
1328:
1329: msg.append(", ");
1330: msg.append("urlTitle=" + urlTitle);
1331:
1332: msg.append(StringPool.CLOSE_CURLY_BRACE);
1333:
1334: if (_log.isWarnEnabled()) {
1335: _log.warn(msg.toString());
1336: }
1337:
1338: throw new NoSuchEntryException(msg.toString());
1339: }
1340:
1341: return blogsEntry;
1342: }
1343:
1344: public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
1345: throws SystemException {
1346: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1347: String finderClassName = BlogsEntry.class.getName();
1348: String finderMethodName = "fetchByG_UT";
1349: String[] finderParams = new String[] { Long.class.getName(),
1350: String.class.getName() };
1351: Object[] finderArgs = new Object[] { new Long(groupId),
1352: urlTitle };
1353:
1354: Object result = null;
1355:
1356: if (finderClassNameCacheEnabled) {
1357: result = FinderCache.getResult(finderClassName,
1358: finderMethodName, finderParams, finderArgs,
1359: getSessionFactory());
1360: }
1361:
1362: if (result == null) {
1363: Session session = null;
1364:
1365: try {
1366: session = openSession();
1367:
1368: StringMaker query = new StringMaker();
1369:
1370: query
1371: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1372:
1373: query.append("groupId = ?");
1374:
1375: query.append(" AND ");
1376:
1377: if (urlTitle == null) {
1378: query.append("urlTitle IS NULL");
1379: } else {
1380: query.append("urlTitle = ?");
1381: }
1382:
1383: query.append(" ");
1384:
1385: query.append("ORDER BY ");
1386:
1387: query.append("displayDate DESC");
1388:
1389: Query q = session.createQuery(query.toString());
1390:
1391: int queryPos = 0;
1392:
1393: q.setLong(queryPos++, groupId);
1394:
1395: if (urlTitle != null) {
1396: q.setString(queryPos++, urlTitle);
1397: }
1398:
1399: List list = q.list();
1400:
1401: FinderCache.putResult(finderClassNameCacheEnabled,
1402: finderClassName, finderMethodName,
1403: finderParams, finderArgs, list);
1404:
1405: if (list.size() == 0) {
1406: return null;
1407: } else {
1408: return (BlogsEntry) list.get(0);
1409: }
1410: } catch (Exception e) {
1411: throw HibernateUtil.processException(e);
1412: } finally {
1413: closeSession(session);
1414: }
1415: } else {
1416: List list = (List) result;
1417:
1418: if (list.size() == 0) {
1419: return null;
1420: } else {
1421: return (BlogsEntry) list.get(0);
1422: }
1423: }
1424: }
1425:
1426: public List findByC_U(long companyId, long userId)
1427: throws SystemException {
1428: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1429: String finderClassName = BlogsEntry.class.getName();
1430: String finderMethodName = "findByC_U";
1431: String[] finderParams = new String[] { Long.class.getName(),
1432: Long.class.getName() };
1433: Object[] finderArgs = new Object[] { new Long(companyId),
1434: new Long(userId) };
1435:
1436: Object result = null;
1437:
1438: if (finderClassNameCacheEnabled) {
1439: result = FinderCache.getResult(finderClassName,
1440: finderMethodName, finderParams, finderArgs,
1441: getSessionFactory());
1442: }
1443:
1444: if (result == null) {
1445: Session session = null;
1446:
1447: try {
1448: session = openSession();
1449:
1450: StringMaker query = new StringMaker();
1451:
1452: query
1453: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1454:
1455: query.append("companyId = ?");
1456:
1457: query.append(" AND ");
1458:
1459: query.append("userId = ?");
1460:
1461: query.append(" ");
1462:
1463: query.append("ORDER BY ");
1464:
1465: query.append("displayDate DESC");
1466:
1467: Query q = session.createQuery(query.toString());
1468:
1469: int queryPos = 0;
1470:
1471: q.setLong(queryPos++, companyId);
1472:
1473: q.setLong(queryPos++, userId);
1474:
1475: List list = q.list();
1476:
1477: FinderCache.putResult(finderClassNameCacheEnabled,
1478: finderClassName, finderMethodName,
1479: finderParams, finderArgs, list);
1480:
1481: return list;
1482: } catch (Exception e) {
1483: throw HibernateUtil.processException(e);
1484: } finally {
1485: closeSession(session);
1486: }
1487: } else {
1488: return (List) result;
1489: }
1490: }
1491:
1492: public List findByC_U(long companyId, long userId, int begin,
1493: int end) throws SystemException {
1494: return findByC_U(companyId, userId, begin, end, null);
1495: }
1496:
1497: public List findByC_U(long companyId, long userId, int begin,
1498: int end, OrderByComparator obc) throws SystemException {
1499: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1500: String finderClassName = BlogsEntry.class.getName();
1501: String finderMethodName = "findByC_U";
1502: String[] finderParams = new String[] { Long.class.getName(),
1503: Long.class.getName(),
1504:
1505: "java.lang.Integer", "java.lang.Integer",
1506: "com.liferay.portal.kernel.util.OrderByComparator" };
1507: Object[] finderArgs = new Object[] { new Long(companyId),
1508: new Long(userId),
1509:
1510: String.valueOf(begin), String.valueOf(end),
1511: String.valueOf(obc) };
1512:
1513: Object result = null;
1514:
1515: if (finderClassNameCacheEnabled) {
1516: result = FinderCache.getResult(finderClassName,
1517: finderMethodName, finderParams, finderArgs,
1518: getSessionFactory());
1519: }
1520:
1521: if (result == null) {
1522: Session session = null;
1523:
1524: try {
1525: session = openSession();
1526:
1527: StringMaker query = new StringMaker();
1528:
1529: query
1530: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1531:
1532: query.append("companyId = ?");
1533:
1534: query.append(" AND ");
1535:
1536: query.append("userId = ?");
1537:
1538: query.append(" ");
1539:
1540: if (obc != null) {
1541: query.append("ORDER BY ");
1542: query.append(obc.getOrderBy());
1543: }
1544:
1545: else {
1546: query.append("ORDER BY ");
1547:
1548: query.append("displayDate DESC");
1549: }
1550:
1551: Query q = session.createQuery(query.toString());
1552:
1553: int queryPos = 0;
1554:
1555: q.setLong(queryPos++, companyId);
1556:
1557: q.setLong(queryPos++, userId);
1558:
1559: List list = QueryUtil.list(q, getDialect(), begin, end);
1560:
1561: FinderCache.putResult(finderClassNameCacheEnabled,
1562: finderClassName, finderMethodName,
1563: finderParams, finderArgs, list);
1564:
1565: return list;
1566: } catch (Exception e) {
1567: throw HibernateUtil.processException(e);
1568: } finally {
1569: closeSession(session);
1570: }
1571: } else {
1572: return (List) result;
1573: }
1574: }
1575:
1576: public BlogsEntry findByC_U_First(long companyId, long userId,
1577: OrderByComparator obc) throws NoSuchEntryException,
1578: SystemException {
1579: List list = findByC_U(companyId, userId, 0, 1, obc);
1580:
1581: if (list.size() == 0) {
1582: StringMaker msg = new StringMaker();
1583:
1584: msg.append("No BlogsEntry exists with the key {");
1585:
1586: msg.append("companyId=" + companyId);
1587:
1588: msg.append(", ");
1589: msg.append("userId=" + userId);
1590:
1591: msg.append(StringPool.CLOSE_CURLY_BRACE);
1592:
1593: throw new NoSuchEntryException(msg.toString());
1594: } else {
1595: return (BlogsEntry) list.get(0);
1596: }
1597: }
1598:
1599: public BlogsEntry findByC_U_Last(long companyId, long userId,
1600: OrderByComparator obc) throws NoSuchEntryException,
1601: SystemException {
1602: int count = countByC_U(companyId, userId);
1603:
1604: List list = findByC_U(companyId, userId, count - 1, count, obc);
1605:
1606: if (list.size() == 0) {
1607: StringMaker msg = new StringMaker();
1608:
1609: msg.append("No BlogsEntry exists with the key {");
1610:
1611: msg.append("companyId=" + companyId);
1612:
1613: msg.append(", ");
1614: msg.append("userId=" + userId);
1615:
1616: msg.append(StringPool.CLOSE_CURLY_BRACE);
1617:
1618: throw new NoSuchEntryException(msg.toString());
1619: } else {
1620: return (BlogsEntry) list.get(0);
1621: }
1622: }
1623:
1624: public BlogsEntry[] findByC_U_PrevAndNext(long entryId,
1625: long companyId, long userId, OrderByComparator obc)
1626: throws NoSuchEntryException, SystemException {
1627: BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1628:
1629: int count = countByC_U(companyId, userId);
1630:
1631: Session session = null;
1632:
1633: try {
1634: session = openSession();
1635:
1636: StringMaker query = new StringMaker();
1637:
1638: query
1639: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1640:
1641: query.append("companyId = ?");
1642:
1643: query.append(" AND ");
1644:
1645: query.append("userId = ?");
1646:
1647: query.append(" ");
1648:
1649: if (obc != null) {
1650: query.append("ORDER BY ");
1651: query.append(obc.getOrderBy());
1652: }
1653:
1654: else {
1655: query.append("ORDER BY ");
1656:
1657: query.append("displayDate DESC");
1658: }
1659:
1660: Query q = session.createQuery(query.toString());
1661:
1662: int queryPos = 0;
1663:
1664: q.setLong(queryPos++, companyId);
1665:
1666: q.setLong(queryPos++, userId);
1667:
1668: Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1669: blogsEntry);
1670:
1671: BlogsEntry[] array = new BlogsEntryImpl[3];
1672:
1673: array[0] = (BlogsEntry) objArray[0];
1674: array[1] = (BlogsEntry) objArray[1];
1675: array[2] = (BlogsEntry) objArray[2];
1676:
1677: return array;
1678: } catch (Exception e) {
1679: throw HibernateUtil.processException(e);
1680: } finally {
1681: closeSession(session);
1682: }
1683: }
1684:
1685: public List findWithDynamicQuery(
1686: DynamicQueryInitializer queryInitializer)
1687: throws SystemException {
1688: Session session = null;
1689:
1690: try {
1691: session = openSession();
1692:
1693: DynamicQuery query = queryInitializer.initialize(session);
1694:
1695: return query.list();
1696: } catch (Exception e) {
1697: throw HibernateUtil.processException(e);
1698: } finally {
1699: closeSession(session);
1700: }
1701: }
1702:
1703: public List findWithDynamicQuery(
1704: DynamicQueryInitializer queryInitializer, int begin, int end)
1705: throws SystemException {
1706: Session session = null;
1707:
1708: try {
1709: session = openSession();
1710:
1711: DynamicQuery query = queryInitializer.initialize(session);
1712:
1713: query.setLimit(begin, end);
1714:
1715: return query.list();
1716: } catch (Exception e) {
1717: throw HibernateUtil.processException(e);
1718: } finally {
1719: closeSession(session);
1720: }
1721: }
1722:
1723: public List findAll() throws SystemException {
1724: return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1725: }
1726:
1727: public List findAll(int begin, int end) throws SystemException {
1728: return findAll(begin, end, null);
1729: }
1730:
1731: public List findAll(int begin, int end, OrderByComparator obc)
1732: throws SystemException {
1733: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1734: String finderClassName = BlogsEntry.class.getName();
1735: String finderMethodName = "findAll";
1736: String[] finderParams = new String[] { "java.lang.Integer",
1737: "java.lang.Integer",
1738: "com.liferay.portal.kernel.util.OrderByComparator" };
1739: Object[] finderArgs = new Object[] { String.valueOf(begin),
1740: String.valueOf(end), String.valueOf(obc) };
1741:
1742: Object result = null;
1743:
1744: if (finderClassNameCacheEnabled) {
1745: result = FinderCache.getResult(finderClassName,
1746: finderMethodName, finderParams, finderArgs,
1747: getSessionFactory());
1748: }
1749:
1750: if (result == null) {
1751: Session session = null;
1752:
1753: try {
1754: session = openSession();
1755:
1756: StringMaker query = new StringMaker();
1757:
1758: query
1759: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry ");
1760:
1761: if (obc != null) {
1762: query.append("ORDER BY ");
1763: query.append(obc.getOrderBy());
1764: }
1765:
1766: else {
1767: query.append("ORDER BY ");
1768:
1769: query.append("displayDate DESC");
1770: }
1771:
1772: Query q = session.createQuery(query.toString());
1773:
1774: List list = QueryUtil.list(q, getDialect(), begin, end);
1775:
1776: if (obc == null) {
1777: Collections.sort(list);
1778: }
1779:
1780: FinderCache.putResult(finderClassNameCacheEnabled,
1781: finderClassName, finderMethodName,
1782: finderParams, finderArgs, list);
1783:
1784: return list;
1785: } catch (Exception e) {
1786: throw HibernateUtil.processException(e);
1787: } finally {
1788: closeSession(session);
1789: }
1790: } else {
1791: return (List) result;
1792: }
1793: }
1794:
1795: public void removeByUuid(String uuid) throws SystemException {
1796: Iterator itr = findByUuid(uuid).iterator();
1797:
1798: while (itr.hasNext()) {
1799: BlogsEntry blogsEntry = (BlogsEntry) itr.next();
1800:
1801: remove(blogsEntry);
1802: }
1803: }
1804:
1805: public void removeByUUID_G(String uuid, long groupId)
1806: throws NoSuchEntryException, SystemException {
1807: BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
1808:
1809: remove(blogsEntry);
1810: }
1811:
1812: public void removeByGroupId(long groupId) throws SystemException {
1813: Iterator itr = findByGroupId(groupId).iterator();
1814:
1815: while (itr.hasNext()) {
1816: BlogsEntry blogsEntry = (BlogsEntry) itr.next();
1817:
1818: remove(blogsEntry);
1819: }
1820: }
1821:
1822: public void removeByCompanyId(long companyId)
1823: throws SystemException {
1824: Iterator itr = findByCompanyId(companyId).iterator();
1825:
1826: while (itr.hasNext()) {
1827: BlogsEntry blogsEntry = (BlogsEntry) itr.next();
1828:
1829: remove(blogsEntry);
1830: }
1831: }
1832:
1833: public void removeByG_U(long groupId, long userId)
1834: throws SystemException {
1835: Iterator itr = findByG_U(groupId, userId).iterator();
1836:
1837: while (itr.hasNext()) {
1838: BlogsEntry blogsEntry = (BlogsEntry) itr.next();
1839:
1840: remove(blogsEntry);
1841: }
1842: }
1843:
1844: public void removeByG_UT(long groupId, String urlTitle)
1845: throws NoSuchEntryException, SystemException {
1846: BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
1847:
1848: remove(blogsEntry);
1849: }
1850:
1851: public void removeByC_U(long companyId, long userId)
1852: throws SystemException {
1853: Iterator itr = findByC_U(companyId, userId).iterator();
1854:
1855: while (itr.hasNext()) {
1856: BlogsEntry blogsEntry = (BlogsEntry) itr.next();
1857:
1858: remove(blogsEntry);
1859: }
1860: }
1861:
1862: public void removeAll() throws SystemException {
1863: Iterator itr = findAll().iterator();
1864:
1865: while (itr.hasNext()) {
1866: remove((BlogsEntry) itr.next());
1867: }
1868: }
1869:
1870: public int countByUuid(String uuid) throws SystemException {
1871: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1872: String finderClassName = BlogsEntry.class.getName();
1873: String finderMethodName = "countByUuid";
1874: String[] finderParams = new String[] { String.class.getName() };
1875: Object[] finderArgs = new Object[] { uuid };
1876:
1877: Object result = null;
1878:
1879: if (finderClassNameCacheEnabled) {
1880: result = FinderCache.getResult(finderClassName,
1881: finderMethodName, finderParams, finderArgs,
1882: getSessionFactory());
1883: }
1884:
1885: if (result == null) {
1886: Session session = null;
1887:
1888: try {
1889: session = openSession();
1890:
1891: StringMaker query = new StringMaker();
1892:
1893: query.append("SELECT COUNT(*) ");
1894: query
1895: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1896:
1897: if (uuid == null) {
1898: query.append("uuid_ IS NULL");
1899: } else {
1900: query.append("uuid_ = ?");
1901: }
1902:
1903: query.append(" ");
1904:
1905: Query q = session.createQuery(query.toString());
1906:
1907: int queryPos = 0;
1908:
1909: if (uuid != null) {
1910: q.setString(queryPos++, uuid);
1911: }
1912:
1913: Long count = null;
1914:
1915: Iterator itr = q.list().iterator();
1916:
1917: if (itr.hasNext()) {
1918: count = (Long) itr.next();
1919: }
1920:
1921: if (count == null) {
1922: count = new Long(0);
1923: }
1924:
1925: FinderCache.putResult(finderClassNameCacheEnabled,
1926: finderClassName, finderMethodName,
1927: finderParams, finderArgs, count);
1928:
1929: return count.intValue();
1930: } catch (Exception e) {
1931: throw HibernateUtil.processException(e);
1932: } finally {
1933: closeSession(session);
1934: }
1935: } else {
1936: return ((Long) result).intValue();
1937: }
1938: }
1939:
1940: public int countByUUID_G(String uuid, long groupId)
1941: throws SystemException {
1942: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
1943: String finderClassName = BlogsEntry.class.getName();
1944: String finderMethodName = "countByUUID_G";
1945: String[] finderParams = new String[] { String.class.getName(),
1946: Long.class.getName() };
1947: Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1948:
1949: Object result = null;
1950:
1951: if (finderClassNameCacheEnabled) {
1952: result = FinderCache.getResult(finderClassName,
1953: finderMethodName, finderParams, finderArgs,
1954: getSessionFactory());
1955: }
1956:
1957: if (result == null) {
1958: Session session = null;
1959:
1960: try {
1961: session = openSession();
1962:
1963: StringMaker query = new StringMaker();
1964:
1965: query.append("SELECT COUNT(*) ");
1966: query
1967: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
1968:
1969: if (uuid == null) {
1970: query.append("uuid_ IS NULL");
1971: } else {
1972: query.append("uuid_ = ?");
1973: }
1974:
1975: query.append(" AND ");
1976:
1977: query.append("groupId = ?");
1978:
1979: query.append(" ");
1980:
1981: Query q = session.createQuery(query.toString());
1982:
1983: int queryPos = 0;
1984:
1985: if (uuid != null) {
1986: q.setString(queryPos++, uuid);
1987: }
1988:
1989: q.setLong(queryPos++, groupId);
1990:
1991: Long count = null;
1992:
1993: Iterator itr = q.list().iterator();
1994:
1995: if (itr.hasNext()) {
1996: count = (Long) itr.next();
1997: }
1998:
1999: if (count == null) {
2000: count = new Long(0);
2001: }
2002:
2003: FinderCache.putResult(finderClassNameCacheEnabled,
2004: finderClassName, finderMethodName,
2005: finderParams, finderArgs, count);
2006:
2007: return count.intValue();
2008: } catch (Exception e) {
2009: throw HibernateUtil.processException(e);
2010: } finally {
2011: closeSession(session);
2012: }
2013: } else {
2014: return ((Long) result).intValue();
2015: }
2016: }
2017:
2018: public int countByGroupId(long groupId) throws SystemException {
2019: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2020: String finderClassName = BlogsEntry.class.getName();
2021: String finderMethodName = "countByGroupId";
2022: String[] finderParams = new String[] { Long.class.getName() };
2023: Object[] finderArgs = new Object[] { new Long(groupId) };
2024:
2025: Object result = null;
2026:
2027: if (finderClassNameCacheEnabled) {
2028: result = FinderCache.getResult(finderClassName,
2029: finderMethodName, finderParams, finderArgs,
2030: getSessionFactory());
2031: }
2032:
2033: if (result == null) {
2034: Session session = null;
2035:
2036: try {
2037: session = openSession();
2038:
2039: StringMaker query = new StringMaker();
2040:
2041: query.append("SELECT COUNT(*) ");
2042: query
2043: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
2044:
2045: query.append("groupId = ?");
2046:
2047: query.append(" ");
2048:
2049: Query q = session.createQuery(query.toString());
2050:
2051: int queryPos = 0;
2052:
2053: q.setLong(queryPos++, groupId);
2054:
2055: Long count = null;
2056:
2057: Iterator itr = q.list().iterator();
2058:
2059: if (itr.hasNext()) {
2060: count = (Long) itr.next();
2061: }
2062:
2063: if (count == null) {
2064: count = new Long(0);
2065: }
2066:
2067: FinderCache.putResult(finderClassNameCacheEnabled,
2068: finderClassName, finderMethodName,
2069: finderParams, finderArgs, count);
2070:
2071: return count.intValue();
2072: } catch (Exception e) {
2073: throw HibernateUtil.processException(e);
2074: } finally {
2075: closeSession(session);
2076: }
2077: } else {
2078: return ((Long) result).intValue();
2079: }
2080: }
2081:
2082: public int countByCompanyId(long companyId) throws SystemException {
2083: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2084: String finderClassName = BlogsEntry.class.getName();
2085: String finderMethodName = "countByCompanyId";
2086: String[] finderParams = new String[] { Long.class.getName() };
2087: Object[] finderArgs = new Object[] { new Long(companyId) };
2088:
2089: Object result = null;
2090:
2091: if (finderClassNameCacheEnabled) {
2092: result = FinderCache.getResult(finderClassName,
2093: finderMethodName, finderParams, finderArgs,
2094: getSessionFactory());
2095: }
2096:
2097: if (result == null) {
2098: Session session = null;
2099:
2100: try {
2101: session = openSession();
2102:
2103: StringMaker query = new StringMaker();
2104:
2105: query.append("SELECT COUNT(*) ");
2106: query
2107: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
2108:
2109: query.append("companyId = ?");
2110:
2111: query.append(" ");
2112:
2113: Query q = session.createQuery(query.toString());
2114:
2115: int queryPos = 0;
2116:
2117: q.setLong(queryPos++, companyId);
2118:
2119: Long count = null;
2120:
2121: Iterator itr = q.list().iterator();
2122:
2123: if (itr.hasNext()) {
2124: count = (Long) itr.next();
2125: }
2126:
2127: if (count == null) {
2128: count = new Long(0);
2129: }
2130:
2131: FinderCache.putResult(finderClassNameCacheEnabled,
2132: finderClassName, finderMethodName,
2133: finderParams, finderArgs, count);
2134:
2135: return count.intValue();
2136: } catch (Exception e) {
2137: throw HibernateUtil.processException(e);
2138: } finally {
2139: closeSession(session);
2140: }
2141: } else {
2142: return ((Long) result).intValue();
2143: }
2144: }
2145:
2146: public int countByG_U(long groupId, long userId)
2147: throws SystemException {
2148: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2149: String finderClassName = BlogsEntry.class.getName();
2150: String finderMethodName = "countByG_U";
2151: String[] finderParams = new String[] { Long.class.getName(),
2152: Long.class.getName() };
2153: Object[] finderArgs = new Object[] { new Long(groupId),
2154: new Long(userId) };
2155:
2156: Object result = null;
2157:
2158: if (finderClassNameCacheEnabled) {
2159: result = FinderCache.getResult(finderClassName,
2160: finderMethodName, finderParams, finderArgs,
2161: getSessionFactory());
2162: }
2163:
2164: if (result == null) {
2165: Session session = null;
2166:
2167: try {
2168: session = openSession();
2169:
2170: StringMaker query = new StringMaker();
2171:
2172: query.append("SELECT COUNT(*) ");
2173: query
2174: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
2175:
2176: query.append("groupId = ?");
2177:
2178: query.append(" AND ");
2179:
2180: query.append("userId = ?");
2181:
2182: query.append(" ");
2183:
2184: Query q = session.createQuery(query.toString());
2185:
2186: int queryPos = 0;
2187:
2188: q.setLong(queryPos++, groupId);
2189:
2190: q.setLong(queryPos++, userId);
2191:
2192: Long count = null;
2193:
2194: Iterator itr = q.list().iterator();
2195:
2196: if (itr.hasNext()) {
2197: count = (Long) itr.next();
2198: }
2199:
2200: if (count == null) {
2201: count = new Long(0);
2202: }
2203:
2204: FinderCache.putResult(finderClassNameCacheEnabled,
2205: finderClassName, finderMethodName,
2206: finderParams, finderArgs, count);
2207:
2208: return count.intValue();
2209: } catch (Exception e) {
2210: throw HibernateUtil.processException(e);
2211: } finally {
2212: closeSession(session);
2213: }
2214: } else {
2215: return ((Long) result).intValue();
2216: }
2217: }
2218:
2219: public int countByG_UT(long groupId, String urlTitle)
2220: throws SystemException {
2221: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2222: String finderClassName = BlogsEntry.class.getName();
2223: String finderMethodName = "countByG_UT";
2224: String[] finderParams = new String[] { Long.class.getName(),
2225: String.class.getName() };
2226: Object[] finderArgs = new Object[] { new Long(groupId),
2227: urlTitle };
2228:
2229: Object result = null;
2230:
2231: if (finderClassNameCacheEnabled) {
2232: result = FinderCache.getResult(finderClassName,
2233: finderMethodName, finderParams, finderArgs,
2234: getSessionFactory());
2235: }
2236:
2237: if (result == null) {
2238: Session session = null;
2239:
2240: try {
2241: session = openSession();
2242:
2243: StringMaker query = new StringMaker();
2244:
2245: query.append("SELECT COUNT(*) ");
2246: query
2247: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
2248:
2249: query.append("groupId = ?");
2250:
2251: query.append(" AND ");
2252:
2253: if (urlTitle == null) {
2254: query.append("urlTitle IS NULL");
2255: } else {
2256: query.append("urlTitle = ?");
2257: }
2258:
2259: query.append(" ");
2260:
2261: Query q = session.createQuery(query.toString());
2262:
2263: int queryPos = 0;
2264:
2265: q.setLong(queryPos++, groupId);
2266:
2267: if (urlTitle != null) {
2268: q.setString(queryPos++, urlTitle);
2269: }
2270:
2271: Long count = null;
2272:
2273: Iterator itr = q.list().iterator();
2274:
2275: if (itr.hasNext()) {
2276: count = (Long) itr.next();
2277: }
2278:
2279: if (count == null) {
2280: count = new Long(0);
2281: }
2282:
2283: FinderCache.putResult(finderClassNameCacheEnabled,
2284: finderClassName, finderMethodName,
2285: finderParams, finderArgs, count);
2286:
2287: return count.intValue();
2288: } catch (Exception e) {
2289: throw HibernateUtil.processException(e);
2290: } finally {
2291: closeSession(session);
2292: }
2293: } else {
2294: return ((Long) result).intValue();
2295: }
2296: }
2297:
2298: public int countByC_U(long companyId, long userId)
2299: throws SystemException {
2300: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2301: String finderClassName = BlogsEntry.class.getName();
2302: String finderMethodName = "countByC_U";
2303: String[] finderParams = new String[] { Long.class.getName(),
2304: Long.class.getName() };
2305: Object[] finderArgs = new Object[] { new Long(companyId),
2306: new Long(userId) };
2307:
2308: Object result = null;
2309:
2310: if (finderClassNameCacheEnabled) {
2311: result = FinderCache.getResult(finderClassName,
2312: finderMethodName, finderParams, finderArgs,
2313: getSessionFactory());
2314: }
2315:
2316: if (result == null) {
2317: Session session = null;
2318:
2319: try {
2320: session = openSession();
2321:
2322: StringMaker query = new StringMaker();
2323:
2324: query.append("SELECT COUNT(*) ");
2325: query
2326: .append("FROM com.liferay.portlet.blogs.model.BlogsEntry WHERE ");
2327:
2328: query.append("companyId = ?");
2329:
2330: query.append(" AND ");
2331:
2332: query.append("userId = ?");
2333:
2334: query.append(" ");
2335:
2336: Query q = session.createQuery(query.toString());
2337:
2338: int queryPos = 0;
2339:
2340: q.setLong(queryPos++, companyId);
2341:
2342: q.setLong(queryPos++, userId);
2343:
2344: Long count = null;
2345:
2346: Iterator itr = q.list().iterator();
2347:
2348: if (itr.hasNext()) {
2349: count = (Long) itr.next();
2350: }
2351:
2352: if (count == null) {
2353: count = new Long(0);
2354: }
2355:
2356: FinderCache.putResult(finderClassNameCacheEnabled,
2357: finderClassName, finderMethodName,
2358: finderParams, finderArgs, count);
2359:
2360: return count.intValue();
2361: } catch (Exception e) {
2362: throw HibernateUtil.processException(e);
2363: } finally {
2364: closeSession(session);
2365: }
2366: } else {
2367: return ((Long) result).intValue();
2368: }
2369: }
2370:
2371: public int countAll() throws SystemException {
2372: boolean finderClassNameCacheEnabled = BlogsEntryModelImpl.CACHE_ENABLED;
2373: String finderClassName = BlogsEntry.class.getName();
2374: String finderMethodName = "countAll";
2375: String[] finderParams = new String[] {};
2376: Object[] finderArgs = new Object[] {};
2377:
2378: Object result = null;
2379:
2380: if (finderClassNameCacheEnabled) {
2381: result = FinderCache.getResult(finderClassName,
2382: finderMethodName, finderParams, finderArgs,
2383: getSessionFactory());
2384: }
2385:
2386: if (result == null) {
2387: Session session = null;
2388:
2389: try {
2390: session = openSession();
2391:
2392: Query q = session
2393: .createQuery("SELECT COUNT(*) FROM com.liferay.portlet.blogs.model.BlogsEntry");
2394:
2395: Long count = null;
2396:
2397: Iterator itr = q.list().iterator();
2398:
2399: if (itr.hasNext()) {
2400: count = (Long) itr.next();
2401: }
2402:
2403: if (count == null) {
2404: count = new Long(0);
2405: }
2406:
2407: FinderCache.putResult(finderClassNameCacheEnabled,
2408: finderClassName, finderMethodName,
2409: finderParams, finderArgs, count);
2410:
2411: return count.intValue();
2412: } catch (Exception e) {
2413: throw HibernateUtil.processException(e);
2414: } finally {
2415: closeSession(session);
2416: }
2417: } else {
2418: return ((Long) result).intValue();
2419: }
2420: }
2421:
2422: protected void initDao() {
2423: }
2424:
2425: private static ModelListener _getListener() {
2426: if (Validator.isNotNull(_LISTENER)) {
2427: try {
2428: return (ModelListener) Class.forName(_LISTENER)
2429: .newInstance();
2430: } catch (Exception e) {
2431: _log.error(e);
2432: }
2433: }
2434:
2435: return null;
2436: }
2437:
2438: private static final String _LISTENER = GetterUtil
2439: .getString(PropsUtil
2440: .get("value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry"));
2441: private static Log _log = LogFactory
2442: .getLog(BlogsEntryPersistenceImpl.class);
2443: }
|