1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.tags.service.persistence;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.bean.InitializingBean;
27  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
28  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
29  import com.liferay.portal.kernel.dao.orm.Query;
30  import com.liferay.portal.kernel.dao.orm.QueryPos;
31  import com.liferay.portal.kernel.dao.orm.QueryUtil;
32  import com.liferay.portal.kernel.dao.orm.Session;
33  import com.liferay.portal.kernel.util.GetterUtil;
34  import com.liferay.portal.kernel.util.ListUtil;
35  import com.liferay.portal.kernel.util.OrderByComparator;
36  import com.liferay.portal.kernel.util.StringPool;
37  import com.liferay.portal.kernel.util.StringUtil;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
40  
41  import com.liferay.portlet.tags.NoSuchPropertyException;
42  import com.liferay.portlet.tags.model.TagsProperty;
43  import com.liferay.portlet.tags.model.impl.TagsPropertyImpl;
44  import com.liferay.portlet.tags.model.impl.TagsPropertyModelImpl;
45  
46  import org.apache.commons.logging.Log;
47  import org.apache.commons.logging.LogFactory;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.Iterator;
52  import java.util.List;
53  
54  /**
55   * <a href="TagsPropertyPersistenceImpl.java.html"><b><i>View Source</i></b></a>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   */
60  public class TagsPropertyPersistenceImpl extends BasePersistenceImpl
61      implements TagsPropertyPersistence, InitializingBean {
62      public TagsProperty create(long propertyId) {
63          TagsProperty tagsProperty = new TagsPropertyImpl();
64  
65          tagsProperty.setNew(true);
66          tagsProperty.setPrimaryKey(propertyId);
67  
68          return tagsProperty;
69      }
70  
71      public TagsProperty remove(long propertyId)
72          throws NoSuchPropertyException, SystemException {
73          Session session = null;
74  
75          try {
76              session = openSession();
77  
78              TagsProperty tagsProperty = (TagsProperty)session.get(TagsPropertyImpl.class,
79                      new Long(propertyId));
80  
81              if (tagsProperty == null) {
82                  if (_log.isWarnEnabled()) {
83                      _log.warn("No TagsProperty exists with the primary key " +
84                          propertyId);
85                  }
86  
87                  throw new NoSuchPropertyException(
88                      "No TagsProperty exists with the primary key " +
89                      propertyId);
90              }
91  
92              return remove(tagsProperty);
93          }
94          catch (NoSuchPropertyException nsee) {
95              throw nsee;
96          }
97          catch (Exception e) {
98              throw processException(e);
99          }
100         finally {
101             closeSession(session);
102         }
103     }
104 
105     public TagsProperty remove(TagsProperty tagsProperty)
106         throws SystemException {
107         if (_listeners.length > 0) {
108             for (ModelListener listener : _listeners) {
109                 listener.onBeforeRemove(tagsProperty);
110             }
111         }
112 
113         tagsProperty = removeImpl(tagsProperty);
114 
115         if (_listeners.length > 0) {
116             for (ModelListener listener : _listeners) {
117                 listener.onAfterRemove(tagsProperty);
118             }
119         }
120 
121         return tagsProperty;
122     }
123 
124     protected TagsProperty removeImpl(TagsProperty tagsProperty)
125         throws SystemException {
126         Session session = null;
127 
128         try {
129             session = openSession();
130 
131             session.delete(tagsProperty);
132 
133             session.flush();
134 
135             return tagsProperty;
136         }
137         catch (Exception e) {
138             throw processException(e);
139         }
140         finally {
141             closeSession(session);
142 
143             FinderCacheUtil.clearCache(TagsProperty.class.getName());
144         }
145     }
146 
147     /**
148      * @deprecated Use <code>update(TagsProperty tagsProperty, boolean merge)</code>.
149      */
150     public TagsProperty update(TagsProperty tagsProperty)
151         throws SystemException {
152         if (_log.isWarnEnabled()) {
153             _log.warn(
154                 "Using the deprecated update(TagsProperty tagsProperty) method. Use update(TagsProperty tagsProperty, boolean merge) instead.");
155         }
156 
157         return update(tagsProperty, false);
158     }
159 
160     /**
161      * Add, update, or merge, the entity. This method also calls the model
162      * listeners to trigger the proper events associated with adding, deleting,
163      * or updating an entity.
164      *
165      * @param        tagsProperty the entity to add, update, or merge
166      * @param        merge boolean value for whether to merge the entity. The
167      *                default value is false. Setting merge to true is more
168      *                expensive and should only be true when tagsProperty is
169      *                transient. See LEP-5473 for a detailed discussion of this
170      *                method.
171      * @return        true if the portlet can be displayed via Ajax
172      */
173     public TagsProperty update(TagsProperty tagsProperty, boolean merge)
174         throws SystemException {
175         boolean isNew = tagsProperty.isNew();
176 
177         if (_listeners.length > 0) {
178             for (ModelListener listener : _listeners) {
179                 if (isNew) {
180                     listener.onBeforeCreate(tagsProperty);
181                 }
182                 else {
183                     listener.onBeforeUpdate(tagsProperty);
184                 }
185             }
186         }
187 
188         tagsProperty = updateImpl(tagsProperty, merge);
189 
190         if (_listeners.length > 0) {
191             for (ModelListener listener : _listeners) {
192                 if (isNew) {
193                     listener.onAfterCreate(tagsProperty);
194                 }
195                 else {
196                     listener.onAfterUpdate(tagsProperty);
197                 }
198             }
199         }
200 
201         return tagsProperty;
202     }
203 
204     public TagsProperty updateImpl(
205         com.liferay.portlet.tags.model.TagsProperty tagsProperty, boolean merge)
206         throws SystemException {
207         Session session = null;
208 
209         try {
210             session = openSession();
211 
212             if (merge) {
213                 session.merge(tagsProperty);
214             }
215             else {
216                 if (tagsProperty.isNew()) {
217                     session.save(tagsProperty);
218                 }
219             }
220 
221             session.flush();
222 
223             tagsProperty.setNew(false);
224 
225             return tagsProperty;
226         }
227         catch (Exception e) {
228             throw processException(e);
229         }
230         finally {
231             closeSession(session);
232 
233             FinderCacheUtil.clearCache(TagsProperty.class.getName());
234         }
235     }
236 
237     public TagsProperty findByPrimaryKey(long propertyId)
238         throws NoSuchPropertyException, SystemException {
239         TagsProperty tagsProperty = fetchByPrimaryKey(propertyId);
240 
241         if (tagsProperty == null) {
242             if (_log.isWarnEnabled()) {
243                 _log.warn("No TagsProperty exists with the primary key " +
244                     propertyId);
245             }
246 
247             throw new NoSuchPropertyException(
248                 "No TagsProperty exists with the primary key " + propertyId);
249         }
250 
251         return tagsProperty;
252     }
253 
254     public TagsProperty fetchByPrimaryKey(long propertyId)
255         throws SystemException {
256         Session session = null;
257 
258         try {
259             session = openSession();
260 
261             return (TagsProperty)session.get(TagsPropertyImpl.class,
262                 new Long(propertyId));
263         }
264         catch (Exception e) {
265             throw processException(e);
266         }
267         finally {
268             closeSession(session);
269         }
270     }
271 
272     public List<TagsProperty> findByCompanyId(long companyId)
273         throws SystemException {
274         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
275         String finderClassName = TagsProperty.class.getName();
276         String finderMethodName = "findByCompanyId";
277         String[] finderParams = new String[] { Long.class.getName() };
278         Object[] finderArgs = new Object[] { new Long(companyId) };
279 
280         Object result = null;
281 
282         if (finderClassNameCacheEnabled) {
283             result = FinderCacheUtil.getResult(finderClassName,
284                     finderMethodName, finderParams, finderArgs, this);
285         }
286 
287         if (result == null) {
288             Session session = null;
289 
290             try {
291                 session = openSession();
292 
293                 StringBuilder query = new StringBuilder();
294 
295                 query.append(
296                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
297 
298                 query.append("companyId = ?");
299 
300                 query.append(" ");
301 
302                 query.append("ORDER BY ");
303 
304                 query.append("key_ ASC");
305 
306                 Query q = session.createQuery(query.toString());
307 
308                 QueryPos qPos = QueryPos.getInstance(q);
309 
310                 qPos.add(companyId);
311 
312                 List<TagsProperty> list = q.list();
313 
314                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
315                     finderClassName, finderMethodName, finderParams,
316                     finderArgs, list);
317 
318                 return list;
319             }
320             catch (Exception e) {
321                 throw processException(e);
322             }
323             finally {
324                 closeSession(session);
325             }
326         }
327         else {
328             return (List<TagsProperty>)result;
329         }
330     }
331 
332     public List<TagsProperty> findByCompanyId(long companyId, int start, int end)
333         throws SystemException {
334         return findByCompanyId(companyId, start, end, null);
335     }
336 
337     public List<TagsProperty> findByCompanyId(long companyId, int start,
338         int end, OrderByComparator obc) throws SystemException {
339         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
340         String finderClassName = TagsProperty.class.getName();
341         String finderMethodName = "findByCompanyId";
342         String[] finderParams = new String[] {
343                 Long.class.getName(),
344                 
345                 "java.lang.Integer", "java.lang.Integer",
346                 "com.liferay.portal.kernel.util.OrderByComparator"
347             };
348         Object[] finderArgs = new Object[] {
349                 new Long(companyId),
350                 
351                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
352             };
353 
354         Object result = null;
355 
356         if (finderClassNameCacheEnabled) {
357             result = FinderCacheUtil.getResult(finderClassName,
358                     finderMethodName, finderParams, finderArgs, this);
359         }
360 
361         if (result == null) {
362             Session session = null;
363 
364             try {
365                 session = openSession();
366 
367                 StringBuilder query = new StringBuilder();
368 
369                 query.append(
370                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
371 
372                 query.append("companyId = ?");
373 
374                 query.append(" ");
375 
376                 if (obc != null) {
377                     query.append("ORDER BY ");
378                     query.append(obc.getOrderBy());
379                 }
380 
381                 else {
382                     query.append("ORDER BY ");
383 
384                     query.append("key_ ASC");
385                 }
386 
387                 Query q = session.createQuery(query.toString());
388 
389                 QueryPos qPos = QueryPos.getInstance(q);
390 
391                 qPos.add(companyId);
392 
393                 List<TagsProperty> list = (List<TagsProperty>)QueryUtil.list(q,
394                         getDialect(), start, end);
395 
396                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
397                     finderClassName, finderMethodName, finderParams,
398                     finderArgs, list);
399 
400                 return list;
401             }
402             catch (Exception e) {
403                 throw processException(e);
404             }
405             finally {
406                 closeSession(session);
407             }
408         }
409         else {
410             return (List<TagsProperty>)result;
411         }
412     }
413 
414     public TagsProperty findByCompanyId_First(long companyId,
415         OrderByComparator obc) throws NoSuchPropertyException, SystemException {
416         List<TagsProperty> list = findByCompanyId(companyId, 0, 1, obc);
417 
418         if (list.size() == 0) {
419             StringBuilder msg = new StringBuilder();
420 
421             msg.append("No TagsProperty exists with the key {");
422 
423             msg.append("companyId=" + companyId);
424 
425             msg.append(StringPool.CLOSE_CURLY_BRACE);
426 
427             throw new NoSuchPropertyException(msg.toString());
428         }
429         else {
430             return list.get(0);
431         }
432     }
433 
434     public TagsProperty findByCompanyId_Last(long companyId,
435         OrderByComparator obc) throws NoSuchPropertyException, SystemException {
436         int count = countByCompanyId(companyId);
437 
438         List<TagsProperty> list = findByCompanyId(companyId, count - 1, count,
439                 obc);
440 
441         if (list.size() == 0) {
442             StringBuilder msg = new StringBuilder();
443 
444             msg.append("No TagsProperty exists with the key {");
445 
446             msg.append("companyId=" + companyId);
447 
448             msg.append(StringPool.CLOSE_CURLY_BRACE);
449 
450             throw new NoSuchPropertyException(msg.toString());
451         }
452         else {
453             return list.get(0);
454         }
455     }
456 
457     public TagsProperty[] findByCompanyId_PrevAndNext(long propertyId,
458         long companyId, OrderByComparator obc)
459         throws NoSuchPropertyException, SystemException {
460         TagsProperty tagsProperty = findByPrimaryKey(propertyId);
461 
462         int count = countByCompanyId(companyId);
463 
464         Session session = null;
465 
466         try {
467             session = openSession();
468 
469             StringBuilder query = new StringBuilder();
470 
471             query.append(
472                 "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
473 
474             query.append("companyId = ?");
475 
476             query.append(" ");
477 
478             if (obc != null) {
479                 query.append("ORDER BY ");
480                 query.append(obc.getOrderBy());
481             }
482 
483             else {
484                 query.append("ORDER BY ");
485 
486                 query.append("key_ ASC");
487             }
488 
489             Query q = session.createQuery(query.toString());
490 
491             QueryPos qPos = QueryPos.getInstance(q);
492 
493             qPos.add(companyId);
494 
495             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
496                     tagsProperty);
497 
498             TagsProperty[] array = new TagsPropertyImpl[3];
499 
500             array[0] = (TagsProperty)objArray[0];
501             array[1] = (TagsProperty)objArray[1];
502             array[2] = (TagsProperty)objArray[2];
503 
504             return array;
505         }
506         catch (Exception e) {
507             throw processException(e);
508         }
509         finally {
510             closeSession(session);
511         }
512     }
513 
514     public List<TagsProperty> findByEntryId(long entryId)
515         throws SystemException {
516         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
517         String finderClassName = TagsProperty.class.getName();
518         String finderMethodName = "findByEntryId";
519         String[] finderParams = new String[] { Long.class.getName() };
520         Object[] finderArgs = new Object[] { new Long(entryId) };
521 
522         Object result = null;
523 
524         if (finderClassNameCacheEnabled) {
525             result = FinderCacheUtil.getResult(finderClassName,
526                     finderMethodName, finderParams, finderArgs, this);
527         }
528 
529         if (result == null) {
530             Session session = null;
531 
532             try {
533                 session = openSession();
534 
535                 StringBuilder query = new StringBuilder();
536 
537                 query.append(
538                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
539 
540                 query.append("entryId = ?");
541 
542                 query.append(" ");
543 
544                 query.append("ORDER BY ");
545 
546                 query.append("key_ ASC");
547 
548                 Query q = session.createQuery(query.toString());
549 
550                 QueryPos qPos = QueryPos.getInstance(q);
551 
552                 qPos.add(entryId);
553 
554                 List<TagsProperty> list = q.list();
555 
556                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
557                     finderClassName, finderMethodName, finderParams,
558                     finderArgs, list);
559 
560                 return list;
561             }
562             catch (Exception e) {
563                 throw processException(e);
564             }
565             finally {
566                 closeSession(session);
567             }
568         }
569         else {
570             return (List<TagsProperty>)result;
571         }
572     }
573 
574     public List<TagsProperty> findByEntryId(long entryId, int start, int end)
575         throws SystemException {
576         return findByEntryId(entryId, start, end, null);
577     }
578 
579     public List<TagsProperty> findByEntryId(long entryId, int start, int end,
580         OrderByComparator obc) throws SystemException {
581         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
582         String finderClassName = TagsProperty.class.getName();
583         String finderMethodName = "findByEntryId";
584         String[] finderParams = new String[] {
585                 Long.class.getName(),
586                 
587                 "java.lang.Integer", "java.lang.Integer",
588                 "com.liferay.portal.kernel.util.OrderByComparator"
589             };
590         Object[] finderArgs = new Object[] {
591                 new Long(entryId),
592                 
593                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
594             };
595 
596         Object result = null;
597 
598         if (finderClassNameCacheEnabled) {
599             result = FinderCacheUtil.getResult(finderClassName,
600                     finderMethodName, finderParams, finderArgs, this);
601         }
602 
603         if (result == null) {
604             Session session = null;
605 
606             try {
607                 session = openSession();
608 
609                 StringBuilder query = new StringBuilder();
610 
611                 query.append(
612                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
613 
614                 query.append("entryId = ?");
615 
616                 query.append(" ");
617 
618                 if (obc != null) {
619                     query.append("ORDER BY ");
620                     query.append(obc.getOrderBy());
621                 }
622 
623                 else {
624                     query.append("ORDER BY ");
625 
626                     query.append("key_ ASC");
627                 }
628 
629                 Query q = session.createQuery(query.toString());
630 
631                 QueryPos qPos = QueryPos.getInstance(q);
632 
633                 qPos.add(entryId);
634 
635                 List<TagsProperty> list = (List<TagsProperty>)QueryUtil.list(q,
636                         getDialect(), start, end);
637 
638                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
639                     finderClassName, finderMethodName, finderParams,
640                     finderArgs, list);
641 
642                 return list;
643             }
644             catch (Exception e) {
645                 throw processException(e);
646             }
647             finally {
648                 closeSession(session);
649             }
650         }
651         else {
652             return (List<TagsProperty>)result;
653         }
654     }
655 
656     public TagsProperty findByEntryId_First(long entryId, OrderByComparator obc)
657         throws NoSuchPropertyException, SystemException {
658         List<TagsProperty> list = findByEntryId(entryId, 0, 1, obc);
659 
660         if (list.size() == 0) {
661             StringBuilder msg = new StringBuilder();
662 
663             msg.append("No TagsProperty exists with the key {");
664 
665             msg.append("entryId=" + entryId);
666 
667             msg.append(StringPool.CLOSE_CURLY_BRACE);
668 
669             throw new NoSuchPropertyException(msg.toString());
670         }
671         else {
672             return list.get(0);
673         }
674     }
675 
676     public TagsProperty findByEntryId_Last(long entryId, OrderByComparator obc)
677         throws NoSuchPropertyException, SystemException {
678         int count = countByEntryId(entryId);
679 
680         List<TagsProperty> list = findByEntryId(entryId, count - 1, count, obc);
681 
682         if (list.size() == 0) {
683             StringBuilder msg = new StringBuilder();
684 
685             msg.append("No TagsProperty exists with the key {");
686 
687             msg.append("entryId=" + entryId);
688 
689             msg.append(StringPool.CLOSE_CURLY_BRACE);
690 
691             throw new NoSuchPropertyException(msg.toString());
692         }
693         else {
694             return list.get(0);
695         }
696     }
697 
698     public TagsProperty[] findByEntryId_PrevAndNext(long propertyId,
699         long entryId, OrderByComparator obc)
700         throws NoSuchPropertyException, SystemException {
701         TagsProperty tagsProperty = findByPrimaryKey(propertyId);
702 
703         int count = countByEntryId(entryId);
704 
705         Session session = null;
706 
707         try {
708             session = openSession();
709 
710             StringBuilder query = new StringBuilder();
711 
712             query.append(
713                 "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
714 
715             query.append("entryId = ?");
716 
717             query.append(" ");
718 
719             if (obc != null) {
720                 query.append("ORDER BY ");
721                 query.append(obc.getOrderBy());
722             }
723 
724             else {
725                 query.append("ORDER BY ");
726 
727                 query.append("key_ ASC");
728             }
729 
730             Query q = session.createQuery(query.toString());
731 
732             QueryPos qPos = QueryPos.getInstance(q);
733 
734             qPos.add(entryId);
735 
736             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
737                     tagsProperty);
738 
739             TagsProperty[] array = new TagsPropertyImpl[3];
740 
741             array[0] = (TagsProperty)objArray[0];
742             array[1] = (TagsProperty)objArray[1];
743             array[2] = (TagsProperty)objArray[2];
744 
745             return array;
746         }
747         catch (Exception e) {
748             throw processException(e);
749         }
750         finally {
751             closeSession(session);
752         }
753     }
754 
755     public List<TagsProperty> findByC_K(long companyId, String key)
756         throws SystemException {
757         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
758         String finderClassName = TagsProperty.class.getName();
759         String finderMethodName = "findByC_K";
760         String[] finderParams = new String[] {
761                 Long.class.getName(), String.class.getName()
762             };
763         Object[] finderArgs = new Object[] { new Long(companyId), key };
764 
765         Object result = null;
766 
767         if (finderClassNameCacheEnabled) {
768             result = FinderCacheUtil.getResult(finderClassName,
769                     finderMethodName, finderParams, finderArgs, this);
770         }
771 
772         if (result == null) {
773             Session session = null;
774 
775             try {
776                 session = openSession();
777 
778                 StringBuilder query = new StringBuilder();
779 
780                 query.append(
781                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
782 
783                 query.append("companyId = ?");
784 
785                 query.append(" AND ");
786 
787                 if (key == null) {
788                     query.append("key_ IS NULL");
789                 }
790                 else {
791                     query.append("key_ = ?");
792                 }
793 
794                 query.append(" ");
795 
796                 query.append("ORDER BY ");
797 
798                 query.append("key_ ASC");
799 
800                 Query q = session.createQuery(query.toString());
801 
802                 QueryPos qPos = QueryPos.getInstance(q);
803 
804                 qPos.add(companyId);
805 
806                 if (key != null) {
807                     qPos.add(key);
808                 }
809 
810                 List<TagsProperty> list = q.list();
811 
812                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
813                     finderClassName, finderMethodName, finderParams,
814                     finderArgs, list);
815 
816                 return list;
817             }
818             catch (Exception e) {
819                 throw processException(e);
820             }
821             finally {
822                 closeSession(session);
823             }
824         }
825         else {
826             return (List<TagsProperty>)result;
827         }
828     }
829 
830     public List<TagsProperty> findByC_K(long companyId, String key, int start,
831         int end) throws SystemException {
832         return findByC_K(companyId, key, start, end, null);
833     }
834 
835     public List<TagsProperty> findByC_K(long companyId, String key, int start,
836         int end, OrderByComparator obc) throws SystemException {
837         boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
838         String finderClassName = TagsProperty.class.getName();
839         String finderMethodName = "findByC_K";
840         String[] finderParams = new String[] {
841                 Long.class.getName(), String.class.getName(),
842                 
843                 "java.lang.Integer", "java.lang.Integer",
844                 "com.liferay.portal.kernel.util.OrderByComparator"
845             };
846         Object[] finderArgs = new Object[] {
847                 new Long(companyId),
848                 
849                 key,
850                 
851                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
852             };
853 
854         Object result = null;
855 
856         if (finderClassNameCacheEnabled) {
857             result = FinderCacheUtil.getResult(finderClassName,
858                     finderMethodName, finderParams, finderArgs, this);
859         }
860 
861         if (result == null) {
862             Session session = null;
863 
864             try {
865                 session = openSession();
866 
867                 StringBuilder query = new StringBuilder();
868 
869                 query.append(
870                     "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
871 
872                 query.append("companyId = ?");
873 
874                 query.append(" AND ");
875 
876                 if (key == null) {
877                     query.append("key_ IS NULL");
878                 }
879                 else {
880                     query.append("key_ = ?");
881                 }
882 
883                 query.append(" ");
884 
885                 if (obc != null) {
886                     query.append("ORDER BY ");
887                     query.append(obc.getOrderBy());
888                 }
889 
890                 else {
891                     query.append("ORDER BY ");
892 
893                     query.append("key_ ASC");
894                 }
895 
896                 Query q = session.createQuery(query.toString());
897 
898                 QueryPos qPos = QueryPos.getInstance(q);
899 
900                 qPos.add(companyId);
901 
902                 if (key != null) {
903                     qPos.add(key);
904                 }
905 
906                 List<TagsProperty> list = (List<TagsProperty>)QueryUtil.list(q,
907                         getDialect(), start, end);
908 
909                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
910                     finderClassName, finderMethodName, finderParams,
911                     finderArgs, list);
912 
913                 return list;
914             }
915             catch (Exception e) {
916                 throw processException(e);
917             }
918             finally {
919                 closeSession(session);
920             }
921         }
922         else {
923             return (List<TagsProperty>)result;
924         }
925     }
926 
927     public TagsProperty findByC_K_First(long companyId, String key,
928         OrderByComparator obc) throws NoSuchPropertyException, SystemException {
929         List<TagsProperty> list = findByC_K(companyId, key, 0, 1, obc);
930 
931         if (list.size() == 0) {
932             StringBuilder msg = new StringBuilder();
933 
934             msg.append("No TagsProperty exists with the key {");
935 
936             msg.append("companyId=" + companyId);
937 
938             msg.append(", ");
939             msg.append("key=" + key);
940 
941             msg.append(StringPool.CLOSE_CURLY_BRACE);
942 
943             throw new NoSuchPropertyException(msg.toString());
944         }
945         else {
946             return list.get(0);
947         }
948     }
949 
950     public TagsProperty findByC_K_Last(long companyId, String key,
951         OrderByComparator obc) throws NoSuchPropertyException, SystemException {
952         int count = countByC_K(companyId, key);
953 
954         List<TagsProperty> list = findByC_K(companyId, key, count - 1, count,
955                 obc);
956 
957         if (list.size() == 0) {
958             StringBuilder msg = new StringBuilder();
959 
960             msg.append("No TagsProperty exists with the key {");
961 
962             msg.append("companyId=" + companyId);
963 
964             msg.append(", ");
965             msg.append("key=" + key);
966 
967             msg.append(StringPool.CLOSE_CURLY_BRACE);
968 
969             throw new NoSuchPropertyException(msg.toString());
970         }
971         else {
972             return list.get(0);
973         }
974     }
975 
976     public TagsProperty[] findByC_K_PrevAndNext(long propertyId,
977         long companyId, String key, OrderByComparator obc)
978         throws NoSuchPropertyException, SystemException {
979         TagsProperty tagsProperty = findByPrimaryKey(propertyId);
980 
981         int count = countByC_K(companyId, key);
982 
983         Session session = null;
984 
985         try {
986             session = openSession();
987 
988             StringBuilder query = new StringBuilder();
989 
990             query.append(
991                 "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
992 
993             query.append("companyId = ?");
994 
995             query.append(" AND ");
996 
997             if (key == null) {
998                 query.append("key_ IS NULL");
999             }
1000            else {
1001                query.append("key_ = ?");
1002            }
1003
1004            query.append(" ");
1005
1006            if (obc != null) {
1007                query.append("ORDER BY ");
1008                query.append(obc.getOrderBy());
1009            }
1010
1011            else {
1012                query.append("ORDER BY ");
1013
1014                query.append("key_ ASC");
1015            }
1016
1017            Query q = session.createQuery(query.toString());
1018
1019            QueryPos qPos = QueryPos.getInstance(q);
1020
1021            qPos.add(companyId);
1022
1023            if (key != null) {
1024                qPos.add(key);
1025            }
1026
1027            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1028                    tagsProperty);
1029
1030            TagsProperty[] array = new TagsPropertyImpl[3];
1031
1032            array[0] = (TagsProperty)objArray[0];
1033            array[1] = (TagsProperty)objArray[1];
1034            array[2] = (TagsProperty)objArray[2];
1035
1036            return array;
1037        }
1038        catch (Exception e) {
1039            throw processException(e);
1040        }
1041        finally {
1042            closeSession(session);
1043        }
1044    }
1045
1046    public TagsProperty findByE_K(long entryId, String key)
1047        throws NoSuchPropertyException, SystemException {
1048        TagsProperty tagsProperty = fetchByE_K(entryId, key);
1049
1050        if (tagsProperty == null) {
1051            StringBuilder msg = new StringBuilder();
1052
1053            msg.append("No TagsProperty exists with the key {");
1054
1055            msg.append("entryId=" + entryId);
1056
1057            msg.append(", ");
1058            msg.append("key=" + key);
1059
1060            msg.append(StringPool.CLOSE_CURLY_BRACE);
1061
1062            if (_log.isWarnEnabled()) {
1063                _log.warn(msg.toString());
1064            }
1065
1066            throw new NoSuchPropertyException(msg.toString());
1067        }
1068
1069        return tagsProperty;
1070    }
1071
1072    public TagsProperty fetchByE_K(long entryId, String key)
1073        throws SystemException {
1074        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1075        String finderClassName = TagsProperty.class.getName();
1076        String finderMethodName = "fetchByE_K";
1077        String[] finderParams = new String[] {
1078                Long.class.getName(), String.class.getName()
1079            };
1080        Object[] finderArgs = new Object[] { new Long(entryId), key };
1081
1082        Object result = null;
1083
1084        if (finderClassNameCacheEnabled) {
1085            result = FinderCacheUtil.getResult(finderClassName,
1086                    finderMethodName, finderParams, finderArgs, this);
1087        }
1088
1089        if (result == null) {
1090            Session session = null;
1091
1092            try {
1093                session = openSession();
1094
1095                StringBuilder query = new StringBuilder();
1096
1097                query.append(
1098                    "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
1099
1100                query.append("entryId = ?");
1101
1102                query.append(" AND ");
1103
1104                if (key == null) {
1105                    query.append("key_ IS NULL");
1106                }
1107                else {
1108                    query.append("key_ = ?");
1109                }
1110
1111                query.append(" ");
1112
1113                query.append("ORDER BY ");
1114
1115                query.append("key_ ASC");
1116
1117                Query q = session.createQuery(query.toString());
1118
1119                QueryPos qPos = QueryPos.getInstance(q);
1120
1121                qPos.add(entryId);
1122
1123                if (key != null) {
1124                    qPos.add(key);
1125                }
1126
1127                List<TagsProperty> list = q.list();
1128
1129                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1130                    finderClassName, finderMethodName, finderParams,
1131                    finderArgs, list);
1132
1133                if (list.size() == 0) {
1134                    return null;
1135                }
1136                else {
1137                    return list.get(0);
1138                }
1139            }
1140            catch (Exception e) {
1141                throw processException(e);
1142            }
1143            finally {
1144                closeSession(session);
1145            }
1146        }
1147        else {
1148            List<TagsProperty> list = (List<TagsProperty>)result;
1149
1150            if (list.size() == 0) {
1151                return null;
1152            }
1153            else {
1154                return list.get(0);
1155            }
1156        }
1157    }
1158
1159    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1160        throws SystemException {
1161        Session session = null;
1162
1163        try {
1164            session = openSession();
1165
1166            dynamicQuery.compile(session);
1167
1168            return dynamicQuery.list();
1169        }
1170        catch (Exception e) {
1171            throw processException(e);
1172        }
1173        finally {
1174            closeSession(session);
1175        }
1176    }
1177
1178    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1179        int start, int end) throws SystemException {
1180        Session session = null;
1181
1182        try {
1183            session = openSession();
1184
1185            dynamicQuery.setLimit(start, end);
1186
1187            dynamicQuery.compile(session);
1188
1189            return dynamicQuery.list();
1190        }
1191        catch (Exception e) {
1192            throw processException(e);
1193        }
1194        finally {
1195            closeSession(session);
1196        }
1197    }
1198
1199    public List<TagsProperty> findAll() throws SystemException {
1200        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1201    }
1202
1203    public List<TagsProperty> findAll(int start, int end)
1204        throws SystemException {
1205        return findAll(start, end, null);
1206    }
1207
1208    public List<TagsProperty> findAll(int start, int end, OrderByComparator obc)
1209        throws SystemException {
1210        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1211        String finderClassName = TagsProperty.class.getName();
1212        String finderMethodName = "findAll";
1213        String[] finderParams = new String[] {
1214                "java.lang.Integer", "java.lang.Integer",
1215                "com.liferay.portal.kernel.util.OrderByComparator"
1216            };
1217        Object[] finderArgs = new Object[] {
1218                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1219            };
1220
1221        Object result = null;
1222
1223        if (finderClassNameCacheEnabled) {
1224            result = FinderCacheUtil.getResult(finderClassName,
1225                    finderMethodName, finderParams, finderArgs, this);
1226        }
1227
1228        if (result == null) {
1229            Session session = null;
1230
1231            try {
1232                session = openSession();
1233
1234                StringBuilder query = new StringBuilder();
1235
1236                query.append(
1237                    "FROM com.liferay.portlet.tags.model.TagsProperty ");
1238
1239                if (obc != null) {
1240                    query.append("ORDER BY ");
1241                    query.append(obc.getOrderBy());
1242                }
1243
1244                else {
1245                    query.append("ORDER BY ");
1246
1247                    query.append("key_ ASC");
1248                }
1249
1250                Query q = session.createQuery(query.toString());
1251
1252                List<TagsProperty> list = (List<TagsProperty>)QueryUtil.list(q,
1253                        getDialect(), start, end);
1254
1255                if (obc == null) {
1256                    Collections.sort(list);
1257                }
1258
1259                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1260                    finderClassName, finderMethodName, finderParams,
1261                    finderArgs, list);
1262
1263                return list;
1264            }
1265            catch (Exception e) {
1266                throw processException(e);
1267            }
1268            finally {
1269                closeSession(session);
1270            }
1271        }
1272        else {
1273            return (List<TagsProperty>)result;
1274        }
1275    }
1276
1277    public void removeByCompanyId(long companyId) throws SystemException {
1278        for (TagsProperty tagsProperty : findByCompanyId(companyId)) {
1279            remove(tagsProperty);
1280        }
1281    }
1282
1283    public void removeByEntryId(long entryId) throws SystemException {
1284        for (TagsProperty tagsProperty : findByEntryId(entryId)) {
1285            remove(tagsProperty);
1286        }
1287    }
1288
1289    public void removeByC_K(long companyId, String key)
1290        throws SystemException {
1291        for (TagsProperty tagsProperty : findByC_K(companyId, key)) {
1292            remove(tagsProperty);
1293        }
1294    }
1295
1296    public void removeByE_K(long entryId, String key)
1297        throws NoSuchPropertyException, SystemException {
1298        TagsProperty tagsProperty = findByE_K(entryId, key);
1299
1300        remove(tagsProperty);
1301    }
1302
1303    public void removeAll() throws SystemException {
1304        for (TagsProperty tagsProperty : findAll()) {
1305            remove(tagsProperty);
1306        }
1307    }
1308
1309    public int countByCompanyId(long companyId) throws SystemException {
1310        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1311        String finderClassName = TagsProperty.class.getName();
1312        String finderMethodName = "countByCompanyId";
1313        String[] finderParams = new String[] { Long.class.getName() };
1314        Object[] finderArgs = new Object[] { new Long(companyId) };
1315
1316        Object result = null;
1317
1318        if (finderClassNameCacheEnabled) {
1319            result = FinderCacheUtil.getResult(finderClassName,
1320                    finderMethodName, finderParams, finderArgs, this);
1321        }
1322
1323        if (result == null) {
1324            Session session = null;
1325
1326            try {
1327                session = openSession();
1328
1329                StringBuilder query = new StringBuilder();
1330
1331                query.append("SELECT COUNT(*) ");
1332                query.append(
1333                    "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
1334
1335                query.append("companyId = ?");
1336
1337                query.append(" ");
1338
1339                Query q = session.createQuery(query.toString());
1340
1341                QueryPos qPos = QueryPos.getInstance(q);
1342
1343                qPos.add(companyId);
1344
1345                Long count = null;
1346
1347                Iterator<Long> itr = q.list().iterator();
1348
1349                if (itr.hasNext()) {
1350                    count = itr.next();
1351                }
1352
1353                if (count == null) {
1354                    count = new Long(0);
1355                }
1356
1357                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1358                    finderClassName, finderMethodName, finderParams,
1359                    finderArgs, count);
1360
1361                return count.intValue();
1362            }
1363            catch (Exception e) {
1364                throw processException(e);
1365            }
1366            finally {
1367                closeSession(session);
1368            }
1369        }
1370        else {
1371            return ((Long)result).intValue();
1372        }
1373    }
1374
1375    public int countByEntryId(long entryId) throws SystemException {
1376        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1377        String finderClassName = TagsProperty.class.getName();
1378        String finderMethodName = "countByEntryId";
1379        String[] finderParams = new String[] { Long.class.getName() };
1380        Object[] finderArgs = new Object[] { new Long(entryId) };
1381
1382        Object result = null;
1383
1384        if (finderClassNameCacheEnabled) {
1385            result = FinderCacheUtil.getResult(finderClassName,
1386                    finderMethodName, finderParams, finderArgs, this);
1387        }
1388
1389        if (result == null) {
1390            Session session = null;
1391
1392            try {
1393                session = openSession();
1394
1395                StringBuilder query = new StringBuilder();
1396
1397                query.append("SELECT COUNT(*) ");
1398                query.append(
1399                    "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
1400
1401                query.append("entryId = ?");
1402
1403                query.append(" ");
1404
1405                Query q = session.createQuery(query.toString());
1406
1407                QueryPos qPos = QueryPos.getInstance(q);
1408
1409                qPos.add(entryId);
1410
1411                Long count = null;
1412
1413                Iterator<Long> itr = q.list().iterator();
1414
1415                if (itr.hasNext()) {
1416                    count = itr.next();
1417                }
1418
1419                if (count == null) {
1420                    count = new Long(0);
1421                }
1422
1423                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1424                    finderClassName, finderMethodName, finderParams,
1425                    finderArgs, count);
1426
1427                return count.intValue();
1428            }
1429            catch (Exception e) {
1430                throw processException(e);
1431            }
1432            finally {
1433                closeSession(session);
1434            }
1435        }
1436        else {
1437            return ((Long)result).intValue();
1438        }
1439    }
1440
1441    public int countByC_K(long companyId, String key) throws SystemException {
1442        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1443        String finderClassName = TagsProperty.class.getName();
1444        String finderMethodName = "countByC_K";
1445        String[] finderParams = new String[] {
1446                Long.class.getName(), String.class.getName()
1447            };
1448        Object[] finderArgs = new Object[] { new Long(companyId), key };
1449
1450        Object result = null;
1451
1452        if (finderClassNameCacheEnabled) {
1453            result = FinderCacheUtil.getResult(finderClassName,
1454                    finderMethodName, finderParams, finderArgs, this);
1455        }
1456
1457        if (result == null) {
1458            Session session = null;
1459
1460            try {
1461                session = openSession();
1462
1463                StringBuilder query = new StringBuilder();
1464
1465                query.append("SELECT COUNT(*) ");
1466                query.append(
1467                    "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
1468
1469                query.append("companyId = ?");
1470
1471                query.append(" AND ");
1472
1473                if (key == null) {
1474                    query.append("key_ IS NULL");
1475                }
1476                else {
1477                    query.append("key_ = ?");
1478                }
1479
1480                query.append(" ");
1481
1482                Query q = session.createQuery(query.toString());
1483
1484                QueryPos qPos = QueryPos.getInstance(q);
1485
1486                qPos.add(companyId);
1487
1488                if (key != null) {
1489                    qPos.add(key);
1490                }
1491
1492                Long count = null;
1493
1494                Iterator<Long> itr = q.list().iterator();
1495
1496                if (itr.hasNext()) {
1497                    count = itr.next();
1498                }
1499
1500                if (count == null) {
1501                    count = new Long(0);
1502                }
1503
1504                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1505                    finderClassName, finderMethodName, finderParams,
1506                    finderArgs, count);
1507
1508                return count.intValue();
1509            }
1510            catch (Exception e) {
1511                throw processException(e);
1512            }
1513            finally {
1514                closeSession(session);
1515            }
1516        }
1517        else {
1518            return ((Long)result).intValue();
1519        }
1520    }
1521
1522    public int countByE_K(long entryId, String key) throws SystemException {
1523        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1524        String finderClassName = TagsProperty.class.getName();
1525        String finderMethodName = "countByE_K";
1526        String[] finderParams = new String[] {
1527                Long.class.getName(), String.class.getName()
1528            };
1529        Object[] finderArgs = new Object[] { new Long(entryId), key };
1530
1531        Object result = null;
1532
1533        if (finderClassNameCacheEnabled) {
1534            result = FinderCacheUtil.getResult(finderClassName,
1535                    finderMethodName, finderParams, finderArgs, this);
1536        }
1537
1538        if (result == null) {
1539            Session session = null;
1540
1541            try {
1542                session = openSession();
1543
1544                StringBuilder query = new StringBuilder();
1545
1546                query.append("SELECT COUNT(*) ");
1547                query.append(
1548                    "FROM com.liferay.portlet.tags.model.TagsProperty WHERE ");
1549
1550                query.append("entryId = ?");
1551
1552                query.append(" AND ");
1553
1554                if (key == null) {
1555                    query.append("key_ IS NULL");
1556                }
1557                else {
1558                    query.append("key_ = ?");
1559                }
1560
1561                query.append(" ");
1562
1563                Query q = session.createQuery(query.toString());
1564
1565                QueryPos qPos = QueryPos.getInstance(q);
1566
1567                qPos.add(entryId);
1568
1569                if (key != null) {
1570                    qPos.add(key);
1571                }
1572
1573                Long count = null;
1574
1575                Iterator<Long> itr = q.list().iterator();
1576
1577                if (itr.hasNext()) {
1578                    count = itr.next();
1579                }
1580
1581                if (count == null) {
1582                    count = new Long(0);
1583                }
1584
1585                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1586                    finderClassName, finderMethodName, finderParams,
1587                    finderArgs, count);
1588
1589                return count.intValue();
1590            }
1591            catch (Exception e) {
1592                throw processException(e);
1593            }
1594            finally {
1595                closeSession(session);
1596            }
1597        }
1598        else {
1599            return ((Long)result).intValue();
1600        }
1601    }
1602
1603    public int countAll() throws SystemException {
1604        boolean finderClassNameCacheEnabled = TagsPropertyModelImpl.CACHE_ENABLED;
1605        String finderClassName = TagsProperty.class.getName();
1606        String finderMethodName = "countAll";
1607        String[] finderParams = new String[] {  };
1608        Object[] finderArgs = new Object[] {  };
1609
1610        Object result = null;
1611
1612        if (finderClassNameCacheEnabled) {
1613            result = FinderCacheUtil.getResult(finderClassName,
1614                    finderMethodName, finderParams, finderArgs, this);
1615        }
1616
1617        if (result == null) {
1618            Session session = null;
1619
1620            try {
1621                session = openSession();
1622
1623                Query q = session.createQuery(
1624                        "SELECT COUNT(*) FROM com.liferay.portlet.tags.model.TagsProperty");
1625
1626                Long count = null;
1627
1628                Iterator<Long> itr = q.list().iterator();
1629
1630                if (itr.hasNext()) {
1631                    count = itr.next();
1632                }
1633
1634                if (count == null) {
1635                    count = new Long(0);
1636                }
1637
1638                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1639                    finderClassName, finderMethodName, finderParams,
1640                    finderArgs, count);
1641
1642                return count.intValue();
1643            }
1644            catch (Exception e) {
1645                throw processException(e);
1646            }
1647            finally {
1648                closeSession(session);
1649            }
1650        }
1651        else {
1652            return ((Long)result).intValue();
1653        }
1654    }
1655
1656    public void registerListener(ModelListener listener) {
1657        List<ModelListener> listeners = ListUtil.fromArray(_listeners);
1658
1659        listeners.add(listener);
1660
1661        _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1662    }
1663
1664    public void unregisterListener(ModelListener listener) {
1665        List<ModelListener> listeners = ListUtil.fromArray(_listeners);
1666
1667        listeners.remove(listener);
1668
1669        _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1670    }
1671
1672    public void afterPropertiesSet() {
1673        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1674                    com.liferay.portal.util.PropsUtil.get(
1675                        "value.object.listener.com.liferay.portlet.tags.model.TagsProperty")));
1676
1677        if (listenerClassNames.length > 0) {
1678            try {
1679                List<ModelListener> listeners = new ArrayList<ModelListener>();
1680
1681                for (String listenerClassName : listenerClassNames) {
1682                    listeners.add((ModelListener)Class.forName(
1683                            listenerClassName).newInstance());
1684                }
1685
1686                _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1687            }
1688            catch (Exception e) {
1689                _log.error(e);
1690            }
1691        }
1692    }
1693
1694    private static Log _log = LogFactory.getLog(TagsPropertyPersistenceImpl.class);
1695    private ModelListener[] _listeners = new ModelListener[0];
1696}