All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nedap.archie.rm.changecontrol.Version Maven / Gradle / Ivy

There is a newer version: 3.11.0
Show newest version
package com.nedap.archie.rm.changecontrol;

import com.nedap.archie.rm.RMObject;
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.Invariant;
import com.nedap.archie.rminfo.RMProperty;
import com.nedap.archie.rmutil.InvariantUtil;

import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.Objects;

/**
 * Version class. You will need to create a subclass to make this work.
 * 

* Created by pieter.bos on 08/07/16. */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VERSION", propOrder = { "contribution", "commitAudit", "signature" }) public abstract class Version extends RMObject { private ObjectRef contribution; @Nullable private String signature; @XmlElement(name = "commit_audit") private AuditDetails commitAudit; public Version() { } public Version(AuditDetails commitAudit, ObjectRef contribution, @Nullable String signature) { this.contribution = contribution; this.signature = signature; this.commitAudit = commitAudit; } public ObjectRef getContribution() { return contribution; } public void setContribution(ObjectRef contribution) { this.contribution = contribution; } public String getSignature() { return signature; } public void setSignature(String signature) { this.signature = signature; } public AuditDetails getCommitAudit() { return commitAudit; } public void setCommitAudit(AuditDetails commitAudit) { this.commitAudit = commitAudit; } public abstract ObjectVersionId getUid(); public abstract ObjectVersionId getPrecedingVersionUid(); public abstract Type getData(); public abstract DvCodedText getLifecycleState(); public abstract String getCanonicalForm(); // public HierObjectId getOwnerId() { // if(getUid() != null) { // return getUid().getObjectId().getValue(); // } // // } @RMProperty("is_branch") public abstract boolean isBranch(); @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Version version = (Version) o; return Objects.equals(contribution, version.contribution) && Objects.equals(signature, version.signature) && Objects.equals(commitAudit, version.commitAudit); } @Override public int hashCode() { return Objects.hash(contribution, signature, commitAudit); } //TODO: Preceding_version_uid_validity, if version_tree_id() is implemented @Invariant("Lifecycle_state_valid") public boolean lifecycleStateValid() { return InvariantUtil.belongsToTerminologyByGroupId(getLifecycleState(), "version lifecycle state"); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy