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