diff --git a/src/main/java/pl/itcrowd/youtrack/api/Command.java b/src/main/java/pl/itcrowd/youtrack/api/Command.java index d99e359..3374dd9 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/Command.java +++ b/src/main/java/pl/itcrowd/youtrack/api/Command.java @@ -4,12 +4,9 @@ import pl.itcrowd.youtrack.api.defaults.Fields; import pl.itcrowd.youtrack.api.defaults.StateValues; public class Command { -// ------------------------------ FIELDS ------------------------------ protected StringBuilder command = new StringBuilder(); -// -------------------------- STATIC METHODS -------------------------- - public static Command assigneeCommand(String assignee) { return new Command().assignee(assignee); @@ -25,22 +22,16 @@ public class Command { return new Command().state(state); } -// --------------------------- CONSTRUCTORS --------------------------- - protected Command() { } -// ------------------------ CANONICAL METHODS ------------------------ - @Override public String toString() { return command.toString().trim(); } -// -------------------------- OTHER METHODS -------------------------- - public Command assignee(String assignee) { return command(Fields.assignee, assignee); diff --git a/src/main/java/pl/itcrowd/youtrack/api/Commander.java b/src/main/java/pl/itcrowd/youtrack/api/Commander.java index 4cbf5fa..e71cc5a 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/Commander.java +++ b/src/main/java/pl/itcrowd/youtrack/api/Commander.java @@ -1,7 +1,6 @@ package pl.itcrowd.youtrack.api; public interface Commander { -// -------------------------- OTHER METHODS -------------------------- String getCommand(); } diff --git a/src/main/java/pl/itcrowd/youtrack/api/ErrorUnmarshaller.java b/src/main/java/pl/itcrowd/youtrack/api/ErrorUnmarshaller.java index 40f201d..7295e5d 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/ErrorUnmarshaller.java +++ b/src/main/java/pl/itcrowd/youtrack/api/ErrorUnmarshaller.java @@ -12,7 +12,6 @@ import java.io.StringReader; //TODO methods from this class should be probably merged with YoutrackUnmarshaller public final class ErrorUnmarshaller { -// -------------------------- STATIC METHODS -------------------------- public static String unmarshal(String string) throws JAXBException, IOException { @@ -34,8 +33,6 @@ public final class ErrorUnmarshaller { } } -// --------------------------- CONSTRUCTORS --------------------------- - private ErrorUnmarshaller() { } diff --git a/src/main/java/pl/itcrowd/youtrack/api/Filter.java b/src/main/java/pl/itcrowd/youtrack/api/Filter.java index 2a653f5..7e79367 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/Filter.java +++ b/src/main/java/pl/itcrowd/youtrack/api/Filter.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.List; public final class Filter { -// ------------------------------ FIELDS ------------------------------ private long after; @@ -16,8 +15,6 @@ public final class Filter { private long maxResults; -// -------------------------- STATIC METHODS -------------------------- - public static Filter createdFilter(String date) { return new Filter().created(date); @@ -93,15 +90,11 @@ public final class Filter { return new Filter().updater(updater); } -// --------------------------- CONSTRUCTORS --------------------------- - private Filter() { } -// ------------------------ CANONICAL METHODS ------------------------ - @Override public String toString() { @@ -124,8 +117,6 @@ public final class Filter { return builder.length() > space.length() ? builder.substring(space.length()) : builder.toString(); } -// -------------------------- OTHER METHODS -------------------------- - public Filter after(long after) { this.after = after; @@ -235,17 +226,12 @@ public final class Filter { return this; } -// -------------------------- INNER CLASSES -------------------------- - private class Condition { -// ------------------------------ FIELDS ------------------------------ private Fields field; private String value; -// --------------------------- CONSTRUCTORS --------------------------- - private Condition(Fields field, String value) { this.field = field; diff --git a/src/main/java/pl/itcrowd/youtrack/api/IssueWrapper.java b/src/main/java/pl/itcrowd/youtrack/api/IssueWrapper.java index fabe2b1..341dcbe 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/IssueWrapper.java +++ b/src/main/java/pl/itcrowd/youtrack/api/IssueWrapper.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; public class IssueWrapper implements Serializable { -// ------------------------------ FIELDS ------------------------------ private static final Log log = LogFactory.getLog(IssueWrapper.class); @@ -25,8 +24,6 @@ public class IssueWrapper implements Serializable { private Issue issue; -// --------------------------- CONSTRUCTORS --------------------------- - public IssueWrapper(Issue issue) { this.issue = issue; @@ -44,8 +41,6 @@ public class IssueWrapper implements Serializable { } } -// -------------------------- OTHER METHODS -------------------------- - public List getComments() { return Collections.unmodifiableList(comments); diff --git a/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java b/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java index 9950430..87a0b41 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java +++ b/src/main/java/pl/itcrowd/youtrack/api/URIUtils.java @@ -4,7 +4,6 @@ import java.net.URI; import java.net.URISyntaxException; public class URIUtils { -// -------------------------- STATIC METHODS -------------------------- public static URI buildURI(URI base, String path) { diff --git a/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java b/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java index f48ecd5..f92ea74 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java +++ b/src/main/java/pl/itcrowd/youtrack/api/YoutrackAPI.java @@ -64,326 +64,318 @@ import java.util.regex.Pattern; import static pl.itcrowd.youtrack.api.URIUtils.buildURI; public class YoutrackAPI { -// ------------------------------ FIELDS ------------------------------ - private final static QName Enumeration_QNAME = new QName("", "enumeration"); + private final static QName Enumeration_QNAME = new QName("", "enumeration"); - private final static QName Issue_QNAME = new QName("", "issue"); + private final static QName Issue_QNAME = new QName("", "issue"); - private static Log LOG = LogFactory.getLog(YoutrackAPI.class); + private static Log LOG = LogFactory.getLog(YoutrackAPI.class); - private HttpClient httpClient; + private HttpClient httpClient; - private String serviceLocation; + private String serviceLocation; - private URI serviceLocationURI; + private URI serviceLocationURI; -// -------------------------- STATIC METHODS -------------------------- + private static HttpClient getDefaultHttpClient() + { + SSLContext sslContext; + try { + sslContext = SSLContext.getInstance("SSL"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + // set up a TrustManager that trusts everything + try { + sslContext.init(null, new TrustManager[]{new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException + { + } + + public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException + { + } + + public X509Certificate[] getAcceptedIssuers() + { + return new X509Certificate[0]; + } + }}, new SecureRandom()); + } catch (KeyManagementException e) { + throw new RuntimeException(e); + } + + SSLSocketFactory sf = new SSLSocketFactory(sslContext); + Scheme httpsScheme = new Scheme("https", 443, sf); + SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault(); + schemeRegistry.register(schemeRegistry.unregister("https")); + schemeRegistry.register(httpsScheme); - private static HttpClient getDefaultHttpClient() - { - SSLContext sslContext; - try { - sslContext = SSLContext.getInstance("SSL"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); + ClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry); + return new DefaultHttpClient(cm); } - // set up a TrustManager that trusts everything - try { - sslContext.init(null, new TrustManager[]{new X509TrustManager() { - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException - { - } - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException - { + private static boolean isBlank(String str) + { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return true; } - - public X509Certificate[] getAcceptedIssuers() - { - return new X509Certificate[0]; + for (int i = 0; i < strLen; i++) { + if ((!Character.isWhitespace(str.charAt(i)))) { + return false; + } } - }}, new SecureRandom()); - } catch (KeyManagementException e) { - throw new RuntimeException(e); + return true; } - SSLSocketFactory sf = new SSLSocketFactory(sslContext); - Scheme httpsScheme = new Scheme("https", 443, sf); - SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault(); - schemeRegistry.register(schemeRegistry.unregister("https")); - schemeRegistry.register(httpsScheme); - - ClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry); - return new DefaultHttpClient(cm); - } - - private static boolean isBlank(String str) - { - int strLen; - if (str == null || (strLen = str.length()) == 0) { - return true; + public YoutrackAPI(String serviceLocation) + { + this(serviceLocation, null); } - for (int i = 0; i < strLen; i++) { - if ((!Character.isWhitespace(str.charAt(i)))) { - return false; - } + + 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; } - return true; - } -// --------------------------- CONSTRUCTORS --------------------------- + public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, JAXBException + { + this(serviceLocation, null, username, password); + } - public YoutrackAPI(String serviceLocation) - { - this(serviceLocation, null); - } + public YoutrackAPI(String serviceLocation, HttpClient httpClient, String username, String password) throws IOException, JAXBException + { + this(serviceLocation, httpClient); + login(username, password); + } - public YoutrackAPI(String serviceLocation, HttpClient httpClient) - { - if (serviceLocation == null) { - throw new IllegalArgumentException("serviceLocation cannot be null"); + public String getServiceLocation() + { + return serviceLocation; } - this.serviceLocation = serviceLocation; - try { - serviceLocationURI = new URI(this.serviceLocation); - } catch (URISyntaxException e) { - throw new RuntimeException(e); + + public void command(String issueId, String command) throws IOException + { + command(issueId, command, null, null, null, null); } - 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); - } - -// --------------------- GETTER / SETTER METHODS --------------------- - - public String getServiceLocation() - { - return serviceLocation; - } - -// -------------------------- OTHER METHODS -------------------------- - - public void command(String issueId, String command) throws IOException - { - command(issueId, command, null, null, null, null); - } - - public void command(String issueId, Command command) throws IOException - { - command(issueId, command.toString()); - } - - public void command(String issueId, String command, String comment, String group, Boolean disableNotifications, String runAs) throws IOException - { - final HttpPost request = new HttpPost(buildURI(serviceLocationURI, "/rest/issue/" + issueId + "/execute")); - final List parameters = new ArrayList(); - parameters.add(new BasicNameValuePair("command", command)); - if (!isBlank(comment)) { - parameters.add(new BasicNameValuePair("comment", comment)); + + public void command(String issueId, Command command) throws IOException + { + command(issueId, command.toString()); } - if (!isBlank(group)) { - parameters.add(new BasicNameValuePair("group", group)); + + public void command(String issueId, String command, String comment, String group, Boolean disableNotifications, String runAs) throws IOException + { + final HttpPost request = new HttpPost(buildURI(serviceLocationURI, "/rest/issue/" + issueId + "/execute")); + final List parameters = new ArrayList(); + parameters.add(new BasicNameValuePair("command", command)); + if (!isBlank(comment)) { + parameters.add(new BasicNameValuePair("comment", comment)); + } + if (!isBlank(group)) { + parameters.add(new BasicNameValuePair("group", group)); + } + if (disableNotifications != null) { + parameters.add(new BasicNameValuePair("disableNotifications", disableNotifications.toString())); + } + if (!isBlank(runAs)) { + parameters.add(new BasicNameValuePair("runAs", runAs)); + } + request.setEntity(new UrlEncodedFormEntity(parameters)); + execute(request); } - if (disableNotifications != null) { - parameters.add(new BasicNameValuePair("disableNotifications", disableNotifications.toString())); + + /** + * Creates new issue on Youtrack. + * + * @param project project to create issue in + * @param summary summary of the issue + * @param description longer description of the issue + * + * @return issue id of created issue + * + * @throws IOException in case of communication problems + */ + public String createIssue(String project, String summary, String description) throws IOException + { + final HttpPut request = createPutRequest(buildURI(serviceLocationURI, "/rest/issue"), new BasicNameValuePair("project", project), + new BasicNameValuePair("summary", summary), new BasicNameValuePair("description", description)); + final HttpResponse response = httpClient.execute(request); + final StatusLine statusLine = response.getStatusLine(); + final HttpEntity entity = response.getEntity(); + final String responseText = entity == null ? null : EntityUtils.toString(entity); + throwExceptionsIfNeeded(statusLine, responseText); + + final Header header = response.getFirstHeader(HttpHeaders.LOCATION); + if (header == null) { + throw new YoutrackAPIException("Missing location header despite positive status code: " + statusLine.getStatusCode()); + } + final String issueURL = header.getValue(); + final Matcher matcher = Pattern.compile(".*(" + project + "-\\d+)").matcher(issueURL); + if (!matcher.find() || matcher.groupCount() < 1) { + throw new YoutrackAPIException("Cannot extract issue id from issue URL: " + issueURL); + } + return matcher.group(1); } - if (!isBlank(runAs)) { - parameters.add(new BasicNameValuePair("runAs", runAs)); + + public void deleteIssue(String issueId) throws IOException + { + execute(new HttpDelete(buildURI(serviceLocationURI, "/rest/issue/" + issueId))); } - request.setEntity(new UrlEncodedFormEntity(parameters)); - execute(request); - } - - /** - * Creates new issue on Youtrack. - * - * @param project project to create issue in - * @param summary summary of the issue - * @param description longer description of the issue - * - * @return issue id of created issue - * - * @throws IOException in case of communication problems - */ - public String createIssue(String project, String summary, String description) throws IOException - { - final HttpPut request = createPutRequest(buildURI(serviceLocationURI, "/rest/issue"), new BasicNameValuePair("project", project), - new BasicNameValuePair("summary", summary), new BasicNameValuePair("description", description)); - final HttpResponse response = httpClient.execute(request); - final StatusLine statusLine = response.getStatusLine(); - final HttpEntity entity = response.getEntity(); - final String responseText = entity == null ? null : EntityUtils.toString(entity); - throwExceptionsIfNeeded(statusLine, responseText); - - final Header header = response.getFirstHeader(HttpHeaders.LOCATION); - if (header == null) { - throw new YoutrackAPIException("Missing location header despite positive status code: " + statusLine.getStatusCode()); + + 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); + } } - final String issueURL = header.getValue(); - final Matcher matcher = Pattern.compile(".*(" + project + "-\\d+)").matcher(issueURL); - if (!matcher.find() || matcher.groupCount() < 1) { - throw new YoutrackAPIException("Cannot extract issue id from issue URL: " + issueURL); + + 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); + } } - return matcher.group(1); - } - - public void deleteIssue(String issueId) throws IOException - { - 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 List getIndividualAssignees(String project) 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); + } } - } - - 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 IssueWrapper getIssue(String issueId) throws IOException, JAXBException + { + 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 List getIndividualAssignees(String project) 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); + + 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); } - } - - public IssueWrapper getIssue(String issueId) throws IOException, JAXBException - { - 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; - } + + public List searchIssuesByProject(String project, Object filter) throws JAXBException, IOException + { + final Object result = YoutrackUnmarshaller.unmarshall( + execute(new HttpGet(buildURI(serviceLocationURI, "/rest/issue/byproject/" + project, "filter=" + (filter == null ? "" : filter))))); + if (!(result instanceof Issues)) { + throw new YoutrackAPIException("Unmarshalling problem. Expected Issues, received: " + result.getClass() + " " + result); + } + List issues = ((Issues) result).getIssues(); + List wrappedIssues = new ArrayList(); + for (Issue issue : issues) { + wrappedIssues.add(new IssueWrapper(issue)); + } + return wrappedIssues; } - 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 void updateIssue(String issueId, String summary, String description) throws IOException + { + final HttpPost request = createPostRequest(buildURI(serviceLocationURI, "/rest/issue/" + issueId), + new BasicNameValuePair(Fields.summary.name(), summary), new BasicNameValuePair(Fields.description.name(), description)); + final HttpResponse response = httpClient.execute(request); + final StatusLine statusLine = response.getStatusLine(); + final HttpEntity entity = response.getEntity(); + final String responseText = entity == null ? null : EntityUtils.toString(entity); + throwExceptionsIfNeeded(statusLine, responseText); } - } - - 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); - } - - public List searchIssuesByProject(String project, Object filter) throws JAXBException, IOException - { - final Object result = YoutrackUnmarshaller.unmarshall( - execute(new HttpGet(buildURI(serviceLocationURI, "/rest/issue/byproject/" + project, "filter=" + (filter == null ? "" : filter))))); - if (!(result instanceof Issues)) { - throw new YoutrackAPIException("Unmarshalling problem. Expected Issues, received: " + result.getClass() + " " + result); + + private HttpPost createPostRequest(URI uri, NameValuePair... nameValuePair) throws UnsupportedEncodingException + { + return setEntity(new HttpPost(uri), nameValuePair); } - List issues = ((Issues) result).getIssues(); - List wrappedIssues = new ArrayList(); - for (Issue issue : issues) { - wrappedIssues.add(new IssueWrapper(issue)); + + private HttpPut createPutRequest(URI uri, NameValuePair... nameValuePair) throws UnsupportedEncodingException + { + return setEntity(new HttpPut(uri), nameValuePair); } - return wrappedIssues; - } - - public void updateIssue(String issueId, String summary, String description) throws IOException - { - final HttpPost request = createPostRequest(buildURI(serviceLocationURI, "/rest/issue/" + issueId), new BasicNameValuePair(Fields.summary.name(), summary), - new BasicNameValuePair(Fields.description.name(), description)); - final HttpResponse response = httpClient.execute(request); - final StatusLine statusLine = response.getStatusLine(); - final HttpEntity entity = response.getEntity(); - final String responseText = entity == null ? null : EntityUtils.toString(entity); - throwExceptionsIfNeeded(statusLine, responseText); - } - - private HttpPost createPostRequest(URI uri, NameValuePair... nameValuePair) throws UnsupportedEncodingException - { - return setEntity(new HttpPost(uri), nameValuePair); - } - - private HttpPut createPutRequest(URI uri, NameValuePair... nameValuePair) throws UnsupportedEncodingException - { - return setEntity(new HttpPut(uri), nameValuePair); - } - - private String execute(HttpUriRequest request) throws IOException - { - final HttpResponse response = httpClient.execute(request); - final StatusLine statusLine = response.getStatusLine(); - final HttpEntity entity = response.getEntity(); - String responseText = entity == null ? null : EntityUtils.toString(entity); - if (statusLine.getStatusCode() >= 300) { - try { - final String error = ErrorUnmarshaller.unmarshal(responseText); - throw new YoutrackErrorException(error, statusLine.getStatusCode()); - } catch (JAXBException e) { - LOG.error("Cannot unmarshal following response text:\n" + responseText, e); - throw new HttpResponseException(statusLine.getStatusCode(), responseText); - } + + private String execute(HttpUriRequest request) throws IOException + { + final HttpResponse response = httpClient.execute(request); + final StatusLine statusLine = response.getStatusLine(); + final HttpEntity entity = response.getEntity(); + String responseText = entity == null ? null : EntityUtils.toString(entity); + if (statusLine.getStatusCode() >= 300) { + try { + final String error = ErrorUnmarshaller.unmarshal(responseText); + throw new YoutrackErrorException(error, statusLine.getStatusCode()); + } catch (JAXBException e) { + LOG.error("Cannot unmarshal following response text:\n" + responseText, e); + throw new HttpResponseException(statusLine.getStatusCode(), responseText); + } + } + if (entity == null) { + throw new ClientProtocolException("Response contains no content"); + } + return responseText; } - if (entity == null) { - throw new ClientProtocolException("Response contains no content"); + + private T setEntity(T request, NameValuePair[] nameValuePair) throws UnsupportedEncodingException + { + final ArrayList list = new ArrayList(); + Collections.addAll(list, nameValuePair); + request.setEntity(new UrlEncodedFormEntity(list)); + return request; } - return responseText; - } - - private T setEntity(T request, NameValuePair[] nameValuePair) throws UnsupportedEncodingException - { - final ArrayList list = new ArrayList(); - Collections.addAll(list, nameValuePair); - request.setEntity(new UrlEncodedFormEntity(list)); - return request; - } - - private void throwExceptionsIfNeeded(StatusLine statusLine, String responseText) throws IOException - { - if (statusLine.getStatusCode() >= 300) { - throw new HttpResponseException(statusLine.getStatusCode(), responseText); + + private void throwExceptionsIfNeeded(StatusLine statusLine, String responseText) throws IOException + { + if (statusLine.getStatusCode() >= 300) { + throw new HttpResponseException(statusLine.getStatusCode(), responseText); + } } - } } \ No newline at end of file diff --git a/src/main/java/pl/itcrowd/youtrack/api/YoutrackUnmarshaller.java b/src/main/java/pl/itcrowd/youtrack/api/YoutrackUnmarshaller.java index 3948743..4c9688c 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/YoutrackUnmarshaller.java +++ b/src/main/java/pl/itcrowd/youtrack/api/YoutrackUnmarshaller.java @@ -8,7 +8,6 @@ import java.io.Reader; import java.io.StringReader; public final class YoutrackUnmarshaller { -// -------------------------- STATIC METHODS -------------------------- public static Object unmarshall(String string) throws JAXBException { @@ -20,8 +19,6 @@ public final class YoutrackUnmarshaller { return JAXBContext.newInstance(ObjectFactory.class).createUnmarshaller().unmarshal(reader); } -// --------------------------- CONSTRUCTORS --------------------------- - private YoutrackUnmarshaller() { } diff --git a/src/main/java/pl/itcrowd/youtrack/api/defaults/DateValues.java b/src/main/java/pl/itcrowd/youtrack/api/defaults/DateValues.java index f038f31..e894da5 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/defaults/DateValues.java +++ b/src/main/java/pl/itcrowd/youtrack/api/defaults/DateValues.java @@ -4,12 +4,8 @@ public enum DateValues { Today, Yesterday, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday, Sunday, ThisWeek("{This week}"), LastWeek("{Last week}"), TwoWeeksAgo( "{Two weeks ago}"), ThreeWeeksAgo("{Three weeks ago}"), ThisMonth("{This month}"), LastMonth("{Last month}"); -// ------------------------------ FIELDS ------------------------------ - private String filterValue; -// --------------------------- CONSTRUCTORS --------------------------- - private DateValues() { filterValue = name(); @@ -20,8 +16,6 @@ public enum DateValues { this.filterValue = filterValue; } -// --------------------- GETTER / SETTER METHODS --------------------- - public String getFilterValue() { return filterValue; diff --git a/src/main/java/pl/itcrowd/youtrack/api/defaults/Fields.java b/src/main/java/pl/itcrowd/youtrack/api/defaults/Fields.java index ea813df..daf6349 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/defaults/Fields.java +++ b/src/main/java/pl/itcrowd/youtrack/api/defaults/Fields.java @@ -16,12 +16,8 @@ public enum Fields implements Commander { updated, updaterName("updated by"); -// ------------------------------ FIELDS ------------------------------ - private String command; -// --------------------------- CONSTRUCTORS --------------------------- - private Fields() { command = name(); @@ -32,8 +28,6 @@ public enum Fields implements Commander { this.command = command; } -// --------------------- GETTER / SETTER METHODS --------------------- - public String getCommand() { if (command == null) { diff --git a/src/main/java/pl/itcrowd/youtrack/api/defaults/StateValues.java b/src/main/java/pl/itcrowd/youtrack/api/defaults/StateValues.java index b41537b..aa1c91b 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/defaults/StateValues.java +++ b/src/main/java/pl/itcrowd/youtrack/api/defaults/StateValues.java @@ -30,16 +30,12 @@ public enum StateValues { Resolved("Resolved", null), Unresolved("Unresolved", null); -// ------------------------------ FIELDS ------------------------------ - private String commandValue; private String filterValue; private boolean not; -// --------------------------- CONSTRUCTORS --------------------------- - private StateValues() { this(false); @@ -67,16 +63,12 @@ public enum StateValues { this.commandValue = commandValue == null ? name() : commandValue; } -// ------------------------ CANONICAL METHODS ------------------------ - @Override public String toString() { return getCommandValue(); } -// -------------------------- OTHER METHODS -------------------------- - public String getCommandValue() { return (not ? "-" : "") + commandValue; diff --git a/src/main/java/pl/itcrowd/youtrack/api/exceptions/NoResultFoundException.java b/src/main/java/pl/itcrowd/youtrack/api/exceptions/NoResultFoundException.java index c848d6e..a6867d8 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/exceptions/NoResultFoundException.java +++ b/src/main/java/pl/itcrowd/youtrack/api/exceptions/NoResultFoundException.java @@ -1,7 +1,6 @@ package pl.itcrowd.youtrack.api.exceptions; public class NoResultFoundException extends RuntimeException { -// --------------------------- CONSTRUCTORS --------------------------- public NoResultFoundException(String message, Throwable cause) { diff --git a/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackAPIException.java b/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackAPIException.java index 22ddd36..6596662 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackAPIException.java +++ b/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackAPIException.java @@ -1,7 +1,6 @@ package pl.itcrowd.youtrack.api.exceptions; public class YoutrackAPIException extends RuntimeException { -// --------------------------- CONSTRUCTORS --------------------------- public YoutrackAPIException() { diff --git a/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackErrorException.java b/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackErrorException.java index 875d999..6a8b81e 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackErrorException.java +++ b/src/main/java/pl/itcrowd/youtrack/api/exceptions/YoutrackErrorException.java @@ -1,20 +1,15 @@ package pl.itcrowd.youtrack.api.exceptions; public class YoutrackErrorException extends RuntimeException { -// ------------------------------ FIELDS ------------------------------ private int statusCode; -// --------------------------- CONSTRUCTORS --------------------------- - public YoutrackErrorException(String message, int statusCode) { super(message); this.statusCode = statusCode; } -// --------------------- GETTER / SETTER METHODS --------------------- - public int getStatusCode() { return statusCode; diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/AssignedByType.java b/src/main/java/pl/itcrowd/youtrack/api/rest/AssignedByType.java index 5e99f87..c5a76e3 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/AssignedByType.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/AssignedByType.java @@ -30,13 +30,10 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "assignedByType", propOrder = {"userGroupRef"}) public class AssignedByType { -// ------------------------------ FIELDS ------------------------------ @XmlElement(required = true) protected UserGroupRefType userGroupRef; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the userGroupRef property. * diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeList.java b/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeList.java index 3af1286..483e326 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeList.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeList.java @@ -47,7 +47,6 @@ import java.util.List; @XmlType(name = "", propOrder = {"assignees"}) @XmlRootElement(name = "assigneeList") public class AssigneeList { -// ------------------------------ FIELDS ------------------------------ @XmlElement(required = true) protected AssigneeList.Assignees assignees; @@ -58,8 +57,6 @@ public class AssigneeList { @XmlAttribute protected String individualsUrl; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the assignees property. * @@ -126,8 +123,6 @@ public class AssigneeList { this.individualsUrl = value; } -// -------------------------- INNER CLASSES -------------------------- - /** *

Java class for anonymous complex type. *

@@ -148,13 +143,10 @@ public class AssigneeList { @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"assignees"}) public static class Assignees { -// ------------------------------ FIELDS ------------------------------ @XmlElement(name = "assignee") protected List assignees; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the assignees property. *

diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeType.java b/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeType.java index 71f7435..f8949db 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeType.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/AssigneeType.java @@ -33,18 +33,15 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "assigneeType", propOrder = {"assignedBy"}) public class AssigneeType { -// ------------------------------ FIELDS ------------------------------ @XmlElement(required = true) protected AssignedByType assignedBy; @XmlAttribute - protected String isIndividualAssignee; - - @XmlAttribute protected String login; -// --------------------- GETTER / SETTER METHODS --------------------- + @XmlAttribute + protected String isIndividualAssignee; /** * Gets the value of the assignedBy property. @@ -69,46 +66,46 @@ public class AssigneeType { } /** - * Gets the value of the isIndividualAssignee property. + * Gets the value of the login property. * * @return possible object is * {@link String } */ - public String getIsIndividualAssignee() + public String getLogin() { - return isIndividualAssignee; + return login; } /** - * Sets the value of the isIndividualAssignee property. + * Sets the value of the login property. * * @param value allowed object is * {@link String } */ - public void setIsIndividualAssignee(String value) + public void setLogin(String value) { - this.isIndividualAssignee = value; + this.login = value; } /** - * Gets the value of the login property. + * Gets the value of the isIndividualAssignee property. * * @return possible object is * {@link String } */ - public String getLogin() + public String getIsIndividualAssignee() { - return login; + return isIndividualAssignee; } /** - * Sets the value of the login property. + * Sets the value of the isIndividualAssignee property. * * @param value allowed object is * {@link String } */ - public void setLogin(String value) + public void setIsIndividualAssignee(String value) { - this.login = value; + this.isIndividualAssignee = value; } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/Comment.java b/src/main/java/pl/itcrowd/youtrack/api/rest/Comment.java index 80a7a95..334aaa2 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/Comment.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/Comment.java @@ -57,62 +57,37 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "commentType", propOrder = {"content"}) public class Comment { -// ------------------------------ FIELDS ------------------------------ - @XmlAttribute - protected String author; - - @XmlElementRefs({@XmlElementRef(name = "value", type = JAXBElement.class), @XmlElementRef(name = "replies", type = JAXBElement.class)}) + @XmlElementRefs({@XmlElementRef(name = "replies", type = JAXBElement.class), @XmlElementRef(name = "value", type = JAXBElement.class)}) @XmlMixed protected List content; @XmlAttribute - protected Long created; + protected String id; @XmlAttribute - protected String deleted; + protected String author; @XmlAttribute - protected String id; + protected String issueId; @XmlAttribute - protected String issueId; + protected String deleted; @XmlAttribute - protected String name; + protected String text; @XmlAttribute protected String shownForIssueAuthor; @XmlAttribute - protected String text; + protected Long created; @XmlAttribute protected Long updated; -// --------------------- GETTER / SETTER METHODS --------------------- - - /** - * 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; - } + @XmlAttribute + protected String name; /** * Gets the value of the content property. @@ -132,9 +107,9 @@ public class Comment { *

*

* Objects of the following type(s) are allowed in the list - * {@link String } * {@link JAXBElement }{@code <}{@link Comment.Value }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link String } */ public List getContent() { @@ -145,113 +120,113 @@ public class Comment { } /** - * Gets the value of the created property. + * Gets the value of the id property. * * @return possible object is - * {@link Long } + * {@link String } */ - public Long getCreated() + public String getId() { - return created; + return id; } /** - * Sets the value of the created property. + * Sets the value of the id property. * * @param value allowed object is - * {@link Long } + * {@link String } */ - public void setCreated(Long value) + public void setId(String value) { - this.created = value; + this.id = value; } /** - * Gets the value of the deleted property. + * Gets the value of the author property. * * @return possible object is * {@link String } */ - public String getDeleted() + public String getAuthor() { - return deleted; + return author; } /** - * Sets the value of the deleted property. + * Sets the value of the author property. * * @param value allowed object is * {@link String } */ - public void setDeleted(String value) + public void setAuthor(String value) { - this.deleted = value; + this.author = value; } /** - * Gets the value of the id property. + * Gets the value of the issueId property. * * @return possible object is * {@link String } */ - public String getId() + public String getIssueId() { - return id; + return issueId; } /** - * Sets the value of the id property. + * Sets the value of the issueId property. * * @param value allowed object is * {@link String } */ - public void setId(String value) + public void setIssueId(String value) { - this.id = value; + this.issueId = value; } /** - * Gets the value of the issueId property. + * Gets the value of the deleted property. * * @return possible object is * {@link String } */ - public String getIssueId() + public String getDeleted() { - return issueId; + return deleted; } /** - * Sets the value of the issueId property. + * Sets the value of the deleted property. * * @param value allowed object is * {@link String } */ - public void setIssueId(String value) + public void setDeleted(String value) { - this.issueId = value; + this.deleted = value; } /** - * Gets the value of the name property. + * Gets the value of the text property. * * @return possible object is * {@link String } */ - public String getName() + public String getText() { - return name; + return text; } /** - * Sets the value of the name property. + * Sets the value of the text property. * * @param value allowed object is * {@link String } */ - public void setName(String value) + public void setText(String value) { - this.name = value; + this.text = value; } /** @@ -277,25 +252,25 @@ public class Comment { } /** - * Gets the value of the text property. + * Gets the value of the created property. * * @return possible object is - * {@link String } + * {@link Long } */ - public String getText() + public Long getCreated() { - return text; + return created; } /** - * Sets the value of the text property. + * Sets the value of the created property. * * @param value allowed object is - * {@link String } + * {@link Long } */ - public void setText(String value) + public void setCreated(Long value) { - this.text = value; + this.created = value; } /** @@ -320,7 +295,27 @@ public class Comment { this.updated = value; } -// -------------------------- INNER CLASSES -------------------------- + /** + * 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. @@ -341,39 +336,36 @@ public class Comment { @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"value"}) public static class Value { -// ------------------------------ FIELDS ------------------------------ - @XmlAttribute - protected String role; + @XmlValue + protected String value; @XmlAttribute protected String type; - @XmlValue - protected String value; - -// --------------------- GETTER / SETTER METHODS --------------------- + @XmlAttribute + protected String role; /** - * Gets the value of the role property. + * Gets the value of the value property. * * @return possible object is * {@link String } */ - public String getRole() + public String getValue() { - return role; + return value; } /** - * Sets the value of the role property. + * Sets the value of the value property. * * @param value allowed object is * {@link String } */ - public void setRole(String value) + public void setValue(String value) { - this.role = value; + this.value = value; } /** @@ -399,25 +391,25 @@ public class Comment { } /** - * Gets the value of the value property. + * Gets the value of the role property. * * @return possible object is * {@link String } */ - public String getValue() + public String getRole() { - return value; + return role; } /** - * Sets the value of the value property. + * Sets the value of the role property. * * @param value allowed object is * {@link String } */ - public void setValue(String value) + public void setRole(String value) { - this.value = value; + this.role = value; } } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/Enumeration.java b/src/main/java/pl/itcrowd/youtrack/api/rest/Enumeration.java index 6ed8768..a4c7fd4 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/Enumeration.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/Enumeration.java @@ -34,37 +34,12 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "enumerationType", propOrder = {"values"}) public class Enumeration { -// ------------------------------ FIELDS ------------------------------ - - @XmlAttribute - protected String name; @XmlElement(name = "value") protected List values; -// --------------------- GETTER / SETTER METHODS --------------------- - - /** - * 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; - } + @XmlAttribute + protected String name; /** * Gets the value of the values property. @@ -93,4 +68,26 @@ public class Enumeration { } return this.values; } + + /** + * 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; + } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/EnumerationValue.java b/src/main/java/pl/itcrowd/youtrack/api/rest/EnumerationValue.java index d34adf7..fd0a67e 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/EnumerationValue.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/EnumerationValue.java @@ -29,57 +29,54 @@ import javax.xml.bind.annotation.XmlValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "enumerationValueType", propOrder = {"value"}) public class EnumerationValue { -// ------------------------------ FIELDS ------------------------------ - - @XmlAttribute - protected Long colorIndex; @XmlValue protected String value; -// --------------------- GETTER / SETTER METHODS --------------------- + @XmlAttribute + protected Long colorIndex; /** - * Gets the value of the colorIndex property. + * Gets the value of the value property. * * @return possible object is - * {@link Long } + * {@link String } */ - public Long getColorIndex() + public String getValue() { - return colorIndex; + return value; } /** - * Sets the value of the colorIndex property. + * Sets the value of the value property. * * @param value allowed object is - * {@link Long } + * {@link String } */ - public void setColorIndex(Long value) + public void setValue(String value) { - this.colorIndex = value; + this.value = value; } /** - * Gets the value of the value property. + * Gets the value of the colorIndex property. * * @return possible object is - * {@link String } + * {@link Long } */ - public String getValue() + public Long getColorIndex() { - return value; + return colorIndex; } /** - * Sets the value of the value property. + * Sets the value of the colorIndex property. * * @param value allowed object is - * {@link String } + * {@link Long } */ - public void setValue(String value) + public void setColorIndex(Long value) { - this.value = value; + this.colorIndex = value; } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/Field.java b/src/main/java/pl/itcrowd/youtrack/api/rest/Field.java index 2f2f67e..9b0ed50 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/Field.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/Field.java @@ -44,37 +44,12 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "fieldType", propOrder = {"values"}) public class Field { -// ------------------------------ FIELDS ------------------------------ - - @XmlAttribute - protected String name; @XmlElement(name = "value") protected List values; -// --------------------- GETTER / SETTER METHODS --------------------- - - /** - * 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; - } + @XmlAttribute + protected String name; /** * Gets the value of the values property. @@ -104,7 +79,27 @@ public class Field { return this.values; } -// -------------------------- INNER CLASSES -------------------------- + /** + * 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. @@ -125,18 +120,15 @@ public class Field { @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"content"}) public static class Value { -// ------------------------------ FIELDS ------------------------------ @XmlValue protected String content; @XmlAttribute - protected String role; - - @XmlAttribute protected String type; -// --------------------- GETTER / SETTER METHODS --------------------- + @XmlAttribute + protected String role; /** * Gets the value of the content property. @@ -161,47 +153,47 @@ public class Field { } /** - * Gets the value of the role property. + * Gets the value of the type property. * * @return possible object is * {@link String } */ - public String getRole() + public String getType() { - return role; + return type; } /** - * Sets the value of the role property. + * Sets the value of the type property. * * @param value allowed object is * {@link String } */ - public void setRole(String value) + public void setType(String value) { - this.role = value; + this.type = value; } /** - * Gets the value of the type property. + * Gets the value of the role property. * * @return possible object is * {@link String } */ - public String getType() + public String getRole() { - return type; + return role; } /** - * Sets the value of the type property. + * Sets the value of the role property. * * @param value allowed object is * {@link String } */ - public void setType(String value) + public void setRole(String value) { - this.type = value; + this.role = value; } } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/Issue.java b/src/main/java/pl/itcrowd/youtrack/api/rest/Issue.java index f295db3..7fe706f 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/Issue.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/Issue.java @@ -36,7 +36,6 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "issueType", propOrder = {"fieldOrComment"}) public class Issue { -// ------------------------------ FIELDS ------------------------------ @XmlElements({@XmlElement(name = "comment", type = Comment.class), @XmlElement(name = "field", type = Field.class)}) protected List fieldOrComment; @@ -44,8 +43,6 @@ public class Issue { @XmlAttribute protected String id; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the fieldOrComment property. *

diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/Issues.java b/src/main/java/pl/itcrowd/youtrack/api/rest/Issues.java index 347fdfa..a18e83d 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/Issues.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/Issues.java @@ -34,13 +34,10 @@ import java.util.List; @XmlType(name = "", propOrder = {"issues"}) @XmlRootElement(name = "issues") public class Issues { -// ------------------------------ FIELDS ------------------------------ @XmlElement(name = "issue") protected List issues; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the issues property. *

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 27e2c88..96dc2e6 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/ObjectFactory.java @@ -13,7 +13,7 @@ import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface - * generated in the pl.it_crowd.youtrack.api.rest package. + * generated in the pl.itcrowd.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 @@ -25,13 +25,6 @@ import javax.xml.namespace.QName; */ @XmlRegistry public class ObjectFactory { -// ------------------------------ FIELDS ------------------------------ - - 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 _Error_QNAME = new QName("", "error"); @@ -39,81 +32,89 @@ public class ObjectFactory { private final static QName _Issue_QNAME = new QName("", "issue"); -// --------------------------- CONSTRUCTORS --------------------------- + 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"); /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.it_crowd.youtrack.api.rest + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.itcrowd.youtrack.api.rest */ public ObjectFactory() { } -// -------------------------- OTHER METHODS -------------------------- + /** + * Create an instance of {@link Comment.Value } + */ + public Comment.Value createCommentValue() + { + return new Comment.Value(); + } /** - * Create an instance of {@link AssignedByType } + * Create an instance of {@link EnumerationValue } */ - public AssignedByType createAssignedByType() + public EnumerationValue createEnumerationValue() { - return new AssignedByType(); + return new EnumerationValue(); } /** - * Create an instance of {@link AssigneeList } + * Create an instance of {@link Issue } */ - public AssigneeList createAssigneeList() + public Issue createIssue() { - return new AssigneeList(); + return new Issue(); } /** - * Create an instance of {@link AssigneeList.Assignees } + * Create an instance of {@link UserRefs } */ - public AssigneeList.Assignees createAssigneeListAssignees() + public UserRefs createUserRefs() { - return new AssigneeList.Assignees(); + return new UserRefs(); } /** - * Create an instance of {@link AssigneeType } + * Create an instance of {@link User } */ - public AssigneeType createAssigneeType() + public User createUser() { - return new AssigneeType(); + return new User(); } /** - * Create an instance of {@link Comment } + * Create an instance of {@link Issues } */ - public Comment createComment() + public Issues createIssues() { - return new Comment(); + return new Issues(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link Field } */ - @XmlElementDecl(namespace = "", name = "replies", scope = Comment.class) - public JAXBElement createCommentReplies(String value) + public Field createField() { - return new JAXBElement(_CommentReplies_QNAME, String.class, Comment.class, value); + return new Field(); } /** - * Create an instance of {@link Comment.Value } + * Create an instance of {@link Comment } */ - public Comment.Value createCommentValue() + public Comment createComment() { - return new Comment.Value(); + return new Comment(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}} + * Create an instance of {@link AssigneeList.Assignees } */ - @XmlElementDecl(namespace = "", name = "value", scope = Comment.class) - public JAXBElement createCommentValue(Comment.Value value) + public AssigneeList.Assignees createAssigneeListAssignees() { - return new JAXBElement(_CommentValue_QNAME, Comment.Value.class, Comment.class, value); + return new AssigneeList.Assignees(); } /** @@ -125,62 +126,61 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link Enumeration }{@code >}} + * Create an instance of {@link AssigneeList } */ - @XmlElementDecl(namespace = "", name = "enumeration") - public JAXBElement createEnumeration(Enumeration value) + public AssigneeList createAssigneeList() { - return new JAXBElement(_Enumeration_QNAME, Enumeration.class, null, value); + return new AssigneeList(); } /** - * Create an instance of {@link EnumerationValue } + * Create an instance of {@link UserGroupRefType } */ - public EnumerationValue createEnumerationValue() + public UserGroupRefType createUserGroupRefType() { - return new EnumerationValue(); + return new UserGroupRefType(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link Field.Value } */ - @XmlElementDecl(namespace = "", name = "error") - public JAXBElement createError(String value) + public Field.Value createFieldValue() { - return new JAXBElement(_Error_QNAME, String.class, null, value); + return new Field.Value(); } /** - * 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 Field.Value } + * Create an instance of {@link AssigneeType } */ - public Field.Value createFieldValue() + public AssigneeType createAssigneeType() { - return new Field.Value(); + return new AssigneeType(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} */ - @XmlElementDecl(namespace = "", name = "int") - public JAXBElement createInt(Short value) + @XmlElementDecl(namespace = "", name = "error") + public JAXBElement createError(String value) { - return new JAXBElement(_Int_QNAME, Short.class, null, value); + return new JAXBElement(_Error_QNAME, String.class, null, value); } /** - * Create an instance of {@link Issue } + * Create an instance of {@link JAXBElement }{@code <}{@link Short }{@code >}} */ - public Issue createIssue() + @XmlElementDecl(namespace = "", name = "int") + public JAXBElement createInt(Short value) { - return new Issue(); + return new JAXBElement(_Int_QNAME, Short.class, null, value); } /** @@ -193,34 +193,29 @@ public class ObjectFactory { } /** - * Create an instance of {@link Issues } - */ - public Issues createIssues() - { - return new Issues(); - } - - /** - * Create an instance of {@link User } + * Create an instance of {@link JAXBElement }{@code <}{@link Enumeration }{@code >}} */ - public User createUser() + @XmlElementDecl(namespace = "", name = "enumeration") + public JAXBElement createEnumeration(Enumeration value) { - return new User(); + return new JAXBElement(_Enumeration_QNAME, Enumeration.class, null, value); } /** - * Create an instance of {@link UserGroupRefType } + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} */ - public UserGroupRefType createUserGroupRefType() + @XmlElementDecl(namespace = "", name = "replies", scope = Comment.class) + public JAXBElement createCommentReplies(String value) { - return new UserGroupRefType(); + return new JAXBElement(_CommentReplies_QNAME, String.class, Comment.class, value); } /** - * Create an instance of {@link UserRefs } + * Create an instance of {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}} */ - public UserRefs createUserRefs() + @XmlElementDecl(namespace = "", name = "value", scope = Comment.class) + public JAXBElement createCommentValue(Comment.Value value) { - return new UserRefs(); + return new JAXBElement(_CommentValue_QNAME, Comment.Value.class, Comment.class, value); } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/User.java b/src/main/java/pl/itcrowd/youtrack/api/rest/User.java index 5615ec0..69e0069 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/User.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/User.java @@ -30,7 +30,6 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "userType") public class User { -// ------------------------------ FIELDS ------------------------------ @XmlAttribute(required = true) protected String login; @@ -39,8 +38,6 @@ public class User { @XmlSchemaType(name = "anyURI") protected String url; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the login property. * diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/UserGroupRefType.java b/src/main/java/pl/itcrowd/youtrack/api/rest/UserGroupRefType.java index 8a64447..20b0c51 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/UserGroupRefType.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/UserGroupRefType.java @@ -30,7 +30,9 @@ import javax.xml.bind.annotation.XmlValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "userGroupRefType", propOrder = {"value"}) public class UserGroupRefType { -// ------------------------------ FIELDS ------------------------------ + + @XmlValue + protected String value; @XmlAttribute protected String name; @@ -38,74 +40,69 @@ public class UserGroupRefType { @XmlAttribute protected String url; - @XmlValue - protected String value; - -// --------------------- GETTER / SETTER METHODS --------------------- - /** - * Gets the value of the name property. + * Gets the value of the value property. * * @return possible object is * {@link String } */ - public String getName() + public String getValue() { - return name; + return value; } /** - * Sets the value of the name property. + * Sets the value of the value property. * * @param value allowed object is * {@link String } */ - public void setName(String value) + public void setValue(String value) { - this.name = value; + this.value = value; } /** - * Gets the value of the url property. + * Gets the value of the name property. * * @return possible object is * {@link String } */ - public String getUrl() + public String getName() { - return url; + return name; } /** - * Sets the value of the url property. + * Sets the value of the name property. * * @param value allowed object is * {@link String } */ - public void setUrl(String value) + public void setName(String value) { - this.url = value; + this.name = value; } /** - * Gets the value of the value property. + * Gets the value of the url property. * * @return possible object is * {@link String } */ - public String getValue() + public String getUrl() { - return value; + return url; } /** - * Sets the value of the value property. + * Sets the value of the url property. * * @param value allowed object is * {@link String } */ - public void setValue(String value) + public void setUrl(String value) { - this.value = value; + this.url = value; } } diff --git a/src/main/java/pl/itcrowd/youtrack/api/rest/UserRefs.java b/src/main/java/pl/itcrowd/youtrack/api/rest/UserRefs.java index d645028..bde9479 100644 --- a/src/main/java/pl/itcrowd/youtrack/api/rest/UserRefs.java +++ b/src/main/java/pl/itcrowd/youtrack/api/rest/UserRefs.java @@ -34,13 +34,10 @@ import java.util.List; @XmlType(name = "", propOrder = {"users"}) @XmlRootElement(name = "userRefs") public class UserRefs { -// ------------------------------ FIELDS ------------------------------ @XmlElement(name = "user") protected List users; -// --------------------- GETTER / SETTER METHODS --------------------- - /** * Gets the value of the users property. *

diff --git a/src/test/java/pl/itcrowd/youtrack/api/rest/CommandTest.java b/src/test/java/pl/itcrowd/youtrack/api/rest/CommandTest.java index 13478a7..766135a 100644 --- a/src/test/java/pl/itcrowd/youtrack/api/rest/CommandTest.java +++ b/src/test/java/pl/itcrowd/youtrack/api/rest/CommandTest.java @@ -6,7 +6,6 @@ import pl.itcrowd.youtrack.api.Command; import pl.itcrowd.youtrack.api.defaults.StateValues; public class CommandTest { -// -------------------------- OTHER METHODS -------------------------- @Test public void assignee() diff --git a/src/test/java/pl/itcrowd/youtrack/api/rest/FilterTest.java b/src/test/java/pl/itcrowd/youtrack/api/rest/FilterTest.java index 40f7133..024cfc5 100644 --- a/src/test/java/pl/itcrowd/youtrack/api/rest/FilterTest.java +++ b/src/test/java/pl/itcrowd/youtrack/api/rest/FilterTest.java @@ -7,7 +7,6 @@ import pl.itcrowd.youtrack.api.defaults.DateValues; import pl.itcrowd.youtrack.api.defaults.StateValues; public class FilterTest { -// -------------------------- OTHER METHODS -------------------------- @Test public void chaining() diff --git a/src/test/java/pl/itcrowd/youtrack/api/rest/URIUtilsTest.java b/src/test/java/pl/itcrowd/youtrack/api/rest/URIUtilsTest.java index 2888730..2005af2 100644 --- a/src/test/java/pl/itcrowd/youtrack/api/rest/URIUtilsTest.java +++ b/src/test/java/pl/itcrowd/youtrack/api/rest/URIUtilsTest.java @@ -11,7 +11,6 @@ import java.net.URISyntaxException; import static org.junit.Assert.assertEquals; public class URIUtilsTest { -// -------------------------- OTHER METHODS -------------------------- @Test public void buildURI() throws URISyntaxException diff --git a/src/test/java/pl/itcrowd/youtrack/api/rest/YoutrackAPITest.java b/src/test/java/pl/itcrowd/youtrack/api/rest/YoutrackAPITest.java index b104c90..d6edd58 100644 --- a/src/test/java/pl/itcrowd/youtrack/api/rest/YoutrackAPITest.java +++ b/src/test/java/pl/itcrowd/youtrack/api/rest/YoutrackAPITest.java @@ -38,7 +38,6 @@ import static org.mockito.Mockito.when; * Ticket TST-2 should be deleted. */ public class YoutrackAPITest { -// -------------------------- OTHER METHODS -------------------------- @Test public void command() throws IOException, JAXBException