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