001    /**
002     * Copyright (c) 2000-present 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.documentlibrary.service.persistence;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
020    import com.liferay.portal.kernel.dao.orm.Property;
021    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
022    import com.liferay.portal.kernel.exception.PortalException;
023    import com.liferay.portal.util.PortalUtil;
024    
025    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
026    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
027    import com.liferay.portlet.exportimport.lar.ManifestSummary;
028    import com.liferay.portlet.exportimport.lar.PortletDataContext;
029    import com.liferay.portlet.exportimport.lar.StagedModelDataHandler;
030    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerRegistryUtil;
031    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
032    import com.liferay.portlet.exportimport.lar.StagedModelType;
033    
034    /**
035     * @author Brian Wing Shun Chan
036     * @deprecated As of 7.0.0, replaced by {@link com.liferay.portlet.documentlibrary.service.DLFileShortcutLocalServiceUtil#getExportActionableDynamicQuery(PortletDataContext)}
037     * @generated
038     */
039    @Deprecated
040    @ProviderType
041    public class DLFileShortcutExportActionableDynamicQuery
042            extends DLFileShortcutActionableDynamicQuery {
043            public DLFileShortcutExportActionableDynamicQuery(
044                    PortletDataContext portletDataContext) {
045                    _portletDataContext = portletDataContext;
046    
047                    setCompanyId(_portletDataContext.getCompanyId());
048    
049                    setGroupId(_portletDataContext.getScopeGroupId());
050            }
051    
052            @Override
053            public long performCount() throws PortalException {
054                    ManifestSummary manifestSummary = _portletDataContext.getManifestSummary();
055    
056                    StagedModelType stagedModelType = getStagedModelType();
057    
058                    long modelAdditionCount = super.performCount();
059    
060                    manifestSummary.addModelAdditionCount(stagedModelType.toString(),
061                            modelAdditionCount);
062    
063                    long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(_portletDataContext,
064                                    stagedModelType);
065    
066                    manifestSummary.addModelDeletionCount(stagedModelType.toString(),
067                            modelDeletionCount);
068    
069                    return modelAdditionCount;
070            }
071    
072            @Override
073            protected void addCriteria(DynamicQuery dynamicQuery) {
074                    _portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
075    
076                    StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil.getStagedModelDataHandler(DLFileShortcut.class.getName());
077    
078                    Property workflowStatusProperty = PropertyFactoryUtil.forName("status");
079    
080                    dynamicQuery.add(workflowStatusProperty.in(
081                                    stagedModelDataHandler.getExportableStatuses()));
082            }
083    
084            protected StagedModelType getStagedModelType() {
085                    return new StagedModelType(PortalUtil.getClassNameId(
086                                    DLFileShortcut.class.getName()));
087            }
088    
089            @Override
090            protected void performAction(Object object) throws PortalException {
091                    DLFileShortcut stagedModel = (DLFileShortcut)object;
092    
093                    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext,
094                            stagedModel);
095            }
096    
097            private PortletDataContext _portletDataContext;
098    }