1   package com.atlassian.plugins.codegen.modules.common;
2   
3   import com.atlassian.plugins.codegen.ClassId;
4   import com.atlassian.plugins.codegen.modules.AbstractClassBasedModuleProperties;
5   
6   /**
7    * @since 3.6
8    */
9   public class TemplateContextItemProperties extends AbstractClassBasedModuleProperties
10  {
11      public static final String CONTEXT_KEY = "CONTEXT_KEY";
12      public static final String COMPONENT_REF = "COMPONENT_REF";
13      public static final String GLOBAL = "GLOBAL";
14  
15      public TemplateContextItemProperties()
16      {
17          this("My Template Context Item");
18      }
19  
20      protected TemplateContextItemProperties(TemplateContextItemProperties from, ClassId newClass)
21      {
22          super(from, newClass);
23      }
24  
25      public TemplateContextItemProperties withClass(ClassId newClass)
26      {
27          return new TemplateContextItemProperties(this, newClass);
28      }
29  
30      public TemplateContextItemProperties(String moduleName)
31      {
32          super();
33          setModuleNameAndKey(moduleName);
34          setGlobal(false);
35      }
36  
37      public TemplateContextItemProperties(String moduleName, String contextKey)
38      {
39          this(moduleName);
40          setContextKey(contextKey);
41      }
42  
43      public void setContextKey(String key)
44      {
45          setProperty(CONTEXT_KEY, key);
46      }
47  
48      public String getContextKey()
49      {
50          return getProperty(CONTEXT_KEY);
51      }
52  
53      public void setComponentRef(String ref)
54      {
55          setProperty(COMPONENT_REF, ref);
56      }
57  
58      public String getComponentRef()
59      {
60          return getProperty(COMPONENT_REF);
61      }
62  
63      public void setGlobal(boolean global)
64      {
65          setProperty(GLOBAL, Boolean.toString(global));
66      }
67  
68      public boolean isGlobal()
69      {
70          return Boolean.valueOf(getProperty(GLOBAL));
71      }
72  }