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.Repository;
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.RepositoryLocalServiceUtil#getExportActionableDynamicQuery(PortletDataContext)}
035     * @generated
036     */
037    @Deprecated
038    @ProviderType
039    public class RepositoryExportActionableDynamicQuery
040            extends RepositoryActionableDynamicQuery {
041            public RepositoryExportActionableDynamicQuery(
042                    PortletDataContext portletDataContext) {
043                    _portletDataContext = portletDataContext;
044    
045                    setCompanyId(_portletDataContext.getCompanyId());
046    
047                    setGroupId(_portletDataContext.getScopeGroupId());
048            }
049    
050            @Override
051            public long performCount() throws PortalException {
052                    ManifestSummary manifestSummary = _portletDataContext.getManifestSummary();
053    
054                    StagedModelType stagedModelType = getStagedModelType();
055    
056                    long modelAdditionCount = super.performCount();
057    
058                    manifestSummary.addModelAdditionCount(stagedModelType.toString(),
059                            modelAdditionCount);
060    
061                    long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(_portletDataContext,
062                                    stagedModelType);
063    
064                    manifestSummary.addModelDeletionCount(stagedModelType.toString(),
065                            modelDeletionCount);
066    
067                    return modelAdditionCount;
068            }
069    
070            @Override
071            protected void addCriteria(DynamicQuery dynamicQuery) {
072                    _portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
073    
074                    if (getStagedModelType().getReferrerClassNameId() >= 0) {
075                            Property classNameIdProperty = PropertyFactoryUtil.forName(
076                                            "classNameId");
077    
078                            dynamicQuery.add(classNameIdProperty.eq(getStagedModelType()
079                                                                                                                    .getReferrerClassNameId()));
080                    }
081            }
082    
083            protected StagedModelType getStagedModelType() {
084                    return new StagedModelType(PortalUtil.getClassNameId(
085                                    Repository.class.getName()));
086            }
087    
088            @Override
089            protected void performAction(Object object) throws PortalException {
090                    Repository stagedModel = (Repository)object;
091    
092                    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext,
093                            stagedModel);
094            }
095    
096            private PortletDataContext _portletDataContext;
097    }