Skip to content

Commit 285ae4e

Browse files
Jack ThorleyEsendexDev
authored andcommitted
Merge branch 'Java-SDK-Deprecate-Contact-Endpoint-Replace-With-New'
2 parents 9a426dd + c3b45ac commit 285ae4e

41 files changed

Lines changed: 540 additions & 742 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 93 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,98 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
<properties>
7-
<buildnumber>0</buildnumber>
8-
</properties>
9-
<groupId>esendex-java-sdk</groupId>
10-
<artifactId>esendex-java-sdk</artifactId>
11-
<version>1.0.1</version>
12-
<build>
13-
<plugins>
14-
<plugin>
15-
<artifactId>maven-compiler-plugin</artifactId>
16-
<version>2.3.2</version>
17-
<configuration>
18-
<source>1.8</source>
19-
<target>1.8</target>
20-
</configuration>
21-
</plugin>
22-
<plugin>
23-
<groupId>org.apache.maven.plugins</groupId>
24-
<artifactId>maven-failsafe-plugin</artifactId>
25-
<version>2.17</version>
26-
</plugin>
27-
<plugin>
28-
<groupId>org.apache.maven.plugins</groupId>
29-
<artifactId>maven-surefire-plugin</artifactId>
30-
<version>2.17</version>
31-
<dependencies>
32-
<dependency>
33-
<groupId>org.apache.maven.surefire</groupId>
34-
<artifactId>surefire-junit47</artifactId>
35-
<version>2.17</version>
36-
</dependency>
37-
</dependencies>
38-
</plugin>
39-
<plugin>
40-
<artifactId>maven-dependency-plugin</artifactId>
41-
<executions>
42-
<execution>
43-
<phase>package</phase>
44-
<goals>
45-
<goal>copy-dependencies</goal>
46-
</goals>
47-
<configuration>
48-
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
49-
</configuration>
50-
</execution>
51-
</executions>
52-
</plugin>
53-
</plugins>
54-
<resources>
55-
<resource>
56-
<directory>src/main/resources</directory>
57-
<filtering>true</filtering>
58-
</resource>
59-
</resources>
60-
</build>
61-
<dependencies>
62-
<dependency>
63-
<groupId>commons-logging</groupId>
64-
<artifactId>commons-logging</artifactId>
65-
<version>1.1.1</version>
66-
</dependency>
67-
<dependency>
68-
<groupId>com.thoughtworks.xstream</groupId>
69-
<artifactId>xstream</artifactId>
70-
<version>1.4.7</version>
71-
</dependency>
72-
<dependency>
73-
<groupId>junit</groupId>
74-
<artifactId>junit</artifactId>
75-
<version>4.9</version>
76-
</dependency>
77-
</dependencies>
5+
<modelVersion>4.0.0</modelVersion>
6+
<properties>
7+
<buildnumber>0</buildnumber>
8+
</properties>
9+
<groupId>esendex-java-sdk</groupId>
10+
<artifactId>esendex-java-sdk</artifactId>
11+
<version>2.0.1</version>
12+
<build>
13+
<plugins>
14+
<plugin>
15+
<artifactId>maven-compiler-plugin</artifactId>
16+
<version>2.3.2</version>
17+
<configuration>
18+
<source>1.8</source>
19+
<target>1.8</target>
20+
</configuration>
21+
</plugin>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-failsafe-plugin</artifactId>
25+
<version>2.17</version>
26+
</plugin>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-surefire-plugin</artifactId>
30+
<version>2.17</version>
31+
<dependencies>
32+
<dependency>
33+
<groupId>org.apache.maven.surefire</groupId>
34+
<artifactId>surefire-junit47</artifactId>
35+
<version>2.17</version>
36+
</dependency>
37+
</dependencies>
38+
</plugin>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-javadoc-plugin</artifactId>
42+
<version>2.10.3</version>
43+
<configuration>
44+
<destDir>${project.build.directory}/apidocs</destDir>
45+
<reportOutputDirectory>${project.reporting.outputDirectory}/apidocs</reportOutputDirectory>
46+
</configuration>
47+
<executions>
48+
<execution>
49+
<id>attach-javadocs</id>
50+
<goals>
51+
<goal>jar</goal>
52+
</goals>
53+
<configuration>
54+
<additionalparam>-Xdoclint:none</additionalparam>
55+
</configuration>
56+
</execution>
57+
</executions>
58+
</plugin>
59+
<plugin>
60+
<artifactId>maven-dependency-plugin</artifactId>
61+
<executions>
62+
<execution>
63+
<phase>package</phase>
64+
<goals>
65+
<goal>copy-dependencies</goal>
66+
</goals>
67+
<configuration>
68+
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
69+
</configuration>
70+
</execution>
71+
</executions>
72+
</plugin>
73+
</plugins>
74+
<resources>
75+
<resource>
76+
<directory>src/main/resources</directory>
77+
<filtering>true</filtering>
78+
</resource>
79+
</resources>
80+
</build>
81+
<dependencies>
82+
<dependency>
83+
<groupId>commons-logging</groupId>
84+
<artifactId>commons-logging</artifactId>
85+
<version>1.1.1</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>com.thoughtworks.xstream</groupId>
89+
<artifactId>xstream</artifactId>
90+
<version>1.4.7</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>junit</groupId>
94+
<artifactId>junit</artifactId>
95+
<version>4.9</version>
96+
</dependency>
97+
</dependencies>
7898

7999
</project>

src/main/java/esendex/sdk/java/ServiceFactory.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
/**
2121
* A factory for services. A service is the fundamental developer interface to
2222
* the Esendex resources. A new ServiceFactory should be created for every
23-
* Authentication identity.
24-
*
23+
* Authentication identity.
24+
*
2525
* @author Mike Whittaker
2626
*/
2727
public abstract class ServiceFactory implements IServiceFactory {
28-
28+
2929
protected Authenticator authenticator;
3030

3131
/**
@@ -47,7 +47,7 @@ public static SessionServiceFactory createSessionAuthenticatingFactory(
4747
UserPassword userPassword) throws EsendexException {
4848
return new SessionServiceFactoryImpl(userPassword);
4949
}
50-
50+
5151
/**
5252
* Create a ServiceFactory whose services will connect using Basic
5353
* authentication.
@@ -83,13 +83,13 @@ public InboxService getInboxService() {
8383
return new InboxServiceImpl(authenticator);
8484
}
8585

86-
/**
87-
* Obtains a service suitable for create, read, update and delete
88-
* operations on the users contacts.
89-
* @return the service
90-
*/
86+
/**
87+
* Obtains a service suitable for create, read, update and delete
88+
* operations on the users contacts.
89+
* @return the service
90+
*/
9191
public ContactService getContactService() {
9292
return new ContactServiceImpl(authenticator);
9393
}
94-
94+
9595
}

src/main/java/esendex/sdk/java/http/HttpConnectorImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public HttpResponse connect(URL url,
3636
HttpURLConnection uc = createHttpRequest(url, method, authenticator, data);
3737

3838
return executeHttpRequest(uc);
39-
39+
4040
} catch (IOException ex) {
41-
41+
4242
throw new HttpException("Failed connection to: " + url, ex);
4343
}
4444

@@ -55,7 +55,7 @@ private HttpResponse executeHttpRequest(HttpURLConnection uc) throws IOException
5555
}
5656

5757
String response = null;
58-
if (HttpURLConnection.HTTP_OK == respCode) {
58+
if (HttpURLConnection.HTTP_OK == respCode || HttpURLConnection.HTTP_CREATED == respCode ) {
5959

6060
response = readHttpResponse(uc);
6161
}

src/main/java/esendex/sdk/java/http/HttpQuery.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,49 @@
44
import java.net.URLEncoder;
55

66
public class HttpQuery {
7-
7+
88
private StringBuilder queryString = new StringBuilder();
9-
10-
public static final Key<Boolean> RETURN_MESSAGE_HEADERS
9+
10+
public static final Key<Boolean> RETURN_MESSAGE_HEADERS
1111
= new Key<Boolean>("returnMessageHeaders");
12-
13-
public static final Key<Integer> COUNT
12+
13+
public static final Key<Integer> COUNT
1414
= new Key<Integer>("count");
1515

16-
public static final Key<Integer> START_INDEX
16+
public static final Key<Integer> START_INDEX
1717
= new Key<Integer>("startIndex");
1818

19-
public static final Key<Action> ACTION
19+
public static final Key<Action> ACTION
2020
= new Key<Action>("action");
21-
22-
public static final Key<String> FILTER_VALUE
21+
22+
public static final Key<String> FILTER_VALUE
2323
= new Key<String>("filterValue");
24-
25-
public static final Key<String> FILTER_BY
24+
25+
public static final Key<String> FILTER_BY
2626
= new Key<String>("filterBy");
27-
27+
28+
public static final Key<String> ACCOUNT_REFERENCE
29+
= new Key<String>("accountreference");
30+
2831
public static final String ACCOUNT_FILTER = "account";
29-
32+
33+
3034
public enum Action {
3135
READ,
3236
UNREAD;
3337
public String toString() {
3438
return name().toLowerCase();
3539
}
3640
}
37-
41+
3842
public enum FilterBy {
3943
ACCOUNT ("");
4044
String value;
4145
private FilterBy(String v) {
4246
this.value = v;
4347
}
4448
}
45-
49+
4650
public <E> void addParameter(Key<E> key, E value) {
4751
if (queryString.length() > 0) queryString.append('&');
4852
queryString.append(key.name);
@@ -55,12 +59,12 @@ public <E> void addParameter(Key<E> key, E value) {
5559
queryString.append(value.toString());
5660
}
5761
}
58-
62+
5963
@Override
6064
public String toString() {
6165
return queryString.toString();
6266
}
63-
67+
6468
private static class Key<T> {
6569
String name;
6670
Key(String n) {
Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
11
package esendex.sdk.java.model.domain.impl;
22

3-
import esendex.sdk.java.model.types.ContactType;
4-
53
public class BaseContact {
64

75
private String id;
8-
private String concurrencyId;
9-
private String uri;
106
private String firstName;
117
private String lastName;
128
private String quickName;
139
private String mobileNumber;
14-
private ContactType type;
15-
16-
public BaseContact() {
10+
private String accountReference;
11+
12+
public BaseContact() {
1713
}
1814

1915
public String getId() {
2016
return id;
2117
}
22-
23-
public String getConcurrencyId() {
24-
return concurrencyId;
25-
}
26-
27-
public String getUri() {
28-
return uri;
29-
}
3018

3119
public String getFirstName() {
3220
return firstName;
@@ -44,18 +32,14 @@ public String getMobileNumber() {
4432
return mobileNumber;
4533
}
4634

47-
public ContactType getType() {
48-
return type;
49-
}
35+
public String getAccountReference() {return accountReference;}
5036

5137
protected void setId(String id) {
5238
this.id = id;
5339
}
5440

55-
protected void setConcurrencyId(String concurrencyId) {
56-
this.concurrencyId = concurrencyId;
57-
}
58-
41+
protected void setAccountReference(String accountReference) {this.accountReference = accountReference; }
42+
5943
protected void setFirstName(String firstName) {
6044
this.firstName = firstName;
6145
}
@@ -72,8 +56,4 @@ protected void setMobileNumber(String mobileNumber) {
7256
this.mobileNumber = mobileNumber;
7357
}
7458

75-
protected void setType(ContactType type) {
76-
this.type = type;
77-
}
78-
7959
}

0 commit comments

Comments
 (0)