001    /**
002     * Copyright (c) 2000-2010 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.portal.kernel.lar.PortletDataContext;
018    import com.liferay.portlet.journal.model.JournalArticle;
019    
020    /**
021     * <p>
022     * Provides the strategy for creating new content when new Journal content is
023     * imported into a layout set from a LAR. The default strategy implemented by
024     * this class is to return zero for the author and approval user ids, which
025     * causes the default user id import strategy to be used. Content will be added
026     * as is with no transformations.
027     * </p>
028     *
029     * @author Joel Kozikowski
030     * @see    com.liferay.portlet.journal.lar.JournalContentPortletDataHandlerImpl
031     * @see    com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl
032     */
033    public class JournalCreationStrategyImpl implements JournalCreationStrategy {
034    
035            public long getAuthorUserId(PortletDataContext context, Object journalObj)
036                    throws Exception {
037    
038                    return JournalCreationStrategy.USE_DEFAULT_USER_ID_STRATEGY;
039            }
040    
041            public String getTransformedContent(
042                            PortletDataContext context, JournalArticle newArticle)
043                    throws Exception {
044    
045                    return JournalCreationStrategy.ARTICLE_CONTENT_UNCHANGED;
046            }
047    
048            public boolean addCommunityPermissions(
049                            PortletDataContext context, Object journalObj)
050                    throws Exception {
051    
052                    return true;
053            }
054    
055            public boolean addGuestPermissions(
056                            PortletDataContext context, Object journalObj)
057                    throws Exception {
058    
059                    return true;
060            }
061    
062    }