001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.dao.orm.DynamicQuery;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.lar.ExportImportHelperUtil;
021    import com.liferay.portal.kernel.lar.ManifestSummary;
022    import com.liferay.portal.kernel.lar.PortletDataContext;
023    import com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil;
024    import com.liferay.portal.kernel.lar.StagedModelType;
025    import com.liferay.portal.model.Layout;
026    import com.liferay.portal.util.PortalUtil;
027    
028    /**
029     * @author Brian Wing Shun Chan
030     * @generated
031     */
032    public class LayoutExportActionableDynamicQuery
033            extends LayoutActionableDynamicQuery {
034            public LayoutExportActionableDynamicQuery(
035                    PortletDataContext portletDataContext) throws SystemException {
036                    _portletDataContext = portletDataContext;
037    
038                    setCompanyId(_portletDataContext.getCompanyId());
039    
040                    setGroupId(_portletDataContext.getScopeGroupId());
041            }
042    
043            @Override
044            public long performCount() throws PortalException, SystemException {
045                    ManifestSummary manifestSummary = _portletDataContext.getManifestSummary();
046    
047                    StagedModelType stagedModelType = getStagedModelType();
048    
049                    long modelAdditionCount = super.performCount();
050    
051                    manifestSummary.addModelAdditionCount(stagedModelType.toString(),
052                            modelAdditionCount);
053    
054                    long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(_portletDataContext,
055                                    stagedModelType);
056    
057                    manifestSummary.addModelDeletionCount(stagedModelType.toString(),
058                            modelDeletionCount);
059    
060                    return modelAdditionCount;
061            }
062    
063            @Override
064            protected void addCriteria(DynamicQuery dynamicQuery) {
065                    _portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
066            }
067    
068            protected StagedModelType getStagedModelType() {
069                    return new StagedModelType(PortalUtil.getClassNameId(
070                                    Layout.class.getName()));
071            }
072    
073            @Override
074            @SuppressWarnings("unused")
075            protected void performAction(Object object)
076                    throws PortalException, SystemException {
077                    Layout stagedModel = (Layout)object;
078    
079                    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext,
080                            stagedModel);
081            }
082    
083            private PortletDataContext _portletDataContext;
084    }