public class TermsAndConditions extends java.lang.Object implements IXMLEncodable
Modifier and Type | Class and Description |
---|---|
class |
TermsAndConditions.Translation
Class that represents a translation of the enclosing terms and conditions.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
accepted |
static java.lang.String |
DATE_FORMAT |
private TermsAndConditions.Translation |
defaultTl |
private java.util.Date |
m_date |
private static java.lang.String |
MSG_DISPLAY_ERROR |
private ServiceOperator |
operator |
private static java.util.Hashtable |
tcHashtable |
private java.util.Hashtable |
translations |
static java.lang.String |
XML_ATTR_ACCEPTED |
static java.lang.String |
XML_ATTR_DATE |
static java.lang.String |
XML_ELEMENT_CONTAINER_NAME |
static java.lang.String |
XML_ELEMENT_NAME |
static java.lang.String |
XML_ELEMENT_TRANSLATION_NAME |
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Constructor and Description |
---|
TermsAndConditions(org.w3c.dom.Element termsAndConditionRoot)
Creates a TermsAndConditions container from the given XML DOM element
with all translation that are stored within this element.
|
TermsAndConditions(org.w3c.dom.Element termsAndConditionRoot,
ServiceOperator operator,
boolean withSignatureCheck)
Creates a TermsAndConditions container from the given XML DOM element
with all translation that are stored within this element.
|
TermsAndConditions(ServiceOperator operator,
java.util.Date date)
Creates an empty Terms And Condition object for the specified id and validation date
which serves as a container for the different translations.
|
TermsAndConditions(ServiceOperator operator,
java.lang.String date) |
Modifier and Type | Method and Description |
---|---|
void |
addTranslation(org.w3c.dom.Element translationRoot)
adds a T&C translation which specified by the DOMElement translationRoot
|
private void |
addTranslation(TermsAndConditions.Translation t,
boolean withSignatureCheck) |
int |
compareTo(java.lang.Object o) |
org.w3c.dom.Element |
createTCRoot(org.w3c.dom.Document doc) |
org.w3c.dom.Element |
createXMLOutput(org.w3c.dom.Document doc) |
boolean |
equals(java.lang.Object anotherTC) |
static org.w3c.dom.Element |
getAllTermsAndConditionsAsXMLElement(org.w3c.dom.Document ownerDoc) |
java.util.Enumeration |
getAllTranslations()
returns all translations of this T&C container
|
java.util.Date |
getDate()
return a date object which holds the date from when these T&Cs became valid
|
java.lang.String |
getDateString()
returns the date as String in the format 'yyyyMMdd' from when these T&Cs became valid
|
TermsAndConditions.Translation |
getDefaultTranslation()
returns the default translation of the T&C which is displayed if there
is no translation available for current display language
|
java.lang.String |
getHTMLText(java.util.Locale locale) |
java.lang.String |
getHTMLText(java.lang.String language) |
static java.lang.String |
getHTMLText(TermsAndConditions.Translation translation) |
ServiceOperator |
getOperator()
returns the ServiceOperator-DBEntry referring to the operator to whom these T&C belong.
|
java.lang.String |
getTemplateReferenceId(java.lang.String locale)
return the id of the template which is needed to render the translation specified
by the two-letter language code
|
static TermsAndConditions |
getTermsAndConditions(ServiceOperator operator) |
TermsAndConditions.Translation |
getTranslation(java.util.Locale locale)
returns the translation of the T&C specified by the corresponding locale object
|
TermsAndConditions.Translation |
getTranslation(java.lang.String locale)
returns the translation of the T&C specified by the two letter language code
|
boolean |
hasDefaultTranslation()
for checking if a default translation is specified which must be true if this
T&C container is not empty.
|
boolean |
hasTranslation(java.util.Locale locale)
for checking if this T&C container provides a translation specified by the given locale object
|
boolean |
hasTranslation(java.lang.String locale)
returns if this T&C container provides a translation specified by the two-letter language code
|
boolean |
hasTranslations()
for checking whether this T&C container has stored translations at all
|
TermsAndConditions.Translation |
initializeEmptyTranslation(java.util.Locale locale) |
TermsAndConditions.Translation |
initializeEmptyTranslation(java.lang.String locale) |
boolean |
isAccepted()
returns whether these T&C are accepted by the user
this is true if and only if they were read and accepted.
|
boolean |
isMostRecent(java.util.Date toWhichDate)
true if the date of the T&Cs are equal or more recent than 'toWhichDate'
|
boolean |
isMostRecent(java.lang.String toWhichDate) |
boolean |
isSignatureObsolete() |
static void |
loadTermsAndConditionsFromXMLElement(org.w3c.dom.Element listRoot) |
static void |
removeTermsAndConditions(ServiceOperator operator) |
static void |
removeTermsAndConditions(TermsAndConditions tc) |
TermsAndConditions.Translation |
removeTranslation(java.util.Locale locale) |
TermsAndConditions.Translation |
removeTranslation(java.lang.String locale) |
void |
setAccepted(boolean accepted)
marks the T&Cs as accepted if 'accepted' is true or
rejected otherwise
|
void |
setDate(java.util.Date date) |
static void |
storeTermsAndConditions(TermsAndConditions tc) |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document doc)
Return an element that can be appended to the document.
|
private org.w3c.dom.Element |
xmlOut(org.w3c.dom.Document doc,
boolean signedTranslations) |
public static final java.lang.String XML_ATTR_ACCEPTED
public static final java.lang.String XML_ATTR_DATE
private static final java.lang.String MSG_DISPLAY_ERROR
public static final java.lang.String XML_ELEMENT_CONTAINER_NAME
public static final java.lang.String XML_ELEMENT_NAME
public static final java.lang.String XML_ELEMENT_TRANSLATION_NAME
public static final java.lang.String DATE_FORMAT
private ServiceOperator operator
private java.util.Date m_date
private java.util.Hashtable translations
private TermsAndConditions.Translation defaultTl
private boolean accepted
private static final java.util.Hashtable tcHashtable
public TermsAndConditions(ServiceOperator operator, java.lang.String date) throws java.text.ParseException
java.text.ParseException
public TermsAndConditions(ServiceOperator operator, java.util.Date date) throws java.text.ParseException
java.text.ParseException
public TermsAndConditions(org.w3c.dom.Element termsAndConditionRoot) throws XMLParseException, java.text.ParseException, java.security.SignatureException
termsAndConditionRoot
- the DOM Element from which the Container will be createdXMLParseException
- if termsAndConditionsRoot does not provide a valid operator SKI
or the date attribute is missingjava.text.ParseException
- if the date is in a wrong format (must be .java.security.SignatureException
- if the signature of a Terms and Conditions translation
has no valid signature.public TermsAndConditions(org.w3c.dom.Element termsAndConditionRoot, ServiceOperator operator, boolean withSignatureCheck) throws XMLParseException, java.text.ParseException, java.security.SignatureException
termsAndConditionRoot
- the DOM Element from which the Container will be createdop
- the Operator to whom these Terms And Conditions belongXMLParseException
- if op is null and termsAndConditionsRoot does not provide a valid operator SKI
or the date attribute is missingjava.text.ParseException
- if the date is in a wrong format.java.security.SignatureException
- if the signature of a Terms and Conditions translation
has no valid signature.public java.lang.String getDateString()
public void addTranslation(org.w3c.dom.Element translationRoot) throws XMLParseException, java.security.SignatureException
translationRoot
- the DOMELement form which the translation should be appended to the
T&Cs containerXMLParseException
- if the translation does not refer to a valid T&C template or the
'locale' attribute which specifies the language is not set.java.security.SignatureException
- if translationRoot does not contain a valid signaturepublic TermsAndConditions.Translation removeTranslation(java.lang.String locale)
public TermsAndConditions.Translation removeTranslation(java.util.Locale locale)
public TermsAndConditions.Translation initializeEmptyTranslation(java.lang.String locale)
public TermsAndConditions.Translation initializeEmptyTranslation(java.util.Locale locale)
private void addTranslation(TermsAndConditions.Translation t, boolean withSignatureCheck) throws java.security.SignatureException
java.security.SignatureException
public TermsAndConditions.Translation getDefaultTranslation()
public TermsAndConditions.Translation getTranslation(java.util.Locale locale)
locale
- the locale refering to the desired translation languagepublic TermsAndConditions.Translation getTranslation(java.lang.String locale)
the
- two letter code specifying the desired translation langugaepublic java.util.Enumeration getAllTranslations()
public java.lang.String getTemplateReferenceId(java.lang.String locale)
locale
- public boolean hasTranslation(java.lang.String locale)
locale
- the two letter-code of the languagepublic boolean hasTranslation(java.util.Locale locale)
locale
- locale object referring to the corresponding languagepublic boolean hasTranslations()
public boolean hasDefaultTranslation()
public ServiceOperator getOperator()
public void setDate(java.util.Date date)
public java.util.Date getDate()
public void setAccepted(boolean accepted)
accepted
- true stands for accept, false for rejectpublic boolean isAccepted()
public static void storeTermsAndConditions(TermsAndConditions tc)
public static TermsAndConditions getTermsAndConditions(ServiceOperator operator)
public static void removeTermsAndConditions(TermsAndConditions tc)
public static void removeTermsAndConditions(ServiceOperator operator)
public static org.w3c.dom.Element getAllTermsAndConditionsAsXMLElement(org.w3c.dom.Document ownerDoc)
public static void loadTermsAndConditionsFromXMLElement(org.w3c.dom.Element listRoot)
public java.lang.String getHTMLText(java.util.Locale locale)
public java.lang.String getHTMLText(java.lang.String language)
public static java.lang.String getHTMLText(TermsAndConditions.Translation translation)
public boolean isSignatureObsolete()
public boolean equals(java.lang.Object anotherTC)
equals
in class java.lang.Object
public int compareTo(java.lang.Object o)
public boolean isMostRecent(java.lang.String toWhichDate) throws java.text.ParseException
java.text.ParseException
public boolean isMostRecent(java.util.Date toWhichDate)
private org.w3c.dom.Element xmlOut(org.w3c.dom.Document doc, boolean signedTranslations)
public org.w3c.dom.Element createTCRoot(org.w3c.dom.Document doc)
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document doc)
IXMLEncodable
toXmlElement
in interface IXMLEncodable
doc
- a documentpublic org.w3c.dom.Element createXMLOutput(org.w3c.dom.Document doc)
Copyright © 2023. All rights reserved.