Commit 5b6367a591b324b018aef8e3483850289e928944

Authored by l.gladek
1 parent e8c60a86

searchIssuesByProject changed

1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<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"> 2 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
4 5
5 <groupId>pl.com.it-crowd</groupId> 6 <groupId>pl.com.it-crowd</groupId>
6 <artifactId>youtrack-rest-api</artifactId> 7 <artifactId>youtrack-rest-api</artifactId>
7 - <version>1.0.1-SNAPSHOT</version> 8 + <version>1.0.2-SNAPSHOT</version>
8 9
9 <dependencies> 10 <dependencies>
10 <dependency> 11 <dependency>
@@ -65,12 +66,12 @@ @@ -65,12 +66,12 @@
65 </plugins> 66 </plugins>
66 </build> 67 </build>
67 </profile> 68 </profile>
68 - <profile>  
69 - <id>release</id>  
70 - <properties>  
71 - <skipTests>true</skipTests>  
72 - </properties>  
73 - </profile> 69 + <profile>
  70 + <id>release</id>
  71 + <properties>
  72 + <skipTests>true</skipTests>
  73 + </properties>
  74 + </profile>
74 </profiles> 75 </profiles>
75 76
76 <distributionManagement> 77 <distributionManagement>
@@ -19,9 +19,13 @@ import java.net.URL; @@ -19,9 +19,13 @@ import java.net.URL;
19 import java.util.ArrayList; 19 import java.util.ArrayList;
20 import java.util.List; 20 import java.util.List;
21 21
  22 +import java.security.GeneralSecurityException;
  23 +
22 public class YoutrackAPI { 24 public class YoutrackAPI {
23 // ------------------------------ FIELDS ------------------------------ 25 // ------------------------------ FIELDS ------------------------------
24 26
  27 + private Integer MAX_RESULTS = 1000;
  28 +
25 private String serviceLocation; 29 private String serviceLocation;
26 30
27 private WebClient webClient; 31 private WebClient webClient;
@@ -34,6 +38,11 @@ public class YoutrackAPI { @@ -34,6 +38,11 @@ public class YoutrackAPI {
34 this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6); 38 this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
35 this.webClient.setJavaScriptEnabled(false); 39 this.webClient.setJavaScriptEnabled(false);
36 this.webClient.setCssEnabled(false); 40 this.webClient.setCssEnabled(false);
  41 + try {
  42 + this.webClient.setUseInsecureSSL(true);
  43 + } catch (GeneralSecurityException e) {
  44 + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
  45 + }
37 } 46 }
38 47
39 public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, AuthenticationException 48 public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, AuthenticationException
@@ -71,11 +80,11 @@ public class YoutrackAPI { @@ -71,11 +80,11 @@ public class YoutrackAPI {
71 } 80 }
72 } 81 }
73 82
74 - public List<Issue> searchIssuesByProject(String project, String filter) throws JAXBException, IOException 83 + public List<Issue> searchIssuesByProject(String project) throws JAXBException, IOException
75 { 84 {
76 - String url = serviceLocation + "/rest/issue/byproject/" + project + "?filter=" + filter; 85 + String url = serviceLocation + "/rest/issue/byproject/" + project + "?max=" + MAX_RESULTS;
77 WebResponse webResponse = webClient.<Page>getPage(url).getWebResponse(); 86 WebResponse webResponse = webClient.<Page>getPage(url).getWebResponse();
78 -// System.out.println(webResponse.getContentAsString()); 87 +
79 List<Issues.Issue> issues = IssuesUnmarshaller.unmarshal(webResponse.getContentAsStream()).getIssue(); 88 List<Issues.Issue> issues = IssuesUnmarshaller.unmarshal(webResponse.getContentAsStream()).getIssue();
80 List<Issue> result = new ArrayList<Issue>(); 89 List<Issue> result = new ArrayList<Issue>();
81 for (Issues.Issue issue : issues) { 90 for (Issues.Issue issue : issues) {
Please register or login to post a comment