com.nedap.archie.rm.changecontrol.ImportedVersion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openehr-rm Show documentation
Show all versions of openehr-rm Show documentation
An implementation of the openehr reference model
package com.nedap.archie.rm.changecontrol;
import com.nedap.archie.rm.datavalues.DvCodedText;
import com.nedap.archie.rm.generic.AuditDetails;
import com.nedap.archie.rm.support.identification.ObjectId;
import com.nedap.archie.rm.support.identification.ObjectRef;
import com.nedap.archie.rm.support.identification.ObjectVersionId;
import com.nedap.archie.rminfo.RMProperty;
import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlType;
import java.util.Objects;
/**
* Created by pieter.bos on 08/07/16.
*/
@XmlType(name = "IMPORTED_VERSION")
public class ImportedVersion extends Version {
private OriginalVersion item;
public ImportedVersion() {
}
public ImportedVersion(AuditDetails commitAudit, ObjectRef extends ObjectId> contribution, @Nullable String signature, OriginalVersion item) {
super(commitAudit, contribution, signature);
this.item = item;
}
@Override
public ObjectVersionId getUid() {
return item == null ? null : item.getUid();
}
@Override
public ObjectVersionId getPrecedingVersionUid() {
return item == null ? null : item.getPrecedingVersionUid();
}
@Override
public T getData() {
return item == null ? null : item.getData();
}
@Override
public DvCodedText getLifecycleState() {
return item == null ? null : item.getLifecycleState();
}
@Override
public String getCanonicalForm() {
return item == null ? null : item.getCanonicalForm();//TODO: this is probably not right
}
@Override
@RMProperty("is_branch")
public boolean isBranch() {
return item == null ? null : item.isBranch();//TODO: this is probably not right
}
public OriginalVersion getItem() {
return item;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ImportedVersion> that = (ImportedVersion>) o;
return Objects.equals(item, that.item);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), item);
}
}