Пример #1
0
 public void InvokeMapJoinRule(JoinRule rule, CSEntry csentry, ref ValueCollection values)
 {
     Tracer.TraceInformation("enter-invokemapjoinrule {0}", rule.Name);
     try
     {
         object targetValue = null;
         foreach (Value value in rule.SourceExpression.Source)
         {
             if (value.GetType().Equals(typeof(MultiValueAttribute)))
             {
                 MultiValueAttribute attr = (MultiValueAttribute)value;
                 object mv = attr.GetValueOrDefault(Direction.Import, csentry, null);
                 targetValue = attr.Transform(mv, TransformDirection.Source);
             }
             if (value.GetType().Equals(typeof(Attribute)))
             {
                 Attribute attr         = (Attribute)value;
                 object    concateValue = attr.GetValueOrDefault(Direction.Import, csentry, null);
                 concateValue = attr.Transform(concateValue, TransformDirection.Source);
                 targetValue  = targetValue as string + concateValue;
                 attr         = null;
                 continue;
             }
             if (value.GetType().Equals(typeof(Constant)))
             {
                 targetValue = targetValue + ((Constant)value).Value;
                 continue;
             }
         }
         Tracer.TraceInformation("add-invokemapjoinrule-value rule: {0}, value: '{1}'", rule.Name, targetValue);
         values.Add(targetValue as string);
     }
     catch (Exception ex)
     {
         Tracer.TraceError("invokemapjoinrule {0}", ex.GetBaseException());
         throw ex;
     }
     finally
     {
         Tracer.TraceInformation("exit-invokemapjoinrule {0}", rule.Name);
     }
 }
Пример #2
0
        void IMASynchronization.MapAttributesForJoin(string FlowRuleName, CSEntry csentry, ref ValueCollection values)
        {
            Tracer.TraceInformation("enter-mapattributesforjoin [{0}]", FlowRuleName);

            JoinRule rule = null;

            try
            {
                string maName = csentry.MA.Name;
                Tracer.TraceInformation("csentry: dn: {0}, ma: {1}, rule: {2}", csentry.DN, maName, FlowRuleName);

                ManagementAgent ma = config.ManagementAgent.Where(m => m.Name.Equals(maName)).FirstOrDefault();
                if (ma == null)
                {
                    throw new NotImplementedException("management-agent-" + maName + "-not-found");
                }
                foreach (JoinRule r in ma.JoinRule)
                {
                    Tracer.TraceInformation("found-rule {0}", r.Name);
                }
                rule = ma.JoinRule.FirstOrDefault(r => r.Name.Equals(FlowRuleName));

                if (rule == null)
                {
                    throw new DeclineMappingException("rule-'" + FlowRuleName + "'-not-found-on-ma-" + maName);
                }

                InvokeMapJoinRule(rule, csentry, ref values);

                rule = null;
            }
            catch (Exception ex)
            {
                Tracer.TraceError("mapattributesforjoin {0}", ex.GetBaseException());
                throw ex;
            }
            finally
            {
                Tracer.TraceInformation("exit-mapattributesforjoin [{0}]", FlowRuleName);
            }
        }