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