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

io.legaldocml.akn.element.Step Maven / Gradle / Ivy

The newest version!
package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
import io.legaldocml.akn.attribute.Actor;
import io.legaldocml.akn.attribute.Agent;
import io.legaldocml.akn.attribute.Date;
import io.legaldocml.akn.attribute.Outcome;
import io.legaldocml.akn.attribute.Role;
import io.legaldocml.akn.type.AgentRef;
import io.legaldocml.akn.type.ConceptRef;
import io.legaldocml.akn.type.RoleRef;
import io.legaldocml.io.AttributeGetterSetter;
import io.legaldocml.io.XmlReader;
import io.legaldocml.io.XmlWriter;
import io.legaldocml.io.impl.Buffers;

import java.io.IOException;
import java.time.OffsetDateTime;

import static io.legaldocml.akn.AknAttributes.ACTOR;
import static io.legaldocml.akn.AknAttributes.AS;
import static io.legaldocml.akn.AknAttributes.BY;
import static io.legaldocml.akn.AknAttributes.DATE;
import static io.legaldocml.akn.AknAttributes.OUTCOME;
import static io.legaldocml.akn.AknElements.STEP;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4AgentRef;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4ConceptRef;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4DateTime;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4RoleRef;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4String;
import static io.legaldocml.akn.util.XmlWriterHelper.writeActor;
import static io.legaldocml.akn.util.XmlWriterHelper.writeAgent;
import static io.legaldocml.akn.util.XmlWriterHelper.writeDate;
import static io.legaldocml.akn.util.XmlWriterHelper.writeOutcome;
import static io.legaldocml.akn.util.XmlWriterHelper.writeRole;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;

/**
 * The element step is a metadata element specifying facts about a workflow step occurred to the document. For each
 * event, a date, a type, an agent (and the corresponding role) that generated the action must be referenced. The
 * outcome, too, can be specified.
 * 

*

 *   
 * 	   
 * 	     
 * 		   
 * 		     
 * 			 
 * 			 
 * 		 	 
 * 		 	 
 * 		   
 * 	     
 * 	   
 *   
 * 
* * @author Jacques Militello */ public final class Step extends AnyOtherType implements Role, Date, Outcome, Actor, Agent { /** * Memory address. */ private static final long ADDRESS_STEP = Buffers.address(STEP); private static final ImmutableMap> ATTRIBUTES; static { ATTRIBUTES = ImmutableMap.>builder() .putAll(AnyOtherType.ATTRIBUTES) .put(DATE, attributeGetterSetter4DateTime(DATE, getFieldOffset(Step.class, "date"))) .put(AS, attributeGetterSetter4RoleRef(AS, getFieldOffset(Step.class, "as"))) .put(OUTCOME, attributeGetterSetter4ConceptRef(OUTCOME, getFieldOffset(Step.class, "outcome"))) .put(ACTOR, attributeGetterSetter4String(ACTOR, getFieldOffset(Step.class, "actor"))) .put(BY, attributeGetterSetter4AgentRef(BY, getFieldOffset(Step.class, "by"))) .build(); } private RoleRef as; private OffsetDateTime date; private ConceptRef outcome; private String actor; private AgentRef by; /** * {@inheritDoc} */ @Override public OffsetDateTime getDate() { return this.date; } /** * {@inheritDoc} */ @Override public void setDate(OffsetDateTime date) { this.date = date; } /** * {@inheritDoc} */ @Override public RoleRef getAs() { return this.as; } /** * {@inheritDoc} */ @Override public void setAs(RoleRef as) { this.as = as; } /** * {@inheritDoc} */ @Override public ConceptRef getOutcome() { return this.outcome; } /** * {@inheritDoc} */ @Override public void setOutcome(ConceptRef outcome) { this.outcome = outcome; } /** * {@inheritDoc} */ @Override public String getActor() { return this.actor; } /** * {@inheritDoc} */ @Override public void setActor(String actor) { this.actor = actor; } @Override public AgentRef getBy() { return this.by; } @Override public void setBy(AgentRef by) { this.by = by; } /** * {@inheritDoc} */ @Override public void read(XmlReader reader) { super.read(reader); } /** * {@inheritDoc} */ @Override public void write(XmlWriter writer) throws IOException { writer.writeStart(ADDRESS_STEP, 4); writeDate(writer, this); writeOutcome(writer, this); writeActor(writer, this); writeRole(writer, this); if (writer.getVersion() > 2) { writeAgent(writer, this); } super.write(writer); writer.writeEnd(ADDRESS_STEP, 4); } /** * {@inheritDoc} */ @Override public String name() { return STEP; } @Override public ImmutableMap> attributes() { return ATTRIBUTES; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy