001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.core.annotations;
013
014import java.lang.annotation.ElementType;
015import java.lang.annotation.Retention;
016import java.lang.annotation.RetentionPolicy;
017import java.lang.annotation.Target;
018
019/**
020 * Marks a class as being an operation.
021 * <p>
022 * An operation may provide an ID as the annotation value. If no id is specified the class name will be used as the ID.
023 * <p>
024 * The ID is the key used to register the operation.
025 * <p>
026 * Make sure you choose a proper ID name to avoid collisions (using the default: ID the class name can be a solution).
027 *
028 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
029 */
030@Retention(RetentionPolicy.RUNTIME)
031@Target(ElementType.TYPE)
032public @interface Operation {
033
034    /**
035     * The operation ID (mandatory).
036     * <p>
037     * If not specified the absolute name of the annotated class will be used.
038     */
039    String id() default "";
040
041    /**
042     * The operation category (optional), useful for documentation.
043     * <p>
044     * Provide a category to be used by the UI to classify the operations (on the documentation page or in Studio).
045     */
046    String category() default "Others";
047
048    /**
049     * The operation label (optional), useful for documentation.
050     * <p>
051     * Provide a label for the operation to be used in UI (should not contain any HTML code).
052     */
053    String label() default "";
054
055    /**
056     * Name of the context requires by this operation (optional), useful for documentation.
057     * <p>
058     * Provide the name of the context required by this operation. Example: event, ui, wf, etc..
059     */
060    String requires() default "";
061
062    /**
063     * Description of this operation (optional), useful for documentation.
064     * <p>
065     * Provide a description of the operation (may contain HTML code).
066     */
067    String description() default "";
068
069    /**
070     * Nuxeo version from which this operation is available (optional), useful for documentation.
071     * <p>
072     * The default value is the null string "" which means no specific version is required. Examples: "5.4", "5.9.1".
073     */
074    String since() default "";
075
076    /**
077     * Nuxeo version from which this operation is deprecated (optional), useful for documentation.
078     * <p>
079     * The default value is the null string "" which means no specific version. Examples: "5.4", "5.9.1".
080     *
081     * @since 5.9.1
082     */
083    String deprecatedSince() default "";
084
085    /**
086     * Boolean indicating if this operation should be exposed in Studio (optional), defaults to true.
087     * <p>
088     * This is convenient helper for Studio operations export.
089     *
090     * @since 5.9.1
091     */
092    boolean addToStudio() default true;
093
094    /**
095     * ID Aliases array for a given operation.
096     *
097     * @since 7.1
098     */
099    String[] aliases() default {};
100
101}