com.ironcorelabs.sdk.DocumentEncryptOpts Maven / Gradle / Ivy
// Automatically generated by rust_swig
package com.ironcorelabs.sdk;
/**
* Options for document creation.
*/
public final class DocumentEncryptOpts {
public DocumentEncryptOpts() {
mNativeObj = init();
}
private static native long init();
/**
* @param id unique id of a document. If `null`, the server will assign an id
* @param name human readable name of the document. Does not need to be unique
* @param grantToAuthor Flag determining whether to encrypt to the calling user or not. If set to false at least one value must be present in the `grant` lists.
* @param userGrants list of user ids that will be granted access to the document
* @param groupGrants list of group ids that will be granted access to the document
* @param policyGrant The policy labels which will be evaluated to determine grants.
*/
public DocumentEncryptOpts(DocumentId id, DocumentName name, boolean grantToAuthor, UserId [] userGrants, GroupId [] groupGrants, PolicyGrant policyGrant) {
long a0 = 0;//TODO: use ptr::null() for corresponding constant
if (id != null) {
a0 = id.mNativeObj;
}
long a1 = 0;//TODO: use ptr::null() for corresponding constant
if (name != null) {
a1 = name.mNativeObj;
}
long a5 = 0;//TODO: use ptr::null() for corresponding constant
if (policyGrant != null) {
a5 = policyGrant.mNativeObj;
}
mNativeObj = init(a0, a1, grantToAuthor, userGrants, groupGrants, a5);
JNIReachabilityFence.reachabilityFence3(id, name, policyGrant);
}
private static native long init(long id, long name, boolean grantToAuthor, UserId [] userGrants, GroupId [] groupGrants, long policyGrant);
public synchronized void delete() {
if (mNativeObj != 0) {
do_delete(mNativeObj);
mNativeObj = 0;
}
}
@Override
protected void finalize() throws Throwable {
try {
delete();
}
finally {
super.finalize();
}
}
private static native void do_delete(long me);
/*package*/ DocumentEncryptOpts(InternalPointerMarker marker, long ptr) {
assert marker == InternalPointerMarker.RAW_PTR;
this.mNativeObj = ptr;
}
/*package*/ long mNativeObj;
}