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

io.ciera.tool.sql.ooaofooa.body.impl.ProvidedSignalBodyImpl 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.ProvidedSignalBody;
import io.ciera.tool.sql.ooaofooa.body.impl.BodyImpl;
import io.ciera.tool.sql.ooaofooa.component.signalprovisionsandrequirements.ProvidedSignal;
import io.ciera.tool.sql.ooaofooa.component.signalprovisionsandrequirements.impl.ProvidedSignalImpl;


public class ProvidedSignalBodyImpl extends ModelInstance implements ProvidedSignalBody {

    public static final String KEY_LETTERS = "ACT_PSB";
    public static final ProvidedSignalBody EMPTY_PROVIDEDSIGNALBODY = new EmptyProvidedSignalBody();

    private Sql context;

    // constructors
    private ProvidedSignalBodyImpl( Sql context ) {
        this.context = context;
        ref_Action_ID = UniqueId.random();
        ref_Id = UniqueId.random();
        R686_specifies_processing_for_ProvidedSignal_inst = ProvidedSignalImpl.EMPTY_PROVIDEDSIGNAL;
        R698_is_a_Body_inst = BodyImpl.EMPTY_BODY;
    }

    private ProvidedSignalBodyImpl( Sql context, UniqueId instanceId, UniqueId ref_Action_ID, UniqueId ref_Id ) {
        super(instanceId);
        this.context = context;
        this.ref_Action_ID = ref_Action_ID;
        this.ref_Id = ref_Id;
        R686_specifies_processing_for_ProvidedSignal_inst = ProvidedSignalImpl.EMPTY_PROVIDEDSIGNAL;
        R698_is_a_Body_inst = BodyImpl.EMPTY_BODY;
    }

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

    public static ProvidedSignalBody create( Sql context, UniqueId ref_Action_ID, UniqueId ref_Id ) throws XtumlException {
        return create(context, UniqueId.random(), ref_Action_ID, ref_Id);
    }

    public static ProvidedSignalBody create( Sql context, UniqueId instanceId, UniqueId ref_Action_ID, UniqueId ref_Id ) throws XtumlException {
        ProvidedSignalBody newProvidedSignalBody = new ProvidedSignalBodyImpl( context, instanceId, ref_Action_ID, ref_Id );
        if ( context.addInstance( newProvidedSignalBody ) ) {
            return newProvidedSignalBody;
        }
        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_Id;
    @Override
    public UniqueId getId() throws XtumlException {
        checkLiving();
        return ref_Id;
    }
    @Override
    public void setId(UniqueId ref_Id) throws XtumlException {
        checkLiving();
        if (ref_Id.inequality( this.ref_Id)) {
            final UniqueId oldValue = this.ref_Id;
            this.ref_Id = ref_Id;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Id", oldValue, this.ref_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 ProvidedSignal R686_specifies_processing_for_ProvidedSignal_inst;
    @Override
    public void setR686_specifies_processing_for_ProvidedSignal( ProvidedSignal inst ) {
        R686_specifies_processing_for_ProvidedSignal_inst = inst;
    }
    @Override
    public ProvidedSignal R686_specifies_processing_for_ProvidedSignal() throws XtumlException {
        return R686_specifies_processing_for_ProvidedSignal_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 ProvidedSignalBody self() {
        return this;
    }

    @Override
    public ProvidedSignalBody 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_PROVIDEDSIGNALBODY;
    }

}

class EmptyProvidedSignalBody extends ModelInstance implements ProvidedSignalBody {

    // 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 getId() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setId( UniqueId ref_Id ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }


    // operations


    // selections
    @Override
    public ProvidedSignal R686_specifies_processing_for_ProvidedSignal() {
        return ProvidedSignalImpl.EMPTY_PROVIDEDSIGNAL;
    }
    @Override
    public Body R698_is_a_Body() {
        return BodyImpl.EMPTY_BODY;
    }


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

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

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

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy