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.exception.PortalException;
021    import com.liferay.portal.model.User;
022    import com.liferay.portal.util.PortalUtil;
023    
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.portal.service.UserLocalServiceUtil#getExportActionableDynamicQuery(PortletDataContext)}
033     * @generated
034     */
035    @Deprecated
036    @ProviderType
037    public class UserExportActionableDynamicQuery extends UserActionableDynamicQuery {
038            public UserExportActionableDynamicQuery(
039                    PortletDataContext portletDataContext) {
040                    _portletDataContext = portletDataContext;
041    
042                    setCompanyId(_portletDataContext.getCompanyId());
043            }
044    
045            @Override
046            public long performCount() throws PortalException {
047                    ManifestSummary manifestSummary = _portletDataContext.getManifestSummary();
048    
049                    StagedModelType stagedModelType = getStagedModelType();
050    
051                    long modelAdditionCount = super.performCount();
052    
053                    manifestSummary.addModelAdditionCount(stagedModelType.toString(),
054                            modelAdditionCount);
055    
056                    long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(_portletDataContext,
057                                    stagedModelType);
058    
059                    manifestSummary.addModelDeletionCount(stagedModelType.toString(),
060                            modelDeletionCount);
061    
062                    return modelAdditionCount;
063            }
064    
065            @Override
066            protected void addCriteria(DynamicQuery dynamicQuery) {
067                    _portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
068            }
069    
070            protected StagedModelType getStagedModelType() {
071                    return new StagedModelType(PortalUtil.getClassNameId(
072                                    User.class.getName()));
073            }
074    
075            @Override
076            protected void performAction(Object object) throws PortalException {
077                    User stagedModel = (User)object;
078    
079                    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext,
080                            stagedModel);
081            }
082    
083            private PortletDataContext _portletDataContext;
084    }