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