View Javadoc

1   package com.atlassian.plugin.web;
2   
3   import com.atlassian.plugin.Plugin;
4   import com.atlassian.plugin.web.conditions.ConditionLoadingException;
5   
6   import java.util.List;
7   import java.util.Map;
8   
9   /**
10   * Provides application specific methods to build/render web fragments
11   */
12  public interface WebFragmentHelper
13  {
14      /**
15       * Creates a condition instance.  The following process should be used:<ol>
16       * <li>Load the class via the plugin instance</li>
17       * <li>Instantiate the class using the plugin if it implements {@link com.atlassian.plugin.AutowireCapablePlugin}
18       * <li>If not, instantiate the class with the host container
19       *
20       * @param className the condition class name
21       * @param plugin the plugin from which the condition came
22       * @return the condition instance
23       * @throws ConditionLoadingException If the condition was unable to be created
24       * @deprecated Since 2.7.0, will use HostContainer.create in future versions
25       */
26      Condition loadCondition(String className, Plugin plugin) throws ConditionLoadingException;
27  
28      /**
29       * Creates a context provider instance.  The following process should be used:<ol>
30       * <li>Load the class via the plugin instance</li>
31       * <li>Instantiate the class using the plugin if it implements {@link com.atlassian.plugin.AutowireCapablePlugin}
32       * <li>If not, instantiate the class with the host container
33       *
34       * @param className the context provider class name
35       * @param plugin the plugin from which the context provider came
36       * @return the context provider instance
37       * @throws ConditionLoadingException If the context provider was unable to be created
38       * * @deprecated Since 2.7.0, will use HostContainer.create in future versions
39       */
40      ContextProvider loadContextProvider(String className, Plugin plugin) throws ConditionLoadingException;
41  
42      /**
43       * Look up a message key in the application
44       *
45       * @param key The message key
46       * @param arguments The arguments to use to replace tokens with any expressions already processed
47       * @param context The context (optional)
48       * @return The text message
49       */
50      String getI18nValue(String key, List<?> arguments, Map<String,Object> context);
51  
52      /**
53       * Renders the string fragment as a Velocity template
54       *
55       * @param fragment The string fragment to render
56       * @param context The context to use as the base of the Velocity context
57       * @return The rendered string
58       */
59      String renderVelocityFragment(String fragment, Map<String,Object> context);
60  }