org.somda.sdc.biceps.model.participant.AbstractContextState Maven / Gradle / Ivy
Show all versions of biceps-model Show documentation
package org.somda.sdc.biceps.model.participant;
import java.math.BigInteger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jetbrains.annotations.Nullable;
import org.jvnet.jaxb.lang.CopyStrategy;
import org.jvnet.jaxb.lang.CopyTo;
import org.jvnet.jaxb.lang.JAXBCopyStrategy;
import org.jvnet.jaxb.lang.JAXBToStringStrategy;
import org.jvnet.jaxb.lang.ToString;
import org.jvnet.jaxb.lang.ToStringStrategy;
import org.jvnet.jaxb.locator.ObjectLocator;
import org.jvnet.jaxb.locator.util.LocatorUtils;
import org.somda.sdc.common.model.TimestampAdapter;
/**
* Base type of a context state. Every context state can be identified as valid by a validator instance. Moreover, a context state's lifecycle is determined by a start and end. AbstractContextState bundles these information.
*
* Java class for AbstractContextState complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AbstractContextState", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = {
"validator",
"identification"
})
@XmlSeeAlso({
PatientContextState.class,
LocationContextState.class,
WorkflowContextState.class,
OperatorContextState.class,
MeansContextState.class,
EnsembleContextState.class
})
public class AbstractContextState
extends AbstractMultiState
implements Cloneable, CopyTo, ToString
{
/**
* OPTIONAL list of actors (e.g., persons, devices or any identifiable systems) which have confirmed that a binding of a context state to an MDS is correct.
*
*/
@XmlElement(name = "Validator", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected List validator;
/**
* OPTIONAL ordered list of identifiers for the context. The list is ordered by the position of the identifiers in the list where the ELEMENT with the lower list index has a higher relevance than any entry with a higher list index. The SERVICE PROVIDER defines the relevance and MAY reorder the list at any time.
*
* NOTE 1—Identification can be used to span a communication context between SERVICE PROVIDERs and SERVICE CONSUMERs.
* NOTE 2—Identification can be empty, e.g., if pm:AbstractContextState/@ContextAssociation is "No".
*
*/
@XmlElement(name = "Identification", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected List identification;
/**
* Association of a context. The implied value SHALL be "No".
*
* __R5027: Before a SERVICE PROVIDER decides to remove a specific context state from its MDIB, it SHALL change the context association of that context state to "No".__
*
* NOTE—BICEPS supports no special state removal flag. Therefore, a SERVICE CONSUMER has to rely on the context association in order to decide if a context state can be kept in memory or removed from memory.
*
*/
@XmlAttribute(name = "ContextAssociation")
protected ContextAssociation contextAssociation;
/**
* BindingMdibVersion points to the version of an MDIB when a binding of the context state to an MDS starts.
*
*/
@XmlAttribute(name = "BindingMdibVersion")
protected BigInteger bindingMdibVersion;
/**
* UnbindingMdibVersion points to the version of an MDIB when a binding of a context state to an MDS ends (i.e., the version where the context association was disassociated the first time).
*
*/
@XmlAttribute(name = "UnbindingMdibVersion")
protected BigInteger unbindingMdibVersion;
/**
* Point in time when a binding of a context state to an MDS starts.
*
*/
@XmlAttribute(name = "BindingStartTime")
@XmlJavaTypeAdapter(TimestampAdapter.class)
protected Instant bindingStartTime;
/**
* Point in time when a binding of a context state to an MDS ends.
*
*/
@XmlAttribute(name = "BindingEndTime")
@XmlJavaTypeAdapter(TimestampAdapter.class)
protected Instant bindingEndTime;
/**
* OPTIONAL list of actors (e.g., persons, devices or any identifiable systems) which have confirmed that a binding of a context state to an MDS is correct.
*
* Gets the value of the validator property.
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the validator property.
*
*
* For example, to add a new item, do as follows:
*
*
* getValidator().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link InstanceIdentifier }
*
*
*
* @return
* The value of the validator property.
*/
public List getValidator() {
if (validator == null) {
validator = new ArrayList<>();
}
return this.validator;
}
/**
* OPTIONAL ordered list of identifiers for the context. The list is ordered by the position of the identifiers in the list where the ELEMENT with the lower list index has a higher relevance than any entry with a higher list index. The SERVICE PROVIDER defines the relevance and MAY reorder the list at any time.
*
* NOTE 1—Identification can be used to span a communication context between SERVICE PROVIDERs and SERVICE CONSUMERs.
* NOTE 2—Identification can be empty, e.g., if pm:AbstractContextState/@ContextAssociation is "No".
*
* Gets the value of the identification property.
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the identification property.
*
*
* For example, to add a new item, do as follows:
*
*
* getIdentification().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link InstanceIdentifier }
*
*
*
* @return
* The value of the identification property.
*/
public List getIdentification() {
if (identification == null) {
identification = new ArrayList<>();
}
return this.identification;
}
/**
* Association of a context. The implied value SHALL be "No".
*
* __R5027: Before a SERVICE PROVIDER decides to remove a specific context state from its MDIB, it SHALL change the context association of that context state to "No".__
*
* NOTE—BICEPS supports no special state removal flag. Therefore, a SERVICE CONSUMER has to rely on the context association in order to decide if a context state can be kept in memory or removed from memory.
*
* @return
* possible object is
* {@link ContextAssociation }
*
*/
@Nullable
public ContextAssociation getContextAssociation() {
return contextAssociation;
}
/**
* Sets the value of the contextAssociation property.
*
* @param value
* allowed object is
* {@link ContextAssociation }
*
* @see #getContextAssociation()
*/
public void setContextAssociation(
@Nullable
ContextAssociation value) {
this.contextAssociation = value;
}
/**
* BindingMdibVersion points to the version of an MDIB when a binding of the context state to an MDS starts.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
@Nullable
public BigInteger getBindingMdibVersion() {
return bindingMdibVersion;
}
/**
* Sets the value of the bindingMdibVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @see #getBindingMdibVersion()
*/
public void setBindingMdibVersion(
@Nullable
BigInteger value) {
this.bindingMdibVersion = value;
}
/**
* UnbindingMdibVersion points to the version of an MDIB when a binding of a context state to an MDS ends (i.e., the version where the context association was disassociated the first time).
*
* @return
* possible object is
* {@link BigInteger }
*
*/
@Nullable
public BigInteger getUnbindingMdibVersion() {
return unbindingMdibVersion;
}
/**
* Sets the value of the unbindingMdibVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @see #getUnbindingMdibVersion()
*/
public void setUnbindingMdibVersion(
@Nullable
BigInteger value) {
this.unbindingMdibVersion = value;
}
/**
* Point in time when a binding of a context state to an MDS starts.
*
* @return
* possible object is
* {@link String }
*
*/
@Nullable
public Instant getBindingStartTime() {
return bindingStartTime;
}
/**
* Sets the value of the bindingStartTime property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getBindingStartTime()
*/
public void setBindingStartTime(
@Nullable
Instant value) {
this.bindingStartTime = value;
}
/**
* Point in time when a binding of a context state to an MDS ends.
*
* @return
* possible object is
* {@link String }
*
*/
@Nullable
public Instant getBindingEndTime() {
return bindingEndTime;
}
/**
* Sets the value of the bindingEndTime property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getBindingEndTime()
*/
public void setBindingEndTime(
@Nullable
Instant value) {
this.bindingEndTime = value;
}
public void setValidator(
@Nullable
List value) {
this.validator = null;
if (value!= null) {
List draftl = this.getValidator();
draftl.addAll(value);
}
}
public void setIdentification(
@Nullable
List value) {
this.identification = null;
if (value!= null) {
List draftl = this.getIdentification();
draftl.addAll(value);
}
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
final AbstractContextState that = ((AbstractContextState) object);
{
List leftValidator;
leftValidator = (((this.validator!= null)&&(!this.validator.isEmpty()))?this.getValidator():null);
List rightValidator;
rightValidator = (((that.validator!= null)&&(!that.validator.isEmpty()))?that.getValidator():null);
if ((this.validator!= null)&&(!this.validator.isEmpty())) {
if ((that.validator!= null)&&(!that.validator.isEmpty())) {
if (!leftValidator.equals(rightValidator)) {
return false;
}
} else {
return false;
}
} else {
if ((that.validator!= null)&&(!that.validator.isEmpty())) {
return false;
}
}
}
{
List leftIdentification;
leftIdentification = (((this.identification!= null)&&(!this.identification.isEmpty()))?this.getIdentification():null);
List rightIdentification;
rightIdentification = (((that.identification!= null)&&(!that.identification.isEmpty()))?that.getIdentification():null);
if ((this.identification!= null)&&(!this.identification.isEmpty())) {
if ((that.identification!= null)&&(!that.identification.isEmpty())) {
if (!leftIdentification.equals(rightIdentification)) {
return false;
}
} else {
return false;
}
} else {
if ((that.identification!= null)&&(!that.identification.isEmpty())) {
return false;
}
}
}
{
ContextAssociation leftContextAssociation;
leftContextAssociation = this.getContextAssociation();
ContextAssociation rightContextAssociation;
rightContextAssociation = that.getContextAssociation();
if (this.contextAssociation!= null) {
if (that.contextAssociation!= null) {
if (!leftContextAssociation.equals(rightContextAssociation)) {
return false;
}
} else {
return false;
}
} else {
if (that.contextAssociation!= null) {
return false;
}
}
}
{
BigInteger leftBindingMdibVersion;
leftBindingMdibVersion = this.getBindingMdibVersion();
BigInteger rightBindingMdibVersion;
rightBindingMdibVersion = that.getBindingMdibVersion();
if (this.bindingMdibVersion!= null) {
if (that.bindingMdibVersion!= null) {
if (!leftBindingMdibVersion.equals(rightBindingMdibVersion)) {
return false;
}
} else {
return false;
}
} else {
if (that.bindingMdibVersion!= null) {
return false;
}
}
}
{
BigInteger leftUnbindingMdibVersion;
leftUnbindingMdibVersion = this.getUnbindingMdibVersion();
BigInteger rightUnbindingMdibVersion;
rightUnbindingMdibVersion = that.getUnbindingMdibVersion();
if (this.unbindingMdibVersion!= null) {
if (that.unbindingMdibVersion!= null) {
if (!leftUnbindingMdibVersion.equals(rightUnbindingMdibVersion)) {
return false;
}
} else {
return false;
}
} else {
if (that.unbindingMdibVersion!= null) {
return false;
}
}
}
{
Instant leftBindingStartTime;
leftBindingStartTime = this.getBindingStartTime();
Instant rightBindingStartTime;
rightBindingStartTime = that.getBindingStartTime();
if (this.bindingStartTime!= null) {
if (that.bindingStartTime!= null) {
if (!leftBindingStartTime.equals(rightBindingStartTime)) {
return false;
}
} else {
return false;
}
} else {
if (that.bindingStartTime!= null) {
return false;
}
}
}
{
Instant leftBindingEndTime;
leftBindingEndTime = this.getBindingEndTime();
Instant rightBindingEndTime;
rightBindingEndTime = that.getBindingEndTime();
if (this.bindingEndTime!= null) {
if (that.bindingEndTime!= null) {
if (!leftBindingEndTime.equals(rightBindingEndTime)) {
return false;
}
} else {
return false;
}
} else {
if (that.bindingEndTime!= null) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
currentHashCode = ((currentHashCode* 31)+ super.hashCode());
{
currentHashCode = (currentHashCode* 31);
List theValidator;
theValidator = (((this.validator!= null)&&(!this.validator.isEmpty()))?this.getValidator():null);
if ((this.validator!= null)&&(!this.validator.isEmpty())) {
currentHashCode += theValidator.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
List theIdentification;
theIdentification = (((this.identification!= null)&&(!this.identification.isEmpty()))?this.getIdentification():null);
if ((this.identification!= null)&&(!this.identification.isEmpty())) {
currentHashCode += theIdentification.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
ContextAssociation theContextAssociation;
theContextAssociation = this.getContextAssociation();
if (this.contextAssociation!= null) {
currentHashCode += theContextAssociation.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
BigInteger theBindingMdibVersion;
theBindingMdibVersion = this.getBindingMdibVersion();
if (this.bindingMdibVersion!= null) {
currentHashCode += theBindingMdibVersion.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
BigInteger theUnbindingMdibVersion;
theUnbindingMdibVersion = this.getUnbindingMdibVersion();
if (this.unbindingMdibVersion!= null) {
currentHashCode += theUnbindingMdibVersion.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Instant theBindingStartTime;
theBindingStartTime = this.getBindingStartTime();
if (this.bindingStartTime!= null) {
currentHashCode += theBindingStartTime.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Instant theBindingEndTime;
theBindingEndTime = this.getBindingEndTime();
if (this.bindingEndTime!= null) {
currentHashCode += theBindingEndTime.hashCode();
}
}
return currentHashCode;
}
@Override
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.getInstance();
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Override
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
@Override
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
List theValidator;
theValidator = (((this.validator!= null)&&(!this.validator.isEmpty()))?this.getValidator():null);
strategy.appendField(locator, this, "validator", buffer, theValidator, ((this.validator!= null)&&(!this.validator.isEmpty())));
}
{
List theIdentification;
theIdentification = (((this.identification!= null)&&(!this.identification.isEmpty()))?this.getIdentification():null);
strategy.appendField(locator, this, "identification", buffer, theIdentification, ((this.identification!= null)&&(!this.identification.isEmpty())));
}
{
ContextAssociation theContextAssociation;
theContextAssociation = this.getContextAssociation();
strategy.appendField(locator, this, "contextAssociation", buffer, theContextAssociation, (this.contextAssociation!= null));
}
{
BigInteger theBindingMdibVersion;
theBindingMdibVersion = this.getBindingMdibVersion();
strategy.appendField(locator, this, "bindingMdibVersion", buffer, theBindingMdibVersion, (this.bindingMdibVersion!= null));
}
{
BigInteger theUnbindingMdibVersion;
theUnbindingMdibVersion = this.getUnbindingMdibVersion();
strategy.appendField(locator, this, "unbindingMdibVersion", buffer, theUnbindingMdibVersion, (this.unbindingMdibVersion!= null));
}
{
Instant theBindingStartTime;
theBindingStartTime = this.getBindingStartTime();
strategy.appendField(locator, this, "bindingStartTime", buffer, theBindingStartTime, (this.bindingStartTime!= null));
}
{
Instant theBindingEndTime;
theBindingEndTime = this.getBindingEndTime();
strategy.appendField(locator, this, "bindingEndTime", buffer, theBindingEndTime, (this.bindingEndTime!= null));
}
return buffer;
}
@Override
public Object clone() {
return copyTo(createNewInstance());
}
@Override
public Object copyTo(Object target) {
final CopyStrategy strategy = JAXBCopyStrategy.getInstance();
return copyTo(null, target, strategy);
}
@Override
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
super.copyTo(locator, draftCopy, strategy);
if (draftCopy instanceof AbstractContextState) {
final AbstractContextState copy = ((AbstractContextState) draftCopy);
{
Boolean validatorShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.validator!= null)&&(!this.validator.isEmpty())));
if (validatorShouldBeCopiedAndSet == Boolean.TRUE) {
List sourceValidator;
sourceValidator = (((this.validator!= null)&&(!this.validator.isEmpty()))?this.getValidator():null);
@SuppressWarnings("unchecked")
List copyValidator = ((List ) strategy.copy(LocatorUtils.property(locator, "validator", sourceValidator), sourceValidator, ((this.validator!= null)&&(!this.validator.isEmpty()))));
copy.setValidator(copyValidator);
} else {
if (validatorShouldBeCopiedAndSet == Boolean.FALSE) {
copy.validator = null;
}
}
}
{
Boolean identificationShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.identification!= null)&&(!this.identification.isEmpty())));
if (identificationShouldBeCopiedAndSet == Boolean.TRUE) {
List sourceIdentification;
sourceIdentification = (((this.identification!= null)&&(!this.identification.isEmpty()))?this.getIdentification():null);
@SuppressWarnings("unchecked")
List copyIdentification = ((List ) strategy.copy(LocatorUtils.property(locator, "identification", sourceIdentification), sourceIdentification, ((this.identification!= null)&&(!this.identification.isEmpty()))));
copy.setIdentification(copyIdentification);
} else {
if (identificationShouldBeCopiedAndSet == Boolean.FALSE) {
copy.identification = null;
}
}
}
{
Boolean contextAssociationShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.contextAssociation!= null));
if (contextAssociationShouldBeCopiedAndSet == Boolean.TRUE) {
ContextAssociation sourceContextAssociation;
sourceContextAssociation = this.getContextAssociation();
ContextAssociation copyContextAssociation = ((ContextAssociation) strategy.copy(LocatorUtils.property(locator, "contextAssociation", sourceContextAssociation), sourceContextAssociation, (this.contextAssociation!= null)));
copy.setContextAssociation(copyContextAssociation);
} else {
if (contextAssociationShouldBeCopiedAndSet == Boolean.FALSE) {
copy.contextAssociation = null;
}
}
}
{
Boolean bindingMdibVersionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.bindingMdibVersion!= null));
if (bindingMdibVersionShouldBeCopiedAndSet == Boolean.TRUE) {
BigInteger sourceBindingMdibVersion;
sourceBindingMdibVersion = this.getBindingMdibVersion();
BigInteger copyBindingMdibVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "bindingMdibVersion", sourceBindingMdibVersion), sourceBindingMdibVersion, (this.bindingMdibVersion!= null)));
copy.setBindingMdibVersion(copyBindingMdibVersion);
} else {
if (bindingMdibVersionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.bindingMdibVersion = null;
}
}
}
{
Boolean unbindingMdibVersionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.unbindingMdibVersion!= null));
if (unbindingMdibVersionShouldBeCopiedAndSet == Boolean.TRUE) {
BigInteger sourceUnbindingMdibVersion;
sourceUnbindingMdibVersion = this.getUnbindingMdibVersion();
BigInteger copyUnbindingMdibVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "unbindingMdibVersion", sourceUnbindingMdibVersion), sourceUnbindingMdibVersion, (this.unbindingMdibVersion!= null)));
copy.setUnbindingMdibVersion(copyUnbindingMdibVersion);
} else {
if (unbindingMdibVersionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.unbindingMdibVersion = null;
}
}
}
{
Boolean bindingStartTimeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.bindingStartTime!= null));
if (bindingStartTimeShouldBeCopiedAndSet == Boolean.TRUE) {
Instant sourceBindingStartTime;
sourceBindingStartTime = this.getBindingStartTime();
Instant copyBindingStartTime = ((Instant) strategy.copy(LocatorUtils.property(locator, "bindingStartTime", sourceBindingStartTime), sourceBindingStartTime, (this.bindingStartTime!= null)));
copy.setBindingStartTime(copyBindingStartTime);
} else {
if (bindingStartTimeShouldBeCopiedAndSet == Boolean.FALSE) {
copy.bindingStartTime = null;
}
}
}
{
Boolean bindingEndTimeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.bindingEndTime!= null));
if (bindingEndTimeShouldBeCopiedAndSet == Boolean.TRUE) {
Instant sourceBindingEndTime;
sourceBindingEndTime = this.getBindingEndTime();
Instant copyBindingEndTime = ((Instant) strategy.copy(LocatorUtils.property(locator, "bindingEndTime", sourceBindingEndTime), sourceBindingEndTime, (this.bindingEndTime!= null)));
copy.setBindingEndTime(copyBindingEndTime);
} else {
if (bindingEndTimeShouldBeCopiedAndSet == Boolean.FALSE) {
copy.bindingEndTime = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new AbstractContextState();
}
}