001/* 002 * Copyright 2013 Anyware Services 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 */ 016package org.ametys.core.ui; 017 018import java.lang.annotation.ElementType; 019import java.lang.annotation.Retention; 020import java.lang.annotation.RetentionPolicy; 021import java.lang.annotation.Target; 022 023import org.ametys.core.right.RightAssignmentContext; 024 025/** 026 * Mark the annotated method as callable by a client-side component. 027 */ 028@Retention(RetentionPolicy.RUNTIME) 029@Target(ElementType.METHOD) 030public @interface Callable 031{ 032 /** 033 * The id of right to be checked 034 * @return The right's id or empty if there is no right protection 035 */ 036 public String right() default ""; 037 038 /** 039 * The context to check the right. Defaults to '/${WorkspaceName}' 040 * @return The context 041 */ 042 public String context() default "/${WorkspaceName}"; 043 044 /** 045 * The id of a type of the {@link RightAssignmentContext} to use to convert JS object into into a Java object 046 * @return The id of the {@link RightAssignmentContext} 047 */ 048 public String rightContext() default ""; 049 050 /** 051 * The index of method's argument holding the context value to be converted by {@link RightAssignmentContext} 052 * @return The parameter's index 053 */ 054 public int paramIndex() default -1; 055}