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.journal.lar;
016    
017    import com.liferay.portlet.exportimport.lar.PortletDataContext;
018    import com.liferay.portlet.journal.model.JournalArticle;
019    
020    /**
021     * Provides the strategy for creating new content when new Journal content is
022     * imported into a layout set from a LAR. The default strategy implemented by
023     * this class is to return zero for the author and approval user IDs, which
024     * causes the default user ID import strategy to be used. Content will be added
025     * as is with no transformations.
026     *
027     * <p>
028     * For a better understanding of this class, see
029     * <code>com.liferay.journal.content.web.lar.JournalContentPortletDataHandler</code>
030     * located in Liferay Portal's external <code>modules</code> directory.
031     * </p>
032     *
033     * @author Joel Kozikowski
034     */
035    public class JournalCreationStrategyImpl implements JournalCreationStrategy {
036    
037            @Override
038            public boolean addGroupPermissions(
039                            PortletDataContext context, Object journalObj)
040                    throws Exception {
041    
042                    return true;
043            }
044    
045            @Override
046            public boolean addGuestPermissions(
047                            PortletDataContext context, Object journalObj)
048                    throws Exception {
049    
050                    return true;
051            }
052    
053            @Override
054            public long getAuthorUserId(PortletDataContext context, Object journalObj)
055                    throws Exception {
056    
057                    return JournalCreationStrategy.USE_DEFAULT_USER_ID_STRATEGY;
058            }
059    
060            @Override
061            public String getTransformedContent(
062                            PortletDataContext context, JournalArticle newArticle)
063                    throws Exception {
064    
065                    return JournalCreationStrategy.ARTICLE_CONTENT_UNCHANGED;
066            }
067    
068    }