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

de.gold.scim.common.resources.complex.BulkConfig Maven / Gradle / Ivy

The newest version!
package de.gold.scim.common.resources.complex;

import java.util.Optional;

import de.gold.scim.common.constants.AttributeNames;
import de.gold.scim.common.resources.ServiceProvider;
import de.gold.scim.common.resources.base.ScimObjectNode;
import lombok.Builder;


/**
 * author Pascal Knueppel 
* created at: 18.10.2019 - 10:06
*
* represents the bulk configuration for a {@link ServiceProvider} object
*
* A complex type that specifies bulk configuration options. See Section 3.7 of [RFC7644]. REQUIRED. */ public class BulkConfig extends ScimObjectNode { /** * the default maximum number of operations is 1. This will enforce the developer to modify the service * provider configuration to the applications requirements */ protected static final Integer DEFAULT_MAX_OPERATIONS = 1; /** * the default maximum payload is set to 2MB */ protected static final Long DEFAULT_MAX_PAYLOAD_SIZE = (long)(Math.pow(1024, 2) * 2); @Builder public BulkConfig(Boolean supported, Integer maxOperations, Long maxPayloadSize) { super(null); setSupported(supported); setMaxOperations(maxOperations); setMaxPayloadSize(maxPayloadSize); } /** * A Boolean value specifying whether or not the operation is supported. REQUIRED. */ public boolean isSupported() { return getBooleanAttribute(AttributeNames.RFC7643.SUPPORTED).orElse(false); } /** * A Boolean value specifying whether or not the operation is supported. REQUIRED. */ public void setSupported(Boolean supported) { setAttribute(AttributeNames.RFC7643.SUPPORTED, Optional.ofNullable(supported).orElse(false)); } /** * An integer value specifying the maximum number of operations. REQUIRED. */ public Integer getMaxOperations() { return getLongAttribute(AttributeNames.RFC7643.MAX_OPERATIONS).orElse(Long.valueOf(DEFAULT_MAX_OPERATIONS)) .intValue(); } /** * An integer value specifying the maximum number of operations. REQUIRED. */ public void setMaxOperations(Integer maxOperations) { Long max = maxOperations == null ? null : Long.valueOf(maxOperations); setAttribute(AttributeNames.RFC7643.MAX_OPERATIONS, Optional.ofNullable(max).orElse(Long.valueOf(DEFAULT_MAX_OPERATIONS))); } /** * An integer value specifying the maximum payload size in bytes. REQUIRED. */ public Long getMaxPayloadSize() { return getLongAttribute(AttributeNames.RFC7643.MAX_PAYLOAD_SIZE).orElse(DEFAULT_MAX_PAYLOAD_SIZE); } /** * An integer value specifying the maximum payload size in bytes. REQUIRED. */ public void setMaxPayloadSize(Long maxPayloadSize) { setAttribute(AttributeNames.RFC7643.MAX_PAYLOAD_SIZE, Optional.ofNullable(maxPayloadSize).orElse(DEFAULT_MAX_PAYLOAD_SIZE)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy