001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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            @Override
036            public boolean addGroupPermissions(
037                            PortletDataContext context, Object journalObj)
038                    throws Exception {
039    
040                    return true;
041            }
042    
043            @Override
044            public boolean addGuestPermissions(
045                            PortletDataContext context, Object journalObj)
046                    throws Exception {
047    
048                    return true;
049            }
050    
051            @Override
052            public long getAuthorUserId(PortletDataContext context, Object journalObj)
053                    throws Exception {
054    
055                    return JournalCreationStrategy.USE_DEFAULT_USER_ID_STRATEGY;
056            }
057    
058            @Override
059            public String getTransformedContent(
060                            PortletDataContext context, JournalArticle newArticle)
061                    throws Exception {
062    
063                    return JournalCreationStrategy.ARTICLE_CONTENT_UNCHANGED;
064            }
065    
066    }