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