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

io.ciera.tool.sql.ooaofooa.body.impl.TransitionActionBodyImpl Maven / Gradle / Ivy

package io.ciera.tool.sql.ooaofooa.body.impl;


import io.ciera.runtime.instanceloading.AttributeChangedDelta;
import io.ciera.runtime.instanceloading.InstanceCreatedDelta;
import io.ciera.runtime.summit.application.IRunContext;
import io.ciera.runtime.summit.classes.IInstanceIdentifier;
import io.ciera.runtime.summit.classes.InstanceIdentifier;
import io.ciera.runtime.summit.classes.ModelInstance;
import io.ciera.runtime.summit.exceptions.EmptyInstanceException;
import io.ciera.runtime.summit.exceptions.InstancePopulationException;
import io.ciera.runtime.summit.exceptions.XtumlException;
import io.ciera.runtime.summit.types.IWhere;
import io.ciera.runtime.summit.types.IXtumlType;
import io.ciera.runtime.summit.types.UniqueId;
import io.ciera.tool.Sql;
import io.ciera.tool.sql.ooaofooa.body.Body;
import io.ciera.tool.sql.ooaofooa.body.TransitionActionBody;
import io.ciera.tool.sql.ooaofooa.body.impl.BodyImpl;
import io.ciera.tool.sql.ooaofooa.statemachine.Action;
import io.ciera.tool.sql.ooaofooa.statemachine.impl.ActionImpl;


public class TransitionActionBodyImpl extends ModelInstance implements TransitionActionBody {

    public static final String KEY_LETTERS = "ACT_TAB";
    public static final TransitionActionBody EMPTY_TRANSITIONACTIONBODY = new EmptyTransitionActionBody();

    private Sql context;

    // constructors
    private TransitionActionBodyImpl( Sql context ) {
        this.context = context;
        ref_Action_ID = UniqueId.random();
        ref_SM_ID = UniqueId.random();
        ref_Act_ID = UniqueId.random();
        R688_specifies_processing_for_Action_inst = ActionImpl.EMPTY_ACTION;
        R698_is_a_Body_inst = BodyImpl.EMPTY_BODY;
    }

    private TransitionActionBodyImpl( Sql context, UniqueId instanceId, UniqueId ref_Action_ID, UniqueId ref_SM_ID, UniqueId ref_Act_ID ) {
        super(instanceId);
        this.context = context;
        this.ref_Action_ID = ref_Action_ID;
        this.ref_SM_ID = ref_SM_ID;
        this.ref_Act_ID = ref_Act_ID;
        R688_specifies_processing_for_Action_inst = ActionImpl.EMPTY_ACTION;
        R698_is_a_Body_inst = BodyImpl.EMPTY_BODY;
    }

    public static TransitionActionBody create( Sql context ) throws XtumlException {
        TransitionActionBody newTransitionActionBody = new TransitionActionBodyImpl( context );
        if ( context.addInstance( newTransitionActionBody ) ) {
            newTransitionActionBody.getRunContext().addChange(new InstanceCreatedDelta(newTransitionActionBody, KEY_LETTERS));
            return newTransitionActionBody;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }

    public static TransitionActionBody create( Sql context, UniqueId ref_Action_ID, UniqueId ref_SM_ID, UniqueId ref_Act_ID ) throws XtumlException {
        return create(context, UniqueId.random(), ref_Action_ID, ref_SM_ID, ref_Act_ID);
    }

    public static TransitionActionBody create( Sql context, UniqueId instanceId, UniqueId ref_Action_ID, UniqueId ref_SM_ID, UniqueId ref_Act_ID ) throws XtumlException {
        TransitionActionBody newTransitionActionBody = new TransitionActionBodyImpl( context, instanceId, ref_Action_ID, ref_SM_ID, ref_Act_ID );
        if ( context.addInstance( newTransitionActionBody ) ) {
            return newTransitionActionBody;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }



    // attributes
    private UniqueId ref_Action_ID;
    @Override
    public UniqueId getAction_ID() throws XtumlException {
        checkLiving();
        return ref_Action_ID;
    }
    @Override
    public void setAction_ID(UniqueId ref_Action_ID) throws XtumlException {
        checkLiving();
        if (ref_Action_ID.inequality( this.ref_Action_ID)) {
            final UniqueId oldValue = this.ref_Action_ID;
            this.ref_Action_ID = ref_Action_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Action_ID", oldValue, this.ref_Action_ID));
        }
    }
    private UniqueId ref_SM_ID;
    @Override
    public UniqueId getSM_ID() throws XtumlException {
        checkLiving();
        return ref_SM_ID;
    }
    @Override
    public void setSM_ID(UniqueId ref_SM_ID) throws XtumlException {
        checkLiving();
        if (ref_SM_ID.inequality( this.ref_SM_ID)) {
            final UniqueId oldValue = this.ref_SM_ID;
            this.ref_SM_ID = ref_SM_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_SM_ID", oldValue, this.ref_SM_ID));
        }
    }
    private UniqueId ref_Act_ID;
    @Override
    public UniqueId getAct_ID() throws XtumlException {
        checkLiving();
        return ref_Act_ID;
    }
    @Override
    public void setAct_ID(UniqueId ref_Act_ID) throws XtumlException {
        checkLiving();
        if (ref_Act_ID.inequality( this.ref_Act_ID)) {
            final UniqueId oldValue = this.ref_Act_ID;
            this.ref_Act_ID = ref_Act_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Act_ID", oldValue, this.ref_Act_ID));
        }
    }


    // instance identifiers
    @Override
    public IInstanceIdentifier getId1() {
        try {
            return new InstanceIdentifier(getAction_ID());
        }
        catch ( XtumlException e ) {
            getRunContext().getLog().error(e);
            System.exit(1);
            return null;
        }
    }

    // operations


    // static operations


    // events


    // selections
    private Action R688_specifies_processing_for_Action_inst;
    @Override
    public void setR688_specifies_processing_for_Action( Action inst ) {
        R688_specifies_processing_for_Action_inst = inst;
    }
    @Override
    public Action R688_specifies_processing_for_Action() throws XtumlException {
        return R688_specifies_processing_for_Action_inst;
    }
    private Body R698_is_a_Body_inst;
    @Override
    public void setR698_is_a_Body( Body inst ) {
        R698_is_a_Body_inst = inst;
    }
    @Override
    public Body R698_is_a_Body() throws XtumlException {
        return R698_is_a_Body_inst;
    }


    @Override
    public IRunContext getRunContext() {
        return context().getRunContext();
    }

    @Override
    public Sql context() {
        return context;
    }

    @Override
    public String getKeyLetters() {
        return KEY_LETTERS;
    }

    @Override
    public TransitionActionBody self() {
        return this;
    }

    @Override
    public TransitionActionBody oneWhere(IWhere condition) throws XtumlException {
        if (null == condition) throw new XtumlException("Null condition passed to selection.");
        if (condition.evaluate(this)) return this;
        else return EMPTY_TRANSITIONACTIONBODY;
    }

}

class EmptyTransitionActionBody extends ModelInstance implements TransitionActionBody {

    // attributes
    public UniqueId getAction_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setAction_ID( UniqueId ref_Action_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public UniqueId getSM_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setSM_ID( UniqueId ref_SM_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public UniqueId getAct_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setAct_ID( UniqueId ref_Act_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }


    // operations


    // selections
    @Override
    public Action R688_specifies_processing_for_Action() {
        return ActionImpl.EMPTY_ACTION;
    }
    @Override
    public Body R698_is_a_Body() {
        return BodyImpl.EMPTY_BODY;
    }


    @Override
    public String getKeyLetters() {
        return TransitionActionBodyImpl.KEY_LETTERS;
    }

    @Override
    public TransitionActionBody self() {
        return this;
    }

    @Override
    public boolean isEmpty() {
        return true;
    }

    @Override
    public TransitionActionBody oneWhere(IWhere condition) throws XtumlException {
        if (null == condition) throw new XtumlException("Null condition passed to selection.");
        return TransitionActionBodyImpl.EMPTY_TRANSITIONACTIONBODY;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy