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.asset.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.exception.PortalException;
021    import com.liferay.portal.util.PortalUtil;
022    
023    import com.liferay.portlet.asset.model.AssetCategory;
024    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
025    import com.liferay.portlet.exportimport.lar.ManifestSummary;
026    import com.liferay.portlet.exportimport.lar.PortletDataContext;
027    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
028    import com.liferay.portlet.exportimport.lar.StagedModelType;
029    
030    /**
031     * @author Brian Wing Shun Chan
032     * @deprecated As of 7.0.0, replaced by {@link com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil#getExportActionableDynamicQuery(PortletDataContext)}
033     * @generated
034     */
035    @Deprecated
036    @ProviderType
037    public class AssetCategoryExportActionableDynamicQuery
038            extends AssetCategoryActionableDynamicQuery {
039            public AssetCategoryExportActionableDynamicQuery(
040                    PortletDataContext portletDataContext) {
041                    _portletDataContext = portletDataContext;
042    
043                    setCompanyId(_portletDataContext.getCompanyId());
044    
045                    setGroupId(_portletDataContext.getScopeGroupId());
046            }
047    
048            @Override
049            public long performCount() throws PortalException {
050                    ManifestSummary manifestSummary = _portletDataContext.getManifestSummary();
051    
052                    StagedModelType stagedModelType = getStagedModelType();
053    
054                    long modelAdditionCount = super.performCount();
055    
056                    manifestSummary.addModelAdditionCount(stagedModelType.toString(),
057                            modelAdditionCount);
058    
059                    long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(_portletDataContext,
060                                    stagedModelType);
061    
062                    manifestSummary.addModelDeletionCount(stagedModelType.toString(),
063                            modelDeletionCount);
064    
065                    return modelAdditionCount;
066            }
067    
068            @Override
069            protected void addCriteria(DynamicQuery dynamicQuery) {
070                    _portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
071            }
072    
073            protected StagedModelType getStagedModelType() {
074                    return new StagedModelType(PortalUtil.getClassNameId(
075                                    AssetCategory.class.getName()));
076            }
077    
078            @Override
079            protected void performAction(Object object) throws PortalException {
080                    AssetCategory stagedModel = (AssetCategory)object;
081    
082                    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext,
083                            stagedModel);
084            }
085    
086            private PortletDataContext _portletDataContext;
087    }