View Javadoc

1   package com.atlassian.plugins.rest.test;
2   
3   import com.atlassian.plugins.rest.common.Link;
4   import com.atlassian.plugins.rest.common.expand.Expandable;
5   import com.atlassian.plugins.rest.common.expand.Expander;
6   import com.google.common.base.Preconditions;
7   
8   import javax.ws.rs.core.UriInfo;
9   import javax.xml.bind.annotation.XmlAccessType;
10  import javax.xml.bind.annotation.XmlAccessorType;
11  import javax.xml.bind.annotation.XmlAttribute;
12  import javax.xml.bind.annotation.XmlElement;
13  import javax.xml.bind.annotation.XmlRootElement;
14  
15  @XmlRootElement
16  @XmlAccessorType(XmlAccessType.FIELD)
17  @Expander(ProjectInformationExpander.class)
18  public class ProjectInformation
19  {
20      @XmlAttribute
21      private String expand;
22  
23      @XmlElement
24      private final Link link;
25  
26      @XmlElement
27      private String longName;
28  
29      @XmlElement
30      private String longDescription;
31  
32      @XmlElement
33      @Expandable("specification")
34      private ProjectSpecification specification;
35  
36      private ProjectInformation()
37      {
38          this.link = null;
39      }
40  
41      public ProjectInformation(Link link)
42      {
43          this.link = Preconditions.checkNotNull(link);
44      }
45  
46      public static ProjectInformation getInformation(UriInfo uriInfo)
47      {
48          final ProjectInformation information = new ProjectInformation(Link.self(uriInfo.getAbsolutePathBuilder().path("information").build()));
49          information.setSpecification(ProjectSpecification.getSpecification(uriInfo));
50          return information;
51      }
52  
53      public Link getLink()
54      {
55          return link;
56      }
57  
58      public String getLongName()
59      {
60          return longName;
61      }
62  
63      public void setLongName(String longName)
64      {
65          this.longName = longName;
66      }
67  
68      public String getLongDescription()
69      {
70          return longDescription;
71      }
72  
73      public void setLongDescription(String longDescription)
74      {
75          this.longDescription = longDescription;
76      }
77  
78      public ProjectSpecification getSpecification()
79      {
80          return specification;
81      }
82  
83      public void setSpecification(ProjectSpecification specification)
84      {
85          this.specification = specification;
86      }
87  }