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 @XmlAttribute
20 private String expand;
21
22 @XmlElement
23 private final Link link;
24
25 @XmlElement
26 private String longName;
27
28 @XmlElement
29 private String longDescription;
30
31 @XmlElement
32 @Expandable("specification")
33 private ProjectSpecification specification;
34
35 private ProjectInformation() {
36 this.link = null;
37 }
38
39 public ProjectInformation(Link link) {
40 this.link = Preconditions.checkNotNull(link);
41 }
42
43 public static ProjectInformation getInformation(UriInfo uriInfo) {
44 final ProjectInformation information = new ProjectInformation(Link.self(uriInfo.getAbsolutePathBuilder().path("information").build()));
45 information.setSpecification(ProjectSpecification.getSpecification(uriInfo));
46 return information;
47 }
48
49 public Link getLink() {
50 return link;
51 }
52
53 public String getLongName() {
54 return longName;
55 }
56
57 public void setLongName(String longName) {
58 this.longName = longName;
59 }
60
61 public String getLongDescription() {
62 return longDescription;
63 }
64
65 public void setLongDescription(String longDescription) {
66 this.longDescription = longDescription;
67 }
68
69 public ProjectSpecification getSpecification() {
70 return specification;
71 }
72
73 public void setSpecification(ProjectSpecification specification) {
74 this.specification = specification;
75 }
76 }