1   package com.atlassian.plugins.codegen.modules.jira;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import com.atlassian.plugins.codegen.modules.BasicClassModuleProperties;
7   import com.atlassian.plugins.codegen.modules.common.Label;
8   import com.atlassian.plugins.codegen.modules.common.Resource;
9   
10  /**
11   * @since 3.6
12   */
13  public class ReportProperties extends BasicClassModuleProperties
14  {
15      public static final String LABEL = "LABEL";
16      public static final String RESOURCES = "RESOURCES";
17  
18      public ReportProperties()
19      {
20          this("MyReport");
21      }
22  
23      public ReportProperties(String fqClassName)
24      {
25          super(fqClassName);
26          setResources(new ArrayList<Resource>());
27      }
28  
29      public void setLabel(Label label)
30      {
31          put(LABEL, label);
32          addI18nProperty(label.getKey(), label.getValue());
33      }
34  
35      public Label getLabel()
36      {
37          Label label = null;
38          if (keySet().contains(LABEL))
39          {
40              label = (Label) get(LABEL);
41          }
42          return label;
43      }
44  
45      public void setResources(List<Resource> resources)
46      {
47          put(RESOURCES, resources);
48      }
49  
50      public List<Resource> getResources()
51      {
52          return (List<Resource>) get(RESOURCES);
53      }
54  
55      public void addResource(Resource resource)
56      {
57          List<Resource> resources = getResources();
58          if (null == resources)
59          {
60              resources = new ArrayList<Resource>();
61              setResources(resources);
62          }
63  
64          resources.add(resource);
65      }
66  }