Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.20.0</version>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
Expand Down Expand Up @@ -78,13 +78,13 @@
<github.global.server>github</github.global.server>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
</properties>
<build>
<finalName>Xero-Java-SDK</finalName>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<artifactId>maven3-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/xero/api/OAuthRequestResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ public final Map<String, String> execute() throws IOException,XeroApiException
content = "<Response><Status>DELETED</Status></Response>";
}
if (code != 200 && code != 204) {
Header rateHeader = response.getFirstHeader("x-rate-limit-problem");
if (rateHeader != null) {
content += "&rate=" + rateHeader.getValue().toLowerCase();
}
XeroApiException e = new XeroApiException(code,content);
throw e;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/xero/api/XeroClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1694,11 +1694,13 @@ public List<TrackingCategory> getTrackingCategories() throws IOException {
}
}

public List<TrackingCategory> getTrackingCategories(Date modifiedAfter, String where, String order)
public List<TrackingCategory> getTrackingCategories(Date modifiedAfter, String where, String order,
Boolean includeArchived)
throws IOException {
Map<String, String> params = new HashMap<>();
addToMapIfNotNull(params, "Where", where);
addToMapIfNotNull(params, "order", order);
addToMapIfNotNull(params, "includeArchived", includeArchived);

Response responseObj = get("TrackingCategories", modifiedAfter, params);
if (responseObj.getTrackingCategories() == null) {
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/com/xero/api/jaxb/XeroJAXBMarshaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
* cannot create the marshaller or unmarshaller
*/
public class XeroJAXBMarshaller {

private final Marshaller marshaller;
private final Unmarshaller unmarshaller;
static final JAXBContext context = initContext();

private static JAXBContext initContext() {
Expand All @@ -34,20 +31,13 @@ private static JAXBContext initContext() {
}

public XeroJAXBMarshaller() {
try {
//context = JAXBContext.newInstance("com.xero.model");
marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller();
} catch (Exception e) {
throw new XeroClientException(e.getMessage(), e);
}
}


public String marshall(JAXBElement<?> object) {
try {
StringWriter writer = new StringWriter();
marshaller.marshal(object, writer);
context.createMarshaller().marshal(object, writer);
return writer.toString();
} catch (JAXBException e) {
throw new IllegalStateException("Error marshalling request object " + object.getClass(), e);
Expand All @@ -57,7 +47,7 @@ public String marshall(JAXBElement<?> object) {
public <T> T unmarshall(String responseBody, Class<T> clazz) throws UnsupportedEncodingException {
try {
Source source = new StreamSource(new StringReader(responseBody));
return unmarshaller.unmarshal(source, clazz).getValue();
return context.createUnmarshaller().unmarshal(source, clazz).getValue();
} catch (JAXBException e) {
throw new IllegalStateException("Error unmarshalling response: " + responseBody, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/xero/example/RequestResourceServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
String deleteTrackingCategoryOption = client.deleteTrackingCategoryOption(newTrackingCategory.get(0).getTrackingCategoryID(),newTrackingCategoryOption.get(0).getTrackingOptionID());
messages.add("Delete TrackingCategory Option - : " + deleteTrackingCategoryOption);

List<TrackingCategory> TrackingCategoryWhere = client.getTrackingCategories(null,"Status==\"ACTIVE\"",null);
List<TrackingCategory> TrackingCategoryWhere = client.getTrackingCategories(null,"Status==\"ACTIVE\"",null, false);
messages.add("Get a TrackingCategory with WHERE clause - Name : " + TrackingCategoryWhere.get(0).getName());

List<TrackingCategory> TrackingCategoryList = client.getTrackingCategories();
Expand Down