Skip to content

Commit

Permalink
Merge pull request #76 from mateuszgruszkaonespan/dev
Browse files Browse the repository at this point in the history
PB-65429 [Virtual Room] Setting up a virtual room via SDK
  • Loading branch information
SeungChoi authored Apr 14, 2021
2 parents dcc81c9 + 188b540 commit c5556f9
Show file tree
Hide file tree
Showing 11 changed files with 586 additions and 0 deletions.
70 changes: 70 additions & 0 deletions sdk/src/main/java/com/silanis/esl/api/model/VirtualRoom.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.silanis.esl.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.silanis.esl.api.util.JsonDateSerializer;

import java.util.Date;

import static com.silanis.esl.api.util.SchemaSanitizer.throwOnNull;
import static com.silanis.esl.api.util.SchemaSanitizer.trim;

@JsonIgnoreProperties(ignoreUnknown=true)
public class VirtualRoom extends Model {

@JsonIgnore
private static final String FIELD_VIDEO = "video";
@JsonIgnore
private static final String FIELD_VIDEO_RECORDING = "videoRecording";
@JsonIgnore
private static final String FIELD_START_DATETIME = "startDatetime";
@JsonIgnore
private static final String FIELD_HOST_UID = "hostUid";

private boolean video;
private boolean videoRecording;
private Date startDatetime;
private String hostUid;

public boolean getVideo() {
return video;
}

public VirtualRoom setVideo(boolean value) {
this.video = value;
setDirty(FIELD_VIDEO);
return this;
}

public boolean getVideoRecording() {
return videoRecording;
}

public VirtualRoom setVideoRecording(boolean value) {
this.videoRecording = value;
setDirty(FIELD_VIDEO_RECORDING);
return this;
}

@JsonSerialize(using = JsonDateSerializer.class)
public Date getStartDatetime() {
return startDatetime;
}

public VirtualRoom setStartDatetime(Date value) {
this.startDatetime = value;
setDirty(FIELD_START_DATETIME);
return this;
}

public String getHostUid() {
return hostUid;
}

public VirtualRoom setHostUid(String hostUid) {
this.hostUid = hostUid;
setDirty(FIELD_HOST_UID);
return this;
}
}
11 changes: 11 additions & 0 deletions sdk/src/main/java/com/silanis/esl/sdk/EslClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class EslClient {
private SignerVerificationService signerVerificationService;
private SigningStyleService signingStyleService;
private DataRetentionSettingsService dataRetentionSettingsService;
private VirtualRoomService virtualRoomService;

private ProxyConfiguration proxyConfiguration;

Expand Down Expand Up @@ -167,6 +168,7 @@ private void init(RestClient client) {
signerVerificationService = new SignerVerificationService(client, baseURL);
signingStyleService = new SigningStyleService(client, baseURL);
dataRetentionSettingsService = new DataRetentionSettingsService(client, baseURL);
virtualRoomService = new VirtualRoomService(client, baseURL);
}

/**
Expand Down Expand Up @@ -208,6 +210,15 @@ public DataRetentionSettingsService getDataRetentionSettingsService() {
return dataRetentionSettingsService;
}

/**
* Gets the virtual room config service
*
* @return the virtual room config service
*/
public VirtualRoomService getVirtualRoomService() {
return virtualRoomService;
}

/**
* Gets the report service
*
Expand Down
45 changes: 45 additions & 0 deletions sdk/src/main/java/com/silanis/esl/sdk/VirtualRoom.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.silanis.esl.sdk;

import java.io.Serializable;
import java.util.Date;

public class VirtualRoom implements Serializable {

private boolean video;
private boolean videoRecording;
private Date startDatetime;
private String hostUid;

public boolean getVideo() {
return video;
}

public void setVideo(boolean video) {
this.video = video;
}

public boolean getVideoRecording() {
return videoRecording;
}

public void setVideoRecording(boolean videoRecording) {
this.videoRecording = videoRecording;
}

public Date getStartDatetime() {
return startDatetime;
}

public void setStartDatetime(Date startDatetime) {
this.startDatetime = startDatetime;
}

public String getHostUid() {
return hostUid;
}

public void setHostUid(String hostUid) {
this.hostUid = hostUid;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.silanis.esl.sdk.builder;

import com.silanis.esl.sdk.VirtualRoom;

import java.util.Date;

public class VirtualRoomBuilder {

private boolean video;
private boolean videoRecording;
private Date startDatetime;
private String hostUid;

private VirtualRoomBuilder() {
}

/**
* Create a new Virtual Room.
*
* @return the Virtual Room builder itself
*/
public static VirtualRoomBuilder newVirtualRoom() {
return new VirtualRoomBuilder();
}

/**
* Set if video is on
*
* @param video
* @return This
*/
public VirtualRoomBuilder withVideo(boolean video) {
this.video = video;
return this;
}

/**
* Set if videoRecording is on
*
* @param videoRecording
* @return This
*/
public VirtualRoomBuilder withVideoRecording(boolean videoRecording) {
this.videoRecording = videoRecording;
return this;
}

/**
* Set startDatetime of virtual room meeting
*
* @param startDatetime
* @return This
*/

public VirtualRoomBuilder withStartDateTime(Date startDatetime) {
this.startDatetime = startDatetime;
return this;
}

/**
* Set hostUid for meeting
*
* @param hostUid
* @return This
*/

public VirtualRoomBuilder withHostUid(String hostUid) {
this.hostUid = hostUid;
return this;
}

/**
* Builds the actual VirtualRoom with the specified values
*
* @return the VirtualRoom object
*/
public VirtualRoom build() {
VirtualRoom result = new VirtualRoom();
result.setVideo(video);
result.setStartDatetime(startDatetime);
result.setVideoRecording(videoRecording);
result.setHostUid(hostUid);
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.silanis.esl.sdk.examples;

import com.silanis.esl.sdk.DocumentPackage;
import com.silanis.esl.sdk.DocumentType;
import com.silanis.esl.sdk.PackageId;
import com.silanis.esl.sdk.Signer;
import com.silanis.esl.sdk.VirtualRoom;
import com.silanis.esl.sdk.builder.PackageBuilder;
import com.silanis.esl.sdk.builder.SignerBuilder;

import java.util.Calendar;
import java.util.Date;

import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName;
import static com.silanis.esl.sdk.builder.VirtualRoomBuilder.newVirtualRoom;

public class VirtualRoomExample extends SDKSample {

public VirtualRoom packageVirtualRoomRoomAfterUpdate;

public String hostUid;
public Date startDateTime;

public static void main(String... args) {
new VirtualRoomExample().run();
}

@Override
protected void execute() {

Signer signer = SignerBuilder.newSignerWithEmail(email1)
.withFirstName("Patty")
.withLastName("Galant")
.build();

hostUid = signer.getId();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, 7);
startDateTime = cal.getTime();

VirtualRoom virtualRoom = newVirtualRoom()
.withHostUid(hostUid)
.withVideo(true)
.withVideoRecording(true)
.withStartDateTime(startDateTime)
.build();

DocumentPackage superDuperPackage = PackageBuilder.newPackageNamed(getPackageName())
.describedAs("Description")
.withSigner(SignerBuilder.newSignerWithEmail(email1)
.withFirstName("Patty")
.withLastName("Galant"))
.withDocument(newDocumentWithName("Document")
.withId("DocumentId")
.fromStream(documentInputStream1, DocumentType.PDF))
.build();

PackageId packageId = eslClient.createPackageOneStep(superDuperPackage);
retrievedPackage = eslClient.getPackage(packageId);

eslClient.getVirtualRoomService().setVirtualRoom(packageId, virtualRoom);
packageVirtualRoomRoomAfterUpdate = eslClient.getVirtualRoomService().getVirtualRoom(packageId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public class UrlTemplate {
public static final String EXPIRY_TIME_CONFIGURATION_PATH = "/dataRetentionSettings/expiryTimeConfiguration";
public static final String DATA_MANAGEMENT_POLICY_PATH = "/dataRetentionSettings/dataManagementPolicy";

//VirtualRoomService
public static final String VIRTUAL_ROOM_CONFIG_PATH = "/packages/{packageId}/virtual-room/config";

// QR Code Service
public static final String QRCODE_PATH = "/packages/{packageId}/documents/{documentId}/fields";
public static final String QRCODE_ID_PATH = "/packages/{packageId}/documents/{documentId}/fields/{fieldId}";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.silanis.esl.sdk.internal.converter;

public class VirtualRoomConverter {

private com.silanis.esl.sdk.VirtualRoom sdkVirtualRoom = null;
private com.silanis.esl.api.model.VirtualRoom apiVirtualRoom = null;

/**
* Construct with API VirtualRoom object involved in conversion.
*
* @param apiVirtualRoom
*/
public VirtualRoomConverter(com.silanis.esl.api.model.VirtualRoom apiVirtualRoom) {
this.apiVirtualRoom = apiVirtualRoom;
}

/**
* Construct with SDK VirtualRoom object involved in conversion.
*
* @param sdkVirtualRoom
*/
public VirtualRoomConverter(com.silanis.esl.sdk.VirtualRoom sdkVirtualRoom) {
this.sdkVirtualRoom = sdkVirtualRoom;
}

public com.silanis.esl.sdk.VirtualRoom toSDKVirtualRoom() {
if (apiVirtualRoom == null) {
return sdkVirtualRoom;
}
com.silanis.esl.sdk.VirtualRoom sdkVirtualRoom = new com.silanis.esl.sdk.VirtualRoom();
sdkVirtualRoom.setVideo(apiVirtualRoom.getVideo());
sdkVirtualRoom.setHostUid(apiVirtualRoom.getHostUid());
sdkVirtualRoom.setStartDatetime(apiVirtualRoom.getStartDatetime());
sdkVirtualRoom.setVideoRecording(apiVirtualRoom.getVideoRecording());
return sdkVirtualRoom;
}

public com.silanis.esl.api.model.VirtualRoom toAPIVirtualRoom() {
if (sdkVirtualRoom == null) {
return apiVirtualRoom;
}
com.silanis.esl.api.model.VirtualRoom apiVirtualRoom = new com.silanis.esl.api.model.VirtualRoom();
apiVirtualRoom.setVideo(sdkVirtualRoom.getVideo());
apiVirtualRoom.setHostUid(sdkVirtualRoom.getHostUid());
apiVirtualRoom.setStartDatetime(sdkVirtualRoom.getStartDatetime());
apiVirtualRoom.setVideoRecording(sdkVirtualRoom.getVideoRecording());
return apiVirtualRoom;
}
}
Loading

0 comments on commit c5556f9

Please sign in to comment.