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.workflow;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.service.ServiceContext;
20  import com.liferay.portal.workflow.BaseWorkflowHandler;
21  import com.liferay.portlet.asset.model.AssetRenderer;
22  import com.liferay.portlet.journal.asset.JournalArticleAssetRenderer;
23  import com.liferay.portlet.journal.model.JournalArticle;
24  import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil;
25  
26  /**
27   * <a href="JournalArticleWorkflowHandler.java.html"><b><i>View Source</i></b>
28   * </a>
29   *
30   * @author Bruno Farache
31   * @author Marcellus Tavares
32   */
33  public class JournalArticleWorkflowHandler extends BaseWorkflowHandler {
34  
35      public static final String CLASS_NAME = JournalArticle.class.getName();
36  
37      public String getClassName() {
38          return CLASS_NAME;
39      }
40  
41      public String getType() {
42          return TYPE_CONTENT;
43      }
44  
45      public JournalArticle updateStatus(
46              long companyId, long groupId, long userId, long classPK, int status)
47          throws PortalException, SystemException {
48  
49          ServiceContext serviceContext = new ServiceContext();
50  
51          serviceContext.setScopeGroupId(groupId);
52  
53          return JournalArticleLocalServiceUtil.updateStatus(
54              userId, classPK, status, serviceContext);
55      }
56  
57      protected AssetRenderer getAssetRenderer(long classPK)
58          throws PortalException, SystemException {
59  
60          JournalArticle article = JournalArticleLocalServiceUtil.getArticle(
61              classPK);
62  
63          return new JournalArticleAssetRenderer(article);
64      }
65  
66  }