001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.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,
134                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "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, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
138                            "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                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSPK, args);
422    
423                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
424                                            new Object[] { Long.valueOf(ddmStructureLink.getClassPK()) },
425                                            ddmStructureLink);
426                            }
427                    }
428    
429                    return ddmStructureLink;
430            }
431    
432            protected DDMStructureLink toUnwrappedModel(
433                    DDMStructureLink ddmStructureLink) {
434                    if (ddmStructureLink instanceof DDMStructureLinkImpl) {
435                            return ddmStructureLink;
436                    }
437    
438                    DDMStructureLinkImpl ddmStructureLinkImpl = new DDMStructureLinkImpl();
439    
440                    ddmStructureLinkImpl.setNew(ddmStructureLink.isNew());
441                    ddmStructureLinkImpl.setPrimaryKey(ddmStructureLink.getPrimaryKey());
442    
443                    ddmStructureLinkImpl.setStructureLinkId(ddmStructureLink.getStructureLinkId());
444                    ddmStructureLinkImpl.setClassNameId(ddmStructureLink.getClassNameId());
445                    ddmStructureLinkImpl.setClassPK(ddmStructureLink.getClassPK());
446                    ddmStructureLinkImpl.setStructureId(ddmStructureLink.getStructureId());
447    
448                    return ddmStructureLinkImpl;
449            }
450    
451            /**
452             * 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.
453             *
454             * @param primaryKey the primary key of the d d m structure link
455             * @return the d d m structure link
456             * @throws com.liferay.portal.NoSuchModelException if a d d m structure link with the primary key could not be found
457             * @throws SystemException if a system exception occurred
458             */
459            @Override
460            public DDMStructureLink findByPrimaryKey(Serializable primaryKey)
461                    throws NoSuchModelException, SystemException {
462                    return findByPrimaryKey(((Long)primaryKey).longValue());
463            }
464    
465            /**
466             * 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.
467             *
468             * @param structureLinkId the primary key of the d d m structure link
469             * @return the d d m structure link
470             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
471             * @throws SystemException if a system exception occurred
472             */
473            public DDMStructureLink findByPrimaryKey(long structureLinkId)
474                    throws NoSuchStructureLinkException, SystemException {
475                    DDMStructureLink ddmStructureLink = fetchByPrimaryKey(structureLinkId);
476    
477                    if (ddmStructureLink == null) {
478                            if (_log.isWarnEnabled()) {
479                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + structureLinkId);
480                            }
481    
482                            throw new NoSuchStructureLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
483                                    structureLinkId);
484                    }
485    
486                    return ddmStructureLink;
487            }
488    
489            /**
490             * Returns the d d m structure link with the primary key or returns <code>null</code> if it could not be found.
491             *
492             * @param primaryKey the primary key of the d d m structure link
493             * @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
494             * @throws SystemException if a system exception occurred
495             */
496            @Override
497            public DDMStructureLink fetchByPrimaryKey(Serializable primaryKey)
498                    throws SystemException {
499                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
500            }
501    
502            /**
503             * Returns the d d m structure link with the primary key or returns <code>null</code> if it could not be found.
504             *
505             * @param structureLinkId the primary key of the d d m structure link
506             * @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
507             * @throws SystemException if a system exception occurred
508             */
509            public DDMStructureLink fetchByPrimaryKey(long structureLinkId)
510                    throws SystemException {
511                    DDMStructureLink ddmStructureLink = (DDMStructureLink)EntityCacheUtil.getResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
512                                    DDMStructureLinkImpl.class, structureLinkId);
513    
514                    if (ddmStructureLink == _nullDDMStructureLink) {
515                            return null;
516                    }
517    
518                    if (ddmStructureLink == null) {
519                            Session session = null;
520    
521                            boolean hasException = false;
522    
523                            try {
524                                    session = openSession();
525    
526                                    ddmStructureLink = (DDMStructureLink)session.get(DDMStructureLinkImpl.class,
527                                                    Long.valueOf(structureLinkId));
528                            }
529                            catch (Exception e) {
530                                    hasException = true;
531    
532                                    throw processException(e);
533                            }
534                            finally {
535                                    if (ddmStructureLink != null) {
536                                            cacheResult(ddmStructureLink);
537                                    }
538                                    else if (!hasException) {
539                                            EntityCacheUtil.putResult(DDMStructureLinkModelImpl.ENTITY_CACHE_ENABLED,
540                                                    DDMStructureLinkImpl.class, structureLinkId,
541                                                    _nullDDMStructureLink);
542                                    }
543    
544                                    closeSession(session);
545                            }
546                    }
547    
548                    return ddmStructureLink;
549            }
550    
551            /**
552             * Returns all the d d m structure links where classNameId = &#63;.
553             *
554             * @param classNameId the class name ID
555             * @return the matching d d m structure links
556             * @throws SystemException if a system exception occurred
557             */
558            public List<DDMStructureLink> findByClassNameId(long classNameId)
559                    throws SystemException {
560                    return findByClassNameId(classNameId, QueryUtil.ALL_POS,
561                            QueryUtil.ALL_POS, null);
562            }
563    
564            /**
565             * Returns a range of all the d d m structure links where classNameId = &#63;.
566             *
567             * <p>
568             * 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.
569             * </p>
570             *
571             * @param classNameId the class name ID
572             * @param start the lower bound of the range of d d m structure links
573             * @param end the upper bound of the range of d d m structure links (not inclusive)
574             * @return the range of matching d d m structure links
575             * @throws SystemException if a system exception occurred
576             */
577            public List<DDMStructureLink> findByClassNameId(long classNameId,
578                    int start, int end) throws SystemException {
579                    return findByClassNameId(classNameId, start, end, null);
580            }
581    
582            /**
583             * Returns an ordered range of all the d d m structure links where classNameId = &#63;.
584             *
585             * <p>
586             * 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.
587             * </p>
588             *
589             * @param classNameId the class name ID
590             * @param start the lower bound of the range of d d m structure links
591             * @param end the upper bound of the range of d d m structure links (not inclusive)
592             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
593             * @return the ordered range of matching d d m structure links
594             * @throws SystemException if a system exception occurred
595             */
596            public List<DDMStructureLink> findByClassNameId(long classNameId,
597                    int start, int end, OrderByComparator orderByComparator)
598                    throws SystemException {
599                    FinderPath finderPath = null;
600                    Object[] finderArgs = null;
601    
602                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
603                                    (orderByComparator == null)) {
604                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
605                            finderArgs = new Object[] { classNameId };
606                    }
607                    else {
608                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
609                            finderArgs = new Object[] { classNameId, start, end, orderByComparator };
610                    }
611    
612                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
613                                    finderArgs, this);
614    
615                    if (list == null) {
616                            StringBundler query = null;
617    
618                            if (orderByComparator != null) {
619                                    query = new StringBundler(3 +
620                                                    (orderByComparator.getOrderByFields().length * 3));
621                            }
622                            else {
623                                    query = new StringBundler(2);
624                            }
625    
626                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
627    
628                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
629    
630                            if (orderByComparator != null) {
631                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
632                                            orderByComparator);
633                            }
634    
635                            String sql = query.toString();
636    
637                            Session session = null;
638    
639                            try {
640                                    session = openSession();
641    
642                                    Query q = session.createQuery(sql);
643    
644                                    QueryPos qPos = QueryPos.getInstance(q);
645    
646                                    qPos.add(classNameId);
647    
648                                    list = (List<DDMStructureLink>)QueryUtil.list(q, getDialect(),
649                                                    start, end);
650                            }
651                            catch (Exception e) {
652                                    throw processException(e);
653                            }
654                            finally {
655                                    if (list == null) {
656                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
657                                    }
658                                    else {
659                                            cacheResult(list);
660    
661                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
662                                    }
663    
664                                    closeSession(session);
665                            }
666                    }
667    
668                    return list;
669            }
670    
671            /**
672             * Returns the first d d m structure link in the ordered set where classNameId = &#63;.
673             *
674             * <p>
675             * 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.
676             * </p>
677             *
678             * @param classNameId the class name ID
679             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
680             * @return the first matching d d m structure link
681             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
682             * @throws SystemException if a system exception occurred
683             */
684            public DDMStructureLink findByClassNameId_First(long classNameId,
685                    OrderByComparator orderByComparator)
686                    throws NoSuchStructureLinkException, SystemException {
687                    List<DDMStructureLink> list = findByClassNameId(classNameId, 0, 1,
688                                    orderByComparator);
689    
690                    if (list.isEmpty()) {
691                            StringBundler msg = new StringBundler(4);
692    
693                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
694    
695                            msg.append("classNameId=");
696                            msg.append(classNameId);
697    
698                            msg.append(StringPool.CLOSE_CURLY_BRACE);
699    
700                            throw new NoSuchStructureLinkException(msg.toString());
701                    }
702                    else {
703                            return list.get(0);
704                    }
705            }
706    
707            /**
708             * Returns the last d d m structure link in the ordered set where classNameId = &#63;.
709             *
710             * <p>
711             * 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.
712             * </p>
713             *
714             * @param classNameId the class name ID
715             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
716             * @return the last matching d d m structure link
717             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
718             * @throws SystemException if a system exception occurred
719             */
720            public DDMStructureLink findByClassNameId_Last(long classNameId,
721                    OrderByComparator orderByComparator)
722                    throws NoSuchStructureLinkException, SystemException {
723                    int count = countByClassNameId(classNameId);
724    
725                    List<DDMStructureLink> list = findByClassNameId(classNameId, count - 1,
726                                    count, orderByComparator);
727    
728                    if (list.isEmpty()) {
729                            StringBundler msg = new StringBundler(4);
730    
731                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
732    
733                            msg.append("classNameId=");
734                            msg.append(classNameId);
735    
736                            msg.append(StringPool.CLOSE_CURLY_BRACE);
737    
738                            throw new NoSuchStructureLinkException(msg.toString());
739                    }
740                    else {
741                            return list.get(0);
742                    }
743            }
744    
745            /**
746             * Returns the d d m structure links before and after the current d d m structure link in the ordered set where classNameId = &#63;.
747             *
748             * <p>
749             * 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.
750             * </p>
751             *
752             * @param structureLinkId the primary key of the current d d m structure link
753             * @param classNameId the class name ID
754             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
755             * @return the previous, current, and next d d m structure link
756             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
757             * @throws SystemException if a system exception occurred
758             */
759            public DDMStructureLink[] findByClassNameId_PrevAndNext(
760                    long structureLinkId, long classNameId,
761                    OrderByComparator orderByComparator)
762                    throws NoSuchStructureLinkException, SystemException {
763                    DDMStructureLink ddmStructureLink = findByPrimaryKey(structureLinkId);
764    
765                    Session session = null;
766    
767                    try {
768                            session = openSession();
769    
770                            DDMStructureLink[] array = new DDMStructureLinkImpl[3];
771    
772                            array[0] = getByClassNameId_PrevAndNext(session, ddmStructureLink,
773                                            classNameId, orderByComparator, true);
774    
775                            array[1] = ddmStructureLink;
776    
777                            array[2] = getByClassNameId_PrevAndNext(session, ddmStructureLink,
778                                            classNameId, orderByComparator, false);
779    
780                            return array;
781                    }
782                    catch (Exception e) {
783                            throw processException(e);
784                    }
785                    finally {
786                            closeSession(session);
787                    }
788            }
789    
790            protected DDMStructureLink getByClassNameId_PrevAndNext(Session session,
791                    DDMStructureLink ddmStructureLink, long classNameId,
792                    OrderByComparator orderByComparator, boolean previous) {
793                    StringBundler query = null;
794    
795                    if (orderByComparator != null) {
796                            query = new StringBundler(6 +
797                                            (orderByComparator.getOrderByFields().length * 6));
798                    }
799                    else {
800                            query = new StringBundler(3);
801                    }
802    
803                    query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
804    
805                    query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
806    
807                    if (orderByComparator != null) {
808                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
809    
810                            if (orderByConditionFields.length > 0) {
811                                    query.append(WHERE_AND);
812                            }
813    
814                            for (int i = 0; i < orderByConditionFields.length; i++) {
815                                    query.append(_ORDER_BY_ENTITY_ALIAS);
816                                    query.append(orderByConditionFields[i]);
817    
818                                    if ((i + 1) < orderByConditionFields.length) {
819                                            if (orderByComparator.isAscending() ^ previous) {
820                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
821                                            }
822                                            else {
823                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
824                                            }
825                                    }
826                                    else {
827                                            if (orderByComparator.isAscending() ^ previous) {
828                                                    query.append(WHERE_GREATER_THAN);
829                                            }
830                                            else {
831                                                    query.append(WHERE_LESSER_THAN);
832                                            }
833                                    }
834                            }
835    
836                            query.append(ORDER_BY_CLAUSE);
837    
838                            String[] orderByFields = orderByComparator.getOrderByFields();
839    
840                            for (int i = 0; i < orderByFields.length; i++) {
841                                    query.append(_ORDER_BY_ENTITY_ALIAS);
842                                    query.append(orderByFields[i]);
843    
844                                    if ((i + 1) < orderByFields.length) {
845                                            if (orderByComparator.isAscending() ^ previous) {
846                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
847                                            }
848                                            else {
849                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
850                                            }
851                                    }
852                                    else {
853                                            if (orderByComparator.isAscending() ^ previous) {
854                                                    query.append(ORDER_BY_ASC);
855                                            }
856                                            else {
857                                                    query.append(ORDER_BY_DESC);
858                                            }
859                                    }
860                            }
861                    }
862    
863                    String sql = query.toString();
864    
865                    Query q = session.createQuery(sql);
866    
867                    q.setFirstResult(0);
868                    q.setMaxResults(2);
869    
870                    QueryPos qPos = QueryPos.getInstance(q);
871    
872                    qPos.add(classNameId);
873    
874                    if (orderByComparator != null) {
875                            Object[] values = orderByComparator.getOrderByConditionValues(ddmStructureLink);
876    
877                            for (Object value : values) {
878                                    qPos.add(value);
879                            }
880                    }
881    
882                    List<DDMStructureLink> list = q.list();
883    
884                    if (list.size() == 2) {
885                            return list.get(1);
886                    }
887                    else {
888                            return null;
889                    }
890            }
891    
892            /**
893             * 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.
894             *
895             * @param classPK the class p k
896             * @return the matching d d m structure link
897             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
898             * @throws SystemException if a system exception occurred
899             */
900            public DDMStructureLink findByClassPK(long classPK)
901                    throws NoSuchStructureLinkException, SystemException {
902                    DDMStructureLink ddmStructureLink = fetchByClassPK(classPK);
903    
904                    if (ddmStructureLink == null) {
905                            StringBundler msg = new StringBundler(4);
906    
907                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
908    
909                            msg.append("classPK=");
910                            msg.append(classPK);
911    
912                            msg.append(StringPool.CLOSE_CURLY_BRACE);
913    
914                            if (_log.isWarnEnabled()) {
915                                    _log.warn(msg.toString());
916                            }
917    
918                            throw new NoSuchStructureLinkException(msg.toString());
919                    }
920    
921                    return ddmStructureLink;
922            }
923    
924            /**
925             * 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.
926             *
927             * @param classPK the class p k
928             * @return the matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
929             * @throws SystemException if a system exception occurred
930             */
931            public DDMStructureLink fetchByClassPK(long classPK)
932                    throws SystemException {
933                    return fetchByClassPK(classPK, true);
934            }
935    
936            /**
937             * 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.
938             *
939             * @param classPK the class p k
940             * @param retrieveFromCache whether to use the finder cache
941             * @return the matching d d m structure link, or <code>null</code> if a matching d d m structure link could not be found
942             * @throws SystemException if a system exception occurred
943             */
944            public DDMStructureLink fetchByClassPK(long classPK,
945                    boolean retrieveFromCache) throws SystemException {
946                    Object[] finderArgs = new Object[] { classPK };
947    
948                    Object result = null;
949    
950                    if (retrieveFromCache) {
951                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CLASSPK,
952                                            finderArgs, this);
953                    }
954    
955                    if (result == null) {
956                            StringBundler query = new StringBundler(2);
957    
958                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
959    
960                            query.append(_FINDER_COLUMN_CLASSPK_CLASSPK_2);
961    
962                            String sql = query.toString();
963    
964                            Session session = null;
965    
966                            try {
967                                    session = openSession();
968    
969                                    Query q = session.createQuery(sql);
970    
971                                    QueryPos qPos = QueryPos.getInstance(q);
972    
973                                    qPos.add(classPK);
974    
975                                    List<DDMStructureLink> list = q.list();
976    
977                                    result = list;
978    
979                                    DDMStructureLink ddmStructureLink = null;
980    
981                                    if (list.isEmpty()) {
982                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
983                                                    finderArgs, list);
984                                    }
985                                    else {
986                                            ddmStructureLink = list.get(0);
987    
988                                            cacheResult(ddmStructureLink);
989    
990                                            if ((ddmStructureLink.getClassPK() != classPK)) {
991                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CLASSPK,
992                                                            finderArgs, ddmStructureLink);
993                                            }
994                                    }
995    
996                                    return ddmStructureLink;
997                            }
998                            catch (Exception e) {
999                                    throw processException(e);
1000                            }
1001                            finally {
1002                                    if (result == null) {
1003                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSPK,
1004                                                    finderArgs);
1005                                    }
1006    
1007                                    closeSession(session);
1008                            }
1009                    }
1010                    else {
1011                            if (result instanceof List<?>) {
1012                                    return null;
1013                            }
1014                            else {
1015                                    return (DDMStructureLink)result;
1016                            }
1017                    }
1018            }
1019    
1020            /**
1021             * Returns all the d d m structure links where structureId = &#63;.
1022             *
1023             * @param structureId the structure ID
1024             * @return the matching d d m structure links
1025             * @throws SystemException if a system exception occurred
1026             */
1027            public List<DDMStructureLink> findByStructureId(long structureId)
1028                    throws SystemException {
1029                    return findByStructureId(structureId, QueryUtil.ALL_POS,
1030                            QueryUtil.ALL_POS, null);
1031            }
1032    
1033            /**
1034             * Returns a range of all the d d m structure links where structureId = &#63;.
1035             *
1036             * <p>
1037             * 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.
1038             * </p>
1039             *
1040             * @param structureId the structure ID
1041             * @param start the lower bound of the range of d d m structure links
1042             * @param end the upper bound of the range of d d m structure links (not inclusive)
1043             * @return the range of matching d d m structure links
1044             * @throws SystemException if a system exception occurred
1045             */
1046            public List<DDMStructureLink> findByStructureId(long structureId,
1047                    int start, int end) throws SystemException {
1048                    return findByStructureId(structureId, start, end, null);
1049            }
1050    
1051            /**
1052             * Returns an ordered range of all the d d m structure links where structureId = &#63;.
1053             *
1054             * <p>
1055             * 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.
1056             * </p>
1057             *
1058             * @param structureId the structure ID
1059             * @param start the lower bound of the range of d d m structure links
1060             * @param end the upper bound of the range of d d m structure links (not inclusive)
1061             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1062             * @return the ordered range of matching d d m structure links
1063             * @throws SystemException if a system exception occurred
1064             */
1065            public List<DDMStructureLink> findByStructureId(long structureId,
1066                    int start, int end, OrderByComparator orderByComparator)
1067                    throws SystemException {
1068                    FinderPath finderPath = null;
1069                    Object[] finderArgs = null;
1070    
1071                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1072                                    (orderByComparator == null)) {
1073                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID;
1074                            finderArgs = new Object[] { structureId };
1075                    }
1076                    else {
1077                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID;
1078                            finderArgs = new Object[] { structureId, start, end, orderByComparator };
1079                    }
1080    
1081                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
1082                                    finderArgs, this);
1083    
1084                    if (list == null) {
1085                            StringBundler query = null;
1086    
1087                            if (orderByComparator != null) {
1088                                    query = new StringBundler(3 +
1089                                                    (orderByComparator.getOrderByFields().length * 3));
1090                            }
1091                            else {
1092                                    query = new StringBundler(2);
1093                            }
1094    
1095                            query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
1096    
1097                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1098    
1099                            if (orderByComparator != null) {
1100                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1101                                            orderByComparator);
1102                            }
1103    
1104                            String sql = query.toString();
1105    
1106                            Session session = null;
1107    
1108                            try {
1109                                    session = openSession();
1110    
1111                                    Query q = session.createQuery(sql);
1112    
1113                                    QueryPos qPos = QueryPos.getInstance(q);
1114    
1115                                    qPos.add(structureId);
1116    
1117                                    list = (List<DDMStructureLink>)QueryUtil.list(q, getDialect(),
1118                                                    start, end);
1119                            }
1120                            catch (Exception e) {
1121                                    throw processException(e);
1122                            }
1123                            finally {
1124                                    if (list == null) {
1125                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1126                                    }
1127                                    else {
1128                                            cacheResult(list);
1129    
1130                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1131                                    }
1132    
1133                                    closeSession(session);
1134                            }
1135                    }
1136    
1137                    return list;
1138            }
1139    
1140            /**
1141             * Returns the first d d m structure link in the ordered set where structureId = &#63;.
1142             *
1143             * <p>
1144             * 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.
1145             * </p>
1146             *
1147             * @param structureId the structure ID
1148             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1149             * @return the first matching d d m structure link
1150             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
1151             * @throws SystemException if a system exception occurred
1152             */
1153            public DDMStructureLink findByStructureId_First(long structureId,
1154                    OrderByComparator orderByComparator)
1155                    throws NoSuchStructureLinkException, SystemException {
1156                    List<DDMStructureLink> list = findByStructureId(structureId, 0, 1,
1157                                    orderByComparator);
1158    
1159                    if (list.isEmpty()) {
1160                            StringBundler msg = new StringBundler(4);
1161    
1162                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1163    
1164                            msg.append("structureId=");
1165                            msg.append(structureId);
1166    
1167                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1168    
1169                            throw new NoSuchStructureLinkException(msg.toString());
1170                    }
1171                    else {
1172                            return list.get(0);
1173                    }
1174            }
1175    
1176            /**
1177             * Returns the last d d m structure link in the ordered set where structureId = &#63;.
1178             *
1179             * <p>
1180             * 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.
1181             * </p>
1182             *
1183             * @param structureId the structure ID
1184             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1185             * @return the last matching d d m structure link
1186             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a matching d d m structure link could not be found
1187             * @throws SystemException if a system exception occurred
1188             */
1189            public DDMStructureLink findByStructureId_Last(long structureId,
1190                    OrderByComparator orderByComparator)
1191                    throws NoSuchStructureLinkException, SystemException {
1192                    int count = countByStructureId(structureId);
1193    
1194                    List<DDMStructureLink> list = findByStructureId(structureId, count - 1,
1195                                    count, orderByComparator);
1196    
1197                    if (list.isEmpty()) {
1198                            StringBundler msg = new StringBundler(4);
1199    
1200                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1201    
1202                            msg.append("structureId=");
1203                            msg.append(structureId);
1204    
1205                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1206    
1207                            throw new NoSuchStructureLinkException(msg.toString());
1208                    }
1209                    else {
1210                            return list.get(0);
1211                    }
1212            }
1213    
1214            /**
1215             * Returns the d d m structure links before and after the current d d m structure link in the ordered set where structureId = &#63;.
1216             *
1217             * <p>
1218             * 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.
1219             * </p>
1220             *
1221             * @param structureLinkId the primary key of the current d d m structure link
1222             * @param structureId the structure ID
1223             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1224             * @return the previous, current, and next d d m structure link
1225             * @throws com.liferay.portlet.dynamicdatamapping.NoSuchStructureLinkException if a d d m structure link with the primary key could not be found
1226             * @throws SystemException if a system exception occurred
1227             */
1228            public DDMStructureLink[] findByStructureId_PrevAndNext(
1229                    long structureLinkId, long structureId,
1230                    OrderByComparator orderByComparator)
1231                    throws NoSuchStructureLinkException, SystemException {
1232                    DDMStructureLink ddmStructureLink = findByPrimaryKey(structureLinkId);
1233    
1234                    Session session = null;
1235    
1236                    try {
1237                            session = openSession();
1238    
1239                            DDMStructureLink[] array = new DDMStructureLinkImpl[3];
1240    
1241                            array[0] = getByStructureId_PrevAndNext(session, ddmStructureLink,
1242                                            structureId, orderByComparator, true);
1243    
1244                            array[1] = ddmStructureLink;
1245    
1246                            array[2] = getByStructureId_PrevAndNext(session, ddmStructureLink,
1247                                            structureId, orderByComparator, false);
1248    
1249                            return array;
1250                    }
1251                    catch (Exception e) {
1252                            throw processException(e);
1253                    }
1254                    finally {
1255                            closeSession(session);
1256                    }
1257            }
1258    
1259            protected DDMStructureLink getByStructureId_PrevAndNext(Session session,
1260                    DDMStructureLink ddmStructureLink, long structureId,
1261                    OrderByComparator orderByComparator, boolean previous) {
1262                    StringBundler query = null;
1263    
1264                    if (orderByComparator != null) {
1265                            query = new StringBundler(6 +
1266                                            (orderByComparator.getOrderByFields().length * 6));
1267                    }
1268                    else {
1269                            query = new StringBundler(3);
1270                    }
1271    
1272                    query.append(_SQL_SELECT_DDMSTRUCTURELINK_WHERE);
1273    
1274                    query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1275    
1276                    if (orderByComparator != null) {
1277                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1278    
1279                            if (orderByConditionFields.length > 0) {
1280                                    query.append(WHERE_AND);
1281                            }
1282    
1283                            for (int i = 0; i < orderByConditionFields.length; i++) {
1284                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1285                                    query.append(orderByConditionFields[i]);
1286    
1287                                    if ((i + 1) < orderByConditionFields.length) {
1288                                            if (orderByComparator.isAscending() ^ previous) {
1289                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1290                                            }
1291                                            else {
1292                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1293                                            }
1294                                    }
1295                                    else {
1296                                            if (orderByComparator.isAscending() ^ previous) {
1297                                                    query.append(WHERE_GREATER_THAN);
1298                                            }
1299                                            else {
1300                                                    query.append(WHERE_LESSER_THAN);
1301                                            }
1302                                    }
1303                            }
1304    
1305                            query.append(ORDER_BY_CLAUSE);
1306    
1307                            String[] orderByFields = orderByComparator.getOrderByFields();
1308    
1309                            for (int i = 0; i < orderByFields.length; i++) {
1310                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1311                                    query.append(orderByFields[i]);
1312    
1313                                    if ((i + 1) < orderByFields.length) {
1314                                            if (orderByComparator.isAscending() ^ previous) {
1315                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1316                                            }
1317                                            else {
1318                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1319                                            }
1320                                    }
1321                                    else {
1322                                            if (orderByComparator.isAscending() ^ previous) {
1323                                                    query.append(ORDER_BY_ASC);
1324                                            }
1325                                            else {
1326                                                    query.append(ORDER_BY_DESC);
1327                                            }
1328                                    }
1329                            }
1330                    }
1331    
1332                    String sql = query.toString();
1333    
1334                    Query q = session.createQuery(sql);
1335    
1336                    q.setFirstResult(0);
1337                    q.setMaxResults(2);
1338    
1339                    QueryPos qPos = QueryPos.getInstance(q);
1340    
1341                    qPos.add(structureId);
1342    
1343                    if (orderByComparator != null) {
1344                            Object[] values = orderByComparator.getOrderByConditionValues(ddmStructureLink);
1345    
1346                            for (Object value : values) {
1347                                    qPos.add(value);
1348                            }
1349                    }
1350    
1351                    List<DDMStructureLink> list = q.list();
1352    
1353                    if (list.size() == 2) {
1354                            return list.get(1);
1355                    }
1356                    else {
1357                            return null;
1358                    }
1359            }
1360    
1361            /**
1362             * Returns all the d d m structure links.
1363             *
1364             * @return the d d m structure links
1365             * @throws SystemException if a system exception occurred
1366             */
1367            public List<DDMStructureLink> findAll() throws SystemException {
1368                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1369            }
1370    
1371            /**
1372             * Returns a range of all the d d m structure links.
1373             *
1374             * <p>
1375             * 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.
1376             * </p>
1377             *
1378             * @param start the lower bound of the range of d d m structure links
1379             * @param end the upper bound of the range of d d m structure links (not inclusive)
1380             * @return the range of d d m structure links
1381             * @throws SystemException if a system exception occurred
1382             */
1383            public List<DDMStructureLink> findAll(int start, int end)
1384                    throws SystemException {
1385                    return findAll(start, end, null);
1386            }
1387    
1388            /**
1389             * Returns an ordered range of all the d d m structure links.
1390             *
1391             * <p>
1392             * 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.
1393             * </p>
1394             *
1395             * @param start the lower bound of the range of d d m structure links
1396             * @param end the upper bound of the range of d d m structure links (not inclusive)
1397             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1398             * @return the ordered range of d d m structure links
1399             * @throws SystemException if a system exception occurred
1400             */
1401            public List<DDMStructureLink> findAll(int start, int end,
1402                    OrderByComparator orderByComparator) throws SystemException {
1403                    FinderPath finderPath = null;
1404                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1405    
1406                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1407                                    (orderByComparator == null)) {
1408                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1409                            finderArgs = FINDER_ARGS_EMPTY;
1410                    }
1411                    else {
1412                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1413                            finderArgs = new Object[] { start, end, orderByComparator };
1414                    }
1415    
1416                    List<DDMStructureLink> list = (List<DDMStructureLink>)FinderCacheUtil.getResult(finderPath,
1417                                    finderArgs, this);
1418    
1419                    if (list == null) {
1420                            StringBundler query = null;
1421                            String sql = null;
1422    
1423                            if (orderByComparator != null) {
1424                                    query = new StringBundler(2 +
1425                                                    (orderByComparator.getOrderByFields().length * 3));
1426    
1427                                    query.append(_SQL_SELECT_DDMSTRUCTURELINK);
1428    
1429                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1430                                            orderByComparator);
1431    
1432                                    sql = query.toString();
1433                            }
1434                            else {
1435                                    sql = _SQL_SELECT_DDMSTRUCTURELINK;
1436                            }
1437    
1438                            Session session = null;
1439    
1440                            try {
1441                                    session = openSession();
1442    
1443                                    Query q = session.createQuery(sql);
1444    
1445                                    if (orderByComparator == null) {
1446                                            list = (List<DDMStructureLink>)QueryUtil.list(q,
1447                                                            getDialect(), start, end, false);
1448    
1449                                            Collections.sort(list);
1450                                    }
1451                                    else {
1452                                            list = (List<DDMStructureLink>)QueryUtil.list(q,
1453                                                            getDialect(), start, end);
1454                                    }
1455                            }
1456                            catch (Exception e) {
1457                                    throw processException(e);
1458                            }
1459                            finally {
1460                                    if (list == null) {
1461                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1462                                    }
1463                                    else {
1464                                            cacheResult(list);
1465    
1466                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1467                                    }
1468    
1469                                    closeSession(session);
1470                            }
1471                    }
1472    
1473                    return list;
1474            }
1475    
1476            /**
1477             * Removes all the d d m structure links where classNameId = &#63; from the database.
1478             *
1479             * @param classNameId the class name ID
1480             * @throws SystemException if a system exception occurred
1481             */
1482            public void removeByClassNameId(long classNameId) throws SystemException {
1483                    for (DDMStructureLink ddmStructureLink : findByClassNameId(classNameId)) {
1484                            remove(ddmStructureLink);
1485                    }
1486            }
1487    
1488            /**
1489             * Removes the d d m structure link where classPK = &#63; from the database.
1490             *
1491             * @param classPK the class p k
1492             * @throws SystemException if a system exception occurred
1493             */
1494            public void removeByClassPK(long classPK)
1495                    throws NoSuchStructureLinkException, SystemException {
1496                    DDMStructureLink ddmStructureLink = findByClassPK(classPK);
1497    
1498                    remove(ddmStructureLink);
1499            }
1500    
1501            /**
1502             * Removes all the d d m structure links where structureId = &#63; from the database.
1503             *
1504             * @param structureId the structure ID
1505             * @throws SystemException if a system exception occurred
1506             */
1507            public void removeByStructureId(long structureId) throws SystemException {
1508                    for (DDMStructureLink ddmStructureLink : findByStructureId(structureId)) {
1509                            remove(ddmStructureLink);
1510                    }
1511            }
1512    
1513            /**
1514             * Removes all the d d m structure links from the database.
1515             *
1516             * @throws SystemException if a system exception occurred
1517             */
1518            public void removeAll() throws SystemException {
1519                    for (DDMStructureLink ddmStructureLink : findAll()) {
1520                            remove(ddmStructureLink);
1521                    }
1522            }
1523    
1524            /**
1525             * Returns the number of d d m structure links where classNameId = &#63;.
1526             *
1527             * @param classNameId the class name ID
1528             * @return the number of matching d d m structure links
1529             * @throws SystemException if a system exception occurred
1530             */
1531            public int countByClassNameId(long classNameId) throws SystemException {
1532                    Object[] finderArgs = new Object[] { classNameId };
1533    
1534                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1535                                    finderArgs, this);
1536    
1537                    if (count == null) {
1538                            StringBundler query = new StringBundler(2);
1539    
1540                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1541    
1542                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1543    
1544                            String sql = query.toString();
1545    
1546                            Session session = null;
1547    
1548                            try {
1549                                    session = openSession();
1550    
1551                                    Query q = session.createQuery(sql);
1552    
1553                                    QueryPos qPos = QueryPos.getInstance(q);
1554    
1555                                    qPos.add(classNameId);
1556    
1557                                    count = (Long)q.uniqueResult();
1558                            }
1559                            catch (Exception e) {
1560                                    throw processException(e);
1561                            }
1562                            finally {
1563                                    if (count == null) {
1564                                            count = Long.valueOf(0);
1565                                    }
1566    
1567                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1568                                            finderArgs, count);
1569    
1570                                    closeSession(session);
1571                            }
1572                    }
1573    
1574                    return count.intValue();
1575            }
1576    
1577            /**
1578             * Returns the number of d d m structure links where classPK = &#63;.
1579             *
1580             * @param classPK the class p k
1581             * @return the number of matching d d m structure links
1582             * @throws SystemException if a system exception occurred
1583             */
1584            public int countByClassPK(long classPK) throws SystemException {
1585                    Object[] finderArgs = new Object[] { classPK };
1586    
1587                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSPK,
1588                                    finderArgs, this);
1589    
1590                    if (count == null) {
1591                            StringBundler query = new StringBundler(2);
1592    
1593                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1594    
1595                            query.append(_FINDER_COLUMN_CLASSPK_CLASSPK_2);
1596    
1597                            String sql = query.toString();
1598    
1599                            Session session = null;
1600    
1601                            try {
1602                                    session = openSession();
1603    
1604                                    Query q = session.createQuery(sql);
1605    
1606                                    QueryPos qPos = QueryPos.getInstance(q);
1607    
1608                                    qPos.add(classPK);
1609    
1610                                    count = (Long)q.uniqueResult();
1611                            }
1612                            catch (Exception e) {
1613                                    throw processException(e);
1614                            }
1615                            finally {
1616                                    if (count == null) {
1617                                            count = Long.valueOf(0);
1618                                    }
1619    
1620                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSPK,
1621                                            finderArgs, count);
1622    
1623                                    closeSession(session);
1624                            }
1625                    }
1626    
1627                    return count.intValue();
1628            }
1629    
1630            /**
1631             * Returns the number of d d m structure links where structureId = &#63;.
1632             *
1633             * @param structureId the structure ID
1634             * @return the number of matching d d m structure links
1635             * @throws SystemException if a system exception occurred
1636             */
1637            public int countByStructureId(long structureId) throws SystemException {
1638                    Object[] finderArgs = new Object[] { structureId };
1639    
1640                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1641                                    finderArgs, this);
1642    
1643                    if (count == null) {
1644                            StringBundler query = new StringBundler(2);
1645    
1646                            query.append(_SQL_COUNT_DDMSTRUCTURELINK_WHERE);
1647    
1648                            query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
1649    
1650                            String sql = query.toString();
1651    
1652                            Session session = null;
1653    
1654                            try {
1655                                    session = openSession();
1656    
1657                                    Query q = session.createQuery(sql);
1658    
1659                                    QueryPos qPos = QueryPos.getInstance(q);
1660    
1661                                    qPos.add(structureId);
1662    
1663                                    count = (Long)q.uniqueResult();
1664                            }
1665                            catch (Exception e) {
1666                                    throw processException(e);
1667                            }
1668                            finally {
1669                                    if (count == null) {
1670                                            count = Long.valueOf(0);
1671                                    }
1672    
1673                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1674                                            finderArgs, count);
1675    
1676                                    closeSession(session);
1677                            }
1678                    }
1679    
1680                    return count.intValue();
1681            }
1682    
1683            /**
1684             * Returns the number of d d m structure links.
1685             *
1686             * @return the number of d d m structure links
1687             * @throws SystemException if a system exception occurred
1688             */
1689            public int countAll() throws SystemException {
1690                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1691                                    FINDER_ARGS_EMPTY, this);
1692    
1693                    if (count == null) {
1694                            Session session = null;
1695    
1696                            try {
1697                                    session = openSession();
1698    
1699                                    Query q = session.createQuery(_SQL_COUNT_DDMSTRUCTURELINK);
1700    
1701                                    count = (Long)q.uniqueResult();
1702                            }
1703                            catch (Exception e) {
1704                                    throw processException(e);
1705                            }
1706                            finally {
1707                                    if (count == null) {
1708                                            count = Long.valueOf(0);
1709                                    }
1710    
1711                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1712                                            FINDER_ARGS_EMPTY, count);
1713    
1714                                    closeSession(session);
1715                            }
1716                    }
1717    
1718                    return count.intValue();
1719            }
1720    
1721            /**
1722             * Initializes the d d m structure link persistence.
1723             */
1724            public void afterPropertiesSet() {
1725                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1726                                            com.liferay.portal.util.PropsUtil.get(
1727                                                    "value.object.listener.com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink")));
1728    
1729                    if (listenerClassNames.length > 0) {
1730                            try {
1731                                    List<ModelListener<DDMStructureLink>> listenersList = new ArrayList<ModelListener<DDMStructureLink>>();
1732    
1733                                    for (String listenerClassName : listenerClassNames) {
1734                                            listenersList.add((ModelListener<DDMStructureLink>)InstanceFactory.newInstance(
1735                                                            listenerClassName));
1736                                    }
1737    
1738                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1739                            }
1740                            catch (Exception e) {
1741                                    _log.error(e);
1742                            }
1743                    }
1744            }
1745    
1746            public void destroy() {
1747                    EntityCacheUtil.removeCache(DDMStructureLinkImpl.class.getName());
1748                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1749                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1750            }
1751    
1752            @BeanReference(type = DDMContentPersistence.class)
1753            protected DDMContentPersistence ddmContentPersistence;
1754            @BeanReference(type = DDMStorageLinkPersistence.class)
1755            protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
1756            @BeanReference(type = DDMStructurePersistence.class)
1757            protected DDMStructurePersistence ddmStructurePersistence;
1758            @BeanReference(type = DDMStructureLinkPersistence.class)
1759            protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
1760            @BeanReference(type = DDMTemplatePersistence.class)
1761            protected DDMTemplatePersistence ddmTemplatePersistence;
1762            @BeanReference(type = ResourcePersistence.class)
1763            protected ResourcePersistence resourcePersistence;
1764            @BeanReference(type = UserPersistence.class)
1765            protected UserPersistence userPersistence;
1766            private static final String _SQL_SELECT_DDMSTRUCTURELINK = "SELECT ddmStructureLink FROM DDMStructureLink ddmStructureLink";
1767            private static final String _SQL_SELECT_DDMSTRUCTURELINK_WHERE = "SELECT ddmStructureLink FROM DDMStructureLink ddmStructureLink WHERE ";
1768            private static final String _SQL_COUNT_DDMSTRUCTURELINK = "SELECT COUNT(ddmStructureLink) FROM DDMStructureLink ddmStructureLink";
1769            private static final String _SQL_COUNT_DDMSTRUCTURELINK_WHERE = "SELECT COUNT(ddmStructureLink) FROM DDMStructureLink ddmStructureLink WHERE ";
1770            private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "ddmStructureLink.classNameId = ?";
1771            private static final String _FINDER_COLUMN_CLASSPK_CLASSPK_2 = "ddmStructureLink.classPK = ?";
1772            private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2 = "ddmStructureLink.structureId = ?";
1773            private static final String _ORDER_BY_ENTITY_ALIAS = "ddmStructureLink.";
1774            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDMStructureLink exists with the primary key ";
1775            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDMStructureLink exists with the key {";
1776            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1777            private static Log _log = LogFactoryUtil.getLog(DDMStructureLinkPersistenceImpl.class);
1778            private static DDMStructureLink _nullDDMStructureLink = new DDMStructureLinkImpl() {
1779                            @Override
1780                            public Object clone() {
1781                                    return this;
1782                            }
1783    
1784                            @Override
1785                            public CacheModel<DDMStructureLink> toCacheModel() {
1786                                    return _nullDDMStructureLinkCacheModel;
1787                            }
1788                    };
1789    
1790            private static CacheModel<DDMStructureLink> _nullDDMStructureLinkCacheModel = new CacheModel<DDMStructureLink>() {
1791                            public DDMStructureLink toEntityModel() {
1792                                    return _nullDDMStructureLink;
1793                            }
1794                    };
1795    }