001/* 002 * (C) Copyright 2006-2011 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 * bstefanescu 018 */ 019package org.nuxeo.ecm.automation.core.annotations; 020 021import java.lang.annotation.ElementType; 022import java.lang.annotation.Retention; 023import java.lang.annotation.RetentionPolicy; 024import java.lang.annotation.Target; 025 026/** 027 * Marks a class as being an operation. 028 * <p> 029 * An operation may provide an ID as the annotation value. If no id is specified the class name will be used as the ID. 030 * <p> 031 * The ID is the key used to register the operation. 032 * <p> 033 * Make sure you choose a proper ID name to avoid collisions (using the default: ID the class name can be a solution). 034 * 035 * @author <a href="mailto:[email protected]">Bogdan Stefanescu</a> 036 */ 037@Retention(RetentionPolicy.RUNTIME) 038@Target(ElementType.TYPE) 039public @interface Operation { 040 041 /** 042 * The operation ID (mandatory). 043 * <p> 044 * If not specified the absolute name of the annotated class will be used. 045 */ 046 String id() default ""; 047 048 /** 049 * The operation category (optional), useful for documentation. 050 * <p> 051 * Provide a category to be used by the UI to classify the operations (on the documentation page or in Studio). 052 */ 053 String category() default "Others"; 054 055 /** 056 * The operation label (optional), useful for documentation. 057 * <p> 058 * Provide a label for the operation to be used in UI (should not contain any HTML code). 059 */ 060 String label() default ""; 061 062 /** 063 * Name of the context requires by this operation (optional), useful for documentation. 064 * <p> 065 * Provide the name of the context required by this operation. Example: event, ui, wf, etc.. 066 */ 067 String requires() default ""; 068 069 /** 070 * Description of this operation (optional), useful for documentation. 071 * <p> 072 * Provide a description of the operation (may contain HTML code). 073 */ 074 String description() default ""; 075 076 /** 077 * Nuxeo version from which this operation is available (optional), useful for documentation. 078 * <p> 079 * The default value is the null string "" which means no specific version is required. Examples: "5.4", "5.9.1". 080 */ 081 String since() default ""; 082 083 /** 084 * Nuxeo version from which this operation is deprecated (optional), useful for documentation. 085 * <p> 086 * The default value is the null string "" which means no specific version. Examples: "5.4", "5.9.1". 087 * 088 * @since 5.9.1 089 */ 090 String deprecatedSince() default ""; 091 092 /** 093 * Boolean indicating if this operation should be exposed in Studio (optional), defaults to true. 094 * <p> 095 * This is convenient helper for Studio operations export. 096 * 097 * @since 5.9.1 098 */ 099 boolean addToStudio() default true; 100 101 /** 102 * ID Aliases array for a given operation. 103 * 104 * @since 7.1 105 */ 106 String[] aliases() default {}; 107 108}