org.somda.sdc.biceps.model.participant.MdState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biceps-model Show documentation
Show all versions of biceps-model Show documentation
SDCri is a set of Java libraries that implements a network communication framework conforming
with the IEEE 11073 SDC specifications. This project implements the model for
IEEE 11073-10207.
The newest version!
package org.somda.sdc.biceps.model.participant;
import java.math.BigInteger;
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.XmlType;
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.biceps.model.extension.ExtensionType;
/**
* MdState is the root container to represent the state part of the MDIB. The state part describes the values provided by a POC MEDICAL DEVICE, e.g., which measurement or alert values as well as patient demographics it provides. As the state part most often changes very frequently, it is well-known as the dynamic part of the MDIB. The MdState's counterpart is pm:MdDescription.
*
* Java class for MdState complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MdState", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = {
"extension",
"state"
})
public class MdState implements Cloneable, CopyTo, ToString
{
@XmlElement(name = "Extension", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/extension")
protected ExtensionType extension;
/**
* List of states that describe the volatile status of the objects in the MDIB.
*
*/
@XmlElement(name = "State", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected List state;
/**
* Version number of the states. The version number is incremented by one every time the state part changes. The implied value SHALL be "0".
*
*/
@XmlAttribute(name = "StateVersion")
protected BigInteger stateVersion;
/**
* Gets the value of the extension property.
*
* @return
* possible object is
* {@link ExtensionType }
*
*/
@Nullable
public ExtensionType getExtension() {
return extension;
}
/**
* Sets the value of the extension property.
*
* @param value
* allowed object is
* {@link ExtensionType }
*
*/
public void setExtension(
@Nullable
ExtensionType value) {
this.extension = value;
}
/**
* List of states that describe the volatile status of the objects in the MDIB.
*
* Gets the value of the state 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 state property.
*
*
* For example, to add a new item, do as follows:
*
*
* getState().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link AbstractState }
*
*
*
* @return
* The value of the state property.
*/
public List getState() {
if (state == null) {
state = new ArrayList<>();
}
return this.state;
}
/**
* Version number of the states. The version number is incremented by one every time the state part changes. The implied value SHALL be "0".
*
* @return
* possible object is
* {@link BigInteger }
*
*/
@Nullable
public BigInteger getStateVersion() {
return stateVersion;
}
/**
* Sets the value of the stateVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @see #getStateVersion()
*/
public void setStateVersion(
@Nullable
BigInteger value) {
this.stateVersion = value;
}
public void setState(
@Nullable
List value) {
this.state = null;
if (value!= null) {
List draftl = this.getState();
draftl.addAll(value);
}
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
final MdState that = ((MdState) object);
{
ExtensionType leftExtension;
leftExtension = this.getExtension();
ExtensionType rightExtension;
rightExtension = that.getExtension();
if (this.extension!= null) {
if (that.extension!= null) {
if (!leftExtension.equals(rightExtension)) {
return false;
}
} else {
return false;
}
} else {
if (that.extension!= null) {
return false;
}
}
}
{
List leftState;
leftState = (((this.state!= null)&&(!this.state.isEmpty()))?this.getState():null);
List rightState;
rightState = (((that.state!= null)&&(!that.state.isEmpty()))?that.getState():null);
if ((this.state!= null)&&(!this.state.isEmpty())) {
if ((that.state!= null)&&(!that.state.isEmpty())) {
if (!leftState.equals(rightState)) {
return false;
}
} else {
return false;
}
} else {
if ((that.state!= null)&&(!that.state.isEmpty())) {
return false;
}
}
}
{
BigInteger leftStateVersion;
leftStateVersion = this.getStateVersion();
BigInteger rightStateVersion;
rightStateVersion = that.getStateVersion();
if (this.stateVersion!= null) {
if (that.stateVersion!= null) {
if (!leftStateVersion.equals(rightStateVersion)) {
return false;
}
} else {
return false;
}
} else {
if (that.stateVersion!= null) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
{
currentHashCode = (currentHashCode* 31);
ExtensionType theExtension;
theExtension = this.getExtension();
if (this.extension!= null) {
currentHashCode += theExtension.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
List theState;
theState = (((this.state!= null)&&(!this.state.isEmpty()))?this.getState():null);
if ((this.state!= null)&&(!this.state.isEmpty())) {
currentHashCode += theState.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
BigInteger theStateVersion;
theStateVersion = this.getStateVersion();
if (this.stateVersion!= null) {
currentHashCode += theStateVersion.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) {
{
ExtensionType theExtension;
theExtension = this.getExtension();
strategy.appendField(locator, this, "extension", buffer, theExtension, (this.extension!= null));
}
{
List theState;
theState = (((this.state!= null)&&(!this.state.isEmpty()))?this.getState():null);
strategy.appendField(locator, this, "state", buffer, theState, ((this.state!= null)&&(!this.state.isEmpty())));
}
{
BigInteger theStateVersion;
theStateVersion = this.getStateVersion();
strategy.appendField(locator, this, "stateVersion", buffer, theStateVersion, (this.stateVersion!= 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);
if (draftCopy instanceof MdState) {
final MdState copy = ((MdState) draftCopy);
{
Boolean extensionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.extension!= null));
if (extensionShouldBeCopiedAndSet == Boolean.TRUE) {
ExtensionType sourceExtension;
sourceExtension = this.getExtension();
ExtensionType copyExtension = ((ExtensionType) strategy.copy(LocatorUtils.property(locator, "extension", sourceExtension), sourceExtension, (this.extension!= null)));
copy.setExtension(copyExtension);
} else {
if (extensionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.extension = null;
}
}
}
{
Boolean stateShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.state!= null)&&(!this.state.isEmpty())));
if (stateShouldBeCopiedAndSet == Boolean.TRUE) {
List sourceState;
sourceState = (((this.state!= null)&&(!this.state.isEmpty()))?this.getState():null);
@SuppressWarnings("unchecked")
List copyState = ((List ) strategy.copy(LocatorUtils.property(locator, "state", sourceState), sourceState, ((this.state!= null)&&(!this.state.isEmpty()))));
copy.setState(copyState);
} else {
if (stateShouldBeCopiedAndSet == Boolean.FALSE) {
copy.state = null;
}
}
}
{
Boolean stateVersionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.stateVersion!= null));
if (stateVersionShouldBeCopiedAndSet == Boolean.TRUE) {
BigInteger sourceStateVersion;
sourceStateVersion = this.getStateVersion();
BigInteger copyStateVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "stateVersion", sourceStateVersion), sourceStateVersion, (this.stateVersion!= null)));
copy.setStateVersion(copyStateVersion);
} else {
if (stateVersionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.stateVersion = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new MdState();
}
}