001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.SQLQuery;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041    import com.liferay.portal.service.persistence.BatchSessionUtil;
042    import com.liferay.portal.service.persistence.ResourcePersistence;
043    import com.liferay.portal.service.persistence.UserPersistence;
044    import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
045    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
046    
047    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
048    import com.liferay.portlet.journal.NoSuchStructureException;
049    import com.liferay.portlet.journal.model.JournalStructure;
050    import com.liferay.portlet.journal.model.impl.JournalStructureImpl;
051    import com.liferay.portlet.journal.model.impl.JournalStructureModelImpl;
052    
053    import java.io.Serializable;
054    
055    import java.util.ArrayList;
056    import java.util.Collections;
057    import java.util.List;
058    
059    /**
060     * @author    Brian Wing Shun Chan
061     * @see       JournalStructurePersistence
062     * @see       JournalStructureUtil
063     * @generated
064     */
065    public class JournalStructurePersistenceImpl extends BasePersistenceImpl<JournalStructure>
066            implements JournalStructurePersistence {
067            public static final String FINDER_CLASS_NAME_ENTITY = JournalStructureImpl.class.getName();
068            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
069                    ".List";
070            public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
071                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
072                            FINDER_CLASS_NAME_LIST, "findByUuid",
073                            new String[] {
074                                    String.class.getName(),
075                                    
076                            "java.lang.Integer", "java.lang.Integer",
077                                    "com.liferay.portal.kernel.util.OrderByComparator"
078                            });
079            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
080                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
081                            FINDER_CLASS_NAME_LIST, "countByUuid",
082                            new String[] { String.class.getName() });
083            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
084                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
085                            FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
086                            new String[] { String.class.getName(), Long.class.getName() });
087            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
088                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
089                            FINDER_CLASS_NAME_LIST, "countByUUID_G",
090                            new String[] { String.class.getName(), Long.class.getName() });
091            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
092                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
093                            FINDER_CLASS_NAME_LIST, "findByGroupId",
094                            new String[] {
095                                    Long.class.getName(),
096                                    
097                            "java.lang.Integer", "java.lang.Integer",
098                                    "com.liferay.portal.kernel.util.OrderByComparator"
099                            });
100            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
101                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
102                            FINDER_CLASS_NAME_LIST, "countByGroupId",
103                            new String[] { Long.class.getName() });
104            public static final FinderPath FINDER_PATH_FIND_BY_STRUCTUREID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
105                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
106                            FINDER_CLASS_NAME_LIST, "findByStructureId",
107                            new String[] {
108                                    String.class.getName(),
109                                    
110                            "java.lang.Integer", "java.lang.Integer",
111                                    "com.liferay.portal.kernel.util.OrderByComparator"
112                            });
113            public static final FinderPath FINDER_PATH_COUNT_BY_STRUCTUREID = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
114                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
115                            FINDER_CLASS_NAME_LIST, "countByStructureId",
116                            new String[] { String.class.getName() });
117            public static final FinderPath FINDER_PATH_FETCH_BY_G_S = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
118                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
119                            FINDER_CLASS_NAME_ENTITY, "fetchByG_S",
120                            new String[] { Long.class.getName(), String.class.getName() });
121            public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
122                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
123                            FINDER_CLASS_NAME_LIST, "countByG_S",
124                            new String[] { Long.class.getName(), String.class.getName() });
125            public static final FinderPath FINDER_PATH_FIND_BY_G_P = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
126                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
127                            FINDER_CLASS_NAME_LIST, "findByG_P",
128                            new String[] {
129                                    Long.class.getName(), String.class.getName(),
130                                    
131                            "java.lang.Integer", "java.lang.Integer",
132                                    "com.liferay.portal.kernel.util.OrderByComparator"
133                            });
134            public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
135                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
136                            FINDER_CLASS_NAME_LIST, "countByG_P",
137                            new String[] { Long.class.getName(), String.class.getName() });
138            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
139                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
140                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
141            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
142                            JournalStructureModelImpl.FINDER_CACHE_ENABLED,
143                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
144    
145            public void cacheResult(JournalStructure journalStructure) {
146                    EntityCacheUtil.putResult(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
147                            JournalStructureImpl.class, journalStructure.getPrimaryKey(),
148                            journalStructure);
149    
150                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
151                            new Object[] {
152                                    journalStructure.getUuid(),
153                                    new Long(journalStructure.getGroupId())
154                            }, journalStructure);
155    
156                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_S,
157                            new Object[] {
158                                    new Long(journalStructure.getGroupId()),
159                                    
160                            journalStructure.getStructureId()
161                            }, journalStructure);
162            }
163    
164            public void cacheResult(List<JournalStructure> journalStructures) {
165                    for (JournalStructure journalStructure : journalStructures) {
166                            if (EntityCacheUtil.getResult(
167                                                    JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
168                                                    JournalStructureImpl.class,
169                                                    journalStructure.getPrimaryKey(), this) == null) {
170                                    cacheResult(journalStructure);
171                            }
172                    }
173            }
174    
175            public void clearCache() {
176                    CacheRegistryUtil.clear(JournalStructureImpl.class.getName());
177                    EntityCacheUtil.clearCache(JournalStructureImpl.class.getName());
178                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
179                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
180            }
181    
182            public void clearCache(JournalStructure journalStructure) {
183                    EntityCacheUtil.removeResult(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
184                            JournalStructureImpl.class, journalStructure.getPrimaryKey());
185    
186                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
187                            new Object[] {
188                                    journalStructure.getUuid(),
189                                    new Long(journalStructure.getGroupId())
190                            });
191    
192                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_S,
193                            new Object[] {
194                                    new Long(journalStructure.getGroupId()),
195                                    
196                            journalStructure.getStructureId()
197                            });
198            }
199    
200            public JournalStructure create(long id) {
201                    JournalStructure journalStructure = new JournalStructureImpl();
202    
203                    journalStructure.setNew(true);
204                    journalStructure.setPrimaryKey(id);
205    
206                    String uuid = PortalUUIDUtil.generate();
207    
208                    journalStructure.setUuid(uuid);
209    
210                    return journalStructure;
211            }
212    
213            public JournalStructure remove(Serializable primaryKey)
214                    throws NoSuchModelException, SystemException {
215                    return remove(((Long)primaryKey).longValue());
216            }
217    
218            public JournalStructure remove(long id)
219                    throws NoSuchStructureException, SystemException {
220                    Session session = null;
221    
222                    try {
223                            session = openSession();
224    
225                            JournalStructure journalStructure = (JournalStructure)session.get(JournalStructureImpl.class,
226                                            new Long(id));
227    
228                            if (journalStructure == null) {
229                                    if (_log.isWarnEnabled()) {
230                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
231                                    }
232    
233                                    throw new NoSuchStructureException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
234                                            id);
235                            }
236    
237                            return remove(journalStructure);
238                    }
239                    catch (NoSuchStructureException nsee) {
240                            throw nsee;
241                    }
242                    catch (Exception e) {
243                            throw processException(e);
244                    }
245                    finally {
246                            closeSession(session);
247                    }
248            }
249    
250            protected JournalStructure removeImpl(JournalStructure journalStructure)
251                    throws SystemException {
252                    journalStructure = toUnwrappedModel(journalStructure);
253    
254                    Session session = null;
255    
256                    try {
257                            session = openSession();
258    
259                            if (journalStructure.isCachedModel() ||
260                                            BatchSessionUtil.isEnabled()) {
261                                    Object staleObject = session.get(JournalStructureImpl.class,
262                                                    journalStructure.getPrimaryKeyObj());
263    
264                                    if (staleObject != null) {
265                                            session.evict(staleObject);
266                                    }
267                            }
268    
269                            session.delete(journalStructure);
270    
271                            session.flush();
272                    }
273                    catch (Exception e) {
274                            throw processException(e);
275                    }
276                    finally {
277                            closeSession(session);
278                    }
279    
280                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
281    
282                    JournalStructureModelImpl journalStructureModelImpl = (JournalStructureModelImpl)journalStructure;
283    
284                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
285                            new Object[] {
286                                    journalStructureModelImpl.getOriginalUuid(),
287                                    new Long(journalStructureModelImpl.getOriginalGroupId())
288                            });
289    
290                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_S,
291                            new Object[] {
292                                    new Long(journalStructureModelImpl.getOriginalGroupId()),
293                                    
294                            journalStructureModelImpl.getOriginalStructureId()
295                            });
296    
297                    EntityCacheUtil.removeResult(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
298                            JournalStructureImpl.class, journalStructure.getPrimaryKey());
299    
300                    return journalStructure;
301            }
302    
303            public JournalStructure updateImpl(
304                    com.liferay.portlet.journal.model.JournalStructure journalStructure,
305                    boolean merge) throws SystemException {
306                    journalStructure = toUnwrappedModel(journalStructure);
307    
308                    boolean isNew = journalStructure.isNew();
309    
310                    JournalStructureModelImpl journalStructureModelImpl = (JournalStructureModelImpl)journalStructure;
311    
312                    if (Validator.isNull(journalStructure.getUuid())) {
313                            String uuid = PortalUUIDUtil.generate();
314    
315                            journalStructure.setUuid(uuid);
316                    }
317    
318                    Session session = null;
319    
320                    try {
321                            session = openSession();
322    
323                            BatchSessionUtil.update(session, journalStructure, merge);
324    
325                            journalStructure.setNew(false);
326                    }
327                    catch (Exception e) {
328                            throw processException(e);
329                    }
330                    finally {
331                            closeSession(session);
332                    }
333    
334                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
335    
336                    EntityCacheUtil.putResult(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
337                            JournalStructureImpl.class, journalStructure.getPrimaryKey(),
338                            journalStructure);
339    
340                    if (!isNew &&
341                                    (!Validator.equals(journalStructure.getUuid(),
342                                            journalStructureModelImpl.getOriginalUuid()) ||
343                                    (journalStructure.getGroupId() != journalStructureModelImpl.getOriginalGroupId()))) {
344                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
345                                    new Object[] {
346                                            journalStructureModelImpl.getOriginalUuid(),
347                                            new Long(journalStructureModelImpl.getOriginalGroupId())
348                                    });
349                    }
350    
351                    if (isNew ||
352                                    (!Validator.equals(journalStructure.getUuid(),
353                                            journalStructureModelImpl.getOriginalUuid()) ||
354                                    (journalStructure.getGroupId() != journalStructureModelImpl.getOriginalGroupId()))) {
355                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
356                                    new Object[] {
357                                            journalStructure.getUuid(),
358                                            new Long(journalStructure.getGroupId())
359                                    }, journalStructure);
360                    }
361    
362                    if (!isNew &&
363                                    ((journalStructure.getGroupId() != journalStructureModelImpl.getOriginalGroupId()) ||
364                                    !Validator.equals(journalStructure.getStructureId(),
365                                            journalStructureModelImpl.getOriginalStructureId()))) {
366                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_S,
367                                    new Object[] {
368                                            new Long(journalStructureModelImpl.getOriginalGroupId()),
369                                            
370                                    journalStructureModelImpl.getOriginalStructureId()
371                                    });
372                    }
373    
374                    if (isNew ||
375                                    ((journalStructure.getGroupId() != journalStructureModelImpl.getOriginalGroupId()) ||
376                                    !Validator.equals(journalStructure.getStructureId(),
377                                            journalStructureModelImpl.getOriginalStructureId()))) {
378                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_S,
379                                    new Object[] {
380                                            new Long(journalStructure.getGroupId()),
381                                            
382                                    journalStructure.getStructureId()
383                                    }, journalStructure);
384                    }
385    
386                    return journalStructure;
387            }
388    
389            protected JournalStructure toUnwrappedModel(
390                    JournalStructure journalStructure) {
391                    if (journalStructure instanceof JournalStructureImpl) {
392                            return journalStructure;
393                    }
394    
395                    JournalStructureImpl journalStructureImpl = new JournalStructureImpl();
396    
397                    journalStructureImpl.setNew(journalStructure.isNew());
398                    journalStructureImpl.setPrimaryKey(journalStructure.getPrimaryKey());
399    
400                    journalStructureImpl.setUuid(journalStructure.getUuid());
401                    journalStructureImpl.setId(journalStructure.getId());
402                    journalStructureImpl.setGroupId(journalStructure.getGroupId());
403                    journalStructureImpl.setCompanyId(journalStructure.getCompanyId());
404                    journalStructureImpl.setUserId(journalStructure.getUserId());
405                    journalStructureImpl.setUserName(journalStructure.getUserName());
406                    journalStructureImpl.setCreateDate(journalStructure.getCreateDate());
407                    journalStructureImpl.setModifiedDate(journalStructure.getModifiedDate());
408                    journalStructureImpl.setStructureId(journalStructure.getStructureId());
409                    journalStructureImpl.setParentStructureId(journalStructure.getParentStructureId());
410                    journalStructureImpl.setName(journalStructure.getName());
411                    journalStructureImpl.setDescription(journalStructure.getDescription());
412                    journalStructureImpl.setXsd(journalStructure.getXsd());
413    
414                    return journalStructureImpl;
415            }
416    
417            public JournalStructure findByPrimaryKey(Serializable primaryKey)
418                    throws NoSuchModelException, SystemException {
419                    return findByPrimaryKey(((Long)primaryKey).longValue());
420            }
421    
422            public JournalStructure findByPrimaryKey(long id)
423                    throws NoSuchStructureException, SystemException {
424                    JournalStructure journalStructure = fetchByPrimaryKey(id);
425    
426                    if (journalStructure == null) {
427                            if (_log.isWarnEnabled()) {
428                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
429                            }
430    
431                            throw new NoSuchStructureException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
432                                    id);
433                    }
434    
435                    return journalStructure;
436            }
437    
438            public JournalStructure fetchByPrimaryKey(Serializable primaryKey)
439                    throws SystemException {
440                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
441            }
442    
443            public JournalStructure fetchByPrimaryKey(long id)
444                    throws SystemException {
445                    JournalStructure journalStructure = (JournalStructure)EntityCacheUtil.getResult(JournalStructureModelImpl.ENTITY_CACHE_ENABLED,
446                                    JournalStructureImpl.class, id, this);
447    
448                    if (journalStructure == null) {
449                            Session session = null;
450    
451                            try {
452                                    session = openSession();
453    
454                                    journalStructure = (JournalStructure)session.get(JournalStructureImpl.class,
455                                                    new Long(id));
456                            }
457                            catch (Exception e) {
458                                    throw processException(e);
459                            }
460                            finally {
461                                    if (journalStructure != null) {
462                                            cacheResult(journalStructure);
463                                    }
464    
465                                    closeSession(session);
466                            }
467                    }
468    
469                    return journalStructure;
470            }
471    
472            public List<JournalStructure> findByUuid(String uuid)
473                    throws SystemException {
474                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
475            }
476    
477            public List<JournalStructure> findByUuid(String uuid, int start, int end)
478                    throws SystemException {
479                    return findByUuid(uuid, start, end, null);
480            }
481    
482            public List<JournalStructure> findByUuid(String uuid, int start, int end,
483                    OrderByComparator orderByComparator) throws SystemException {
484                    Object[] finderArgs = new Object[] {
485                                    uuid,
486                                    
487                                    String.valueOf(start), String.valueOf(end),
488                                    String.valueOf(orderByComparator)
489                            };
490    
491                    List<JournalStructure> list = (List<JournalStructure>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
492                                    finderArgs, this);
493    
494                    if (list == null) {
495                            Session session = null;
496    
497                            try {
498                                    session = openSession();
499    
500                                    StringBundler query = null;
501    
502                                    if (orderByComparator != null) {
503                                            query = new StringBundler(3 +
504                                                            (orderByComparator.getOrderByFields().length * 3));
505                                    }
506                                    else {
507                                            query = new StringBundler(3);
508                                    }
509    
510                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
511    
512                                    if (uuid == null) {
513                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
514                                    }
515                                    else {
516                                            if (uuid.equals(StringPool.BLANK)) {
517                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
518                                            }
519                                            else {
520                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
521                                            }
522                                    }
523    
524                                    if (orderByComparator != null) {
525                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
526                                                    orderByComparator);
527                                    }
528    
529                                    else {
530                                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
531                                    }
532    
533                                    String sql = query.toString();
534    
535                                    Query q = session.createQuery(sql);
536    
537                                    QueryPos qPos = QueryPos.getInstance(q);
538    
539                                    if (uuid != null) {
540                                            qPos.add(uuid);
541                                    }
542    
543                                    list = (List<JournalStructure>)QueryUtil.list(q, getDialect(),
544                                                    start, end);
545                            }
546                            catch (Exception e) {
547                                    throw processException(e);
548                            }
549                            finally {
550                                    if (list == null) {
551                                            list = new ArrayList<JournalStructure>();
552                                    }
553    
554                                    cacheResult(list);
555    
556                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
557                                            list);
558    
559                                    closeSession(session);
560                            }
561                    }
562    
563                    return list;
564            }
565    
566            public JournalStructure findByUuid_First(String uuid,
567                    OrderByComparator orderByComparator)
568                    throws NoSuchStructureException, SystemException {
569                    List<JournalStructure> list = findByUuid(uuid, 0, 1, orderByComparator);
570    
571                    if (list.isEmpty()) {
572                            StringBundler msg = new StringBundler(4);
573    
574                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
575    
576                            msg.append("uuid=");
577                            msg.append(uuid);
578    
579                            msg.append(StringPool.CLOSE_CURLY_BRACE);
580    
581                            throw new NoSuchStructureException(msg.toString());
582                    }
583                    else {
584                            return list.get(0);
585                    }
586            }
587    
588            public JournalStructure findByUuid_Last(String uuid,
589                    OrderByComparator orderByComparator)
590                    throws NoSuchStructureException, SystemException {
591                    int count = countByUuid(uuid);
592    
593                    List<JournalStructure> list = findByUuid(uuid, count - 1, count,
594                                    orderByComparator);
595    
596                    if (list.isEmpty()) {
597                            StringBundler msg = new StringBundler(4);
598    
599                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
600    
601                            msg.append("uuid=");
602                            msg.append(uuid);
603    
604                            msg.append(StringPool.CLOSE_CURLY_BRACE);
605    
606                            throw new NoSuchStructureException(msg.toString());
607                    }
608                    else {
609                            return list.get(0);
610                    }
611            }
612    
613            public JournalStructure[] findByUuid_PrevAndNext(long id, String uuid,
614                    OrderByComparator orderByComparator)
615                    throws NoSuchStructureException, SystemException {
616                    JournalStructure journalStructure = findByPrimaryKey(id);
617    
618                    Session session = null;
619    
620                    try {
621                            session = openSession();
622    
623                            JournalStructure[] array = new JournalStructureImpl[3];
624    
625                            array[0] = getByUuid_PrevAndNext(session, journalStructure, uuid,
626                                            orderByComparator, true);
627    
628                            array[1] = journalStructure;
629    
630                            array[2] = getByUuid_PrevAndNext(session, journalStructure, uuid,
631                                            orderByComparator, false);
632    
633                            return array;
634                    }
635                    catch (Exception e) {
636                            throw processException(e);
637                    }
638                    finally {
639                            closeSession(session);
640                    }
641            }
642    
643            protected JournalStructure getByUuid_PrevAndNext(Session session,
644                    JournalStructure journalStructure, String uuid,
645                    OrderByComparator orderByComparator, boolean previous) {
646                    StringBundler query = null;
647    
648                    if (orderByComparator != null) {
649                            query = new StringBundler(6 +
650                                            (orderByComparator.getOrderByFields().length * 6));
651                    }
652                    else {
653                            query = new StringBundler(3);
654                    }
655    
656                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
657    
658                    if (uuid == null) {
659                            query.append(_FINDER_COLUMN_UUID_UUID_1);
660                    }
661                    else {
662                            if (uuid.equals(StringPool.BLANK)) {
663                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
664                            }
665                            else {
666                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
667                            }
668                    }
669    
670                    if (orderByComparator != null) {
671                            String[] orderByFields = orderByComparator.getOrderByFields();
672    
673                            if (orderByFields.length > 0) {
674                                    query.append(WHERE_AND);
675                            }
676    
677                            for (int i = 0; i < orderByFields.length; i++) {
678                                    query.append(_ORDER_BY_ENTITY_ALIAS);
679                                    query.append(orderByFields[i]);
680    
681                                    if ((i + 1) < orderByFields.length) {
682                                            if (orderByComparator.isAscending() ^ previous) {
683                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
684                                            }
685                                            else {
686                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
687                                            }
688                                    }
689                                    else {
690                                            if (orderByComparator.isAscending() ^ previous) {
691                                                    query.append(WHERE_GREATER_THAN);
692                                            }
693                                            else {
694                                                    query.append(WHERE_LESSER_THAN);
695                                            }
696                                    }
697                            }
698    
699                            query.append(ORDER_BY_CLAUSE);
700    
701                            for (int i = 0; i < orderByFields.length; i++) {
702                                    query.append(_ORDER_BY_ENTITY_ALIAS);
703                                    query.append(orderByFields[i]);
704    
705                                    if ((i + 1) < orderByFields.length) {
706                                            if (orderByComparator.isAscending() ^ previous) {
707                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
708                                            }
709                                            else {
710                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
711                                            }
712                                    }
713                                    else {
714                                            if (orderByComparator.isAscending() ^ previous) {
715                                                    query.append(ORDER_BY_ASC);
716                                            }
717                                            else {
718                                                    query.append(ORDER_BY_DESC);
719                                            }
720                                    }
721                            }
722                    }
723    
724                    else {
725                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
726                    }
727    
728                    String sql = query.toString();
729    
730                    Query q = session.createQuery(sql);
731    
732                    q.setFirstResult(0);
733                    q.setMaxResults(2);
734    
735                    QueryPos qPos = QueryPos.getInstance(q);
736    
737                    if (uuid != null) {
738                            qPos.add(uuid);
739                    }
740    
741                    if (orderByComparator != null) {
742                            Object[] values = orderByComparator.getOrderByValues(journalStructure);
743    
744                            for (Object value : values) {
745                                    qPos.add(value);
746                            }
747                    }
748    
749                    List<JournalStructure> list = q.list();
750    
751                    if (list.size() == 2) {
752                            return list.get(1);
753                    }
754                    else {
755                            return null;
756                    }
757            }
758    
759            public JournalStructure findByUUID_G(String uuid, long groupId)
760                    throws NoSuchStructureException, SystemException {
761                    JournalStructure journalStructure = fetchByUUID_G(uuid, groupId);
762    
763                    if (journalStructure == null) {
764                            StringBundler msg = new StringBundler(6);
765    
766                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
767    
768                            msg.append("uuid=");
769                            msg.append(uuid);
770    
771                            msg.append(", groupId=");
772                            msg.append(groupId);
773    
774                            msg.append(StringPool.CLOSE_CURLY_BRACE);
775    
776                            if (_log.isWarnEnabled()) {
777                                    _log.warn(msg.toString());
778                            }
779    
780                            throw new NoSuchStructureException(msg.toString());
781                    }
782    
783                    return journalStructure;
784            }
785    
786            public JournalStructure fetchByUUID_G(String uuid, long groupId)
787                    throws SystemException {
788                    return fetchByUUID_G(uuid, groupId, true);
789            }
790    
791            public JournalStructure fetchByUUID_G(String uuid, long groupId,
792                    boolean retrieveFromCache) throws SystemException {
793                    Object[] finderArgs = new Object[] { uuid, groupId };
794    
795                    Object result = null;
796    
797                    if (retrieveFromCache) {
798                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
799                                            finderArgs, this);
800                    }
801    
802                    if (result == null) {
803                            Session session = null;
804    
805                            try {
806                                    session = openSession();
807    
808                                    StringBundler query = new StringBundler(4);
809    
810                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
811    
812                                    if (uuid == null) {
813                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
814                                    }
815                                    else {
816                                            if (uuid.equals(StringPool.BLANK)) {
817                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
818                                            }
819                                            else {
820                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
821                                            }
822                                    }
823    
824                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
825    
826                                    query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
827    
828                                    String sql = query.toString();
829    
830                                    Query q = session.createQuery(sql);
831    
832                                    QueryPos qPos = QueryPos.getInstance(q);
833    
834                                    if (uuid != null) {
835                                            qPos.add(uuid);
836                                    }
837    
838                                    qPos.add(groupId);
839    
840                                    List<JournalStructure> list = q.list();
841    
842                                    result = list;
843    
844                                    JournalStructure journalStructure = null;
845    
846                                    if (list.isEmpty()) {
847                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
848                                                    finderArgs, list);
849                                    }
850                                    else {
851                                            journalStructure = list.get(0);
852    
853                                            cacheResult(journalStructure);
854    
855                                            if ((journalStructure.getUuid() == null) ||
856                                                            !journalStructure.getUuid().equals(uuid) ||
857                                                            (journalStructure.getGroupId() != groupId)) {
858                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
859                                                            finderArgs, journalStructure);
860                                            }
861                                    }
862    
863                                    return journalStructure;
864                            }
865                            catch (Exception e) {
866                                    throw processException(e);
867                            }
868                            finally {
869                                    if (result == null) {
870                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
871                                                    finderArgs, new ArrayList<JournalStructure>());
872                                    }
873    
874                                    closeSession(session);
875                            }
876                    }
877                    else {
878                            if (result instanceof List<?>) {
879                                    return null;
880                            }
881                            else {
882                                    return (JournalStructure)result;
883                            }
884                    }
885            }
886    
887            public List<JournalStructure> findByGroupId(long groupId)
888                    throws SystemException {
889                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
890            }
891    
892            public List<JournalStructure> findByGroupId(long groupId, int start, int end)
893                    throws SystemException {
894                    return findByGroupId(groupId, start, end, null);
895            }
896    
897            public List<JournalStructure> findByGroupId(long groupId, int start,
898                    int end, OrderByComparator orderByComparator) throws SystemException {
899                    Object[] finderArgs = new Object[] {
900                                    groupId,
901                                    
902                                    String.valueOf(start), String.valueOf(end),
903                                    String.valueOf(orderByComparator)
904                            };
905    
906                    List<JournalStructure> list = (List<JournalStructure>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
907                                    finderArgs, this);
908    
909                    if (list == null) {
910                            Session session = null;
911    
912                            try {
913                                    session = openSession();
914    
915                                    StringBundler query = null;
916    
917                                    if (orderByComparator != null) {
918                                            query = new StringBundler(3 +
919                                                            (orderByComparator.getOrderByFields().length * 3));
920                                    }
921                                    else {
922                                            query = new StringBundler(3);
923                                    }
924    
925                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
926    
927                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
928    
929                                    if (orderByComparator != null) {
930                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
931                                                    orderByComparator);
932                                    }
933    
934                                    else {
935                                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
936                                    }
937    
938                                    String sql = query.toString();
939    
940                                    Query q = session.createQuery(sql);
941    
942                                    QueryPos qPos = QueryPos.getInstance(q);
943    
944                                    qPos.add(groupId);
945    
946                                    list = (List<JournalStructure>)QueryUtil.list(q, getDialect(),
947                                                    start, end);
948                            }
949                            catch (Exception e) {
950                                    throw processException(e);
951                            }
952                            finally {
953                                    if (list == null) {
954                                            list = new ArrayList<JournalStructure>();
955                                    }
956    
957                                    cacheResult(list);
958    
959                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
960                                            finderArgs, list);
961    
962                                    closeSession(session);
963                            }
964                    }
965    
966                    return list;
967            }
968    
969            public JournalStructure findByGroupId_First(long groupId,
970                    OrderByComparator orderByComparator)
971                    throws NoSuchStructureException, SystemException {
972                    List<JournalStructure> list = findByGroupId(groupId, 0, 1,
973                                    orderByComparator);
974    
975                    if (list.isEmpty()) {
976                            StringBundler msg = new StringBundler(4);
977    
978                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
979    
980                            msg.append("groupId=");
981                            msg.append(groupId);
982    
983                            msg.append(StringPool.CLOSE_CURLY_BRACE);
984    
985                            throw new NoSuchStructureException(msg.toString());
986                    }
987                    else {
988                            return list.get(0);
989                    }
990            }
991    
992            public JournalStructure findByGroupId_Last(long groupId,
993                    OrderByComparator orderByComparator)
994                    throws NoSuchStructureException, SystemException {
995                    int count = countByGroupId(groupId);
996    
997                    List<JournalStructure> list = findByGroupId(groupId, count - 1, count,
998                                    orderByComparator);
999    
1000                    if (list.isEmpty()) {
1001                            StringBundler msg = new StringBundler(4);
1002    
1003                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1004    
1005                            msg.append("groupId=");
1006                            msg.append(groupId);
1007    
1008                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1009    
1010                            throw new NoSuchStructureException(msg.toString());
1011                    }
1012                    else {
1013                            return list.get(0);
1014                    }
1015            }
1016    
1017            public JournalStructure[] findByGroupId_PrevAndNext(long id, long groupId,
1018                    OrderByComparator orderByComparator)
1019                    throws NoSuchStructureException, SystemException {
1020                    JournalStructure journalStructure = findByPrimaryKey(id);
1021    
1022                    Session session = null;
1023    
1024                    try {
1025                            session = openSession();
1026    
1027                            JournalStructure[] array = new JournalStructureImpl[3];
1028    
1029                            array[0] = getByGroupId_PrevAndNext(session, journalStructure,
1030                                            groupId, orderByComparator, true);
1031    
1032                            array[1] = journalStructure;
1033    
1034                            array[2] = getByGroupId_PrevAndNext(session, journalStructure,
1035                                            groupId, orderByComparator, false);
1036    
1037                            return array;
1038                    }
1039                    catch (Exception e) {
1040                            throw processException(e);
1041                    }
1042                    finally {
1043                            closeSession(session);
1044                    }
1045            }
1046    
1047            protected JournalStructure getByGroupId_PrevAndNext(Session session,
1048                    JournalStructure journalStructure, long groupId,
1049                    OrderByComparator orderByComparator, boolean previous) {
1050                    StringBundler query = null;
1051    
1052                    if (orderByComparator != null) {
1053                            query = new StringBundler(6 +
1054                                            (orderByComparator.getOrderByFields().length * 6));
1055                    }
1056                    else {
1057                            query = new StringBundler(3);
1058                    }
1059    
1060                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1061    
1062                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1063    
1064                    if (orderByComparator != null) {
1065                            String[] orderByFields = orderByComparator.getOrderByFields();
1066    
1067                            if (orderByFields.length > 0) {
1068                                    query.append(WHERE_AND);
1069                            }
1070    
1071                            for (int i = 0; i < orderByFields.length; i++) {
1072                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1073                                    query.append(orderByFields[i]);
1074    
1075                                    if ((i + 1) < orderByFields.length) {
1076                                            if (orderByComparator.isAscending() ^ previous) {
1077                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1078                                            }
1079                                            else {
1080                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1081                                            }
1082                                    }
1083                                    else {
1084                                            if (orderByComparator.isAscending() ^ previous) {
1085                                                    query.append(WHERE_GREATER_THAN);
1086                                            }
1087                                            else {
1088                                                    query.append(WHERE_LESSER_THAN);
1089                                            }
1090                                    }
1091                            }
1092    
1093                            query.append(ORDER_BY_CLAUSE);
1094    
1095                            for (int i = 0; i < orderByFields.length; i++) {
1096                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1097                                    query.append(orderByFields[i]);
1098    
1099                                    if ((i + 1) < orderByFields.length) {
1100                                            if (orderByComparator.isAscending() ^ previous) {
1101                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1102                                            }
1103                                            else {
1104                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1105                                            }
1106                                    }
1107                                    else {
1108                                            if (orderByComparator.isAscending() ^ previous) {
1109                                                    query.append(ORDER_BY_ASC);
1110                                            }
1111                                            else {
1112                                                    query.append(ORDER_BY_DESC);
1113                                            }
1114                                    }
1115                            }
1116                    }
1117    
1118                    else {
1119                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1120                    }
1121    
1122                    String sql = query.toString();
1123    
1124                    Query q = session.createQuery(sql);
1125    
1126                    q.setFirstResult(0);
1127                    q.setMaxResults(2);
1128    
1129                    QueryPos qPos = QueryPos.getInstance(q);
1130    
1131                    qPos.add(groupId);
1132    
1133                    if (orderByComparator != null) {
1134                            Object[] values = orderByComparator.getOrderByValues(journalStructure);
1135    
1136                            for (Object value : values) {
1137                                    qPos.add(value);
1138                            }
1139                    }
1140    
1141                    List<JournalStructure> list = q.list();
1142    
1143                    if (list.size() == 2) {
1144                            return list.get(1);
1145                    }
1146                    else {
1147                            return null;
1148                    }
1149            }
1150    
1151            public List<JournalStructure> filterFindByGroupId(long groupId)
1152                    throws SystemException {
1153                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1154                            QueryUtil.ALL_POS, null);
1155            }
1156    
1157            public List<JournalStructure> filterFindByGroupId(long groupId, int start,
1158                    int end) throws SystemException {
1159                    return filterFindByGroupId(groupId, start, end, null);
1160            }
1161    
1162            public List<JournalStructure> filterFindByGroupId(long groupId, int start,
1163                    int end, OrderByComparator orderByComparator) throws SystemException {
1164                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1165                            return findByGroupId(groupId, start, end, orderByComparator);
1166                    }
1167    
1168                    Session session = null;
1169    
1170                    try {
1171                            session = openSession();
1172    
1173                            StringBundler query = null;
1174    
1175                            if (orderByComparator != null) {
1176                                    query = new StringBundler(3 +
1177                                                    (orderByComparator.getOrderByFields().length * 3));
1178                            }
1179                            else {
1180                                    query = new StringBundler(3);
1181                            }
1182    
1183                            query.append(_FILTER_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1184    
1185                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1186    
1187                            if (orderByComparator != null) {
1188                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1189                                            orderByComparator);
1190                            }
1191    
1192                            else {
1193                                    query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1194                            }
1195    
1196                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1197                                            JournalStructure.class.getName(), _FILTER_COLUMN_PK,
1198                                            _FILTER_COLUMN_USERID, groupId);
1199    
1200                            SQLQuery q = session.createSQLQuery(sql);
1201    
1202                            q.addEntity(_FILTER_ENTITY_ALIAS, JournalStructureImpl.class);
1203    
1204                            QueryPos qPos = QueryPos.getInstance(q);
1205    
1206                            qPos.add(groupId);
1207    
1208                            return (List<JournalStructure>)QueryUtil.list(q, getDialect(),
1209                                    start, end);
1210                    }
1211                    catch (Exception e) {
1212                            throw processException(e);
1213                    }
1214                    finally {
1215                            closeSession(session);
1216                    }
1217            }
1218    
1219            public List<JournalStructure> findByStructureId(String structureId)
1220                    throws SystemException {
1221                    return findByStructureId(structureId, QueryUtil.ALL_POS,
1222                            QueryUtil.ALL_POS, null);
1223            }
1224    
1225            public List<JournalStructure> findByStructureId(String structureId,
1226                    int start, int end) throws SystemException {
1227                    return findByStructureId(structureId, start, end, null);
1228            }
1229    
1230            public List<JournalStructure> findByStructureId(String structureId,
1231                    int start, int end, OrderByComparator orderByComparator)
1232                    throws SystemException {
1233                    Object[] finderArgs = new Object[] {
1234                                    structureId,
1235                                    
1236                                    String.valueOf(start), String.valueOf(end),
1237                                    String.valueOf(orderByComparator)
1238                            };
1239    
1240                    List<JournalStructure> list = (List<JournalStructure>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_STRUCTUREID,
1241                                    finderArgs, this);
1242    
1243                    if (list == null) {
1244                            Session session = null;
1245    
1246                            try {
1247                                    session = openSession();
1248    
1249                                    StringBundler query = null;
1250    
1251                                    if (orderByComparator != null) {
1252                                            query = new StringBundler(3 +
1253                                                            (orderByComparator.getOrderByFields().length * 3));
1254                                    }
1255                                    else {
1256                                            query = new StringBundler(3);
1257                                    }
1258    
1259                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1260    
1261                                    if (structureId == null) {
1262                                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
1263                                    }
1264                                    else {
1265                                            if (structureId.equals(StringPool.BLANK)) {
1266                                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
1267                                            }
1268                                            else {
1269                                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1270                                            }
1271                                    }
1272    
1273                                    if (orderByComparator != null) {
1274                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1275                                                    orderByComparator);
1276                                    }
1277    
1278                                    else {
1279                                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1280                                    }
1281    
1282                                    String sql = query.toString();
1283    
1284                                    Query q = session.createQuery(sql);
1285    
1286                                    QueryPos qPos = QueryPos.getInstance(q);
1287    
1288                                    if (structureId != null) {
1289                                            qPos.add(structureId);
1290                                    }
1291    
1292                                    list = (List<JournalStructure>)QueryUtil.list(q, getDialect(),
1293                                                    start, end);
1294                            }
1295                            catch (Exception e) {
1296                                    throw processException(e);
1297                            }
1298                            finally {
1299                                    if (list == null) {
1300                                            list = new ArrayList<JournalStructure>();
1301                                    }
1302    
1303                                    cacheResult(list);
1304    
1305                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_STRUCTUREID,
1306                                            finderArgs, list);
1307    
1308                                    closeSession(session);
1309                            }
1310                    }
1311    
1312                    return list;
1313            }
1314    
1315            public JournalStructure findByStructureId_First(String structureId,
1316                    OrderByComparator orderByComparator)
1317                    throws NoSuchStructureException, SystemException {
1318                    List<JournalStructure> list = findByStructureId(structureId, 0, 1,
1319                                    orderByComparator);
1320    
1321                    if (list.isEmpty()) {
1322                            StringBundler msg = new StringBundler(4);
1323    
1324                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1325    
1326                            msg.append("structureId=");
1327                            msg.append(structureId);
1328    
1329                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1330    
1331                            throw new NoSuchStructureException(msg.toString());
1332                    }
1333                    else {
1334                            return list.get(0);
1335                    }
1336            }
1337    
1338            public JournalStructure findByStructureId_Last(String structureId,
1339                    OrderByComparator orderByComparator)
1340                    throws NoSuchStructureException, SystemException {
1341                    int count = countByStructureId(structureId);
1342    
1343                    List<JournalStructure> list = findByStructureId(structureId, count - 1,
1344                                    count, orderByComparator);
1345    
1346                    if (list.isEmpty()) {
1347                            StringBundler msg = new StringBundler(4);
1348    
1349                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1350    
1351                            msg.append("structureId=");
1352                            msg.append(structureId);
1353    
1354                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1355    
1356                            throw new NoSuchStructureException(msg.toString());
1357                    }
1358                    else {
1359                            return list.get(0);
1360                    }
1361            }
1362    
1363            public JournalStructure[] findByStructureId_PrevAndNext(long id,
1364                    String structureId, OrderByComparator orderByComparator)
1365                    throws NoSuchStructureException, SystemException {
1366                    JournalStructure journalStructure = findByPrimaryKey(id);
1367    
1368                    Session session = null;
1369    
1370                    try {
1371                            session = openSession();
1372    
1373                            JournalStructure[] array = new JournalStructureImpl[3];
1374    
1375                            array[0] = getByStructureId_PrevAndNext(session, journalStructure,
1376                                            structureId, orderByComparator, true);
1377    
1378                            array[1] = journalStructure;
1379    
1380                            array[2] = getByStructureId_PrevAndNext(session, journalStructure,
1381                                            structureId, orderByComparator, false);
1382    
1383                            return array;
1384                    }
1385                    catch (Exception e) {
1386                            throw processException(e);
1387                    }
1388                    finally {
1389                            closeSession(session);
1390                    }
1391            }
1392    
1393            protected JournalStructure getByStructureId_PrevAndNext(Session session,
1394                    JournalStructure journalStructure, String structureId,
1395                    OrderByComparator orderByComparator, boolean previous) {
1396                    StringBundler query = null;
1397    
1398                    if (orderByComparator != null) {
1399                            query = new StringBundler(6 +
1400                                            (orderByComparator.getOrderByFields().length * 6));
1401                    }
1402                    else {
1403                            query = new StringBundler(3);
1404                    }
1405    
1406                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1407    
1408                    if (structureId == null) {
1409                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
1410                    }
1411                    else {
1412                            if (structureId.equals(StringPool.BLANK)) {
1413                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
1414                            }
1415                            else {
1416                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1417                            }
1418                    }
1419    
1420                    if (orderByComparator != null) {
1421                            String[] orderByFields = orderByComparator.getOrderByFields();
1422    
1423                            if (orderByFields.length > 0) {
1424                                    query.append(WHERE_AND);
1425                            }
1426    
1427                            for (int i = 0; i < orderByFields.length; i++) {
1428                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1429                                    query.append(orderByFields[i]);
1430    
1431                                    if ((i + 1) < orderByFields.length) {
1432                                            if (orderByComparator.isAscending() ^ previous) {
1433                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1434                                            }
1435                                            else {
1436                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1437                                            }
1438                                    }
1439                                    else {
1440                                            if (orderByComparator.isAscending() ^ previous) {
1441                                                    query.append(WHERE_GREATER_THAN);
1442                                            }
1443                                            else {
1444                                                    query.append(WHERE_LESSER_THAN);
1445                                            }
1446                                    }
1447                            }
1448    
1449                            query.append(ORDER_BY_CLAUSE);
1450    
1451                            for (int i = 0; i < orderByFields.length; i++) {
1452                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1453                                    query.append(orderByFields[i]);
1454    
1455                                    if ((i + 1) < orderByFields.length) {
1456                                            if (orderByComparator.isAscending() ^ previous) {
1457                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1458                                            }
1459                                            else {
1460                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1461                                            }
1462                                    }
1463                                    else {
1464                                            if (orderByComparator.isAscending() ^ previous) {
1465                                                    query.append(ORDER_BY_ASC);
1466                                            }
1467                                            else {
1468                                                    query.append(ORDER_BY_DESC);
1469                                            }
1470                                    }
1471                            }
1472                    }
1473    
1474                    else {
1475                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1476                    }
1477    
1478                    String sql = query.toString();
1479    
1480                    Query q = session.createQuery(sql);
1481    
1482                    q.setFirstResult(0);
1483                    q.setMaxResults(2);
1484    
1485                    QueryPos qPos = QueryPos.getInstance(q);
1486    
1487                    if (structureId != null) {
1488                            qPos.add(structureId);
1489                    }
1490    
1491                    if (orderByComparator != null) {
1492                            Object[] values = orderByComparator.getOrderByValues(journalStructure);
1493    
1494                            for (Object value : values) {
1495                                    qPos.add(value);
1496                            }
1497                    }
1498    
1499                    List<JournalStructure> list = q.list();
1500    
1501                    if (list.size() == 2) {
1502                            return list.get(1);
1503                    }
1504                    else {
1505                            return null;
1506                    }
1507            }
1508    
1509            public JournalStructure findByG_S(long groupId, String structureId)
1510                    throws NoSuchStructureException, SystemException {
1511                    JournalStructure journalStructure = fetchByG_S(groupId, structureId);
1512    
1513                    if (journalStructure == null) {
1514                            StringBundler msg = new StringBundler(6);
1515    
1516                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1517    
1518                            msg.append("groupId=");
1519                            msg.append(groupId);
1520    
1521                            msg.append(", structureId=");
1522                            msg.append(structureId);
1523    
1524                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1525    
1526                            if (_log.isWarnEnabled()) {
1527                                    _log.warn(msg.toString());
1528                            }
1529    
1530                            throw new NoSuchStructureException(msg.toString());
1531                    }
1532    
1533                    return journalStructure;
1534            }
1535    
1536            public JournalStructure fetchByG_S(long groupId, String structureId)
1537                    throws SystemException {
1538                    return fetchByG_S(groupId, structureId, true);
1539            }
1540    
1541            public JournalStructure fetchByG_S(long groupId, String structureId,
1542                    boolean retrieveFromCache) throws SystemException {
1543                    Object[] finderArgs = new Object[] { groupId, structureId };
1544    
1545                    Object result = null;
1546    
1547                    if (retrieveFromCache) {
1548                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_S,
1549                                            finderArgs, this);
1550                    }
1551    
1552                    if (result == null) {
1553                            Session session = null;
1554    
1555                            try {
1556                                    session = openSession();
1557    
1558                                    StringBundler query = new StringBundler(4);
1559    
1560                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1561    
1562                                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
1563    
1564                                    if (structureId == null) {
1565                                            query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
1566                                    }
1567                                    else {
1568                                            if (structureId.equals(StringPool.BLANK)) {
1569                                                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
1570                                            }
1571                                            else {
1572                                                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
1573                                            }
1574                                    }
1575    
1576                                    query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1577    
1578                                    String sql = query.toString();
1579    
1580                                    Query q = session.createQuery(sql);
1581    
1582                                    QueryPos qPos = QueryPos.getInstance(q);
1583    
1584                                    qPos.add(groupId);
1585    
1586                                    if (structureId != null) {
1587                                            qPos.add(structureId);
1588                                    }
1589    
1590                                    List<JournalStructure> list = q.list();
1591    
1592                                    result = list;
1593    
1594                                    JournalStructure journalStructure = null;
1595    
1596                                    if (list.isEmpty()) {
1597                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_S,
1598                                                    finderArgs, list);
1599                                    }
1600                                    else {
1601                                            journalStructure = list.get(0);
1602    
1603                                            cacheResult(journalStructure);
1604    
1605                                            if ((journalStructure.getGroupId() != groupId) ||
1606                                                            (journalStructure.getStructureId() == null) ||
1607                                                            !journalStructure.getStructureId()
1608                                                                                                     .equals(structureId)) {
1609                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_S,
1610                                                            finderArgs, journalStructure);
1611                                            }
1612                                    }
1613    
1614                                    return journalStructure;
1615                            }
1616                            catch (Exception e) {
1617                                    throw processException(e);
1618                            }
1619                            finally {
1620                                    if (result == null) {
1621                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_S,
1622                                                    finderArgs, new ArrayList<JournalStructure>());
1623                                    }
1624    
1625                                    closeSession(session);
1626                            }
1627                    }
1628                    else {
1629                            if (result instanceof List<?>) {
1630                                    return null;
1631                            }
1632                            else {
1633                                    return (JournalStructure)result;
1634                            }
1635                    }
1636            }
1637    
1638            public List<JournalStructure> findByG_P(long groupId,
1639                    String parentStructureId) throws SystemException {
1640                    return findByG_P(groupId, parentStructureId, QueryUtil.ALL_POS,
1641                            QueryUtil.ALL_POS, null);
1642            }
1643    
1644            public List<JournalStructure> findByG_P(long groupId,
1645                    String parentStructureId, int start, int end) throws SystemException {
1646                    return findByG_P(groupId, parentStructureId, start, end, null);
1647            }
1648    
1649            public List<JournalStructure> findByG_P(long groupId,
1650                    String parentStructureId, int start, int end,
1651                    OrderByComparator orderByComparator) throws SystemException {
1652                    Object[] finderArgs = new Object[] {
1653                                    groupId, parentStructureId,
1654                                    
1655                                    String.valueOf(start), String.valueOf(end),
1656                                    String.valueOf(orderByComparator)
1657                            };
1658    
1659                    List<JournalStructure> list = (List<JournalStructure>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1660                                    finderArgs, this);
1661    
1662                    if (list == null) {
1663                            Session session = null;
1664    
1665                            try {
1666                                    session = openSession();
1667    
1668                                    StringBundler query = null;
1669    
1670                                    if (orderByComparator != null) {
1671                                            query = new StringBundler(4 +
1672                                                            (orderByComparator.getOrderByFields().length * 3));
1673                                    }
1674                                    else {
1675                                            query = new StringBundler(4);
1676                                    }
1677    
1678                                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1679    
1680                                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1681    
1682                                    if (parentStructureId == null) {
1683                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1);
1684                                    }
1685                                    else {
1686                                            if (parentStructureId.equals(StringPool.BLANK)) {
1687                                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3);
1688                                            }
1689                                            else {
1690                                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2);
1691                                            }
1692                                    }
1693    
1694                                    if (orderByComparator != null) {
1695                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1696                                                    orderByComparator);
1697                                    }
1698    
1699                                    else {
1700                                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1701                                    }
1702    
1703                                    String sql = query.toString();
1704    
1705                                    Query q = session.createQuery(sql);
1706    
1707                                    QueryPos qPos = QueryPos.getInstance(q);
1708    
1709                                    qPos.add(groupId);
1710    
1711                                    if (parentStructureId != null) {
1712                                            qPos.add(parentStructureId);
1713                                    }
1714    
1715                                    list = (List<JournalStructure>)QueryUtil.list(q, getDialect(),
1716                                                    start, end);
1717                            }
1718                            catch (Exception e) {
1719                                    throw processException(e);
1720                            }
1721                            finally {
1722                                    if (list == null) {
1723                                            list = new ArrayList<JournalStructure>();
1724                                    }
1725    
1726                                    cacheResult(list);
1727    
1728                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P, finderArgs,
1729                                            list);
1730    
1731                                    closeSession(session);
1732                            }
1733                    }
1734    
1735                    return list;
1736            }
1737    
1738            public JournalStructure findByG_P_First(long groupId,
1739                    String parentStructureId, OrderByComparator orderByComparator)
1740                    throws NoSuchStructureException, SystemException {
1741                    List<JournalStructure> list = findByG_P(groupId, parentStructureId, 0,
1742                                    1, orderByComparator);
1743    
1744                    if (list.isEmpty()) {
1745                            StringBundler msg = new StringBundler(6);
1746    
1747                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1748    
1749                            msg.append("groupId=");
1750                            msg.append(groupId);
1751    
1752                            msg.append(", parentStructureId=");
1753                            msg.append(parentStructureId);
1754    
1755                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1756    
1757                            throw new NoSuchStructureException(msg.toString());
1758                    }
1759                    else {
1760                            return list.get(0);
1761                    }
1762            }
1763    
1764            public JournalStructure findByG_P_Last(long groupId,
1765                    String parentStructureId, OrderByComparator orderByComparator)
1766                    throws NoSuchStructureException, SystemException {
1767                    int count = countByG_P(groupId, parentStructureId);
1768    
1769                    List<JournalStructure> list = findByG_P(groupId, parentStructureId,
1770                                    count - 1, count, orderByComparator);
1771    
1772                    if (list.isEmpty()) {
1773                            StringBundler msg = new StringBundler(6);
1774    
1775                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1776    
1777                            msg.append("groupId=");
1778                            msg.append(groupId);
1779    
1780                            msg.append(", parentStructureId=");
1781                            msg.append(parentStructureId);
1782    
1783                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1784    
1785                            throw new NoSuchStructureException(msg.toString());
1786                    }
1787                    else {
1788                            return list.get(0);
1789                    }
1790            }
1791    
1792            public JournalStructure[] findByG_P_PrevAndNext(long id, long groupId,
1793                    String parentStructureId, OrderByComparator orderByComparator)
1794                    throws NoSuchStructureException, SystemException {
1795                    JournalStructure journalStructure = findByPrimaryKey(id);
1796    
1797                    Session session = null;
1798    
1799                    try {
1800                            session = openSession();
1801    
1802                            JournalStructure[] array = new JournalStructureImpl[3];
1803    
1804                            array[0] = getByG_P_PrevAndNext(session, journalStructure, groupId,
1805                                            parentStructureId, orderByComparator, true);
1806    
1807                            array[1] = journalStructure;
1808    
1809                            array[2] = getByG_P_PrevAndNext(session, journalStructure, groupId,
1810                                            parentStructureId, orderByComparator, false);
1811    
1812                            return array;
1813                    }
1814                    catch (Exception e) {
1815                            throw processException(e);
1816                    }
1817                    finally {
1818                            closeSession(session);
1819                    }
1820            }
1821    
1822            protected JournalStructure getByG_P_PrevAndNext(Session session,
1823                    JournalStructure journalStructure, long groupId,
1824                    String parentStructureId, OrderByComparator orderByComparator,
1825                    boolean previous) {
1826                    StringBundler query = null;
1827    
1828                    if (orderByComparator != null) {
1829                            query = new StringBundler(6 +
1830                                            (orderByComparator.getOrderByFields().length * 6));
1831                    }
1832                    else {
1833                            query = new StringBundler(3);
1834                    }
1835    
1836                    query.append(_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1837    
1838                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1839    
1840                    if (parentStructureId == null) {
1841                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1);
1842                    }
1843                    else {
1844                            if (parentStructureId.equals(StringPool.BLANK)) {
1845                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3);
1846                            }
1847                            else {
1848                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2);
1849                            }
1850                    }
1851    
1852                    if (orderByComparator != null) {
1853                            String[] orderByFields = orderByComparator.getOrderByFields();
1854    
1855                            if (orderByFields.length > 0) {
1856                                    query.append(WHERE_AND);
1857                            }
1858    
1859                            for (int i = 0; i < orderByFields.length; i++) {
1860                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1861                                    query.append(orderByFields[i]);
1862    
1863                                    if ((i + 1) < orderByFields.length) {
1864                                            if (orderByComparator.isAscending() ^ previous) {
1865                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1866                                            }
1867                                            else {
1868                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1869                                            }
1870                                    }
1871                                    else {
1872                                            if (orderByComparator.isAscending() ^ previous) {
1873                                                    query.append(WHERE_GREATER_THAN);
1874                                            }
1875                                            else {
1876                                                    query.append(WHERE_LESSER_THAN);
1877                                            }
1878                                    }
1879                            }
1880    
1881                            query.append(ORDER_BY_CLAUSE);
1882    
1883                            for (int i = 0; i < orderByFields.length; i++) {
1884                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1885                                    query.append(orderByFields[i]);
1886    
1887                                    if ((i + 1) < orderByFields.length) {
1888                                            if (orderByComparator.isAscending() ^ previous) {
1889                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1890                                            }
1891                                            else {
1892                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1893                                            }
1894                                    }
1895                                    else {
1896                                            if (orderByComparator.isAscending() ^ previous) {
1897                                                    query.append(ORDER_BY_ASC);
1898                                            }
1899                                            else {
1900                                                    query.append(ORDER_BY_DESC);
1901                                            }
1902                                    }
1903                            }
1904                    }
1905    
1906                    else {
1907                            query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
1908                    }
1909    
1910                    String sql = query.toString();
1911    
1912                    Query q = session.createQuery(sql);
1913    
1914                    q.setFirstResult(0);
1915                    q.setMaxResults(2);
1916    
1917                    QueryPos qPos = QueryPos.getInstance(q);
1918    
1919                    qPos.add(groupId);
1920    
1921                    if (parentStructureId != null) {
1922                            qPos.add(parentStructureId);
1923                    }
1924    
1925                    if (orderByComparator != null) {
1926                            Object[] values = orderByComparator.getOrderByValues(journalStructure);
1927    
1928                            for (Object value : values) {
1929                                    qPos.add(value);
1930                            }
1931                    }
1932    
1933                    List<JournalStructure> list = q.list();
1934    
1935                    if (list.size() == 2) {
1936                            return list.get(1);
1937                    }
1938                    else {
1939                            return null;
1940                    }
1941            }
1942    
1943            public List<JournalStructure> filterFindByG_P(long groupId,
1944                    String parentStructureId) throws SystemException {
1945                    return filterFindByG_P(groupId, parentStructureId, QueryUtil.ALL_POS,
1946                            QueryUtil.ALL_POS, null);
1947            }
1948    
1949            public List<JournalStructure> filterFindByG_P(long groupId,
1950                    String parentStructureId, int start, int end) throws SystemException {
1951                    return filterFindByG_P(groupId, parentStructureId, start, end, null);
1952            }
1953    
1954            public List<JournalStructure> filterFindByG_P(long groupId,
1955                    String parentStructureId, int start, int end,
1956                    OrderByComparator orderByComparator) throws SystemException {
1957                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1958                            return findByG_P(groupId, parentStructureId, start, end,
1959                                    orderByComparator);
1960                    }
1961    
1962                    Session session = null;
1963    
1964                    try {
1965                            session = openSession();
1966    
1967                            StringBundler query = null;
1968    
1969                            if (orderByComparator != null) {
1970                                    query = new StringBundler(4 +
1971                                                    (orderByComparator.getOrderByFields().length * 3));
1972                            }
1973                            else {
1974                                    query = new StringBundler(4);
1975                            }
1976    
1977                            query.append(_FILTER_SQL_SELECT_JOURNALSTRUCTURE_WHERE);
1978    
1979                            query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1980    
1981                            if (parentStructureId == null) {
1982                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1);
1983                            }
1984                            else {
1985                                    if (parentStructureId.equals(StringPool.BLANK)) {
1986                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3);
1987                                    }
1988                                    else {
1989                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2);
1990                                    }
1991                            }
1992    
1993                            if (orderByComparator != null) {
1994                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1995                                            orderByComparator);
1996                            }
1997    
1998                            else {
1999                                    query.append(JournalStructureModelImpl.ORDER_BY_JPQL);
2000                            }
2001    
2002                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2003                                            JournalStructure.class.getName(), _FILTER_COLUMN_PK,
2004                                            _FILTER_COLUMN_USERID, groupId);
2005    
2006                            SQLQuery q = session.createSQLQuery(sql);
2007    
2008                            q.addEntity(_FILTER_ENTITY_ALIAS, JournalStructureImpl.class);
2009    
2010                            QueryPos qPos = QueryPos.getInstance(q);
2011    
2012                            qPos.add(groupId);
2013    
2014                            if (parentStructureId != null) {
2015                                    qPos.add(parentStructureId);
2016                            }
2017    
2018                            return (List<JournalStructure>)QueryUtil.list(q, getDialect(),
2019                                    start, end);
2020                    }
2021                    catch (Exception e) {
2022                            throw processException(e);
2023                    }
2024                    finally {
2025                            closeSession(session);
2026                    }
2027            }
2028    
2029            public List<JournalStructure> findAll() throws SystemException {
2030                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2031            }
2032    
2033            public List<JournalStructure> findAll(int start, int end)
2034                    throws SystemException {
2035                    return findAll(start, end, null);
2036            }
2037    
2038            public List<JournalStructure> findAll(int start, int end,
2039                    OrderByComparator orderByComparator) throws SystemException {
2040                    Object[] finderArgs = new Object[] {
2041                                    String.valueOf(start), String.valueOf(end),
2042                                    String.valueOf(orderByComparator)
2043                            };
2044    
2045                    List<JournalStructure> list = (List<JournalStructure>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2046                                    finderArgs, this);
2047    
2048                    if (list == null) {
2049                            Session session = null;
2050    
2051                            try {
2052                                    session = openSession();
2053    
2054                                    StringBundler query = null;
2055                                    String sql = null;
2056    
2057                                    if (orderByComparator != null) {
2058                                            query = new StringBundler(2 +
2059                                                            (orderByComparator.getOrderByFields().length * 3));
2060    
2061                                            query.append(_SQL_SELECT_JOURNALSTRUCTURE);
2062    
2063                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2064                                                    orderByComparator);
2065    
2066                                            sql = query.toString();
2067                                    }
2068                                    else {
2069                                            sql = _SQL_SELECT_JOURNALSTRUCTURE.concat(JournalStructureModelImpl.ORDER_BY_JPQL);
2070                                    }
2071    
2072                                    Query q = session.createQuery(sql);
2073    
2074                                    if (orderByComparator == null) {
2075                                            list = (List<JournalStructure>)QueryUtil.list(q,
2076                                                            getDialect(), start, end, false);
2077    
2078                                            Collections.sort(list);
2079                                    }
2080                                    else {
2081                                            list = (List<JournalStructure>)QueryUtil.list(q,
2082                                                            getDialect(), start, end);
2083                                    }
2084                            }
2085                            catch (Exception e) {
2086                                    throw processException(e);
2087                            }
2088                            finally {
2089                                    if (list == null) {
2090                                            list = new ArrayList<JournalStructure>();
2091                                    }
2092    
2093                                    cacheResult(list);
2094    
2095                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2096    
2097                                    closeSession(session);
2098                            }
2099                    }
2100    
2101                    return list;
2102            }
2103    
2104            public void removeByUuid(String uuid) throws SystemException {
2105                    for (JournalStructure journalStructure : findByUuid(uuid)) {
2106                            remove(journalStructure);
2107                    }
2108            }
2109    
2110            public void removeByUUID_G(String uuid, long groupId)
2111                    throws NoSuchStructureException, SystemException {
2112                    JournalStructure journalStructure = findByUUID_G(uuid, groupId);
2113    
2114                    remove(journalStructure);
2115            }
2116    
2117            public void removeByGroupId(long groupId) throws SystemException {
2118                    for (JournalStructure journalStructure : findByGroupId(groupId)) {
2119                            remove(journalStructure);
2120                    }
2121            }
2122    
2123            public void removeByStructureId(String structureId)
2124                    throws SystemException {
2125                    for (JournalStructure journalStructure : findByStructureId(structureId)) {
2126                            remove(journalStructure);
2127                    }
2128            }
2129    
2130            public void removeByG_S(long groupId, String structureId)
2131                    throws NoSuchStructureException, SystemException {
2132                    JournalStructure journalStructure = findByG_S(groupId, structureId);
2133    
2134                    remove(journalStructure);
2135            }
2136    
2137            public void removeByG_P(long groupId, String parentStructureId)
2138                    throws SystemException {
2139                    for (JournalStructure journalStructure : findByG_P(groupId,
2140                                    parentStructureId)) {
2141                            remove(journalStructure);
2142                    }
2143            }
2144    
2145            public void removeAll() throws SystemException {
2146                    for (JournalStructure journalStructure : findAll()) {
2147                            remove(journalStructure);
2148                    }
2149            }
2150    
2151            public int countByUuid(String uuid) throws SystemException {
2152                    Object[] finderArgs = new Object[] { uuid };
2153    
2154                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2155                                    finderArgs, this);
2156    
2157                    if (count == null) {
2158                            Session session = null;
2159    
2160                            try {
2161                                    session = openSession();
2162    
2163                                    StringBundler query = new StringBundler(2);
2164    
2165                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2166    
2167                                    if (uuid == null) {
2168                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
2169                                    }
2170                                    else {
2171                                            if (uuid.equals(StringPool.BLANK)) {
2172                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
2173                                            }
2174                                            else {
2175                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
2176                                            }
2177                                    }
2178    
2179                                    String sql = query.toString();
2180    
2181                                    Query q = session.createQuery(sql);
2182    
2183                                    QueryPos qPos = QueryPos.getInstance(q);
2184    
2185                                    if (uuid != null) {
2186                                            qPos.add(uuid);
2187                                    }
2188    
2189                                    count = (Long)q.uniqueResult();
2190                            }
2191                            catch (Exception e) {
2192                                    throw processException(e);
2193                            }
2194                            finally {
2195                                    if (count == null) {
2196                                            count = Long.valueOf(0);
2197                                    }
2198    
2199                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2200                                            finderArgs, count);
2201    
2202                                    closeSession(session);
2203                            }
2204                    }
2205    
2206                    return count.intValue();
2207            }
2208    
2209            public int countByUUID_G(String uuid, long groupId)
2210                    throws SystemException {
2211                    Object[] finderArgs = new Object[] { uuid, groupId };
2212    
2213                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2214                                    finderArgs, this);
2215    
2216                    if (count == null) {
2217                            Session session = null;
2218    
2219                            try {
2220                                    session = openSession();
2221    
2222                                    StringBundler query = new StringBundler(3);
2223    
2224                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2225    
2226                                    if (uuid == null) {
2227                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2228                                    }
2229                                    else {
2230                                            if (uuid.equals(StringPool.BLANK)) {
2231                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2232                                            }
2233                                            else {
2234                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2235                                            }
2236                                    }
2237    
2238                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2239    
2240                                    String sql = query.toString();
2241    
2242                                    Query q = session.createQuery(sql);
2243    
2244                                    QueryPos qPos = QueryPos.getInstance(q);
2245    
2246                                    if (uuid != null) {
2247                                            qPos.add(uuid);
2248                                    }
2249    
2250                                    qPos.add(groupId);
2251    
2252                                    count = (Long)q.uniqueResult();
2253                            }
2254                            catch (Exception e) {
2255                                    throw processException(e);
2256                            }
2257                            finally {
2258                                    if (count == null) {
2259                                            count = Long.valueOf(0);
2260                                    }
2261    
2262                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2263                                            finderArgs, count);
2264    
2265                                    closeSession(session);
2266                            }
2267                    }
2268    
2269                    return count.intValue();
2270            }
2271    
2272            public int countByGroupId(long groupId) throws SystemException {
2273                    Object[] finderArgs = new Object[] { groupId };
2274    
2275                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2276                                    finderArgs, this);
2277    
2278                    if (count == null) {
2279                            Session session = null;
2280    
2281                            try {
2282                                    session = openSession();
2283    
2284                                    StringBundler query = new StringBundler(2);
2285    
2286                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2287    
2288                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2289    
2290                                    String sql = query.toString();
2291    
2292                                    Query q = session.createQuery(sql);
2293    
2294                                    QueryPos qPos = QueryPos.getInstance(q);
2295    
2296                                    qPos.add(groupId);
2297    
2298                                    count = (Long)q.uniqueResult();
2299                            }
2300                            catch (Exception e) {
2301                                    throw processException(e);
2302                            }
2303                            finally {
2304                                    if (count == null) {
2305                                            count = Long.valueOf(0);
2306                                    }
2307    
2308                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2309                                            finderArgs, count);
2310    
2311                                    closeSession(session);
2312                            }
2313                    }
2314    
2315                    return count.intValue();
2316            }
2317    
2318            public int filterCountByGroupId(long groupId) throws SystemException {
2319                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2320                            return countByGroupId(groupId);
2321                    }
2322    
2323                    Session session = null;
2324    
2325                    try {
2326                            session = openSession();
2327    
2328                            StringBundler query = new StringBundler(2);
2329    
2330                            query.append(_FILTER_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2331    
2332                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2333    
2334                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2335                                            JournalStructure.class.getName(), _FILTER_COLUMN_PK,
2336                                            _FILTER_COLUMN_USERID, groupId);
2337    
2338                            SQLQuery q = session.createSQLQuery(sql);
2339    
2340                            q.addScalar(COUNT_COLUMN_NAME,
2341                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
2342    
2343                            QueryPos qPos = QueryPos.getInstance(q);
2344    
2345                            qPos.add(groupId);
2346    
2347                            Long count = (Long)q.uniqueResult();
2348    
2349                            return count.intValue();
2350                    }
2351                    catch (Exception e) {
2352                            throw processException(e);
2353                    }
2354                    finally {
2355                            closeSession(session);
2356                    }
2357            }
2358    
2359            public int countByStructureId(String structureId) throws SystemException {
2360                    Object[] finderArgs = new Object[] { structureId };
2361    
2362                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
2363                                    finderArgs, this);
2364    
2365                    if (count == null) {
2366                            Session session = null;
2367    
2368                            try {
2369                                    session = openSession();
2370    
2371                                    StringBundler query = new StringBundler(2);
2372    
2373                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2374    
2375                                    if (structureId == null) {
2376                                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
2377                                    }
2378                                    else {
2379                                            if (structureId.equals(StringPool.BLANK)) {
2380                                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
2381                                            }
2382                                            else {
2383                                                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
2384                                            }
2385                                    }
2386    
2387                                    String sql = query.toString();
2388    
2389                                    Query q = session.createQuery(sql);
2390    
2391                                    QueryPos qPos = QueryPos.getInstance(q);
2392    
2393                                    if (structureId != null) {
2394                                            qPos.add(structureId);
2395                                    }
2396    
2397                                    count = (Long)q.uniqueResult();
2398                            }
2399                            catch (Exception e) {
2400                                    throw processException(e);
2401                            }
2402                            finally {
2403                                    if (count == null) {
2404                                            count = Long.valueOf(0);
2405                                    }
2406    
2407                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
2408                                            finderArgs, count);
2409    
2410                                    closeSession(session);
2411                            }
2412                    }
2413    
2414                    return count.intValue();
2415            }
2416    
2417            public int countByG_S(long groupId, String structureId)
2418                    throws SystemException {
2419                    Object[] finderArgs = new Object[] { groupId, structureId };
2420    
2421                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
2422                                    finderArgs, this);
2423    
2424                    if (count == null) {
2425                            Session session = null;
2426    
2427                            try {
2428                                    session = openSession();
2429    
2430                                    StringBundler query = new StringBundler(3);
2431    
2432                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2433    
2434                                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2435    
2436                                    if (structureId == null) {
2437                                            query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2438                                    }
2439                                    else {
2440                                            if (structureId.equals(StringPool.BLANK)) {
2441                                                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2442                                            }
2443                                            else {
2444                                                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2445                                            }
2446                                    }
2447    
2448                                    String sql = query.toString();
2449    
2450                                    Query q = session.createQuery(sql);
2451    
2452                                    QueryPos qPos = QueryPos.getInstance(q);
2453    
2454                                    qPos.add(groupId);
2455    
2456                                    if (structureId != null) {
2457                                            qPos.add(structureId);
2458                                    }
2459    
2460                                    count = (Long)q.uniqueResult();
2461                            }
2462                            catch (Exception e) {
2463                                    throw processException(e);
2464                            }
2465                            finally {
2466                                    if (count == null) {
2467                                            count = Long.valueOf(0);
2468                                    }
2469    
2470                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
2471                                            count);
2472    
2473                                    closeSession(session);
2474                            }
2475                    }
2476    
2477                    return count.intValue();
2478            }
2479    
2480            public int filterCountByG_S(long groupId, String structureId)
2481                    throws SystemException {
2482                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2483                            return countByG_S(groupId, structureId);
2484                    }
2485    
2486                    Session session = null;
2487    
2488                    try {
2489                            session = openSession();
2490    
2491                            StringBundler query = new StringBundler(3);
2492    
2493                            query.append(_FILTER_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2494    
2495                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2496    
2497                            if (structureId == null) {
2498                                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2499                            }
2500                            else {
2501                                    if (structureId.equals(StringPool.BLANK)) {
2502                                            query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2503                                    }
2504                                    else {
2505                                            query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2506                                    }
2507                            }
2508    
2509                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2510                                            JournalStructure.class.getName(), _FILTER_COLUMN_PK,
2511                                            _FILTER_COLUMN_USERID, groupId);
2512    
2513                            SQLQuery q = session.createSQLQuery(sql);
2514    
2515                            q.addScalar(COUNT_COLUMN_NAME,
2516                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
2517    
2518                            QueryPos qPos = QueryPos.getInstance(q);
2519    
2520                            qPos.add(groupId);
2521    
2522                            if (structureId != null) {
2523                                    qPos.add(structureId);
2524                            }
2525    
2526                            Long count = (Long)q.uniqueResult();
2527    
2528                            return count.intValue();
2529                    }
2530                    catch (Exception e) {
2531                            throw processException(e);
2532                    }
2533                    finally {
2534                            closeSession(session);
2535                    }
2536            }
2537    
2538            public int countByG_P(long groupId, String parentStructureId)
2539                    throws SystemException {
2540                    Object[] finderArgs = new Object[] { groupId, parentStructureId };
2541    
2542                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
2543                                    finderArgs, this);
2544    
2545                    if (count == null) {
2546                            Session session = null;
2547    
2548                            try {
2549                                    session = openSession();
2550    
2551                                    StringBundler query = new StringBundler(3);
2552    
2553                                    query.append(_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2554    
2555                                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2556    
2557                                    if (parentStructureId == null) {
2558                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1);
2559                                    }
2560                                    else {
2561                                            if (parentStructureId.equals(StringPool.BLANK)) {
2562                                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3);
2563                                            }
2564                                            else {
2565                                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2);
2566                                            }
2567                                    }
2568    
2569                                    String sql = query.toString();
2570    
2571                                    Query q = session.createQuery(sql);
2572    
2573                                    QueryPos qPos = QueryPos.getInstance(q);
2574    
2575                                    qPos.add(groupId);
2576    
2577                                    if (parentStructureId != null) {
2578                                            qPos.add(parentStructureId);
2579                                    }
2580    
2581                                    count = (Long)q.uniqueResult();
2582                            }
2583                            catch (Exception e) {
2584                                    throw processException(e);
2585                            }
2586                            finally {
2587                                    if (count == null) {
2588                                            count = Long.valueOf(0);
2589                                    }
2590    
2591                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
2592                                            count);
2593    
2594                                    closeSession(session);
2595                            }
2596                    }
2597    
2598                    return count.intValue();
2599            }
2600    
2601            public int filterCountByG_P(long groupId, String parentStructureId)
2602                    throws SystemException {
2603                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2604                            return countByG_P(groupId, parentStructureId);
2605                    }
2606    
2607                    Session session = null;
2608    
2609                    try {
2610                            session = openSession();
2611    
2612                            StringBundler query = new StringBundler(3);
2613    
2614                            query.append(_FILTER_SQL_COUNT_JOURNALSTRUCTURE_WHERE);
2615    
2616                            query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2617    
2618                            if (parentStructureId == null) {
2619                                    query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1);
2620                            }
2621                            else {
2622                                    if (parentStructureId.equals(StringPool.BLANK)) {
2623                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3);
2624                                    }
2625                                    else {
2626                                            query.append(_FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2);
2627                                    }
2628                            }
2629    
2630                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2631                                            JournalStructure.class.getName(), _FILTER_COLUMN_PK,
2632                                            _FILTER_COLUMN_USERID, groupId);
2633    
2634                            SQLQuery q = session.createSQLQuery(sql);
2635    
2636                            q.addScalar(COUNT_COLUMN_NAME,
2637                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
2638    
2639                            QueryPos qPos = QueryPos.getInstance(q);
2640    
2641                            qPos.add(groupId);
2642    
2643                            if (parentStructureId != null) {
2644                                    qPos.add(parentStructureId);
2645                            }
2646    
2647                            Long count = (Long)q.uniqueResult();
2648    
2649                            return count.intValue();
2650                    }
2651                    catch (Exception e) {
2652                            throw processException(e);
2653                    }
2654                    finally {
2655                            closeSession(session);
2656                    }
2657            }
2658    
2659            public int countAll() throws SystemException {
2660                    Object[] finderArgs = new Object[0];
2661    
2662                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2663                                    finderArgs, this);
2664    
2665                    if (count == null) {
2666                            Session session = null;
2667    
2668                            try {
2669                                    session = openSession();
2670    
2671                                    Query q = session.createQuery(_SQL_COUNT_JOURNALSTRUCTURE);
2672    
2673                                    count = (Long)q.uniqueResult();
2674                            }
2675                            catch (Exception e) {
2676                                    throw processException(e);
2677                            }
2678                            finally {
2679                                    if (count == null) {
2680                                            count = Long.valueOf(0);
2681                                    }
2682    
2683                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2684                                            count);
2685    
2686                                    closeSession(session);
2687                            }
2688                    }
2689    
2690                    return count.intValue();
2691            }
2692    
2693            public void afterPropertiesSet() {
2694                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2695                                            com.liferay.portal.util.PropsUtil.get(
2696                                                    "value.object.listener.com.liferay.portlet.journal.model.JournalStructure")));
2697    
2698                    if (listenerClassNames.length > 0) {
2699                            try {
2700                                    List<ModelListener<JournalStructure>> listenersList = new ArrayList<ModelListener<JournalStructure>>();
2701    
2702                                    for (String listenerClassName : listenerClassNames) {
2703                                            listenersList.add((ModelListener<JournalStructure>)InstanceFactory.newInstance(
2704                                                            listenerClassName));
2705                                    }
2706    
2707                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2708                            }
2709                            catch (Exception e) {
2710                                    _log.error(e);
2711                            }
2712                    }
2713            }
2714    
2715            @BeanReference(type = JournalArticlePersistence.class)
2716            protected JournalArticlePersistence journalArticlePersistence;
2717            @BeanReference(type = JournalArticleImagePersistence.class)
2718            protected JournalArticleImagePersistence journalArticleImagePersistence;
2719            @BeanReference(type = JournalArticleResourcePersistence.class)
2720            protected JournalArticleResourcePersistence journalArticleResourcePersistence;
2721            @BeanReference(type = JournalContentSearchPersistence.class)
2722            protected JournalContentSearchPersistence journalContentSearchPersistence;
2723            @BeanReference(type = JournalFeedPersistence.class)
2724            protected JournalFeedPersistence journalFeedPersistence;
2725            @BeanReference(type = JournalStructurePersistence.class)
2726            protected JournalStructurePersistence journalStructurePersistence;
2727            @BeanReference(type = JournalTemplatePersistence.class)
2728            protected JournalTemplatePersistence journalTemplatePersistence;
2729            @BeanReference(type = ResourcePersistence.class)
2730            protected ResourcePersistence resourcePersistence;
2731            @BeanReference(type = UserPersistence.class)
2732            protected UserPersistence userPersistence;
2733            @BeanReference(type = WebDAVPropsPersistence.class)
2734            protected WebDAVPropsPersistence webDAVPropsPersistence;
2735            @BeanReference(type = ExpandoValuePersistence.class)
2736            protected ExpandoValuePersistence expandoValuePersistence;
2737            private static final String _SQL_SELECT_JOURNALSTRUCTURE = "SELECT journalStructure FROM JournalStructure journalStructure";
2738            private static final String _SQL_SELECT_JOURNALSTRUCTURE_WHERE = "SELECT journalStructure FROM JournalStructure journalStructure WHERE ";
2739            private static final String _SQL_COUNT_JOURNALSTRUCTURE = "SELECT COUNT(journalStructure) FROM JournalStructure journalStructure";
2740            private static final String _SQL_COUNT_JOURNALSTRUCTURE_WHERE = "SELECT COUNT(journalStructure) FROM JournalStructure journalStructure WHERE ";
2741            private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalStructure.uuid IS NULL";
2742            private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalStructure.uuid = ?";
2743            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalStructure.uuid IS NULL OR journalStructure.uuid = ?)";
2744            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalStructure.uuid IS NULL AND ";
2745            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalStructure.uuid = ? AND ";
2746            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalStructure.uuid IS NULL OR journalStructure.uuid = ?) AND ";
2747            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalStructure.groupId = ?";
2748            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalStructure.groupId = ?";
2749            private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1 = "journalStructure.structureId IS NULL";
2750            private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2 = "journalStructure.structureId = ?";
2751            private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3 = "(journalStructure.structureId IS NULL OR journalStructure.structureId = ?)";
2752            private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalStructure.groupId = ? AND ";
2753            private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalStructure.structureId IS NULL";
2754            private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalStructure.structureId = ?";
2755            private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalStructure.structureId IS NULL OR journalStructure.structureId = ?)";
2756            private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "journalStructure.groupId = ? AND ";
2757            private static final String _FINDER_COLUMN_G_P_PARENTSTRUCTUREID_1 = "journalStructure.parentStructureId IS NULL";
2758            private static final String _FINDER_COLUMN_G_P_PARENTSTRUCTUREID_2 = "journalStructure.parentStructureId = ?";
2759            private static final String _FINDER_COLUMN_G_P_PARENTSTRUCTUREID_3 = "(journalStructure.parentStructureId IS NULL OR journalStructure.parentStructureId = ?)";
2760            private static final String _FILTER_SQL_SELECT_JOURNALSTRUCTURE_WHERE = "SELECT DISTINCT {journalStructure.*} FROM JournalStructure journalStructure WHERE ";
2761            private static final String _FILTER_SQL_COUNT_JOURNALSTRUCTURE_WHERE = "SELECT COUNT(DISTINCT journalStructure.id) AS COUNT_VALUE FROM JournalStructure journalStructure WHERE ";
2762            private static final String _FILTER_COLUMN_PK = "journalStructure.id";
2763            private static final String _FILTER_COLUMN_USERID = "journalStructure.userId";
2764            private static final String _FILTER_ENTITY_ALIAS = "journalStructure";
2765            private static final String _ORDER_BY_ENTITY_ALIAS = "journalStructure.";
2766            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalStructure exists with the primary key ";
2767            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalStructure exists with the key {";
2768            private static Log _log = LogFactoryUtil.getLog(JournalStructurePersistenceImpl.class);
2769    }