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.kernel.lar;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.xml.Element;
019    import com.liferay.portal.model.StagedModel;
020    
021    import java.util.Map;
022    
023    /**
024     * @author Mate Thurzo
025     * @author Daniel Kocsis
026     * @author Zsolt Berentey
027     */
028    public interface StagedModelDataHandler<T extends StagedModel> {
029    
030            public void deleteStagedModel(
031                            String uuid, long groupId, String className, String extraData)
032                    throws PortalException;
033    
034            public void exportStagedModel(
035                            PortletDataContext portletDataContext, T stagedModel)
036                    throws PortletDataException;
037    
038            public T fetchMissingReference(String uuid, long groupId);
039    
040            public T fetchStagedModelByUuidAndCompanyId(String uuid, long companyId);
041    
042            public T fetchStagedModelByUuidAndGroupId(String uuid, long groupId);
043    
044            public String[] getClassNames();
045    
046            public String getDisplayName(T StagedModel);
047    
048            public int[] getExportableStatuses();
049    
050            public Map<String, String> getReferenceAttributes(
051                    PortletDataContext portletDataContext, T stagedModel);
052    
053            /**
054             * @deprecated As of 7.0.0, replaced by {@link
055             *             #importMissingReference(PortletDataContext, Element)}
056             */
057            @Deprecated
058            public void importCompanyStagedModel(
059                            PortletDataContext portletDataContext, Element element)
060                    throws PortletDataException;
061    
062            /**
063             * @deprecated As of 7.0.0, replaced by {@link
064             *             #importMissingReference(PortletDataContext, String, long,
065             *             long)}
066             */
067            @Deprecated
068            public void importCompanyStagedModel(
069                            PortletDataContext portletDataContext, String uuid, long classPK)
070                    throws PortletDataException;
071    
072            public void importMissingReference(
073                            PortletDataContext portletDataContext, Element referenceElement)
074                    throws PortletDataException;
075    
076            public void importMissingReference(
077                            PortletDataContext portletDataContext, String uuid, long groupId,
078                            long classPK)
079                    throws PortletDataException;
080    
081            public void importStagedModel(
082                            PortletDataContext portletDataContext, T stagedModel)
083                    throws PortletDataException;
084    
085            public void restoreStagedModel(
086                            PortletDataContext portletDataContext, T stagedModel)
087                    throws PortletDataException;
088    
089            public boolean validateReference(
090                    PortletDataContext portletDataContext, Element referenceElement);
091    
092    }