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