001    /**
002     * Copyright (c) 2000-present 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.portal.kernel.workflow;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
019    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
020    import com.liferay.portal.model.WorkflowDefinitionLink;
021    import com.liferay.portal.service.ServiceContext;
022    import com.liferay.portlet.asset.model.AssetRenderer;
023    import com.liferay.portlet.asset.model.AssetRendererFactory;
024    
025    import java.io.Serializable;
026    
027    import java.util.Locale;
028    import java.util.Map;
029    
030    import javax.portlet.PortletRequest;
031    import javax.portlet.PortletResponse;
032    import javax.portlet.PortletURL;
033    import javax.portlet.RenderRequest;
034    import javax.portlet.RenderResponse;
035    
036    /**
037     * @author Bruno Farache
038     * @author Macerllus Tavares
039     * @author Juan Fern??ndez
040     * @author Julio Camarero
041     */
042    public interface WorkflowHandler<T> {
043    
044            public AssetRenderer getAssetRenderer(long classPK) throws PortalException;
045    
046            public AssetRendererFactory getAssetRendererFactory();
047    
048            public String getClassName();
049    
050            public String getIconCssClass();
051    
052            public String getIconPath(LiferayPortletRequest liferayPortletRequest);
053    
054            /**
055             * @deprecated As of 7.0.0, replaced by {@link #getSummary(long,
056             *             PortletRequest, PortletResponse)}
057             */
058            @Deprecated
059            public String getSummary(long classPK, Locale locale);
060    
061            public String getSummary(
062                    long classPK, PortletRequest portletRequest,
063                    PortletResponse portletResponse);
064    
065            public String getTitle(long classPK, Locale locale);
066    
067            public String getType(Locale locale);
068    
069            public PortletURL getURLEdit(
070                    long classPK, LiferayPortletRequest liferayPortletRequest,
071                    LiferayPortletResponse liferayPortletResponse);
072    
073            public String getURLEditWorkflowTask(
074                            long workflowTaskId, ServiceContext serviceContext)
075                    throws PortalException;
076    
077            public PortletURL getURLViewDiffs(
078                    long classPK, LiferayPortletRequest liferayPortletRequest,
079                    LiferayPortletResponse liferayPortletResponse);
080    
081            public String getURLViewInContext(
082                    long classPK, LiferayPortletRequest liferayPortletRequest,
083                    LiferayPortletResponse liferayPortletResponse,
084                    String noSuchEntryRedirect);
085    
086            public WorkflowDefinitionLink getWorkflowDefinitionLink(
087                            long companyId, long groupId, long classPK)
088                    throws PortalException;
089    
090            public boolean isAssetTypeSearchable();
091    
092            public boolean isScopeable();
093    
094            public boolean isVisible();
095    
096            public String render(
097                    long classPK, RenderRequest renderRequest,
098                    RenderResponse renderResponse, String template);
099    
100            public void startWorkflowInstance(
101                            long companyId, long groupId, long userId, long classPK, T model,
102                            Map<String, Serializable> workflowContext)
103                    throws PortalException;
104    
105            public T updateStatus(int status, Map<String, Serializable> workflowContext)
106                    throws PortalException;
107    
108    }