-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from mateuszgruszkaonespan/dev
PB-65429 [Virtual Room] Setting up a virtual room via SDK
- Loading branch information
Showing
11 changed files
with
586 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
sdk/src/main/java/com/silanis/esl/api/model/VirtualRoom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
85 changes: 85 additions & 0 deletions
85
sdk/src/main/java/com/silanis/esl/sdk/builder/VirtualRoomBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
sdk/src/main/java/com/silanis/esl/sdk/examples/VirtualRoomExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
sdk/src/main/java/com/silanis/esl/sdk/internal/converter/VirtualRoomConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.