1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.lar;
16  
17  import com.liferay.portal.lar.PortletDataContext;
18  import com.liferay.portlet.journal.model.JournalArticle;
19  
20  /**
21   * <a href="JournalCreationStrategyImpl.java.html"><b><i>View Source</i></b></a>
22   *
23   * <p>
24   * Provides the strategy for creating new content when new Journal content is
25   * imported into a layout set from a LAR. The default strategy implemented by
26   * this class is to return zero for the author and approval user ids, which
27   * causes the default user id import strategy to be used. Content will be added
28   * as is with no transformations.
29   * </p>
30   *
31   * @author Joel Kozikowski
32   * @see    com.liferay.portlet.journal.lar.JournalContentPortletDataHandlerImpl
33   * @see    com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl
34   */
35  public class JournalCreationStrategyImpl implements JournalCreationStrategy {
36  
37      public long getAuthorUserId(PortletDataContext context, Object journalObj)
38          throws Exception {
39  
40          return JournalCreationStrategy.USE_DEFAULT_USER_ID_STRATEGY;
41      }
42  
43      public long getApprovalUserId(PortletDataContext context, Object journalObj)
44          throws Exception {
45  
46          return JournalCreationStrategy.USE_DEFAULT_USER_ID_STRATEGY;
47      }
48  
49      public String getTransformedContent(
50              PortletDataContext context, JournalArticle newArticle)
51          throws Exception {
52  
53          return JournalCreationStrategy.ARTICLE_CONTENT_UNCHANGED;
54      }
55  
56      public boolean addCommunityPermissions(
57              PortletDataContext context, Object journalObj)
58          throws Exception {
59  
60          return true;
61      }
62  
63      public boolean addGuestPermissions(
64              PortletDataContext context, Object journalObj)
65          throws Exception {
66  
67          return true;
68      }
69  
70  }