diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4b8b074 --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + pl.com.it-crowd.youtrack-rest-api + youtrack-rest-api + 1.0.0-SNAPSHOT + + + + junit + junit + 4.8.2 + + + + net.sourceforge.htmlunit + htmlunit + 2.8 + + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + attach-sources + package + + jar-no-fork + + + + + + + + + + generate-jaxb-artifacts + + + + org.codehaus.mojo + jaxb2-maven-plugin + 1.3 + + + + xjc + + + + + pl.com.it_crowd.youtrack.api.rest + ${build.sourceDirectory} + false + + + + + + + + + + it-crowd.com.pl + MyCo Internal Repository + http://artifactory.it-crowd.com.pl/libs-snapshot-local + + + \ No newline at end of file diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/IssuesUnmarshaller.java b/src/main/java/pl/com/it_crowd/youtrack/api/IssuesUnmarshaller.java new file mode 100644 index 0000000..7621f92 --- /dev/null +++ b/src/main/java/pl/com/it_crowd/youtrack/api/IssuesUnmarshaller.java @@ -0,0 +1,38 @@ +package pl.com.it_crowd.youtrack.api; + +import org.apache.commons.io.IOUtils; +import pl.com.it_crowd.youtrack.api.rest.Issues; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.net.URL; + +public class IssuesUnmarshaller { + + public static Issues unmarshal(String url) throws JAXBException, IOException + { + return unmarshal(new URL(url).openStream()); + } + + public static Issues unmarshal(InputStream stream) throws JAXBException, IOException + { + return unmarshal(new InputStreamReader(stream)); + } + + public static Issues unmarshal(Reader reader) throws JAXBException, IOException + { + String content = IOUtils.toString(reader); + try { + JAXBContext jaxbContext = JAXBContext.newInstance(Issues.class.getPackage().getName()); + return (Issues) jaxbContext.createUnmarshaller().unmarshal(new StringReader(content)); + } catch (JAXBException e) { + System.err.println("Cannot unmarshal input stream.\n" + content + e); + throw e; + } + } +} diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/rest/Issues.java b/src/main/java/pl/com/it_crowd/youtrack/api/rest/Issues.java new file mode 100644 index 0000000..c6b0128 --- /dev/null +++ b/src/main/java/pl/com/it_crowd/youtrack/api/rest/Issues.java @@ -0,0 +1,810 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.12.05 at 08:56:01 AM CET +// + +package pl.com.it_crowd.youtrack.api.rest; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElements; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="issue" maxOccurs="unbounded" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <choice maxOccurs="unbounded" minOccurs="0">
+ *                   <element name="field">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="value" maxOccurs="unbounded" minOccurs="0">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                                     <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                           <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="comment">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                             <element name="value" minOccurs="0">
+ *                               <complexType>
+ *                                 <simpleContent>
+ *                                   <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ *                                     <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                                     <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                                   </extension>
+ *                                 </simpleContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                           <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                           <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </choice>
+ *                 <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = {"issue"}) +@XmlRootElement(name = "issues") +public class Issues { + + protected List issue; + + /** + * Gets the value of the issue property. + *

+ *

+ * 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 set method for the issue property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+     *    getIssue().add(newItem);
+     * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link Issues.Issue } + */ + public List getIssue() + { + if (issue == null) { + issue = new ArrayList(); + } + return this.issue; + } + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <choice maxOccurs="unbounded" minOccurs="0">
+     *         <element name="field">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="value" maxOccurs="unbounded" minOccurs="0">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                           <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *                 <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="comment">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                   <element name="value" minOccurs="0">
+     *                     <complexType>
+     *                       <simpleContent>
+     *                         <extension base="<http://www.w3.org/2001/XMLSchema>string">
+     *                           <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                           <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                         </extension>
+     *                       </simpleContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *                 <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *                 <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </choice>
+     *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = {"fieldOrComment"}) + public static class Issue { + + @XmlElements({@XmlElement(name = "field", type = Issues.Issue.Field.class), @XmlElement(name = "comment", type = Issues.Issue.Comment.class)}) + protected List fieldOrComment; + + @XmlAttribute + protected String id; + + /** + * Gets the value of the fieldOrComment property. + *

+ *

+ * 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 set method for the fieldOrComment property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+         *    getFieldOrComment().add(newItem);
+         * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link Issues.Issue.Field } + * {@link Issues.Issue.Comment } + */ + public List getFieldOrComment() + { + if (fieldOrComment == null) { + fieldOrComment = new ArrayList(); + } + return this.fieldOrComment; + } + + /** + * Gets the value of the id property. + * + * @return possible object is + * {@link String } + */ + public String getId() + { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value allowed object is + * {@link String } + */ + public void setId(String value) + { + this.id = value; + } + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *         <element name="value" minOccurs="0">
+         *           <complexType>
+         *             <simpleContent>
+         *               <extension base="<http://www.w3.org/2001/XMLSchema>string">
+         *                 <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *                 <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *               </extension>
+         *             </simpleContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = {"replies", "value"}) + public static class Comment { + + protected String replies; + + protected Issues.Issue.Comment.Value value; + + @XmlAttribute + protected String id; + + @XmlAttribute + protected String author; + + @XmlAttribute + protected String issueId; + + @XmlAttribute + protected String deleted; + + @XmlAttribute + protected String text; + + @XmlAttribute + protected String shownForIssueAuthor; + + @XmlAttribute + protected String created; + + @XmlAttribute + protected String name; + + /** + * Gets the value of the replies property. + * + * @return possible object is + * {@link String } + */ + public String getReplies() + { + return replies; + } + + /** + * Sets the value of the replies property. + * + * @param value allowed object is + * {@link String } + */ + public void setReplies(String value) + { + this.replies = value; + } + + /** + * Gets the value of the value property. + * + * @return possible object is + * {@link Issues.Issue.Comment.Value } + */ + public Issues.Issue.Comment.Value getValue() + { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value allowed object is + * {@link Issues.Issue.Comment.Value } + */ + public void setValue(Issues.Issue.Comment.Value value) + { + this.value = value; + } + + /** + * Gets the value of the id property. + * + * @return possible object is + * {@link String } + */ + public String getId() + { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value allowed object is + * {@link String } + */ + public void setId(String value) + { + this.id = value; + } + + /** + * Gets the value of the author property. + * + * @return possible object is + * {@link String } + */ + public String getAuthor() + { + return author; + } + + /** + * Sets the value of the author property. + * + * @param value allowed object is + * {@link String } + */ + public void setAuthor(String value) + { + this.author = value; + } + + /** + * Gets the value of the issueId property. + * + * @return possible object is + * {@link String } + */ + public String getIssueId() + { + return issueId; + } + + /** + * Sets the value of the issueId property. + * + * @param value allowed object is + * {@link String } + */ + public void setIssueId(String value) + { + this.issueId = value; + } + + /** + * Gets the value of the deleted property. + * + * @return possible object is + * {@link String } + */ + public String getDeleted() + { + return deleted; + } + + /** + * Sets the value of the deleted property. + * + * @param value allowed object is + * {@link String } + */ + public void setDeleted(String value) + { + this.deleted = value; + } + + /** + * Gets the value of the text property. + * + * @return possible object is + * {@link String } + */ + public String getText() + { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value allowed object is + * {@link String } + */ + public void setText(String value) + { + this.text = value; + } + + /** + * Gets the value of the shownForIssueAuthor property. + * + * @return possible object is + * {@link String } + */ + public String getShownForIssueAuthor() + { + return shownForIssueAuthor; + } + + /** + * Sets the value of the shownForIssueAuthor property. + * + * @param value allowed object is + * {@link String } + */ + public void setShownForIssueAuthor(String value) + { + this.shownForIssueAuthor = value; + } + + /** + * Gets the value of the created property. + * + * @return possible object is + * {@link String } + */ + public String getCreated() + { + return created; + } + + /** + * Sets the value of the created property. + * + * @param value allowed object is + * {@link String } + */ + public void setCreated(String value) + { + this.created = value; + } + + /** + * Gets the value of the name property. + * + * @return possible object is + * {@link String } + */ + public String getName() + { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value allowed object is + * {@link String } + */ + public void setName(String value) + { + this.name = value; + } + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+             * <complexType>
+             *   <simpleContent>
+             *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
+             *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+             *       <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+             *     </extension>
+             *   </simpleContent>
+             * </complexType>
+             * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = {"value"}) + public static class Value { + + @XmlValue + protected String value; + + @XmlAttribute + protected String type; + + @XmlAttribute + protected String role; + + /** + * Gets the value of the value property. + * + * @return possible object is + * {@link String } + */ + public String getValue() + { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value allowed object is + * {@link String } + */ + public void setValue(String value) + { + this.value = value; + } + + /** + * Gets the value of the type property. + * + * @return possible object is + * {@link String } + */ + public String getType() + { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value allowed object is + * {@link String } + */ + public void setType(String value) + { + this.type = value; + } + + /** + * Gets the value of the role property. + * + * @return possible object is + * {@link String } + */ + public String getRole() + { + return role; + } + + /** + * Sets the value of the role property. + * + * @param value allowed object is + * {@link String } + */ + public void setRole(String value) + { + this.role = value; + } + } + } + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="value" maxOccurs="unbounded" minOccurs="0">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *                 <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = {"content"}) + public static class Field { + + @XmlElementRef(name = "value", type = JAXBElement.class) + @XmlMixed + protected List content; + + @XmlAttribute + protected String name; + + /** + * Gets the value of the content property. + *

+ *

+ * 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 set method for the content property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+             *    getContent().add(newItem);
+             * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * {@link JAXBElement }{@code <}{@link Issues.Issue.Field.Value }{@code >} + */ + public List getContent() + { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + /** + * Gets the value of the name property. + * + * @return possible object is + * {@link String } + */ + public String getName() + { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value allowed object is + * {@link String } + */ + public void setName(String value) + { + this.name = value; + } + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+             *       <attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "") + public static class Value { + + @XmlAttribute + protected String type; + + @XmlAttribute + protected String role; + + /** + * Gets the value of the type property. + * + * @return possible object is + * {@link String } + */ + public String getType() + { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value allowed object is + * {@link String } + */ + public void setType(String value) + { + this.type = value; + } + + /** + * Gets the value of the role property. + * + * @return possible object is + * {@link String } + */ + public String getRole() + { + return role; + } + + /** + * Sets the value of the role property. + * + * @param value allowed object is + * {@link String } + */ + public void setRole(String value) + { + this.role = value; + } + } + } + } +} diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/rest/ObjectFactory.java b/src/main/java/pl/com/it_crowd/youtrack/api/rest/ObjectFactory.java new file mode 100644 index 0000000..aaa5260 --- /dev/null +++ b/src/main/java/pl/com/it_crowd/youtrack/api/rest/ObjectFactory.java @@ -0,0 +1,96 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.12.05 at 08:56:01 AM CET +// + +package pl.com.it_crowd.youtrack.api.rest; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the pl.com.it_crowd.youtrack.api.rest package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _IssuesIssueFieldValue_QNAME = new QName("", "value"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.com.it_crowd.youtrack.api.rest + */ + public ObjectFactory() + { + } + + /** + * Create an instance of {@link Issues.Issue.Comment.Value } + */ + public Issues.Issue.Comment.Value createIssuesIssueCommentValue() + { + return new Issues.Issue.Comment.Value(); + } + + /** + * Create an instance of {@link Issues.Issue.Comment } + */ + public Issues.Issue.Comment createIssuesIssueComment() + { + return new Issues.Issue.Comment(); + } + + /** + * Create an instance of {@link Issues.Issue.Field } + */ + public Issues.Issue.Field createIssuesIssueField() + { + return new Issues.Issue.Field(); + } + + /** + * Create an instance of {@link Issues } + */ + public Issues createIssues() + { + return new Issues(); + } + + /** + * Create an instance of {@link Issues.Issue } + */ + public Issues.Issue createIssuesIssue() + { + return new Issues.Issue(); + } + + /** + * Create an instance of {@link Issues.Issue.Field.Value } + */ + public Issues.Issue.Field.Value createIssuesIssueFieldValue() + { + return new Issues.Issue.Field.Value(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Issues.Issue.Field.Value }{@code >}} + */ + @XmlElementDecl(namespace = "", name = "value", scope = Issues.Issue.Field.class) + public JAXBElement createIssuesIssueFieldValue(Issues.Issue.Field.Value value) + { + return new JAXBElement(_IssuesIssueFieldValue_QNAME, Issues.Issue.Field.Value.class, Issues.Issue.Field.class, value); + } +} diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/rest/YoutrackAPI.java b/src/main/java/pl/com/it_crowd/youtrack/api/rest/YoutrackAPI.java new file mode 100644 index 0000000..9b64c5f --- /dev/null +++ b/src/main/java/pl/com/it_crowd/youtrack/api/rest/YoutrackAPI.java @@ -0,0 +1,59 @@ +package pl.com.it_crowd.youtrack.api.rest; + +import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.HttpMethod; +import com.gargoylesoftware.htmlunit.Page; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.WebRequest; +import com.gargoylesoftware.htmlunit.WebResponse; +import com.gargoylesoftware.htmlunit.util.NameValuePair; +import pl.com.it_crowd.youtrack.api.IssuesUnmarshaller; + +import javax.xml.bind.JAXBException; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; + +public class YoutrackAPI { + + private String serviceLocation; + + private WebClient webClient; + + public String getServiceLocation() + { + return serviceLocation; + } + + public YoutrackAPI(String serviceLocation) + { + this.serviceLocation = serviceLocation; + this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6); + this.webClient.setJavaScriptEnabled(false); + this.webClient.setCssEnabled(false); + } + + public YoutrackAPI(String serviceLocation, String username, String password) throws IOException + { + this(serviceLocation); + login(username, password); + } + + public void login(String username, String password) throws IOException + { + ArrayList requestParameters = new ArrayList(); + requestParameters.add(new NameValuePair("login", username)); + requestParameters.add(new NameValuePair("password", password)); + WebRequest request = new WebRequest(new URL(serviceLocation + "/rest/user/login"), HttpMethod.POST); + request.setRequestParameters(requestParameters); + WebResponse response = webClient.getPage(request).getWebResponse(); + System.out.println(response); + System.out.println(response.getContentAsString()); + } + + public Issues searchIssuesByProject(String project, String filter) throws JAXBException, IOException + { + String url = serviceLocation + "/rest/issue/byproject/" + project + "?filter=" + filter; + return IssuesUnmarshaller.unmarshal(webClient.getPage(url).getWebResponse().getContentAsStream()); + } +} diff --git a/src/main/xsd/issuesByProject.xml b/src/main/xsd/issuesByProject.xml new file mode 100644 index 0000000..321a578 --- /dev/null +++ b/src/main/xsd/issuesByProject.xml @@ -0,0 +1,587 @@ + + + + + + Normal + + + Task + + + Verified + + + No subsystem + + + SM-2 + SM-3 + SM-4 + SM-5 + SM-6 + SM-7 + SM-8 + SM-9 + SM-10 + + + SM + + + 1 + + + Draw screens + + + 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. + + + + 1292829185847 + + + 1321871424473 + + + root + + + 1321607946298 + + + bernard + + + 0 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 2 + + + Draw screens for "Courses & classes" package + + + 1292829263475 + + + 1321871424473 + + + root + + + 1321607946297 + + + bernard + + + 1 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 3 + + + Draw screens for "Discounts" package + + + 1292829302297 + + + 1321871424473 + + + root + + + 1321607946296 + + + bernard + + + 1 + + + 0 + + + + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 4 + + + Draw screens for "Passes" package + + + 1292829339100 + + + 1321871424473 + + + root + + + 1321607946296 + + + bernard + + + 2 + + + 0 + + + + + + + + + + + + + + + + + + Normal + + + Task + + + Verified + + + jacek + + + No subsystem + + + SM-1 + + + SM + + + 5 + + + Draw screens for "Rooms" package + + + 1292829377329 + + + 1321871424471 + + + root + + + 1321607946295 + + + bernard + + + 3 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 6 + + + Draw screens for "Schools" package + + + 1292829411325 + + + 1321871424472 + + + root + + + 1321607946294 + + + bernard + + + 1 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + jacek + + + No subsystem + + + SM-1 + + + SM + + + 7 + + + Draw screens for "Students" package + + + 1292829469581 + + + 1321871424472 + + + root + + + 1321607946302 + + + bernard + + + 1 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 8 + + + Draw screens for "Subjects" package + + + 1292829513591 + + + 1321871424472 + + + root + + + 1321607946301 + + + bernard + + + 1 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 9 + + + Draw screens for "Teachers" package + + + 1292829553292 + + + 1321871424470 + + + root + + + 1321607946301 + + + bernard + + + 1 + + + 0 + + + + + + + + + Normal + + + Task + + + Verified + + + tomek + + + No subsystem + + + SM-1 + + + SM + + + 10 + + + Draw screens for "Users" package + + + 1292829588016 + + + 1321871424471 + + + root + + + 1321607946300 + + + bernard + + + 1 + + + 0 + + + \ No newline at end of file diff --git a/src/main/xsd/issuesByProject.xsd b/src/main/xsd/issuesByProject.xsd new file mode 100644 index 0000000..a8e4eb0 --- /dev/null +++ b/src/main/xsd/issuesByProject.xsd @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file