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    
034    import javax.servlet.http.HttpServletRequest;
035    import javax.servlet.http.HttpServletResponse;
036    
037    /**
038     * @author Bruno Farache
039     * @author Macerllus Tavares
040     * @author Juan Fern??ndez
041     * @author Julio Camarero
042     */
043    public interface WorkflowHandler<T> {
044    
045            public AssetRenderer<T> getAssetRenderer(long classPK)
046                    throws PortalException;
047    
048            public AssetRendererFactory<T> getAssetRendererFactory();
049    
050            public String getClassName();
051    
052            public String getIconCssClass();
053    
054            public String getIconPath(LiferayPortletRequest liferayPortletRequest);
055    
056            /**
057             * @deprecated As of 7.0.0, replaced by {@link #getSummary(long,
058             *             PortletRequest, PortletResponse)}
059             */
060            @Deprecated
061            public String getSummary(long classPK, Locale locale);
062    
063            public String getSummary(
064                    long classPK, PortletRequest portletRequest,
065                    PortletResponse portletResponse);
066    
067            public String getTitle(long classPK, Locale locale);
068    
069            public String getType(Locale locale);
070    
071            public PortletURL getURLEdit(
072                    long classPK, LiferayPortletRequest liferayPortletRequest,
073                    LiferayPortletResponse liferayPortletResponse);
074    
075            public String getURLEditWorkflowTask(
076                            long workflowTaskId, ServiceContext serviceContext)
077                    throws PortalException;
078    
079            public PortletURL getURLViewDiffs(
080                    long classPK, LiferayPortletRequest liferayPortletRequest,
081                    LiferayPortletResponse liferayPortletResponse);
082    
083            public String getURLViewInContext(
084                    long classPK, LiferayPortletRequest liferayPortletRequest,
085                    LiferayPortletResponse liferayPortletResponse,
086                    String noSuchEntryRedirect);
087    
088            public WorkflowDefinitionLink getWorkflowDefinitionLink(
089                            long companyId, long groupId, long classPK)
090                    throws PortalException;
091    
092            public boolean include(
093                    long classPK, HttpServletRequest request, HttpServletResponse response,
094                    String template);
095    
096            public boolean isAssetTypeSearchable();
097    
098            public boolean isScopeable();
099    
100            public boolean isVisible();
101    
102            public void startWorkflowInstance(
103                            long companyId, long groupId, long userId, long classPK, T model,
104                            Map<String, Serializable> workflowContext)
105                    throws PortalException;
106    
107            public T updateStatus(int status, Map<String, Serializable> workflowContext)
108                    throws PortalException;
109    
110    }