001    /**
002     * Copyright (c) 2000-2012 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.xml.Element;
018    import com.liferay.portal.model.StagedModel;
019    
020    /**
021     * @author Mate Thurzo
022     * @author Daniel Kocsis
023     */
024    public abstract class BaseStagedModelDataHandler<T extends StagedModel>
025            implements StagedModelDataHandler<T> {
026    
027            public void export(
028                    T stagedModel, PortletDataContext portletDataContext,
029                    Element... elements) {
030            }
031    
032            public abstract String getClassName();
033    
034            public void importData(
035                    Element stagedModelElement, PortletDataContext portletDataContext) {
036    
037                    String path = stagedModelElement.attributeValue("path");
038    
039                    T stagedModel = (T)portletDataContext.getZipEntryAsObject(
040                            stagedModelElement, path);
041    
042                    if (!portletDataContext.isPathNotProcessed(path)) {
043                            return;
044                    }
045    
046                    importData(stagedModel, path, portletDataContext);
047            }
048    
049            public void importData(
050                    T stagedModel, String path, PortletDataContext portletDataContext) {
051            }
052    
053    }