001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Mariana Cedica 018 * 019 * $Id$ 020 */ 021package org.nuxeo.ecm.platform.routing.web; 022 023import static org.jboss.seam.ScopeType.CONVERSATION; 024 025import java.io.Serializable; 026import java.util.List; 027 028import org.jboss.seam.annotations.In; 029import org.jboss.seam.annotations.Install; 030import org.jboss.seam.annotations.Name; 031import org.jboss.seam.annotations.Observer; 032import org.jboss.seam.annotations.Scope; 033import org.jboss.seam.annotations.intercept.BypassInterceptors; 034import org.nuxeo.ecm.core.api.DocumentModel; 035import org.nuxeo.ecm.platform.actions.Action; 036import org.nuxeo.ecm.platform.actions.ActionContext; 037import org.nuxeo.ecm.platform.ui.web.api.WebActions; 038import org.nuxeo.ecm.webapp.action.ActionContextProvider; 039import org.nuxeo.ecm.webapp.helpers.EventNames; 040 041/** 042 * Web Actions to edit a document route 043 * 044 * @author Mariana Cedica 045 * @deprecated since 5.9.2 - Use only routes of type 'graph' 046 */ 047@Deprecated 048@Name("routingWebActions") 049@Scope(CONVERSATION) 050@Install(precedence = Install.FRAMEWORK) 051public class DocumentRoutingWebActionsBean implements Serializable { 052 053 /** 054 * 055 */ 056 private static final long serialVersionUID = 1L; 057 058 @In(create = true, required = false) 059 protected transient WebActions webActions; 060 061 @In(create = true, required = false) 062 protected transient ActionContextProvider actionContextProvider; 063 064 protected List<Action> addStepActions; 065 066 protected List<Action> addStepInForkActions; 067 068 protected List<Action> removeStepActions; 069 070 protected List<Action> editStepActions; 071 072 /** 073 * @deprecated since 5.9.2 - Use only routes of type 'graph' 074 */ 075 @Deprecated 076 public List<Action> getAddStepActions(DocumentModel step) { 077 ActionContext context = actionContextProvider.createActionContext(); 078 context.setCurrentDocument(step); 079 addStepActions = webActions.getActionsList(DocumentRoutingWebConstants.ADD_STEP_ACTIONS_LIST, context); 080 return addStepActions; 081 } 082 083 /** 084 * @deprecated since 5.9.2 - Use only routes of type 'graph' 085 */ 086 @Deprecated 087 public List<Action> getAddStepInActions(DocumentModel step) { 088 ActionContext context = actionContextProvider.createActionContext(); 089 context.setCurrentDocument(step); 090 addStepInForkActions = webActions.getActionsList(DocumentRoutingWebConstants.ADD_STEP_IN_FORK_ACTIONS_LIST, 091 context); 092 return addStepInForkActions; 093 } 094 095 /** 096 * @deprecated since 5.9.2 - Use only routes of type 'graph' 097 */ 098 @Deprecated 099 public List<Action> getRemoveStepActions(DocumentModel step) { 100 ActionContext context = actionContextProvider.createActionContext(); 101 context.setCurrentDocument(step); 102 removeStepActions = webActions.getActionsList(DocumentRoutingWebConstants.REMOVE_STEP_ACTIONS_LIST, context); 103 return removeStepActions; 104 } 105 106 /** 107 * @deprecated since 5.9.2 - Use only routes of type 'graph' 108 */ 109 @Deprecated 110 public List<Action> getEditStepActions(DocumentModel step) { 111 ActionContext context = actionContextProvider.createActionContext(); 112 context.setCurrentDocument(step); 113 editStepActions = webActions.getActionsList(DocumentRoutingWebConstants.EDIT_STEP_ACTIONS_LIST, context); 114 return editStepActions; 115 } 116 117 @Observer(value = { EventNames.USER_ALL_DOCUMENT_TYPES_SELECTION_CHANGED, EventNames.LOCATION_SELECTION_CHANGED }, create = false) 118 @BypassInterceptors 119 public void resetTabList() { 120 addStepActions = null; 121 removeStepActions = null; 122 addStepInForkActions = null; 123 editStepActions = null; 124 } 125 126}