public class Consent extends Object implements Serializable
Constructor and Description |
---|
Consent()
Empty constructor mostly used for JSON (de-) serialization
|
Consent(Map<String,Object> consentMap,
DateFormat dateFormat)
A constructor from a map used for example when we use the deserialized data from event
properties.
|
Consent(String scope,
String typeIdentifier,
ConsentStatus status,
Date statusDate,
Date revokeDate)
A constructor to directly build a consent with all it's properties
|
Modifier and Type | Method and Description |
---|---|
Date |
getRevokeDate()
Retrieves the end date for this consent.
|
String |
getScope()
Retrieve the scope for this consent
|
ConsentStatus |
getStatus()
Retrieves the status for this consent.
|
Date |
getStatusDate()
Retrieve the date at which this consent was given.
|
String |
getTypeIdentifier()
Retrieve the consent type identifier for this consent.
|
boolean |
isConsentGrantedAtDate(Date testDate)
Tests if the consent is GRANTED at the specified date
|
boolean |
isConsentGrantedNow()
Test if the consent is GRANTED right now.
|
void |
setRevokeDate(Date revokeDate)
Sets the end date for this consent.
|
void |
setScope(String scope)
Set the scope for this consent
|
void |
setStatus(ConsentStatus status)
Sets the status for this consent.
|
void |
setStatusDate(Date statusDate)
Sets the date from which this consent applies.
|
void |
setTypeIdentifier(String typeIdentifier)
Set the type identifier.
|
Map<String,Object> |
toMap(DateFormat dateFormat)
This is a utility method to generate a Map based on the contents of the consents.
|
String |
toString() |
public Consent()
public Consent(String scope, String typeIdentifier, ConsentStatus status, Date statusDate, Date revokeDate)
scope
- the scope for this consenttypeIdentifier
- the identifier of the type this consent applies tostatus
- the type of status that we are storing for this consent. May be one of @ConsentStatus.DENIED, @ConsentStatus.GRANTED, @ConsentStatus.REVOKEDstatusDate
- the starting date at which this consent was givenrevokeDate
- the date at which this consent will (automatically) revokepublic Consent(Map<String,Object> consentMap, DateFormat dateFormat) throws ParseException
consentMap
- a Map that contains the following key-value pairs : typeIdentifier:String, status:String (must
be one of GRANTED, DENIED or REVOKED), statusDate:String (ISO8601 date format !), revokeDate:String (ISO8601 date format !)dateFormat
- a DateFormat instance to convert the date string to date objectsParseException
- in case one of the dates failed to parse properlypublic String getScope()
public void setScope(String scope)
scope
- a scope identifierpublic void setTypeIdentifier(String typeIdentifier)
typeIdentifier
- a unique String to identify the consent typepublic String getTypeIdentifier()
public ConsentStatus getStatus()
public void setStatus(ConsentStatus status)
status
- the status to set on this consentpublic Date getStatusDate()
public void setStatusDate(Date statusDate)
statusDate
- a valid Date or null if we set not starting date (immediately valid)public Date getRevokeDate()
public void setRevokeDate(Date revokeDate)
revokeDate
- a valid Date or null to indicate an unlimited consentpublic boolean isConsentGrantedNow()
isConsentGrantedAtDate(java.util.Date)
is called.public boolean isConsentGrantedAtDate(Date testDate)
testDate
- the date against which to test the consent to be granted.public Map<String,Object> toMap(DateFormat dateFormat)
dateFormat
- a dateFormat instance such as ISO8601DateFormat to generate the String formats for the statusDate
and revokeDate map entries.Copyright © 2014–2022 Apache Software Foundation. All rights reserved.