com.pdftools.sign.MdpPermissionOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pdftools-sdk Show documentation
Show all versions of pdftools-sdk Show documentation
The Pdftools SDK is a comprehensive development library that lets developers integrate advanced PDF functionalities into in-house applications.
/****************************************************************************
*
* File: MdpPermissionOptions.java
*
* Description: PDFTOOLS MdpPermissionOptions Class
*
* Author: PDF Tools AG
*
* Copyright: Copyright (C) 2023 - 2024 PDF Tools AG, Switzerland
* All rights reserved.
*
* Notice: By downloading and using this artifact, you accept PDF Tools AG's
* [license agreement](https://www.pdf-tools.com/license-agreement/),
* [privacy policy](https://www.pdf-tools.com/privacy-policy/),
* and allow PDF Tools AG to track your usage data.
*
***************************************************************************/
package com.pdftools.sign;
import com.pdftools.sys.*;
import com.pdftools.internal.*;
import java.util.EnumSet;
import java.time.OffsetDateTime;
/**
* The permission options when certifying a document
*/
public class MdpPermissionOptions extends NativeObject
{
protected MdpPermissionOptions(long handle)
{
super(handle);
}
/**
* @hidden
*/
public static MdpPermissionOptions createDynamicObject(long handle)
{
return new MdpPermissionOptions(handle);
}
/**
*
* @param permissions
* @throws IllegalArgumentException if {@code permissions} is {@code null}
*/
public MdpPermissionOptions(com.pdftools.pdf.MdpPermissions permissions)
{
this(newHelper(permissions));
}
private static long newHelper(com.pdftools.pdf.MdpPermissions permissions)
{
if (permissions == null)
throw new IllegalArgumentException("Argument 'permissions' must not be null.", new NullPointerException("'permissions'"));
long handle = newNative(permissions.getValue());
if (handle == 0)
{
switch (getLastErrorCode())
{
case 0: throw new RuntimeException("An unexpected error occurred");
default: throwLastRuntimeException();
}
}
return handle;
}
/**
* The access permissions granted for the document (Getter)
*
*/
public com.pdftools.pdf.MdpPermissions getPermissions()
{
int retVal = getPermissionsNative(getHandle());
if (retVal == 0)
{
switch (getLastErrorCode())
{
case 0: break;
default: throwLastRuntimeException();
}
}
return com.pdftools.pdf.MdpPermissions.fromValue(retVal);
}
/**
* The access permissions granted for the document (Setter)
*
* @throws IllegalArgumentException if {@code value} is {@code null}
*/
public void setPermissions(com.pdftools.pdf.MdpPermissions value)
{
if (value == null)
throw new IllegalArgumentException("Argument 'value' must not be null.", new NullPointerException("'value'"));
boolean retVal = setPermissionsNative(getHandle(), value.getValue());
if (!retVal)
{
switch (getLastErrorCode())
{
case 0: throw new RuntimeException("An unexpected error occurred");
default: throwLastRuntimeException();
}
}
}
private static native long newNative(int permissions);
private native int getPermissionsNative(long handle);
private native boolean setPermissionsNative(long handle, int value);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy