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

io.ciera.tool.sql.ooaofooa.interaction.impl.ActorParticipantImpl Maven / Gradle / Ivy

package io.ciera.tool.sql.ooaofooa.interaction.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.StringUtil;
import io.ciera.runtime.summit.types.UniqueId;
import io.ciera.tool.Sql;
import io.ciera.tool.sql.ooaofooa.interaction.ActorParticipant;
import io.ciera.tool.sql.ooaofooa.interaction.InteractionParticipant;
import io.ciera.tool.sql.ooaofooa.interaction.Lifespan;
import io.ciera.tool.sql.ooaofooa.interaction.impl.InteractionParticipantImpl;
import io.ciera.tool.sql.ooaofooa.interaction.impl.LifespanImpl;


public class ActorParticipantImpl extends ModelInstance implements ActorParticipant {

    public static final String KEY_LETTERS = "SQ_AP";
    public static final ActorParticipant EMPTY_ACTORPARTICIPANT = new EmptyActorParticipant();

    private Sql context;

    // constructors
    private ActorParticipantImpl( Sql context ) {
        this.context = context;
        ref_Part_ID = UniqueId.random();
        m_Name = "";
        m_Descrip = "";
        ref_LS_Part_ID = UniqueId.random();
        R930_is_a_InteractionParticipant_inst = InteractionParticipantImpl.EMPTY_INTERACTIONPARTICIPANT;
        R949_life_is_bounded_by_Lifespan_inst = LifespanImpl.EMPTY_LIFESPAN;
    }

    private ActorParticipantImpl( Sql context, UniqueId instanceId, UniqueId ref_Part_ID, String m_Name, String m_Descrip, UniqueId ref_LS_Part_ID ) {
        super(instanceId);
        this.context = context;
        this.ref_Part_ID = ref_Part_ID;
        this.m_Name = m_Name;
        this.m_Descrip = m_Descrip;
        this.ref_LS_Part_ID = ref_LS_Part_ID;
        R930_is_a_InteractionParticipant_inst = InteractionParticipantImpl.EMPTY_INTERACTIONPARTICIPANT;
        R949_life_is_bounded_by_Lifespan_inst = LifespanImpl.EMPTY_LIFESPAN;
    }

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

    public static ActorParticipant create( Sql context, UniqueId ref_Part_ID, String m_Name, String m_Descrip, UniqueId ref_LS_Part_ID ) throws XtumlException {
        return create(context, UniqueId.random(), ref_Part_ID, m_Name, m_Descrip, ref_LS_Part_ID);
    }

    public static ActorParticipant create( Sql context, UniqueId instanceId, UniqueId ref_Part_ID, String m_Name, String m_Descrip, UniqueId ref_LS_Part_ID ) throws XtumlException {
        ActorParticipant newActorParticipant = new ActorParticipantImpl( context, instanceId, ref_Part_ID, m_Name, m_Descrip, ref_LS_Part_ID );
        if ( context.addInstance( newActorParticipant ) ) {
            return newActorParticipant;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }



    // attributes
    private UniqueId ref_Part_ID;
    @Override
    public UniqueId getPart_ID() throws XtumlException {
        checkLiving();
        return ref_Part_ID;
    }
    @Override
    public void setPart_ID(UniqueId ref_Part_ID) throws XtumlException {
        checkLiving();
        if (ref_Part_ID.inequality( this.ref_Part_ID)) {
            final UniqueId oldValue = this.ref_Part_ID;
            this.ref_Part_ID = ref_Part_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Part_ID", oldValue, this.ref_Part_ID));
        }
    }
    private String m_Name;
    @Override
    public String getName() throws XtumlException {
        checkLiving();
        return m_Name;
    }
    @Override
    public void setName(String m_Name) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(m_Name, this.m_Name)) {
            final String oldValue = this.m_Name;
            this.m_Name = m_Name;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_Name", oldValue, this.m_Name));
        }
    }
    private String m_Descrip;
    @Override
    public String getDescrip() throws XtumlException {
        checkLiving();
        return m_Descrip;
    }
    @Override
    public void setDescrip(String m_Descrip) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(m_Descrip, this.m_Descrip)) {
            final String oldValue = this.m_Descrip;
            this.m_Descrip = m_Descrip;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_Descrip", oldValue, this.m_Descrip));
        }
    }
    private UniqueId ref_LS_Part_ID;
    @Override
    public UniqueId getLS_Part_ID() throws XtumlException {
        checkLiving();
        return ref_LS_Part_ID;
    }
    @Override
    public void setLS_Part_ID(UniqueId ref_LS_Part_ID) throws XtumlException {
        checkLiving();
        if (ref_LS_Part_ID.inequality( this.ref_LS_Part_ID)) {
            final UniqueId oldValue = this.ref_LS_Part_ID;
            this.ref_LS_Part_ID = ref_LS_Part_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_LS_Part_ID", oldValue, this.ref_LS_Part_ID));
        }
    }


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

    // operations


    // static operations


    // events


    // selections
    private InteractionParticipant R930_is_a_InteractionParticipant_inst;
    @Override
    public void setR930_is_a_InteractionParticipant( InteractionParticipant inst ) {
        R930_is_a_InteractionParticipant_inst = inst;
    }
    @Override
    public InteractionParticipant R930_is_a_InteractionParticipant() throws XtumlException {
        return R930_is_a_InteractionParticipant_inst;
    }
    private Lifespan R949_life_is_bounded_by_Lifespan_inst;
    @Override
    public void setR949_life_is_bounded_by_Lifespan( Lifespan inst ) {
        R949_life_is_bounded_by_Lifespan_inst = inst;
    }
    @Override
    public Lifespan R949_life_is_bounded_by_Lifespan() throws XtumlException {
        return R949_life_is_bounded_by_Lifespan_inst;
    }


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

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

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

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

    @Override
    public ActorParticipant 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_ACTORPARTICIPANT;
    }

}

class EmptyActorParticipant extends ModelInstance implements ActorParticipant {

    // attributes
    public UniqueId getPart_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setPart_ID( UniqueId ref_Part_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getName() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setName( String m_Name ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getDescrip() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setDescrip( String m_Descrip ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public UniqueId getLS_Part_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setLS_Part_ID( UniqueId ref_LS_Part_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }


    // operations


    // selections
    @Override
    public InteractionParticipant R930_is_a_InteractionParticipant() {
        return InteractionParticipantImpl.EMPTY_INTERACTIONPARTICIPANT;
    }
    @Override
    public Lifespan R949_life_is_bounded_by_Lifespan() {
        return LifespanImpl.EMPTY_LIFESPAN;
    }


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

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

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

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy