001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.dynamicdatamapping.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.bean.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.Session;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.GetterUtil;
031    import com.liferay.portal.kernel.util.InstanceFactory;
032    import com.liferay.portal.kernel.util.OrderByComparator;
033    import com.liferay.portal.kernel.util.StringBundler;
034    import com.liferay.portal.kernel.util.StringPool;
035    import com.liferay.portal.kernel.util.StringUtil;
036    import com.liferay.portal.model.CacheModel;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.service.persistence.BatchSessionUtil;
039    import com.liferay.portal.service.persistence.ResourcePersistence;
040    import com.liferay.portal.service.persistence.UserPersistence;
041    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042    
043    import com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException;
044    import com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink;
045    import com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureLinkImpl;
046    import com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureLinkModelImpl;
047    
048    import java.io.Serializable;
049    
050    import java.util.ArrayList;
051    import java.util.Collections;
052    import java.util.List;
053    
054    /**
055     * The persistence implementation for the d d m structure link service.
056     *
057     * <p>
058     * Caching information and settings can be found in <code>portal.properties</code>
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see DDMStructureLinkPersistence
063     * @see DDMStructureLinkUtil
064     * @generated
065     */
066    public class DDMStructureLinkPersistenceImpl extends BasePersistenceImpl<DDMStructureLink>
067            implements DDMStructureLinkPersistence {
068            /*
069             * NOTE FOR DEVELOPERS:
070             *
071             * Never modify or reference this class directly. Always use {@link DDMStructureLinkUtil} to access the d d m structure link persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
072             */
073            public static final String FINDER_CLASS_NAME_ENTITY = DDMStructureLinkImpl.class.getName();
074            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075                    ".List1";
076            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077                    ".List2";
078            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID =
079                    new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
080                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
081                            DDMStructureLinkImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
082                            "findByClassNameId",
083                            new String[] {
084                                    Long.class.getName(),
085                                    
086                            "java.lang.Integer", "java.lang.Integer",
087                                    "com.liferay.portal.kernel.util.OrderByComparator"
088                            });
089            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID =
090                    new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
091                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
092                            DDMStructureLinkImpl.class,
093                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByClassNameId",
094                            new String[] { Long.class.getName() },
095                            DDMStructureLinkModelImpl.CLASSNAMEID_COLUMN_BITMASK);
096            public static final FinderPath FINDER_PATH_COUNT_BY_CLASSNAMEID = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
097                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
098                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByClassNameId",
099                            new String[] { Long.class.getName() });
100            public static final FinderPath FINDER_PATH_FETCH_BY_CLASSPK = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
101                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
102                            DDMStructureLinkImpl.class, FINDER_CLASS_NAME_ENTITY,
103                            "fetchByClassPK", new String[] { Long.class.getName() },
104                            DDMStructureLinkModelImpl.CLASSPK_COLUMN_BITMASK);
105            public static final FinderPath FINDER_PATH_COUNT_BY_CLASSPK = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
106                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
107                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByClassPK",
108                            new String[] { Long.class.getName() });
109            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID =
110                    new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
111                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
112                            DDMStructureLinkImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
113                            "findByStructureId",
114                            new String[] {
115                                    Long.class.getName(),
116                                    
117                            "java.lang.Integer", "java.lang.Integer",
118                                    "com.liferay.portal.kernel.util.OrderByComparator"
119                            });
120            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID =
121                    new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
122                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
123                            DDMStructureLinkImpl.class,
124                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByStructureId",
125                            new String[] { Long.class.getName() },
126                            DDMStructureLinkModelImpl.STRUCTUREID_COLUMN_BITMASK);
127            public static final FinderPath FINDER_PATH_COUNT_BY_STRUCTUREID = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
128                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
129                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByStructureId",
130                            new String[] { Long.class.getName() });
131            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
132                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
133                            DDMStructureLinkImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
134                            "findAll", new String[0]);
135            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
136                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED,
137                            DDMStructureLinkImpl.class,
138                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
139            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
140                            DDMStructureLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
141                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
142    
143            /**
144             * Caches the d d m structure link in the entity cache if it is enabled.
145             *
146             * @param ddmStructureLink the d d m structure link
147             */
148            public void cacheResult(DDMStructureLink ddmStructureLink) {
149                    EntityCacheUtil.putResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
150                            DDMStructureLinkImpl.class, ddmStructureLink.getPrimaryKey(),
151                            ddmStructureLink);
152    
153                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
154                            new Object[] { Long.valueOf(ddmStructureLink.getClassPK()) },
155                            ddmStructureLink);
156    
157                    ddmStructureLink.resetOriginalValues();
158            }
159    
160            /**
161             * Caches the d d m structure links in the entity cache if it is enabled.
162             *
163             * @param ddmStructureLinks the d d m structure links
164             */
165            public void cacheResult(List<DDMStructureLink> ddmStructureLinks) {
166                    for (DDMStructureLink ddmStructureLink : ddmStructureLinks) {
167                            if (EntityCacheUtil.getResult(
168                                                    DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
169                                                    DDMStructureLinkImpl.class,
170                                                    ddmStructureLink.getPrimaryKey()) == null) {
171                                    cacheResult(ddmStructureLink);
172                            }
173                            else {
174                                    ddmStructureLink.resetOriginalValues();
175                            }
176                    }
177            }
178    
179            /**
180             * Clears the cache for all d d m structure links.
181             *
182             * <p>
183             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
184             * </p>
185             */
186            @Override
187            public void clearCache() {
188                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
189                            CacheRegistryUtil.clear(DDMStructureLinkImpl.class.getName());
190                    }
191    
192                    EntityCacheUtil.clearCache(DDMStructureLinkImpl.class.getName());
193    
194                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
195                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
196                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
197            }
198    
199            /**
200             * Clears the cache for the d d m structure link.
201             *
202             * <p>
203             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
204             * </p>
205             */
206            @Override
207            public void clearCache(DDMStructureLink ddmStructureLink) {
208                    EntityCacheUtil.removeResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
209                            DDMStructureLinkImpl.class, ddmStructureLink.getPrimaryKey());
210    
211                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
212                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
213    
214                    clearUniqueFindersCache(ddmStructureLink);
215            }
216    
217            @Override
218            public void clearCache(List<DDMStructureLink> ddmStructureLinks) {
219                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
220                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
221    
222                    for (DDMStructureLink ddmStructureLink : ddmStructureLinks) {
223                            EntityCacheUtil.removeResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
224                                    DDMStructureLinkImpl.class, ddmStructureLink.getPrimaryKey());
225    
226                            clearUniqueFindersCache(ddmStructureLink);
227                    }
228            }
229    
230            protected void clearUniqueFindersCache(DDMStructureLink ddmStructureLink) {
231                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSPK,
232                            new Object[] { Long.valueOf(ddmStructureLink.getClassPK()) });
233            }
234    
235            /**
236             * Creates a new d d m structure link with the primary key. Does not add the d d m structure link to the database.
237             *
238             * @param structureLinkId the primary key for the new d d m structure link
239             * @return the new d d m structure link
240             */
241            public DDMStructureLink create(long structureLinkId) {
242                    DDMStructureLink ddmStructureLink = new DDMStructureLinkImpl();
243    
244                    ddmStructureLink.setNew(true);
245                    ddmStructureLink.setPrimaryKey(structureLinkId);
246    
247                    return ddmStructureLink;
248            }
249    
250            /**
251             * Removes the d d m structure link with the primary key from the database. Also notifies the appropriate model listeners.
252             *
253             * @param structureLinkId the primary key of the d d m structure link
254             * @return the d d m structure link that was removed
255             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
256             * @throws SystemException if a system exception occurred
257             */
258            public DDMStructureLink remove(long structureLinkId)
259                    throws NoSuchStructureLinkException, SystemException {
260                    return remove(Long.valueOf(structureLinkId));
261            }
262    
263            /**
264             * Removes the d d m structure link with the primary key from the database. Also notifies the appropriate model listeners.
265             *
266             * @param primaryKey the primary key of the d d m structure link
267             * @return the d d m structure link that was removed
268             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
269             * @throws SystemException if a system exception occurred
270             */
271            @Override
272            public DDMStructureLink remove(Serializable primaryKey)
273                    throws NoSuchStructureLinkException, SystemException {
274                    Session session = null;
275    
276                    try {
277                            session = openSession();
278    
279                            DDMStructureLink ddmStructureLink = (DDMStructureLink)session.get(DDMStructureLinkImpl.class,
280                                            primaryKey);
281    
282                            if (ddmStructureLink == null) {
283                                    if (_log.isWarnEnabled()) {
284                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
285                                    }
286    
287                                    throw new NoSuchStructureLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
288                                            primaryKey);
289                            }
290    
291                            return remove(ddmStructureLink);
292                    }
293                    catch (NoSuchStructureLinkException nsee) {
294                            throw nsee;
295                    }
296                    catch (Exception e) {
297                            throw processException(e);
298                    }
299                    finally {
300                            closeSession(session);
301                    }
302            }
303    
304            @Override
305            protected DDMStructureLink removeImpl(DDMStructureLink ddmStructureLink)
306                    throws SystemException {
307                    ddmStructureLink = toUnwrappedModel(ddmStructureLink);
308    
309                    Session session = null;
310    
311                    try {
312                            session = openSession();
313    
314                            BatchSessionUtil.delete(session, ddmStructureLink);
315                    }
316                    catch (Exception e) {
317                            throw processException(e);
318                    }
319                    finally {
320                            closeSession(session);
321                    }
322    
323                    clearCache(ddmStructureLink);
324    
325                    return ddmStructureLink;
326            }
327    
328            @Override
329            public DDMStructureLink updateImpl(
330                    com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink ddmStructureLink,
331                    boolean merge) throws SystemException {
332                    ddmStructureLink = toUnwrappedModel(ddmStructureLink);
333    
334                    boolean isNew = ddmStructureLink.isNew();
335    
336                    DDMStructureLinkModelImpl ddmStructureLinkModelImpl = (DDMStructureLinkModelImpl)ddmStructureLink;
337    
338                    Session session = null;
339    
340                    try {
341                            session = openSession();
342    
343                            BatchSessionUtil.update(session, ddmStructureLink, merge);
344    
345                            ddmStructureLink.setNew(false);
346                    }
347                    catch (Exception e) {
348                            throw processException(e);
349                    }
350                    finally {
351                            closeSession(session);
352                    }
353    
354                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
355    
356                    if (isNew || !DDMStructureLinkModelImpl.COLUMN_BITMASK_ENABLED) {
357                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
358                    }
359    
360                    else {
361                            if ((ddmStructureLinkModelImpl.getColumnBitmask() &
362                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID.getColumnBitmask()) != 0) {
363                                    Object[] args = new Object[] {
364                                                    Long.valueOf(ddmStructureLinkModelImpl.getOriginalClassNameId())
365                                            };
366    
367                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
368                                            args);
369                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
370                                            args);
371    
372                                    args = new Object[] {
373                                                    Long.valueOf(ddmStructureLinkModelImpl.getClassNameId())
374                                            };
375    
376                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
377                                            args);
378                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
379                                            args);
380                            }
381    
382                            if ((ddmStructureLinkModelImpl.getColumnBitmask() &
383                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID.getColumnBitmask()) != 0) {
384                                    Object[] args = new Object[] {
385                                                    Long.valueOf(ddmStructureLinkModelImpl.getOriginalStructureId())
386                                            };
387    
388                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
389                                            args);
390                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
391                                            args);
392    
393                                    args = new Object[] {
394                                                    Long.valueOf(ddmStructureLinkModelImpl.getStructureId())
395                                            };
396    
397                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
398                                            args);
399                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
400                                            args);
401                            }
402                    }
403    
404                    EntityCacheUtil.putResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
405                            DDMStructureLinkImpl.class, ddmStructureLink.getPrimaryKey(),
406                            ddmStructureLink);
407    
408                    if (isNew) {
409                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
410                                    new Object[] { Long.valueOf(ddmStructureLink.getClassPK()) },
411                                    ddmStructureLink);
412                    }
413                    else {
414                            if ((ddmStructureLinkModelImpl.getColumnBitmask() &
415                                            FINDER_PATH_FETCH_BY_CLASSPK.getColumnBitmask()) != 0) {
416                                    Object[] args = new Object[] {
417                                                    Long.valueOf(ddmStructureLinkModelImpl.getOriginalClassPK())
418                                            };
419    
420                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSPK, args);
421    
422                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSPK, args);
423    
424                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
425                                            new Object[] { Long.valueOf(ddmStructureLink.getClassPK()) },
426                                            ddmStructureLink);
427                            }
428                    }
429    
430                    return ddmStructureLink;
431            }
432    
433            protected DDMStructureLink toUnwrappedModel(
434                    DDMStructureLink ddmStructureLink) {
435                    if (ddmStructureLink instanceof DDMStructureLinkImpl) {
436                            return ddmStructureLink;
437                    }
438    
439                    DDMStructureLinkImpl ddmStructureLinkImpl = new DDMStructureLinkImpl();
440    
441                    ddmStructureLinkImpl.setNew(ddmStructureLink.isNew());
442                    ddmStructureLinkImpl.setPrimaryKey(ddmStructureLink.getPrimaryKey());
443    
444                    ddmStructureLinkImpl.setStructureLinkId(ddmStructureLink.getStructureLinkId());
445                    ddmStructureLinkImpl.setClassNameId(ddmStructureLink.getClassNameId());
446                    ddmStructureLinkImpl.setClassPK(ddmStructureLink.getClassPK());
447                    ddmStructureLinkImpl.setStructureId(ddmStructureLink.getStructureId());
448    
449                    return ddmStructureLinkImpl;
450            }
451    
452            /**
453             * Returns the d d m structure link with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
454             *
455             * @param primaryKey the primary key of the d d m structure link
456             * @return the d d m structure link
457             * @throws com.liferay.portal.NoSuchModelException if a d d m structure link with the primary key could not be found
458             * @throws SystemException if a system exception occurred
459             */
460            @Override
461            public DDMStructureLink findByPrimaryKey(Serializable primaryKey)
462                    throws NoSuchModelException, SystemException {
463                    return findByPrimaryKey(((Long)primaryKey).longValue());
464            }
465    
466            /**
467             * Returns the d d m structure link with the primary key or throws a {@link com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException} if it could not be found.
468             *
469             * @param structureLinkId the primary key of the d d m structure link
470             * @return the d d m structure link
471             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
472             * @throws SystemException if a system exception occurred
473             */
474            public DDMStructureLink findByPrimaryKey(long structureLinkId)
475                    throws NoSuchStructureLinkException, SystemException {
476                    DDMStructureLink ddmStructureLink = fetchByPrimaryKey(structureLinkId);
477    
478                    if (ddmStructureLink == null) {
479                            if (_log.isWarnEnabled()) {
480                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + structureLinkId);
481                            }
482    
483                            throw new NoSuchStructureLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
484                                    structureLinkId);
485                    }
486    
487                    return ddmStructureLink;
488            }
489    
490            /**
491             * Returns the d d m structure link with the primary key or returns <code>null</code> if it could not be found.
492             *
493             * @param primaryKey the primary key of the d d m structure link
494             * @return the d d m structure link, or <code>null</code> if a d d m structure link with the primary key could not be found
495             * @throws SystemException if a system exception occurred
496             */
497            @Override
498            public DDMStructureLink fetchByPrimaryKey(Serializable primaryKey)
499                    throws SystemException {
500                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
501            }
502    
503            /**
504             * Returns the d d m structure link with the primary key or returns <code>null</code> if it could not be found.
505             *
506             * @param structureLinkId the primary key of the d d m structure link
507             * @return the d d m structure link, or <code>null</code> if a d d m structure link with the primary key could not be found
508             * @throws SystemException if a system exception occurred
509             */
510            public DDMStructureLink fetchByPrimaryKey(long structureLinkId)
511                    throws SystemException {
512                    DDMStructureLink ddmStructureLink = (DDMStructureLink)EntityCacheUtil.getResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
513                                    DDMStructureLinkImpl.class, structureLinkId);
514    
515                    if (ddmStructureLink == _nullDDMStructureLink) {
516                            return null;
517                    }
518    
519                    if (ddmStructureLink == null) {
520                            Session session = null;
521    
522                            boolean hasException = false;
523    
524                            try {
525                                    session = openSession();
526    
527                                    ddmStructureLink = (DDMStructureLink)session.get(DDMStructureLinkImpl.class,
528                                                    Long.valueOf(structureLinkId));
529                            }
530                            catch (Exception e) {
531                                    hasException = true;
532    
533                                    throw processException(e);
534                            }
535                            finally {
536                                    if (ddmStructureLink != null) {
537                                            cacheResult(ddmStructureLink);
538                                    }
539                                    else if (!hasException) {
540                                            EntityCacheUtil.putResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
541                                                    DDMStructureLinkImpl.class, structureLinkId,
542                                                    _nullDDMStructureLink);
543                                    }
544    
545                                    closeSession(session);
546                            }
547                    }
548    
549                    return ddmStructureLink;
550            }
551    
552            /**
553             * Returns all the d d m structure links where classNameId = &#63;.
554             *
555             * @param classNameId the class name ID
556             * @return the matching d d m structure links
557             * @throws SystemException if a system exception occurred
558             */
559            public List<DDMStructureLink> findByClassNameId(long classNameId)
560                    throws SystemException {
561                    return findByClassNameId(classNameId, QueryUtil.ALL_POS,
562                            QueryUtil.ALL_POS, null);
563            }
564    
565            /**
566             * Returns a range of all the d d m structure links where classNameId = &#63;.
567             *
568             * <p>
569             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
570             * </p>
571             *
572             * @param classNameId the class name ID
573             * @param start the lower bound of the range of d d m structure links
574             * @param end the upper bound of the range of d d m structure links (not inclusive)
575             * @return the range of matching d d m structure links
576             * @throws SystemException if a system exception occurred
577             */
578            public List<DDMStructureLink> findByClassNameId(long classNameId,
579                    int start, int end) throws SystemException {
580                    return findByClassNameId(classNameId, start, end, null);
581            }
582    
583            /**
584             * Returns an ordered range of all the d d m structure links where classNameId = &#63;.
585             *
586             * <p>
587             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
588             * </p>
589             *
590             * @param classNameId the class name ID
591             * @param start the lower bound of the range of d d m structure links
592             * @param end the upper bound of the range of d d m structure links (not inclusive)
593             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
594             * @return the ordered range of matching d d m structure links
595             * @throws SystemException if a system exception occurred
596             */
597            public List<DDMStructureLink> findByClassNameId(long classNameId,
598                    int start, int end, OrderByComparator orderByComparator)
599                    throws SystemException {
600                    FinderPath finderPath = null;
601                    Object[] finderArgs = null;
602    
603                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
604                                    (orderByComparator == null)) {
605                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
606                            finderArgs = new Object[] { classNameId };
607                    }
608                    else {
609                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
610                            finderArgs = new Object[] { classNameId, start, end, orderByComparator };
611                    }
612    
613                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
614                                    finderArgs, this);
615    
616                    if ((list != null) && !list.isEmpty()) {
617                            for (DDMStructureLink ddmStructureLink : list) {
618                                    if ((classNameId != ddmStructureLink.getClassNameId())) {
619                                            list = null;
620    
621                                            break;
622                                    }
623                            }
624                    }
625    
626                    if (list == null) {
627                            StringBundler query = null;
628    
629                            if (orderByComparator != null) {
630                                    query = new StringBundler(3 +
631                                                    (orderByComparator.getOrderByFields().length * 3));
632                            }
633                            else {
634                                    query = new StringBundler(2);
635                            }
636    
637                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
638    
639                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
640    
641                            if (orderByComparator != null) {
642                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
643                                            orderByComparator);
644                            }
645    
646                            String sql = query.toString();
647    
648                            Session session = null;
649    
650                            try {
651                                    session = openSession();
652    
653                                    Query q = session.createQuery(sql);
654    
655                                    QueryPos qPos = QueryPos.getInstance(q);
656    
657                                    qPos.add(classNameId);
658    
659                                    list = (List<DDMStructureLink>)QueryUtil.list(q, getDialect(),
660                                                    start, end);
661                            }
662                            catch (Exception e) {
663                                    throw processException(e);
664                            }
665                            finally {
666                                    if (list == null) {
667                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
668                                    }
669                                    else {
670                                            cacheResult(list);
671    
672                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
673                                    }
674    
675                                    closeSession(session);
676                            }
677                    }
678    
679                    return list;
680            }
681    
682            /**
683             * Returns the first d d m structure link in the ordered set where classNameId = &#63;.
684             *
685             * @param classNameId the class name ID
686             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
687             * @return the first matching d d m structure link
688             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
689             * @throws SystemException if a system exception occurred
690             */
691            public DDMStructureLink findByClassNameId_First(long classNameId,
692                    OrderByComparator orderByComparator)
693                    throws NoSuchStructureLinkException, SystemException {
694                    DDMStructureLink ddmStructureLink = fetchByClassNameId_First(classNameId,
695                                    orderByComparator);
696    
697                    if (ddmStructureLink != null) {
698                            return ddmStructureLink;
699                    }
700    
701                    StringBundler msg = new StringBundler(4);
702    
703                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
704    
705                    msg.append("classNameId=");
706                    msg.append(classNameId);
707    
708                    msg.append(StringPool.CLOSE_CURLY_BRACE);
709    
710                    throw new NoSuchStructureLinkException(msg.toString());
711            }
712    
713            /**
714             * Returns the first d d m structure link in the ordered set where classNameId = &#63;.
715             *
716             * @param classNameId the class name ID
717             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
718             * @return the first matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
719             * @throws SystemException if a system exception occurred
720             */
721            public DDMStructureLink fetchByClassNameId_First(long classNameId,
722                    OrderByComparator orderByComparator) throws SystemException {
723                    List<DDMStructureLink> list = findByClassNameId(classNameId, 0, 1,
724                                    orderByComparator);
725    
726                    if (!list.isEmpty()) {
727                            return list.get(0);
728                    }
729    
730                    return null;
731            }
732    
733            /**
734             * Returns the last d d m structure link in the ordered set where classNameId = &#63;.
735             *
736             * @param classNameId the class name ID
737             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
738             * @return the last matching d d m structure link
739             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
740             * @throws SystemException if a system exception occurred
741             */
742            public DDMStructureLink findByClassNameId_Last(long classNameId,
743                    OrderByComparator orderByComparator)
744                    throws NoSuchStructureLinkException, SystemException {
745                    DDMStructureLink ddmStructureLink = fetchByClassNameId_Last(classNameId,
746                                    orderByComparator);
747    
748                    if (ddmStructureLink != null) {
749                            return ddmStructureLink;
750                    }
751    
752                    StringBundler msg = new StringBundler(4);
753    
754                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
755    
756                    msg.append("classNameId=");
757                    msg.append(classNameId);
758    
759                    msg.append(StringPool.CLOSE_CURLY_BRACE);
760    
761                    throw new NoSuchStructureLinkException(msg.toString());
762            }
763    
764            /**
765             * Returns the last d d m structure link in the ordered set where classNameId = &#63;.
766             *
767             * @param classNameId the class name ID
768             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
769             * @return the last matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
770             * @throws SystemException if a system exception occurred
771             */
772            public DDMStructureLink fetchByClassNameId_Last(long classNameId,
773                    OrderByComparator orderByComparator) throws SystemException {
774                    int count = countByClassNameId(classNameId);
775    
776                    List<DDMStructureLink> list = findByClassNameId(classNameId, count - 1,
777                                    count, orderByComparator);
778    
779                    if (!list.isEmpty()) {
780                            return list.get(0);
781                    }
782    
783                    return null;
784            }
785    
786            /**
787             * Returns the d d m structure links before and after the current d d m structure link in the ordered set where classNameId = &#63;.
788             *
789             * @param structureLinkId the primary key of the current d d m structure link
790             * @param classNameId the class name ID
791             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
792             * @return the previous, current, and next d d m structure link
793             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
794             * @throws SystemException if a system exception occurred
795             */
796            public DDMStructureLink[] findByClassNameId_PrevAndNext(
797                    long structureLinkId, long classNameId,
798                    OrderByComparator orderByComparator)
799                    throws NoSuchStructureLinkException, SystemException {
800                    DDMStructureLink ddmStructureLink = findByPrimaryKey(structureLinkId);
801    
802                    Session session = null;
803    
804                    try {
805                            session = openSession();
806    
807                            DDMStructureLink[] array = new DDMStructureLinkImpl[3];
808    
809                            array[0] = getByClassNameId_PrevAndNext(session, ddmStructureLink,
810                                            classNameId, orderByComparator, true);
811    
812                            array[1] = ddmStructureLink;
813    
814                            array[2] = getByClassNameId_PrevAndNext(session, ddmStructureLink,
815                                            classNameId, orderByComparator, false);
816    
817                            return array;
818                    }
819                    catch (Exception e) {
820                            throw processException(e);
821                    }
822                    finally {
823                            closeSession(session);
824                    }
825            }
826    
827            protected DDMStructureLink getByClassNameId_PrevAndNext(Session session,
828                    DDMStructureLink ddmStructureLink, long classNameId,
829                    OrderByComparator orderByComparator, boolean previous) {
830                    StringBundler query = null;
831    
832                    if (orderByComparator != null) {
833                            query = new StringBundler(6 +
834                                            (orderByComparator.getOrderByFields().length * 6));
835                    }
836                    else {
837                            query = new StringBundler(3);
838                    }
839    
840                    query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
841    
842                    query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
843    
844                    if (orderByComparator != null) {
845                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
846    
847                            if (orderByConditionFields.length > 0) {
848                                    query.append(WHERE_AND);
849                            }
850    
851                            for (int i = 0; i < orderByConditionFields.length; i++) {
852                                    query.append(_ORDER_BY_ENTITY_ALIAS);
853                                    query.append(orderByConditionFields[i]);
854    
855                                    if ((i + 1) < orderByConditionFields.length) {
856                                            if (orderByComparator.isAscending() ^ previous) {
857                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
858                                            }
859                                            else {
860                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
861                                            }
862                                    }
863                                    else {
864                                            if (orderByComparator.isAscending() ^ previous) {
865                                                    query.append(WHERE_GREATER_THAN);
866                                            }
867                                            else {
868                                                    query.append(WHERE_LESSER_THAN);
869                                            }
870                                    }
871                            }
872    
873                            query.append(ORDER_BY_CLAUSE);
874    
875                            String[] orderByFields = orderByComparator.getOrderByFields();
876    
877                            for (int i = 0; i < orderByFields.length; i++) {
878                                    query.append(_ORDER_BY_ENTITY_ALIAS);
879                                    query.append(orderByFields[i]);
880    
881                                    if ((i + 1) < orderByFields.length) {
882                                            if (orderByComparator.isAscending() ^ previous) {
883                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
884                                            }
885                                            else {
886                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
887                                            }
888                                    }
889                                    else {
890                                            if (orderByComparator.isAscending() ^ previous) {
891                                                    query.append(ORDER_BY_ASC);
892                                            }
893                                            else {
894                                                    query.append(ORDER_BY_DESC);
895                                            }
896                                    }
897                            }
898                    }
899    
900                    String sql = query.toString();
901    
902                    Query q = session.createQuery(sql);
903    
904                    q.setFirstResult(0);
905                    q.setMaxResults(2);
906    
907                    QueryPos qPos = QueryPos.getInstance(q);
908    
909                    qPos.add(classNameId);
910    
911                    if (orderByComparator != null) {
912                            Object[] values = orderByComparator.getOrderByConditionValues(ddmStructureLink);
913    
914                            for (Object value : values) {
915                                    qPos.add(value);
916                            }
917                    }
918    
919                    List<DDMStructureLink> list = q.list();
920    
921                    if (list.size() == 2) {
922                            return list.get(1);
923                    }
924                    else {
925                            return null;
926                    }
927            }
928    
929            /**
930             * Returns the d d m structure link where classPK = &#63; or throws a {@link com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException} if it could not be found.
931             *
932             * @param classPK the class p k
933             * @return the matching d d m structure link
934             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
935             * @throws SystemException if a system exception occurred
936             */
937            public DDMStructureLink findByClassPK(long classPK)
938                    throws NoSuchStructureLinkException, SystemException {
939                    DDMStructureLink ddmStructureLink = fetchByClassPK(classPK);
940    
941                    if (ddmStructureLink == null) {
942                            StringBundler msg = new StringBundler(4);
943    
944                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
945    
946                            msg.append("classPK=");
947                            msg.append(classPK);
948    
949                            msg.append(StringPool.CLOSE_CURLY_BRACE);
950    
951                            if (_log.isWarnEnabled()) {
952                                    _log.warn(msg.toString());
953                            }
954    
955                            throw new NoSuchStructureLinkException(msg.toString());
956                    }
957    
958                    return ddmStructureLink;
959            }
960    
961            /**
962             * Returns the d d m structure link where classPK = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
963             *
964             * @param classPK the class p k
965             * @return the matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
966             * @throws SystemException if a system exception occurred
967             */
968            public DDMStructureLink fetchByClassPK(long classPK)
969                    throws SystemException {
970                    return fetchByClassPK(classPK, true);
971            }
972    
973            /**
974             * Returns the d d m structure link where classPK = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
975             *
976             * @param classPK the class p k
977             * @param retrieveFromCache whether to use the finder cache
978             * @return the matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
979             * @throws SystemException if a system exception occurred
980             */
981            public DDMStructureLink fetchByClassPK(long classPK,
982                    boolean retrieveFromCache) throws SystemException {
983                    Object[] finderArgs = new Object[] { classPK };
984    
985                    Object result = null;
986    
987                    if (retrieveFromCache) {
988                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CLASSPK,
989                                            finderArgs, this);
990                    }
991    
992                    if (result instanceof DDMStructureLink) {
993                            DDMStructureLink ddmStructureLink = (DDMStructureLink)result;
994    
995                            if ((classPK != ddmStructureLink.getClassPK())) {
996                                    result = null;
997                            }
998                    }
999    
1000                    if (result == null) {
1001                            StringBundler query = new StringBundler(2);
1002    
1003                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
1004    
1005                            query.append(_FINDER_COLUMN_CLASSPK_CLASSPK_2);
1006    
1007                            String sql = query.toString();
1008    
1009                            Session session = null;
1010    
1011                            try {
1012                                    session = openSession();
1013    
1014                                    Query q = session.createQuery(sql);
1015    
1016                                    QueryPos qPos = QueryPos.getInstance(q);
1017    
1018                                    qPos.add(classPK);
1019    
1020                                    List<DDMStructureLink> list = q.list();
1021    
1022                                    result = list;
1023    
1024                                    DDMStructureLink ddmStructureLink = null;
1025    
1026                                    if (list.isEmpty()) {
1027                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
1028                                                    finderArgs, list);
1029                                    }
1030                                    else {
1031                                            ddmStructureLink = list.get(0);
1032    
1033                                            cacheResult(ddmStructureLink);
1034    
1035                                            if ((ddmStructureLink.getClassPK() != classPK)) {
1036                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
1037                                                            finderArgs, ddmStructureLink);
1038                                            }
1039                                    }
1040    
1041                                    return ddmStructureLink;
1042                            }
1043                            catch (Exception e) {
1044                                    throw processException(e);
1045                            }
1046                            finally {
1047                                    if (result == null) {
1048                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSPK,
1049                                                    finderArgs);
1050                                    }
1051    
1052                                    closeSession(session);
1053                            }
1054                    }
1055                    else {
1056                            if (result instanceof List<?>) {
1057                                    return null;
1058                            }
1059                            else {
1060                                    return (DDMStructureLink)result;
1061                            }
1062                    }
1063            }
1064    
1065            /**
1066             * Returns all the d d m structure links where structureId = &#63;.
1067             *
1068             * @param structureId the structure ID
1069             * @return the matching d d m structure links
1070             * @throws SystemException if a system exception occurred
1071             */
1072            public List<DDMStructureLink> findByStructureId(long structureId)
1073                    throws SystemException {
1074                    return findByStructureId(structureId, QueryUtil.ALL_POS,
1075                            QueryUtil.ALL_POS, null);
1076            }
1077    
1078            /**
1079             * Returns a range of all the d d m structure links where structureId = &#63;.
1080             *
1081             * <p>
1082             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1083             * </p>
1084             *
1085             * @param structureId the structure ID
1086             * @param start the lower bound of the range of d d m structure links
1087             * @param end the upper bound of the range of d d m structure links (not inclusive)
1088             * @return the range of matching d d m structure links
1089             * @throws SystemException if a system exception occurred
1090             */
1091            public List<DDMStructureLink> findByStructureId(long structureId,
1092                    int start, int end) throws SystemException {
1093                    return findByStructureId(structureId, start, end, null);
1094            }
1095    
1096            /**
1097             * Returns an ordered range of all the d d m structure links where structureId = &#63;.
1098             *
1099             * <p>
1100             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1101             * </p>
1102             *
1103             * @param structureId the structure ID
1104             * @param start the lower bound of the range of d d m structure links
1105             * @param end the upper bound of the range of d d m structure links (not inclusive)
1106             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1107             * @return the ordered range of matching d d m structure links
1108             * @throws SystemException if a system exception occurred
1109             */
1110            public List<DDMStructureLink> findByStructureId(long structureId,
1111                    int start, int end, OrderByComparator orderByComparator)
1112                    throws SystemException {
1113                    FinderPath finderPath = null;
1114                    Object[] finderArgs = null;
1115    
1116                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1117                                    (orderByComparator == null)) {
1118                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID;
1119                            finderArgs = new Object[] { structureId };
1120                    }
1121                    else {
1122                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID;
1123                            finderArgs = new Object[] { structureId, start, end, orderByComparator };
1124                    }
1125    
1126                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
1127                                    finderArgs, this);
1128    
1129                    if ((list != null) && !list.isEmpty()) {
1130                            for (DDMStructureLink ddmStructureLink : list) {
1131                                    if ((structureId != ddmStructureLink.getStructureId())) {
1132                                            list = null;
1133    
1134                                            break;
1135                                    }
1136                            }
1137                    }
1138    
1139                    if (list == null) {
1140                            StringBundler query = null;
1141    
1142                            if (orderByComparator != null) {
1143                                    query = new StringBundler(3 +
1144                                                    (orderByComparator.getOrderByFields().length * 3));
1145                            }
1146                            else {
1147                                    query = new StringBundler(2);
1148                            }
1149    
1150                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
1151    
1152                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1153    
1154                            if (orderByComparator != null) {
1155                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1156                                            orderByComparator);
1157                            }
1158    
1159                            String sql = query.toString();
1160    
1161                            Session session = null;
1162    
1163                            try {
1164                                    session = openSession();
1165    
1166                                    Query q = session.createQuery(sql);
1167    
1168                                    QueryPos qPos = QueryPos.getInstance(q);
1169    
1170                                    qPos.add(structureId);
1171    
1172                                    list = (List<DDMStructureLink>)QueryUtil.list(q, getDialect(),
1173                                                    start, end);
1174                            }
1175                            catch (Exception e) {
1176                                    throw processException(e);
1177                            }
1178                            finally {
1179                                    if (list == null) {
1180                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1181                                    }
1182                                    else {
1183                                            cacheResult(list);
1184    
1185                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1186                                    }
1187    
1188                                    closeSession(session);
1189                            }
1190                    }
1191    
1192                    return list;
1193            }
1194    
1195            /**
1196             * Returns the first d d m structure link in the ordered set where structureId = &#63;.
1197             *
1198             * @param structureId the structure ID
1199             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1200             * @return the first matching d d m structure link
1201             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
1202             * @throws SystemException if a system exception occurred
1203             */
1204            public DDMStructureLink findByStructureId_First(long structureId,
1205                    OrderByComparator orderByComparator)
1206                    throws NoSuchStructureLinkException, SystemException {
1207                    DDMStructureLink ddmStructureLink = fetchByStructureId_First(structureId,
1208                                    orderByComparator);
1209    
1210                    if (ddmStructureLink != null) {
1211                            return ddmStructureLink;
1212                    }
1213    
1214                    StringBundler msg = new StringBundler(4);
1215    
1216                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1217    
1218                    msg.append("structureId=");
1219                    msg.append(structureId);
1220    
1221                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1222    
1223                    throw new NoSuchStructureLinkException(msg.toString());
1224            }
1225    
1226            /**
1227             * Returns the first d d m structure link in the ordered set where structureId = &#63;.
1228             *
1229             * @param structureId the structure ID
1230             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1231             * @return the first matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
1232             * @throws SystemException if a system exception occurred
1233             */
1234            public DDMStructureLink fetchByStructureId_First(long structureId,
1235                    OrderByComparator orderByComparator) throws SystemException {
1236                    List<DDMStructureLink> list = findByStructureId(structureId, 0, 1,
1237                                    orderByComparator);
1238    
1239                    if (!list.isEmpty()) {
1240                            return list.get(0);
1241                    }
1242    
1243                    return null;
1244            }
1245    
1246            /**
1247             * Returns the last d d m structure link in the ordered set where structureId = &#63;.
1248             *
1249             * @param structureId the structure ID
1250             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1251             * @return the last matching d d m structure link
1252             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
1253             * @throws SystemException if a system exception occurred
1254             */
1255            public DDMStructureLink findByStructureId_Last(long structureId,
1256                    OrderByComparator orderByComparator)
1257                    throws NoSuchStructureLinkException, SystemException {
1258                    DDMStructureLink ddmStructureLink = fetchByStructureId_Last(structureId,
1259                                    orderByComparator);
1260    
1261                    if (ddmStructureLink != null) {
1262                            return ddmStructureLink;
1263                    }
1264    
1265                    StringBundler msg = new StringBundler(4);
1266    
1267                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1268    
1269                    msg.append("structureId=");
1270                    msg.append(structureId);
1271    
1272                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1273    
1274                    throw new NoSuchStructureLinkException(msg.toString());
1275            }
1276    
1277            /**
1278             * Returns the last d d m structure link in the ordered set where structureId = &#63;.
1279             *
1280             * @param structureId the structure ID
1281             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1282             * @return the last matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
1283             * @throws SystemException if a system exception occurred
1284             */
1285            public DDMStructureLink fetchByStructureId_Last(long structureId,
1286                    OrderByComparator orderByComparator) throws SystemException {
1287                    int count = countByStructureId(structureId);
1288    
1289                    List<DDMStructureLink> list = findByStructureId(structureId, count - 1,
1290                                    count, orderByComparator);
1291    
1292                    if (!list.isEmpty()) {
1293                            return list.get(0);
1294                    }
1295    
1296                    return null;
1297            }
1298    
1299            /**
1300             * Returns the d d m structure links before and after the current d d m structure link in the ordered set where structureId = &#63;.
1301             *
1302             * @param structureLinkId the primary key of the current d d m structure link
1303             * @param structureId the structure ID
1304             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1305             * @return the previous, current, and next d d m structure link
1306             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
1307             * @throws SystemException if a system exception occurred
1308             */
1309            public DDMStructureLink[] findByStructureId_PrevAndNext(
1310                    long structureLinkId, long structureId,
1311                    OrderByComparator orderByComparator)
1312                    throws NoSuchStructureLinkException, SystemException {
1313                    DDMStructureLink ddmStructureLink = findByPrimaryKey(structureLinkId);
1314    
1315                    Session session = null;
1316    
1317                    try {
1318                            session = openSession();
1319    
1320                            DDMStructureLink[] array = new DDMStructureLinkImpl[3];
1321    
1322                            array[0] = getByStructureId_PrevAndNext(session, ddmStructureLink,
1323                                            structureId, orderByComparator, true);
1324    
1325                            array[1] = ddmStructureLink;
1326    
1327                            array[2] = getByStructureId_PrevAndNext(session, ddmStructureLink,
1328                                            structureId, orderByComparator, false);
1329    
1330                            return array;
1331                    }
1332                    catch (Exception e) {
1333                            throw processException(e);
1334                    }
1335                    finally {
1336                            closeSession(session);
1337                    }
1338            }
1339    
1340            protected DDMStructureLink getByStructureId_PrevAndNext(Session session,
1341                    DDMStructureLink ddmStructureLink, long structureId,
1342                    OrderByComparator orderByComparator, boolean previous) {
1343                    StringBundler query = null;
1344    
1345                    if (orderByComparator != null) {
1346                            query = new StringBundler(6 +
1347                                            (orderByComparator.getOrderByFields().length * 6));
1348                    }
1349                    else {
1350                            query = new StringBundler(3);
1351                    }
1352    
1353                    query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
1354    
1355                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1356    
1357                    if (orderByComparator != null) {
1358                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1359    
1360                            if (orderByConditionFields.length > 0) {
1361                                    query.append(WHERE_AND);
1362                            }
1363    
1364                            for (int i = 0; i < orderByConditionFields.length; i++) {
1365                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1366                                    query.append(orderByConditionFields[i]);
1367    
1368                                    if ((i + 1) < orderByConditionFields.length) {
1369                                            if (orderByComparator.isAscending() ^ previous) {
1370                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1371                                            }
1372                                            else {
1373                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1374                                            }
1375                                    }
1376                                    else {
1377                                            if (orderByComparator.isAscending() ^ previous) {
1378                                                    query.append(WHERE_GREATER_THAN);
1379                                            }
1380                                            else {
1381                                                    query.append(WHERE_LESSER_THAN);
1382                                            }
1383                                    }
1384                            }
1385    
1386                            query.append(ORDER_BY_CLAUSE);
1387    
1388                            String[] orderByFields = orderByComparator.getOrderByFields();
1389    
1390                            for (int i = 0; i < orderByFields.length; i++) {
1391                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1392                                    query.append(orderByFields[i]);
1393    
1394                                    if ((i + 1) < orderByFields.length) {
1395                                            if (orderByComparator.isAscending() ^ previous) {
1396                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1397                                            }
1398                                            else {
1399                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1400                                            }
1401                                    }
1402                                    else {
1403                                            if (orderByComparator.isAscending() ^ previous) {
1404                                                    query.append(ORDER_BY_ASC);
1405                                            }
1406                                            else {
1407                                                    query.append(ORDER_BY_DESC);
1408                                            }
1409                                    }
1410                            }
1411                    }
1412    
1413                    String sql = query.toString();
1414    
1415                    Query q = session.createQuery(sql);
1416    
1417                    q.setFirstResult(0);
1418                    q.setMaxResults(2);
1419    
1420                    QueryPos qPos = QueryPos.getInstance(q);
1421    
1422                    qPos.add(structureId);
1423    
1424                    if (orderByComparator != null) {
1425                            Object[] values = orderByComparator.getOrderByConditionValues(ddmStructureLink);
1426    
1427                            for (Object value : values) {
1428                                    qPos.add(value);
1429                            }
1430                    }
1431    
1432                    List<DDMStructureLink> list = q.list();
1433    
1434                    if (list.size() == 2) {
1435                            return list.get(1);
1436                    }
1437                    else {
1438                            return null;
1439                    }
1440            }
1441    
1442            /**
1443             * Returns all the d d m structure links.
1444             *
1445             * @return the d d m structure links
1446             * @throws SystemException if a system exception occurred
1447             */
1448            public List<DDMStructureLink> findAll() throws SystemException {
1449                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1450            }
1451    
1452            /**
1453             * Returns a range of all the d d m structure links.
1454             *
1455             * <p>
1456             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1457             * </p>
1458             *
1459             * @param start the lower bound of the range of d d m structure links
1460             * @param end the upper bound of the range of d d m structure links (not inclusive)
1461             * @return the range of d d m structure links
1462             * @throws SystemException if a system exception occurred
1463             */
1464            public List<DDMStructureLink> findAll(int start, int end)
1465                    throws SystemException {
1466                    return findAll(start, end, null);
1467            }
1468    
1469            /**
1470             * Returns an ordered range of all the d d m structure links.
1471             *
1472             * <p>
1473             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1474             * </p>
1475             *
1476             * @param start the lower bound of the range of d d m structure links
1477             * @param end the upper bound of the range of d d m structure links (not inclusive)
1478             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1479             * @return the ordered range of d d m structure links
1480             * @throws SystemException if a system exception occurred
1481             */
1482            public List<DDMStructureLink> findAll(int start, int end,
1483                    OrderByComparator orderByComparator) throws SystemException {
1484                    FinderPath finderPath = null;
1485                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1486    
1487                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1488                                    (orderByComparator == null)) {
1489                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1490                            finderArgs = FINDER_ARGS_EMPTY;
1491                    }
1492                    else {
1493                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1494                            finderArgs = new Object[] { start, end, orderByComparator };
1495                    }
1496    
1497                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
1498                                    finderArgs, this);
1499    
1500                    if (list == null) {
1501                            StringBundler query = null;
1502                            String sql = null;
1503    
1504                            if (orderByComparator != null) {
1505                                    query = new StringBundler(2 +
1506                                                    (orderByComparator.getOrderByFields().length * 3));
1507    
1508                                    query.append(_SQL_SELECT_DDMSTRUCTURELINK);
1509    
1510                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1511                                            orderByComparator);
1512    
1513                                    sql = query.toString();
1514                            }
1515                            else {
1516                                    sql = _SQL_SELECT_DDMSTRUCTURELINK;
1517                            }
1518    
1519                            Session session = null;
1520    
1521                            try {
1522                                    session = openSession();
1523    
1524                                    Query q = session.createQuery(sql);
1525    
1526                                    if (orderByComparator == null) {
1527                                            list = (List<DDMStructureLink>)QueryUtil.list(q,
1528                                                            getDialect(), start, end, false);
1529    
1530                                            Collections.sort(list);
1531                                    }
1532                                    else {
1533                                            list = (List<DDMStructureLink>)QueryUtil.list(q,
1534                                                            getDialect(), start, end);
1535                                    }
1536                            }
1537                            catch (Exception e) {
1538                                    throw processException(e);
1539                            }
1540                            finally {
1541                                    if (list == null) {
1542                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1543                                    }
1544                                    else {
1545                                            cacheResult(list);
1546    
1547                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1548                                    }
1549    
1550                                    closeSession(session);
1551                            }
1552                    }
1553    
1554                    return list;
1555            }
1556    
1557            /**
1558             * Removes all the d d m structure links where classNameId = &#63; from the database.
1559             *
1560             * @param classNameId the class name ID
1561             * @throws SystemException if a system exception occurred
1562             */
1563            public void removeByClassNameId(long classNameId) throws SystemException {
1564                    for (DDMStructureLink ddmStructureLink : findByClassNameId(classNameId)) {
1565                            remove(ddmStructureLink);
1566                    }
1567            }
1568    
1569            /**
1570             * Removes the d d m structure link where classPK = &#63; from the database.
1571             *
1572             * @param classPK the class p k
1573             * @return the d d m structure link that was removed
1574             * @throws SystemException if a system exception occurred
1575             */
1576            public DDMStructureLink removeByClassPK(long classPK)
1577                    throws NoSuchStructureLinkException, SystemException {
1578                    DDMStructureLink ddmStructureLink = findByClassPK(classPK);
1579    
1580                    return remove(ddmStructureLink);
1581            }
1582    
1583            /**
1584             * Removes all the d d m structure links where structureId = &#63; from the database.
1585             *
1586             * @param structureId the structure ID
1587             * @throws SystemException if a system exception occurred
1588             */
1589            public void removeByStructureId(long structureId) throws SystemException {
1590                    for (DDMStructureLink ddmStructureLink : findByStructureId(structureId)) {
1591                            remove(ddmStructureLink);
1592                    }
1593            }
1594    
1595            /**
1596             * Removes all the d d m structure links from the database.
1597             *
1598             * @throws SystemException if a system exception occurred
1599             */
1600            public void removeAll() throws SystemException {
1601                    for (DDMStructureLink ddmStructureLink : findAll()) {
1602                            remove(ddmStructureLink);
1603                    }
1604            }
1605    
1606            /**
1607             * Returns the number of d d m structure links where classNameId = &#63;.
1608             *
1609             * @param classNameId the class name ID
1610             * @return the number of matching d d m structure links
1611             * @throws SystemException if a system exception occurred
1612             */
1613            public int countByClassNameId(long classNameId) throws SystemException {
1614                    Object[] finderArgs = new Object[] { classNameId };
1615    
1616                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1617                                    finderArgs, this);
1618    
1619                    if (count == null) {
1620                            StringBundler query = new StringBundler(2);
1621    
1622                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1623    
1624                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1625    
1626                            String sql = query.toString();
1627    
1628                            Session session = null;
1629    
1630                            try {
1631                                    session = openSession();
1632    
1633                                    Query q = session.createQuery(sql);
1634    
1635                                    QueryPos qPos = QueryPos.getInstance(q);
1636    
1637                                    qPos.add(classNameId);
1638    
1639                                    count = (Long)q.uniqueResult();
1640                            }
1641                            catch (Exception e) {
1642                                    throw processException(e);
1643                            }
1644                            finally {
1645                                    if (count == null) {
1646                                            count = Long.valueOf(0);
1647                                    }
1648    
1649                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1650                                            finderArgs, count);
1651    
1652                                    closeSession(session);
1653                            }
1654                    }
1655    
1656                    return count.intValue();
1657            }
1658    
1659            /**
1660             * Returns the number of d d m structure links where classPK = &#63;.
1661             *
1662             * @param classPK the class p k
1663             * @return the number of matching d d m structure links
1664             * @throws SystemException if a system exception occurred
1665             */
1666            public int countByClassPK(long classPK) throws SystemException {
1667                    Object[] finderArgs = new Object[] { classPK };
1668    
1669                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSPK,
1670                                    finderArgs, this);
1671    
1672                    if (count == null) {
1673                            StringBundler query = new StringBundler(2);
1674    
1675                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1676    
1677                            query.append(_FINDER_COLUMN_CLASSPK_CLASSPK_2);
1678    
1679                            String sql = query.toString();
1680    
1681                            Session session = null;
1682    
1683                            try {
1684                                    session = openSession();
1685    
1686                                    Query q = session.createQuery(sql);
1687    
1688                                    QueryPos qPos = QueryPos.getInstance(q);
1689    
1690                                    qPos.add(classPK);
1691    
1692                                    count = (Long)q.uniqueResult();
1693                            }
1694                            catch (Exception e) {
1695                                    throw processException(e);
1696                            }
1697                            finally {
1698                                    if (count == null) {
1699                                            count = Long.valueOf(0);
1700                                    }
1701    
1702                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSPK,
1703                                            finderArgs, count);
1704    
1705                                    closeSession(session);
1706                            }
1707                    }
1708    
1709                    return count.intValue();
1710            }
1711    
1712            /**
1713             * Returns the number of d d m structure links where structureId = &#63;.
1714             *
1715             * @param structureId the structure ID
1716             * @return the number of matching d d m structure links
1717             * @throws SystemException if a system exception occurred
1718             */
1719            public int countByStructureId(long structureId) throws SystemException {
1720                    Object[] finderArgs = new Object[] { structureId };
1721    
1722                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1723                                    finderArgs, this);
1724    
1725                    if (count == null) {
1726                            StringBundler query = new StringBundler(2);
1727    
1728                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1729    
1730                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1731    
1732                            String sql = query.toString();
1733    
1734                            Session session = null;
1735    
1736                            try {
1737                                    session = openSession();
1738    
1739                                    Query q = session.createQuery(sql);
1740    
1741                                    QueryPos qPos = QueryPos.getInstance(q);
1742    
1743                                    qPos.add(structureId);
1744    
1745                                    count = (Long)q.uniqueResult();
1746                            }
1747                            catch (Exception e) {
1748                                    throw processException(e);
1749                            }
1750                            finally {
1751                                    if (count == null) {
1752                                            count = Long.valueOf(0);
1753                                    }
1754    
1755                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1756                                            finderArgs, count);
1757    
1758                                    closeSession(session);
1759                            }
1760                    }
1761    
1762                    return count.intValue();
1763            }
1764    
1765            /**
1766             * Returns the number of d d m structure links.
1767             *
1768             * @return the number of d d m structure links
1769             * @throws SystemException if a system exception occurred
1770             */
1771            public int countAll() throws SystemException {
1772                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1773                                    FINDER_ARGS_EMPTY, this);
1774    
1775                    if (count == null) {
1776                            Session session = null;
1777    
1778                            try {
1779                                    session = openSession();
1780    
1781                                    Query q = session.createQuery(_SQL_COUNT_DDMSTRUCTURELINK);
1782    
1783                                    count = (Long)q.uniqueResult();
1784                            }
1785                            catch (Exception e) {
1786                                    throw processException(e);
1787                            }
1788                            finally {
1789                                    if (count == null) {
1790                                            count = Long.valueOf(0);
1791                                    }
1792    
1793                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1794                                            FINDER_ARGS_EMPTY, count);
1795    
1796                                    closeSession(session);
1797                            }
1798                    }
1799    
1800                    return count.intValue();
1801            }
1802    
1803            /**
1804             * Initializes the d d m structure link persistence.
1805             */
1806            public void afterPropertiesSet() {
1807                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1808                                            com.liferay.portal.util.PropsUtil.get(
1809                                                    "value.object.listener.com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink")));
1810    
1811                    if (listenerClassNames.length > 0) {
1812                            try {
1813                                    List<ModelListener<DDMStructureLink>> listenersList = new ArrayList<ModelListener<DDMStructureLink>>();
1814    
1815                                    for (String listenerClassName : listenerClassNames) {
1816                                            listenersList.add((ModelListener<DDMStructureLink>)InstanceFactory.newInstance(
1817                                                            listenerClassName));
1818                                    }
1819    
1820                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1821                            }
1822                            catch (Exception e) {
1823                                    _log.error(e);
1824                            }
1825                    }
1826            }
1827    
1828            public void destroy() {
1829                    EntityCacheUtil.removeCache(DDMStructureLinkImpl.class.getName());
1830                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1831                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1832            }
1833    
1834            @BeanReference(type = DDMContentPersistence.class)
1835            protected DDMContentPersistence ddmContentPersistence;
1836            @BeanReference(type = DDMStorageLinkPersistence.class)
1837            protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
1838            @BeanReference(type = DDMStructurePersistence.class)
1839            protected DDMStructurePersistence ddmStructurePersistence;
1840            @BeanReference(type = DDMStructureLinkPersistence.class)
1841            protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
1842            @BeanReference(type = DDMTemplatePersistence.class)
1843            protected DDMTemplatePersistence ddmTemplatePersistence;
1844            @BeanReference(type = ResourcePersistence.class)
1845            protected ResourcePersistence resourcePersistence;
1846            @BeanReference(type = UserPersistence.class)
1847            protected UserPersistence userPersistence;
1848            private static final String _SQL_SELECT_DDMSTRUCTURELINK = "SELECT ddmStructureLink FROM DDMStructureLink ddmStructureLink";
1849            private static final String _SQL_SELECT_DDMSTRUCTURELINK_WHERE = "SELECT ddmStructureLink FROM DDMStructureLink ddmStructureLink WHERE ";
1850            private static final String _SQL_COUNT_DDMSTRUCTURELINK = "SELECT COUNT(ddmStructureLink) FROM DDMStructureLink ddmStructureLink";
1851            private static final String _SQL_COUNT_DDMSTRUCTURELINK_WHERE = "SELECT COUNT(ddmStructureLink) FROM DDMStructureLink ddmStructureLink WHERE ";
1852            private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "ddmStructureLink.classNameId = ?";
1853            private static final String _FINDER_COLUMN_CLASSPK_CLASSPK_2 = "ddmStructureLink.classPK = ?";
1854            private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2 = "ddmStructureLink.structureId = ?";
1855            private static final String _ORDER_BY_ENTITY_ALIAS = "ddmStructureLink.";
1856            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDMStructureLink exists with the primary key ";
1857            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDMStructureLink exists with the key {";
1858            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1859            private static Log _log = LogFactoryUtil.getLog(DDMStructureLinkPersistenceImpl.class);
1860            private static DDMStructureLink _nullDDMStructureLink = new DDMStructureLinkImpl() {
1861                            @Override
1862                            public Object clone() {
1863                                    return this;
1864                            }
1865    
1866                            @Override
1867                            public CacheModel<DDMStructureLink> toCacheModel() {
1868                                    return _nullDDMStructureLinkCacheModel;
1869                            }
1870                    };
1871    
1872            private static CacheModel<DDMStructureLink> _nullDDMStructureLinkCacheModel = new CacheModel<DDMStructureLink>() {
1873                            public DDMStructureLink toEntityModel() {
1874                                    return _nullDDMStructureLink;
1875                            }
1876                    };
1877    }