Example #1
0
        /**********************************************************************************************//**
        * Searches for the first attribute.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \exception   EvaluationException Thrown when an Evaluation error condition occurs.
        *
        * \param   network The network.
        * \param   process The process.
        * \param   channel The channel.
        * \param   message The message.
        * \param   key     The key.
        *
        * \return  The found attribute.
        *  .
        **************************************************************************************************/

        private Attribute FindAttribute(BaseNetwork network, BaseProcess process, BaseChannel channel, BaseMessage message, dynamic key)
        {
            HostingElementTypes hostingElementType = or[brp.ork.HostingElementType];
            Attribute           attribute;

            switch (hostingElementType)
            {
            case HostingElementTypes.Network:
                if ((attribute = network.FindAttribute(TypesUtility.GetKeyToString(key))) != null)
                {
                    return(attribute);
                }
                break;

            case HostingElementTypes.Process:
                if ((attribute = process.FindAttribute(TypesUtility.GetKeyToString(key))) != null)
                {
                    return(attribute);
                }
                break;

            case HostingElementTypes.Channel:
                if ((attribute = channel.FindAttribute(TypesUtility.GetKeyToString(key))) != null)
                {
                    return(attribute);
                }
                break;

            case HostingElementTypes.Message:
                if ((attribute = message.FindAttribute(TypesUtility.GetKeyToString(key))) != null)
                {
                    return(attribute);
                }
                break;

            default:
                throw new EvaluationException("Unknown hots type : " + TypesUtility.GetKeyToString(hostingElementType));
            }
            throw new EvaluationException("There is no attribute " + TypesUtility.GetKeyToString(key) +
                                          " In " + TypesUtility.GetKeyToString(hostingElementType));
        }