All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ironcorelabs.sdk.DocumentEncryptOpts Maven / Gradle / Ivy

There is a newer version: 0.16.0
Show newest version
// 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 static DocumentEncryptOpts create(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;
        }

        long ret = do_create(a0, a1, grantToAuthor, userGrants, groupGrants, a5);
        DocumentEncryptOpts convRet = new DocumentEncryptOpts(InternalPointerMarker.RAW_PTR, ret);

        JNIReachabilityFence.reachabilityFence3(id, name, policyGrant);

        return convRet;
    }
    private static native long do_create(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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy