Пример #1
0
 public void Execute(ref IBaseMessage inmsg, IPipelineContext pc)
 {
     try
     {
         if (castRequired)
         {
             if (promotion == ContextInstructionTypeEnum.Write)
             {
                 inmsg.Context.Write(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type));
             }
             else if (promotion == ContextInstructionTypeEnum.Promote)
             {
                 inmsg.Context.Promote(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type));
             }
         }
         else
         {
             if (promotion == ContextInstructionTypeEnum.Write)
             {
                 inmsg.Context.Write(propertyName, propertyNamespace, value);
             }
             else if (promotion == ContextInstructionTypeEnum.Promote)
             {
                 inmsg.Context.Promote(propertyName, propertyNamespace, value);
             }
         }
     }
     catch (Exception e)
     {
         throw new Exception("Unable to set context property " + propertyNamespace + "#" + propertyName + ". Encountered error - " + e.ToString());
     }
 }
Пример #2
0
        public void Execute(ref IBaseMessage inmsg, IPipelineContext pc)
        {
            try
            {
                object value = null;
                value = StaticHelpers.ReadFromSSO(_SSOApplication, _SSOKey);

                if (promotion == ContextInstructionTypeEnum.Write)
                {
                    inmsg.Context.Write(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type));
                }
                else if (promotion == ContextInstructionTypeEnum.Promote)
                {
                    inmsg.Context.Promote(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type));
                }
            }
            catch (Exception e)
            {
                throw new Exception("Unable to set context property " + propertyNamespace + "#" + propertyName + " from SSO application " + _SSOApplication + " and SSO Key " + _SSOKey + ". Encountered error - " + e.ToString());
            }
        }
Пример #3
0
 public void Execute(ref IBaseMessage inmsg, IPipelineContext pc)
 {
     try
     {
         if (castRequired)
         {
             inmsg.GetPart(partName).PartProperties.Write(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type));
         }
         else
         {
             inmsg.GetPart(partName).PartProperties.Write(propertyName, propertyNamespace, value);
         }
     }
     catch (Exception e)
     {
         throw new Exception("Unable to set part property " + propertyNamespace + "#" + propertyName + " on message part " + partName
                             + ". Encountered error - " + e.ToString());
     }
 }
Пример #4
0
 public DateTime ConvertToDateTime(object obj)
 {
     return((DateTime)TypeCaster.GetTypedObject(obj, TypeEnum.DateTime));
 }
Пример #5
0
 public bool ConvertToBool(object obj)
 {
     return((bool)TypeCaster.GetTypedObject(obj, TypeEnum.Boolean));
 }
Пример #6
0
 public int ConvertToInt(object obj)
 {
     return((int)TypeCaster.GetTypedObject(obj, TypeEnum.Integer));
 }
Пример #7
0
 public void Execute(ref IBaseMessage inmsg, IPipelineContext pc)
 {
     if (throwException)
     {
         throw new Exception("Will fail");
     }
     else
     {
         try
         {
             if (promotion == ContextInstructionTypeEnum.Write)
             {
                 inmsg.Context.Write(propertyName, "https://BREPipelineFramework.TestProject.BREPipelineFramework_PropSchema", TypeCaster.GetTypedObject(value, type));
             }
             else if (promotion == ContextInstructionTypeEnum.Promote)
             {
                 inmsg.Context.Promote(propertyName, "https://BREPipelineFramework.TestProject.BREPipelineFramework_PropSchema", TypeCaster.GetTypedObject(value, type));
             }
         }
         catch (Exception e)
         {
             throw new Exception("Unable to set context property " + "https://BREPipelineFramework.TestProject.BREPipelineFramework_PropSchema" + "#" + propertyName + ". Encountered error - " + e.ToString());
         }
     }
 }
Пример #8
0
        public void Execute(ref IBaseMessage inmsg, IPipelineContext pc)
        {
            XmlTextReader   xmlTextReader   = new XmlTextReader(inmsg.BodyPart.GetOriginalDataStream());
            XPathCollection xPathCollection = GetXPathCollection();
            XPathReader     xPathReader     = new XPathReader(xmlTextReader, xPathCollection);

            while (xPathReader.ReadUntilMatch())
            {
                for (int i = 0; i < xPathCollection.Count; i++)
                {
                    if (xPathReader.Match(i))
                    {
                        string value = null;

                        _XPathInstructions.ElementAt(i).IsFound = true;
                        switch (_XPathInstructions.ElementAt(i).XPathResultType)
                        {
                        case XPathResultTypeEnum.Name:
                            value = xPathReader.LocalName;
                            break;

                        case XPathResultTypeEnum.Namespace:
                            value = xPathReader.NamespaceURI;
                            break;

                        case XPathResultTypeEnum.Value:
                            value = xPathReader.ReadString();
                            break;
                        }

                        if (_XPathInstructions.ElementAt(i).Promotion == ContextInstructionTypeEnum.Promote)
                        {
                            inmsg.Context.Promote(_XPathInstructions.ElementAt(i).PropertyName, _XPathInstructions.ElementAt(i).PropertyNamespace, TypeCaster.GetTypedObject(value, _XPathInstructions.ElementAt(i).Type));
                        }
                        else
                        {
                            inmsg.Context.Write(_XPathInstructions.ElementAt(i).PropertyName, _XPathInstructions.ElementAt(i).PropertyNamespace, TypeCaster.GetTypedObject(value, _XPathInstructions.ElementAt(i).Type));
                        }
                    }
                }
            }

            for (int i = 0; i < xPathCollection.Count; i++)
            {
                if (_XPathInstructions.ElementAt(i).IsFound == false && _XPathInstructions.ElementAt(i).ExceptionIfNotFound == true)
                {
                    throw new Exception("Unable to evaluate XPath expression " + _XPathInstructions.ElementAt(i).XPathQuery + " against the message.");
                }
            }

            inmsg.BodyPart.Data.Position = 0;
        }