diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..af19312 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..407ac72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +target +.idea +*.iml +filter-dev.properties diff --git a/pom.xml b/pom.xml index 4b79bc6..1aa04c4 100644 --- a/pom.xml +++ b/pom.xml @@ -2,40 +2,25 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>pl.itcrowd</groupId> <artifactId>youtrack-rest-api</artifactId> <version>1.1.0-SNAPSHOT</version> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.2-beta1</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.9.0-rc1</version> - <scope>test</scope> - </dependency> - </dependencies> - + <scm> + <developerConnection>scm:git:https://itcrowd.pl/gitblit/git/OpenSource/youtrack-rest-api.git</developerConnection> + </scm> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-release-plugin</artifactId> + <version>2.4.1</version> + <configuration> + <localCheckout>true</localCheckout> + <pushChanges>false</pushChanges> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.1.2</version> <executions> @@ -48,17 +33,8 @@ </execution> </executions> </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <autoVersionSubmodules>true</autoVersionSubmodules> - <pushChanges>false</pushChanges> - <localCheckout>true</localCheckout> - </configuration> - </plugin> </plugins> </build> - <profiles> <profile> <id>generate-jaxb-artifacts</id> @@ -76,10 +52,10 @@ </execution> </executions> <configuration> - <packageName>pl.itcrowd.youtrack.api.rest</packageName> - <outputDirectory>${project.build.sourceDirectory}</outputDirectory> <clearOutputDir>false</clearOutputDir> <extension>false</extension> + <outputDirectory>${project.build.sourceDirectory}</outputDirectory> + <packageName>pl.itcrowd.youtrack.api.rest</packageName> </configuration> </plugin> </plugins> @@ -92,7 +68,30 @@ </properties> </profile> </profiles> - + <dependencies> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.2-beta1</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.9.0-rc1</version> + <scope>test</scope> + </dependency> + </dependencies> <distributionManagement> <repository> <id>itcrowd.pl</id> @@ -105,9 +104,4 @@ <url>http://artifactory.itcrowd.pl/libs-snapshot-local</url> </snapshotRepository> </distributionManagement> - - <scm> - <developerConnection>scm:git:https://itcrowd.pl/gitblit/git/OpenSource/youtrack-rest-api.git</developerConnection> - </scm> - </project> diff --git a/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java b/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java index 87a0b41..01ad56f 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java +++ b/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java @@ -2,12 +2,13 @@ package pl.itcrowd.youtrack.api; import java.net.URI; import java.net.URISyntaxException; +import java.util.Map; public class URIUtils { public static URI buildURI(URI base, String path) { - return buildURI(base, path, null); + return buildURI(base, path, (String) null); } public static URI buildURI(URI base, String path, String query) @@ -19,4 +20,15 @@ public class URIUtils { throw new RuntimeException(e); } } + + public static URI buildURI(URI base, String path, Map<String, Object> params) + { + final StringBuilder query = new StringBuilder(); + for (Map.Entry<String, Object> entry : params.entrySet()) { + if (null != entry.getValue()) { + query.append("&").append(entry.getKey()).append("=").append(entry.getValue()); + } + } + return buildURI(base, path, query.length() > 0 ? query.substring(1) : query.toString()); + } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java b/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java index 26d7786..5b911cf 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java +++ b/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java @@ -35,6 +35,7 @@ import pl.itcrowd.youtrack.api.exceptions.YoutrackErrorException; import pl.itcrowd.youtrack.api.rest.AssigneeList; import pl.itcrowd.youtrack.api.rest.Enumeration; import pl.itcrowd.youtrack.api.rest.Issue; +import pl.itcrowd.youtrack.api.rest.IssueCompacts; import pl.itcrowd.youtrack.api.rest.Issues; import pl.itcrowd.youtrack.api.rest.User; import pl.itcrowd.youtrack.api.rest.UserRefs; @@ -57,7 +58,9 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -77,6 +80,36 @@ public class YoutrackAPI { private URI serviceLocationURI; + public YoutrackAPI(String serviceLocation) + { + this(serviceLocation, null); + } + + public YoutrackAPI(String serviceLocation, HttpClient httpClient) + { + if (serviceLocation == null) { + throw new IllegalArgumentException("serviceLocation cannot be null"); + } + this.serviceLocation = serviceLocation; + try { + serviceLocationURI = new URI(this.serviceLocation); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + this.httpClient = httpClient == null ? getDefaultHttpClient() : httpClient; + } + + public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, JAXBException + { + this(serviceLocation, null, username, password); + } + + public YoutrackAPI(String serviceLocation, HttpClient httpClient, String username, String password) throws IOException, JAXBException + { + this(serviceLocation, httpClient); + login(username, password); + } + private static HttpClient getDefaultHttpClient() { SSLContext sslContext; @@ -129,34 +162,71 @@ public class YoutrackAPI { return true; } - public YoutrackAPI(String serviceLocation) + public AssigneeList getAssignees(String project) throws IOException, JAXBException { - this(serviceLocation, null); + final String responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/project/" + project + "/assignee"))); + final Object result = YoutrackUnmarshaller.unmarshall(responseString); + if (result instanceof AssigneeList) { + return (AssigneeList) result; + } else { + throw new YoutrackAPIException("Unexpected type: " + result); + } } - public YoutrackAPI(String serviceLocation, HttpClient httpClient) + public Enumeration getBundle(String customField) throws IOException, JAXBException { - if (serviceLocation == null) { - throw new IllegalArgumentException("serviceLocation cannot be null"); - } - this.serviceLocation = serviceLocation; - try { - serviceLocationURI = new URI(this.serviceLocation); - } catch (URISyntaxException e) { - throw new RuntimeException(e); + final Object result = YoutrackUnmarshaller.unmarshall( + execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/customfield/bundle/" + customField)))); + if (result instanceof Enumeration) { + return (Enumeration) result; + } else if (result instanceof JAXBElement) { + final JAXBElement jaxbElement = (JAXBElement) result; + if (Enumeration_QNAME.equals(jaxbElement.getName())) { + return (Enumeration) ((JAXBElement) result).getValue(); + } else { + throw new YoutrackAPIException("Unexpected type: " + jaxbElement.getValue()); + } + } else { + throw new YoutrackAPIException("Unexpected type: " + result); } - this.httpClient = httpClient == null ? getDefaultHttpClient() : httpClient; } - public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, JAXBException + public List<User> getIndividualAssignees(String project) throws IOException, JAXBException { - this(serviceLocation, null, username, password); + final String responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/project/" + project + "/assignee/individual"))); + final Object result = YoutrackUnmarshaller.unmarshall(responseString); + if (result instanceof UserRefs) { + return ((UserRefs) result).getUsers(); + } else { + throw new YoutrackAPIException("Unexpected type: " + result); + } } - public YoutrackAPI(String serviceLocation, HttpClient httpClient, String username, String password) throws IOException, JAXBException + public IssueWrapper getIssue(String issueId) throws IOException, JAXBException { - this(serviceLocation, httpClient); - login(username, password); + final String responseString; + try { + responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/issue/" + issueId))); + } catch (YoutrackErrorException e) { + if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { + throw new NoResultFoundException(e.getMessage(), e); + } else { + throw e; + } + } + final Object result = YoutrackUnmarshaller.unmarshall(responseString); + if (result instanceof pl.itcrowd.youtrack.api.rest.Issue) { + return new IssueWrapper((Issue) result); + } else if (result instanceof JAXBElement) { + final JAXBElement jaxbElement = (JAXBElement) result; + if (Issue_QNAME.equals(jaxbElement.getName())) { + return new IssueWrapper((Issue) jaxbElement.getValue()); + } else { + throw new YoutrackAPIException("Unexpected type: " + jaxbElement.getValue()); + } + } else { + throw new YoutrackAPIException("Unexpected type " + result); + } } public String getServiceLocation() @@ -233,78 +303,29 @@ public class YoutrackAPI { execute(new HttpDelete(buildURI(serviceLocationURI, "/rest/issue/" + issueId))); } - public AssigneeList getAssignees(String project) throws IOException, JAXBException - { - final String responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/project/" + project + "/assignee"))); - final Object result = YoutrackUnmarshaller.unmarshall(responseString); - if (result instanceof AssigneeList) { - return (AssigneeList) result; - } else { - throw new YoutrackAPIException("Unexpected type: " + result); - } - } - - public Enumeration getBundle(String customField) throws IOException, JAXBException - { - final Object result = YoutrackUnmarshaller.unmarshall( - execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/customfield/bundle/" + customField)))); - if (result instanceof Enumeration) { - return (Enumeration) result; - } else if (result instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) result; - if (Enumeration_QNAME.equals(jaxbElement.getName())) { - return (Enumeration) ((JAXBElement) result).getValue(); - } else { - throw new YoutrackAPIException("Unexpected type: " + jaxbElement.getValue()); - } - } else { - throw new YoutrackAPIException("Unexpected type: " + result); - } - } - - public List<User> getIndividualAssignees(String project) throws IOException, JAXBException + public void login(String username, String password) throws IOException, JAXBException { - final String responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/admin/project/" + project + "/assignee/individual"))); - final Object result = YoutrackUnmarshaller.unmarshall(responseString); - if (result instanceof UserRefs) { - return ((UserRefs) result).getUsers(); - } else { - throw new YoutrackAPIException("Unexpected type: " + result); - } + final HttpPost request = new HttpPost(buildURI(serviceLocationURI, "/rest/user/login")); + request.setEntity(new UrlEncodedFormEntity(Arrays.asList(new BasicNameValuePair("login", username), new BasicNameValuePair("password", password)))); + execute(request); } - public IssueWrapper getIssue(String issueId) throws IOException, JAXBException + public List<IssueWrapper> searchIssues(Object filter, Integer maxResults, Integer after) throws JAXBException, IOException { - final String responseString; - try { - responseString = execute(new HttpGet(buildURI(serviceLocationURI, "/rest/issue/" + issueId))); - } catch (YoutrackErrorException e) { - if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { - throw new NoResultFoundException(e.getMessage(), e); - } else { - throw e; - } + final Map<String, Object> params = new HashMap<String, Object>(); + params.put("filter", filter); + params.put("max", maxResults); + params.put("after", after); + final Object result = YoutrackUnmarshaller.unmarshall(execute(new HttpGet(buildURI(serviceLocationURI, "/rest/issue", params)))); + if (!(result instanceof IssueCompacts)) { + throw new YoutrackAPIException("Unmarshalling problem. Expected Issues, received: " + result.getClass() + " " + result); } - final Object result = YoutrackUnmarshaller.unmarshall(responseString); - if (result instanceof pl.itcrowd.youtrack.api.rest.Issue) { - return new IssueWrapper((Issue) result); - } else if (result instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) result; - if (Issue_QNAME.equals(jaxbElement.getName())) { - return new IssueWrapper((Issue) jaxbElement.getValue()); - } else { - throw new YoutrackAPIException("Unexpected type: " + jaxbElement.getValue()); - } - } else { - throw new YoutrackAPIException("Unexpected type " + result); + List<Issue> issues = ((IssueCompacts) result).getIssues(); + List<IssueWrapper> wrappedIssues = new ArrayList<IssueWrapper>(); + for (Issue issue : issues) { + wrappedIssues.add(new IssueWrapper(issue)); } - } - - public void login(String username, String password) throws IOException, JAXBException - { - final HttpPost request = new HttpPost(buildURI(serviceLocationURI, "/rest/user/login")); - request.setEntity(new UrlEncodedFormEntity(Arrays.asList(new BasicNameValuePair("login", username), new BasicNameValuePair("password", password)))); - execute(request); + return wrappedIssues; } public List<IssueWrapper> searchIssuesByProject(String project, Object filter) throws JAXBException, IOException @@ -345,7 +366,7 @@ public class YoutrackAPI { private String execute(HttpUriRequest request) throws IOException { - request.addHeader("Accept","application/xml"); + request.addHeader("Accept", "application/xml"); final HttpResponse response = httpClient.execute(request); final StatusLine statusLine = response.getStatusLine(); final HttpEntity entity = response.getEntity(); diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/IssueCompacts.java b/src/main/java/pl/itcrowd/youtrack/api/rest/IssueCompacts.java new file mode 100644 index 0000000..314c198 --- /dev/null +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/IssueCompacts.java @@ -0,0 +1,68 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// +package pl.itcrowd.youtrack.api.rest; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; + +/** + * <p>Java class for anonymous complex type. + * <p/> + * <p>The following schema fragment specifies the expected content contained within this class. + * <p/> + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence maxOccurs="unbounded" minOccurs="0"> + * <element name="issue" type="{}issueType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = {"issues"}) +@XmlRootElement(name = "issueCompacts") +public class IssueCompacts { + + @XmlElement(name = "issue") + protected List<Issue> issues; + + /** + * Gets the value of the issues property. + * <p/> + * <p/> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the issues property. + * <p/> + * <p/> + * For example, to add a new item, do as follows: + * <pre> + * getIssues().add(newItem); + * </pre> + * <p/> + * <p/> + * <p/> + * Objects of the following type(s) are allowed in the list + * {@link Issue } + */ + public List<Issue> getIssues() + { + if (issues == null) { + issues = new ArrayList<Issue>(); + } + return this.issues; + } +} diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java b/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java index 75efb9e..2eae2b5 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java @@ -26,22 +26,22 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _Error_QNAME = new QName("", "error"); - - private final static QName _Int_QNAME = new QName("", "int"); - - private final static QName _Issue_QNAME = new QName("", "issue"); - - private final static QName _Enumeration_QNAME = new QName("", "enumeration"); - private final static QName _CommentReplies_QNAME = new QName("", "replies"); private final static QName _CommentValue_QNAME = new QName("", "value"); + private final static QName _Enumeration_QNAME = new QName("", "enumeration"); + private final static QName _ErrorTypeField_QNAME = new QName("", "field"); private final static QName _ErrorTypeMessage_QNAME = new QName("", "message"); + private final static QName _Error_QNAME = new QName("", "error"); + + private final static QName _Int_QNAME = new QName("", "int"); + + private final static QName _Issue_QNAME = new QName("", "issue"); + /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.itcrowd.youtrack.api.rest */ @@ -50,83 +50,86 @@ public class ObjectFactory { } /** - * Create an instance of {@link Field } + * Create an instance of {@link AssignedByType } */ - public Field createField() + public AssignedByType createAssignedByType() { - return new Field(); + return new AssignedByType(); } /** - * Create an instance of {@link Enumeration } + * Create an instance of {@link AssigneeList } */ - public Enumeration createEnumeration() + public AssigneeList createAssigneeList() { - return new Enumeration(); + return new AssigneeList(); } /** - * Create an instance of {@link User } + * Create an instance of {@link AssigneeList.Assignees } */ - public User createUser() + public AssigneeList.Assignees createAssigneeListAssignees() { - return new User(); + return new AssigneeList.Assignees(); } /** - * Create an instance of {@link UserRefs } + * Create an instance of {@link AssigneeType } */ - public UserRefs createUserRefs() + public AssigneeType createAssigneeType() { - return new UserRefs(); + return new AssigneeType(); } /** - * Create an instance of {@link Issues } + * Create an instance of {@link Comment } */ - public Issues createIssues() + public Comment createComment() { - return new Issues(); + return new Comment(); } /** - * Create an instance of {@link AssigneeList } + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} */ - public AssigneeList createAssigneeList() + @XmlElementDecl(namespace = "", name = "replies", scope = Comment.class) + public JAXBElement<String> createCommentReplies(String value) { - return new AssigneeList(); + return new JAXBElement<String>(_CommentReplies_QNAME, String.class, Comment.class, value); } /** - * Create an instance of {@link Field.Value } + * Create an instance of {@link Comment.Value } */ - public Field.Value createFieldValue() + public Comment.Value createCommentValue() { - return new Field.Value(); + return new Comment.Value(); } /** - * Create an instance of {@link AssigneeType } + * Create an instance of {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}} */ - public AssigneeType createAssigneeType() + @XmlElementDecl(namespace = "", name = "value", scope = Comment.class) + public JAXBElement<Comment.Value> createCommentValue(Comment.Value value) { - return new AssigneeType(); + return new JAXBElement<Comment.Value>(_CommentValue_QNAME, Comment.Value.class, Comment.class, value); } /** - * Create an instance of {@link ErrorType } + * Create an instance of {@link Enumeration } */ - public ErrorType createErrorType() + public Enumeration createEnumeration() { - return new ErrorType(); + return new Enumeration(); } /** - * Create an instance of {@link AssignedByType } + * Create an instance of {@link JAXBElement }{@code <}{@link Enumeration }{@code >}} */ - public AssignedByType createAssignedByType() + @XmlElementDecl(namespace = "", name = "enumeration") + public JAXBElement<Enumeration> createEnumeration(Enumeration value) { - return new AssignedByType(); + return new JAXBElement<Enumeration>(_Enumeration_QNAME, Enumeration.class, null, value); } /** @@ -138,52 +141,54 @@ public class ObjectFactory { } /** - * Create an instance of {@link AssigneeList.Assignees } + * Create an instance of {@link JAXBElement }{@code <}{@link ErrorType }{@code >}} */ - public AssigneeList.Assignees createAssigneeListAssignees() + @XmlElementDecl(namespace = "", name = "error") + public JAXBElement<ErrorType> createError(ErrorType value) { - return new AssigneeList.Assignees(); + return new JAXBElement<ErrorType>(_Error_QNAME, ErrorType.class, null, value); } /** - * Create an instance of {@link UserGroupRefType } + * Create an instance of {@link ErrorType } */ - public UserGroupRefType createUserGroupRefType() + public ErrorType createErrorType() { - return new UserGroupRefType(); + return new ErrorType(); } /** - * Create an instance of {@link Comment } + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} */ - public Comment createComment() + @XmlElementDecl(namespace = "", name = "field", scope = ErrorType.class) + public JAXBElement<String> createErrorTypeField(String value) { - return new Comment(); + return new JAXBElement<String>(_ErrorTypeField_QNAME, String.class, ErrorType.class, value); } /** - * Create an instance of {@link Comment.Value } + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} */ - public Comment.Value createCommentValue() + @XmlElementDecl(namespace = "", name = "message", scope = ErrorType.class) + public JAXBElement<String> createErrorTypeMessage(String value) { - return new Comment.Value(); + return new JAXBElement<String>(_ErrorTypeMessage_QNAME, String.class, ErrorType.class, value); } /** - * Create an instance of {@link Issue } + * Create an instance of {@link Field } */ - public Issue createIssue() + public Field createField() { - return new Issue(); + return new Field(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link ErrorType }{@code >}} + * Create an instance of {@link Field.Value } */ - @XmlElementDecl(namespace = "", name = "error") - public JAXBElement<ErrorType> createError(ErrorType value) + public Field.Value createFieldValue() { - return new JAXBElement<ErrorType>(_Error_QNAME, ErrorType.class, null, value); + return new Field.Value(); } /** @@ -196,6 +201,14 @@ public class ObjectFactory { } /** + * Create an instance of {@link Issue } + */ + public Issue createIssue() + { + return new Issue(); + } + + /** * Create an instance of {@link JAXBElement }{@code <}{@link Issue }{@code >}} */ @XmlElementDecl(namespace = "", name = "issue") @@ -205,47 +218,42 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link Enumeration }{@code >}} + * Create an instance of {@link IssueCompacts } */ - @XmlElementDecl(namespace = "", name = "enumeration") - public JAXBElement<Enumeration> createEnumeration(Enumeration value) + public IssueCompacts createIssueCompacts() { - return new JAXBElement<Enumeration>(_Enumeration_QNAME, Enumeration.class, null, value); + return new IssueCompacts(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link Issues } */ - @XmlElementDecl(namespace = "", name = "replies", scope = Comment.class) - public JAXBElement<String> createCommentReplies(String value) + public Issues createIssues() { - return new JAXBElement<String>(_CommentReplies_QNAME, String.class, Comment.class, value); + return new Issues(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}} + * Create an instance of {@link User } */ - @XmlElementDecl(namespace = "", name = "value", scope = Comment.class) - public JAXBElement<Comment.Value> createCommentValue(Comment.Value value) + public User createUser() { - return new JAXBElement<Comment.Value>(_CommentValue_QNAME, Comment.Value.class, Comment.class, value); + return new User(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link UserGroupRefType } */ - @XmlElementDecl(namespace = "", name = "field", scope = ErrorType.class) - public JAXBElement<String> createErrorTypeField(String value) + public UserGroupRefType createUserGroupRefType() { - return new JAXBElement<String>(_ErrorTypeField_QNAME, String.class, ErrorType.class, value); + return new UserGroupRefType(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link UserRefs } */ - @XmlElementDecl(namespace = "", name = "message", scope = ErrorType.class) - public JAXBElement<String> createErrorTypeMessage(String value) + public UserRefs createUserRefs() { - return new JAXBElement<String>(_ErrorTypeMessage_QNAME, String.class, ErrorType.class, value); + return new UserRefs(); } } diff --git a/src/main/xjb/bindings.xjb b/src/main/xjb/bindings.xjb index a617032..6497e79 100644 --- a/src/main/xjb/bindings.xjb +++ b/src/main/xjb/bindings.xjb @@ -9,6 +9,12 @@ </jxb:bindings> </jxb:bindings> + <jxb:bindings schemaLocation="../xsd/issues.xsd" node="/xs:schema"> + <jxb:bindings node=".//xs:element[@name='issueCompacts']//xs:sequence[@id='issues']"> + <jxb:property name="issues"/> + </jxb:bindings> + </jxb:bindings> + <jxb:bindings schemaLocation="../xsd/individualAssignees.xsd" node="/xs:schema"> <jxb:bindings node=".//xs:element[@name='userRefs']//xs:sequence[@id='users']"> <jxb:property name="users"/> diff --git a/src/main/xsd/issues.xml b/src/main/xsd/issues.xml new file mode 100644 index 0000000..fe51b86 --- /dev/null +++ b/src/main/xsd/issues.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<issueCompacts> + <issue id="SM-1"> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="projectShortName"> + <value>SM</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="numberInProject"> + <value>1</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="summary"> + <value>Draw screens</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="description"> + <value>Draw screens in Balsamiq, the online tool for drawing screen sketches. http://balsamiq.com/ + As a result the screen image in PNG format and Balsamiq source in XML format are expected. + Artefacts must be delivered in form of directory structure (not in Enterprise Architect file). + Partially documented packages will not be accepted. + Sample directory structure: + + Package name (directory) + + Screen name (directory) + - Screen name.png + - Screen name.xml + + In screens include only elements specific to documented screen. Do not include stuff that will land in template. + </value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="created"> + <value>1292829185847</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updated"> + <value>1321871424473</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updaterName"> + <value>root</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updaterFullName"> + <value>root</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="resolved"> + <value>1321607946298</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="reporterName"> + <value>bernard</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="reporterFullName"> + <value>Bernard Łabno</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="commentsCount"> + <value>0</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="votes"> + <value>0</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinkField" name="links"> + <value type="Depend" role="depends on">SM-2</value> + <value type="Depend" role="depends on">SM-3</value> + <value type="Depend" role="depends on">SM-4</value> + <value type="Depend" role="depends on">SM-5</value> + <value type="Depend" role="depends on">SM-6</value> + <value type="Depend" role="depends on">SM-7</value> + <value type="Depend" role="depends on">SM-8</value> + <value type="Depend" role="depends on">SM-9</value> + <value type="Depend" role="depends on">SM-10</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Priority"> + <value>Normal</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Type"> + <value>Task</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="State"> + <value>Verified</value> + </field> + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Environment"> + <value>Beta</value> + </field> + </issue> +</issueCompacts> \ No newline at end of file diff --git a/src/main/xsd/issues.xsd b/src/main/xsd/issues.xsd new file mode 100644 index 0000000..8033dd5 --- /dev/null +++ b/src/main/xsd/issues.xsd @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:include schemaLocation="types.xsd"/> + <xs:element name="issueCompacts"> + <xs:complexType> + <xs:sequence id="issues" minOccurs="0" maxOccurs="unbounded"> + <xs:element name="issue" type="issueType"/> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> \ No newline at end of file