001/* 002 * (C) Copyright 2013 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 * Thomas Roger 018 */ 019 020package org.nuxeo.ecm.automation.jsf.operations; 021 022import org.jboss.seam.core.Events; 023import org.nuxeo.ecm.automation.core.Constants; 024import org.nuxeo.ecm.automation.core.annotations.Operation; 025import org.nuxeo.ecm.automation.core.annotations.OperationMethod; 026import org.nuxeo.ecm.automation.core.annotations.Param; 027import org.nuxeo.ecm.automation.core.util.StringList; 028 029/** 030 * Operation that raises configurable seam events. 031 * 032 * @since 5.7 033 */ 034@Operation(id = RaiseSeamEvents.ID, category = Constants.CAT_UI, requires = Constants.SEAM_CONTEXT, label = "Raise Seam events", description = "Raise Seam events without parameters. This is a void operation - the input object is returned back as the output", aliases = { "Seam.RaiseEvents" }) 035public class RaiseSeamEvents { 036 037 public static final String ID = "WebUI.RaiseSeamEvents"; 038 039 @Param(name = "seamEvents", required = true) 040 protected StringList seamEvents; 041 042 @OperationMethod 043 public void run() { 044 if (seamEvents != null) { 045 for (String event : seamEvents) { 046 Events.instance().raiseEvent(event); 047 } 048 } 049 } 050 051}