Skip to content

Commit a9b9458

Browse files
Merge pull request #15 from SendSafely/v3.1.6
v3.1.6
2 parents cea22d1 + 8d840a3 commit a9b9458

13 files changed

+227
-6
lines changed

SampleApplication/README.MD

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
11
SampleApplication is intended to provide a starting point for building custom Java application integrations using the SendSafely Java Client API.
22

33
# Instructions
4-
Download the most recent release of the SendSafely Client API, extract, and copy all of the contained jar files into the SampleApplication/lib folder.
4+
Download the most recent release of the SendSafely Client API from [GitHub](https://github.com/SendSafely/Java-Client-API/releases) or a [public maven repository](https://mvnrepository.com/artifact/com.sendsafely/sendsafely-java-api) and copy the jar files into the SampleApplication/lib folder. Alternatively, build and run SampleApplication using the Maven instructions below.
55

6-
## Compile
6+
## Manual
7+
### Build
78

89
`mkdir bin`
910

1011
`javac -cp "lib/*" -d bin src/*.java`
1112

12-
## Run (macOS/Linux)
13+
### Run (macOS/Linux)
1314

1415
```
1516
java -cp "lib/*:bin" SendSafelyRefApp
1617
```
1718

18-
## Run (Windows)
19+
### Run (Windows)
1920

2021
```
2122
java -cp "lib/*;bin/" SendSafelyRefApp
2223
```
24+
## Maven
25+
### Build
26+
```mvn clean compile package```
27+
28+
### Run (macOS/Linux)
29+
```java -cp "lib/*:target/SampleApplication-1.0-SNAPSHOT.jar" SendSafelyRefApp```
30+
31+
### Run (Windows)
32+
```java -cp "lib/*;target/SampleApplication-1.0-SNAPSHOT.jar" SendSafelyRefApp```
2333

2434
### Command Line Argments
2535

SampleApplication/pom.xml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
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+
7+
<groupId>com.sendsafely</groupId>
8+
<artifactId>SampleApplication</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<name>SampleApplication</name>
12+
<url>https://www.sendsafely.com</url>
13+
<packaging>jar</packaging>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.sendsafely</groupId>
18+
<artifactId>sendsafely-java-api</artifactId>
19+
<version>3.1.5</version>
20+
</dependency>
21+
</dependencies>
22+
23+
<build>
24+
<sourceDirectory>src</sourceDirectory>
25+
<plugins>
26+
<plugin>
27+
<groupId>org.apache.maven.plugins</groupId>
28+
<artifactId>maven-dependency-plugin</artifactId>
29+
<executions>
30+
<execution>
31+
<id>copy-dependencies</id>
32+
<phase>package</phase>
33+
<goals>
34+
<goal>copy-dependencies</goal>
35+
</goals>
36+
<configuration>
37+
<outputDirectory>lib</outputDirectory>
38+
<overWriteReleases>false</overWriteReleases>
39+
<overWriteSnapshots>false</overWriteSnapshots>
40+
<overWriteIfNewer>true</overWriteIfNewer>
41+
</configuration>
42+
</execution>
43+
</executions>
44+
</plugin>
45+
<plugin>
46+
<artifactId>maven-compiler-plugin</artifactId>
47+
<version>3.8.1</version>
48+
<configuration>
49+
<source>1.8</source>
50+
<target>1.8</target>
51+
</configuration>
52+
</plugin>
53+
</plugins>
54+
</build>
55+
</project>

SendSafelyAPI/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Installation
2+
The sendsafely-java-api jar is available from [GitHub](https://github.com/SendSafely/Java-Client-API/releases) or a [public maven repository](https://search.maven.org/artifact/com.sendsafely/sendsafely-java-api).
3+
4+
Use the following dependency in your project to grab via Maven:
5+
```
6+
<dependency>
7+
<groupId>com.sendsafely</groupId>
8+
<artifactId>sendsafely-java-api</artifactId>
9+
<version>3.1.6</version>
10+
</dependency>
11+
```
12+
13+
Refer to the SendSafely [Java-Client-API/SampleApplication](https://github.com/SendSafely/Java-Client-API/tree/master/SampleApplication) for a quick start with using the Java Client API.

SendSafelyAPI/pom.xml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.sendsafely</groupId>
8+
<artifactId>sendsafely-java-api</artifactId>
9+
<version>3.1.6</version>
10+
<packaging>jar</packaging>
11+
12+
<name>SendSafely Java Client API</name>
13+
<description>The SendSafely Client API allows programmatic access to SendSafely and provides a layer of abstraction from our REST API, which requires developers to perform several complex tasks in a correct manner. </description>
14+
<url>https://developer.sendsafely.com</url>
15+
16+
<licenses>
17+
<license>
18+
<name>The Apache License, Version 2.0</name>
19+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20+
</license>
21+
</licenses>
22+
23+
<developers>
24+
<developer>
25+
<name>SendSafely</name>
26+
<email>[email protected]</email>
27+
<organization>SendSafely</organization>
28+
<organizationUrl>https://www.sendsafely.com</organizationUrl>
29+
</developer>
30+
</developers>
31+
32+
<issueManagement>
33+
<url>https://sendsafely.zendesk.com/hc/requests/new</url>
34+
</issueManagement>
35+
36+
<scm>
37+
<connection>scm:git:git://github.com/SendSafely/Java-Client-API.git</connection>
38+
<developerConnection>scm:git:ssh://github.com/SendSafely/Java-Client-API.git</developerConnection>
39+
<url>https://github.com/SendSafely/Java-Client-API</url>
40+
</scm>
41+
42+
<distributionManagement>
43+
<snapshotRepository>
44+
<id>ossrh</id>
45+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
46+
</snapshotRepository>
47+
<repository>
48+
<id>ossrh</id>
49+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
50+
</repository>
51+
</distributionManagement>
52+
53+
<dependencies>
54+
<dependency>
55+
<groupId>com.google.code.gson</groupId>
56+
<artifactId>gson</artifactId>
57+
<version>2.8.6</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>commons-io</groupId>
61+
<artifactId>commons-io</artifactId>
62+
<version>2.5</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.bouncycastle</groupId>
66+
<artifactId>bcprov-jdk15on</artifactId>
67+
<version>1.65</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.bouncycastle</groupId>
71+
<artifactId>bcpg-jdk15on</artifactId>
72+
<version>1.65</version>
73+
</dependency>
74+
</dependencies>
75+
</project>

SendSafelyAPI/src/com/sendsafely/BasePackage.java

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class BasePackage {
3030
private Date packageTimestamp;
3131
private String packageOwner = "";
3232
private String packageParentId;
33+
private boolean allowReplyAll;
3334

3435
/**
3536
* @returnType String
@@ -273,4 +274,11 @@ public void setPackageParentId(String packageParentId) {
273274
this.packageParentId = packageParentId;
274275
}
275276

277+
public boolean isAllowReplyAll() {
278+
return allowReplyAll;
279+
}
280+
281+
public void setAllowReplyAll(boolean allowReplyAll) {
282+
this.allowReplyAll = allowReplyAll;
283+
}
276284
}

SendSafelyAPI/src/com/sendsafely/File.java

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.sendsafely;
22

3+
import java.util.Date;
4+
35
/**
46
* A Java Bean containing information about a file.
57
* Only the Getters should be used from this object, since the server will populate the object.
@@ -13,6 +15,7 @@ public class File {
1315
private long fileSize;
1416
//private String createdBy;
1517
private int parts;
18+
private Date fileUploaded;
1619

1720
public File(String fileId, String fileName, long fileSize, int parts){
1821
this.fileId = fileId;
@@ -101,5 +104,15 @@ public int getParts() {
101104
public void setParts(int parts) {
102105
this.parts = parts;
103106
}
107+
108+
public Date getFileUploaded() {
109+
return fileUploaded;
110+
}
111+
112+
public void setFileUploaded(Date fileUploaded) {
113+
this.fileUploaded = fileUploaded;
114+
}
115+
116+
104117

105118
}

SendSafelyAPI/src/com/sendsafely/SendSafely.java

+19
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,25 @@ public PackageURL finalizePackage(String packageId, String keycode) throws Limit
680680
return handler.makeRequest(packageId, keycode);
681681
}
682682

683+
/**
684+
* @description Finalizes the package so it can be delivered to the recipients.
685+
* @param packageId The unique package id of the package to be finalized.
686+
* @param keycode The keycode belonging to the package.
687+
* @param notify A boolean flag indicating whether SendSafely should send the secure link to the package recipients
688+
* @param allowReplyAll A boolean flag that when set to true will allow recipients to reply to the package sender and all other recipients on the package. By default, SendSafely only allows replying to the package sender.
689+
* @returnType PackageURL
690+
* @return A link to access the package. This link can be sent to the recipients.
691+
* @throws LimitExceededException
692+
* @throws FinalizePackageFailedException
693+
* @throws ApproverRequiredException
694+
*/
695+
public PackageURL finalizePackage(String packageId, String keycode, boolean notify, boolean allowReplyAll) throws LimitExceededException, FinalizePackageFailedException, ApproverRequiredException
696+
{
697+
FinalizePackageHandler handler = (FinalizePackageHandler)HandlerFactory.getInstance(uploadManager, Endpoint.FINALIZE_PACKAGE);
698+
handler.setNotify(notify);
699+
return handler.setRequestAllowReplyAll(allowReplyAll).makeRequest(packageId, keycode);
700+
}
701+
683702
/**
684703
* @description Finalizes the package so it can be delivered to the recipients.
685704
* @param packageId The unique package id of the package to be finalized.

SendSafelyAPI/src/com/sendsafely/dto/request/FinalizePackageRequest.java

+4
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ public void setUndisclosedRecipients(boolean undisclosedRecipients) {
3131
super.setPostParam("undisclosedRecipients", undisclosedRecipients);
3232
}
3333

34+
public void setAllowReplyAll(boolean allowReplyAll) {
35+
super.setPostParam("allowReplyAll", allowReplyAll);
36+
}
37+
3438
}

SendSafelyAPI/src/com/sendsafely/dto/response/FileResponse.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package com.sendsafely.dto.response;
22

3+
import java.util.Date;
4+
35
public class FileResponse {
46

57
private String fileId;
68
private String fileName;
79
private long fileSize;
810
private String createdByEmail;
911
private int parts;
12+
private Date fileUploaded;
13+
private String fileUploadedStr;
1014

1115
public String getFileId() {
1216
return fileId;
@@ -38,6 +42,10 @@ public int getParts() {
3842
public void setParts(int parts) {
3943
this.parts = parts;
4044
}
41-
42-
45+
public Date getFileUploaded() {
46+
return fileUploaded;
47+
}
48+
public String getFileUploadedStr() {
49+
return fileUploadedStr;
50+
}
4351
}

SendSafelyAPI/src/com/sendsafely/dto/response/PackageInformationResponse.java

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class PackageInformationResponse extends BaseResponse {
2828
private Date packageTimestamp;
2929
private String packageSender;
3030
private String packageParentId;
31+
private boolean allowReplyAll;
3132

3233
public List<RecipientResponse> getRecipients() {
3334
return recipients;
@@ -150,4 +151,11 @@ public String getPackageParentId() {
150151
public void setPackageParentId(String packageParentId) {
151152
this.packageParentId = packageParentId;
152153
}
154+
public boolean isAllowReplyAll() {
155+
return allowReplyAll;
156+
}
157+
public void setAllowReplyAll(boolean allowReplyAll) {
158+
this.allowReplyAll = allowReplyAll;
159+
}
160+
153161
}

SendSafelyAPI/src/com/sendsafely/handlers/FinalizePackageHandler.java

+5
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,9 @@ public void setNotify(boolean notify) {
185185
this.notify = notify;
186186
}
187187

188+
public FinalizePackageHandler setRequestAllowReplyAll(boolean allowReplyAll) {
189+
request.setAllowReplyAll(allowReplyAll);
190+
return this;
191+
}
192+
188193
}

SendSafelyAPI/src/com/sendsafely/handlers/GetDirectoryHandler.java

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ private List<File> convert(List<FileResponse> files) {
6161
newFile.setFileName(resp.getFileName());
6262
newFile.setFileSize(resp.getFileSize());
6363
newFile.setParts(resp.getParts());
64+
newFile.setFileUploaded(resp.getFileUploaded());
6465
fileList.add(newFile);
6566
}
6667
return fileList;

SendSafelyAPI/src/com/sendsafely/handlers/PackageInformationHandler.java

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ protected Package convert(PackageInformationResponse obj)
8989
info.setPackageTimestamp(obj.getPackageTimestamp());
9090
info.setPackageOwner(obj.getPackageSender());
9191
info.setPackageParentId(obj.getPackageParentId());
92+
info.setAllowReplyAll(obj.isAllowReplyAll());
9293
return info;
9394
}
9495

@@ -127,6 +128,7 @@ protected File createFile(FileResponse resp)
127128
f.setFileName(resp.getFileName());
128129
f.setFileSize(resp.getFileSize());
129130
f.setParts(resp.getParts());
131+
f.setFileUploaded(resp.getFileUploaded());
130132
return f;
131133
}
132134

0 commit comments

Comments
 (0)