示例#1
0
        private void AddChoiceAnnotation(PartBridge part, Relationship relationship)
        {
            NamedAndTyped choiceOptionRelationship = null;
            string        choiceType = relationship.Type;

            if (relationship.Choice)
            {
                choiceOptionRelationship = BeanBridgeChoiceRelationshipResolver.ResolveChoice(part, relationship);
            }
            else
            {
                if (relationship.TemplateRelationship)
                {
                    Argument argument = this.interaction.GetArgumentByTemplateParameterName(relationship.TemplateParameterName);
                    if (argument != null && argument.Choice)
                    {
                        Ca.Infoway.Messagebuilder.Xml.Predicate <Relationship> predicate = ChoiceSupport.ChoiceOptionTypePredicate(new string[] {
                            part.GetTypeName()
                        });
                        choiceOptionRelationship = argument.FindChoiceOption(predicate);
                        choiceType = argument.Name;
                    }
                }
            }
            if (choiceOptionRelationship != null)
            {
                CurrentBuffer().AddInfo("Selected option " + choiceOptionRelationship.Type + " (" + choiceOptionRelationship.Name + ") from choice "
                                        + choiceType);
            }
        }
示例#2
0
        public virtual object GetInitializedReadOnlyAssociation(NamedAndTyped relationshipName)
        {
            object       @object;
            BeanProperty beanProperty = FindBeanProperty(relationshipName);

            if (beanProperty == null)
            {
                @object = null;
            }
            else
            {
                if (!beanProperty.Readable)
                {
                    @object = null;
                }
                else
                {
                    if (ListElementUtil.IsCollection((Type)beanProperty.PropertyType))
                    {
                        //Initialized collections don't count
                        @object = null;
                    }
                    else
                    {
                        @object = beanProperty.Get();
                    }
                }
            }
            return(@object);
        }
示例#3
0
        internal virtual object Get(NamedAndTyped relationship)
        {
            object result = this.relationships.SafeGet(new RelationshipMap.Key(relationship));

            if (result == null)
            {
                result = this.relationships.SafeGet(new RelationshipMap.Key(relationship.Name));
            }
            return(result);
        }
示例#4
0
        internal virtual object GetField(NamedAndTyped relationship)
        {
            object o = this.map.Get(relationship);

            if (o is BeanProperty)
            {
                return(GetMessageBeanPart().GetField(WordUtils.Uncapitalize(((BeanProperty)o).Name)));
            }
            else
            {
                throw new MarshallingException("Relationship " + relationship.Name + " of " + ToString() + " does not resolve to a bean property"
                                               );
            }
        }
示例#5
0
 internal Key(NamedAndTyped namedAndTyped)
 {
     this.name = namedAndTyped.Name;
     this.type = namedAndTyped.Type;
 }
示例#6
0
 internal virtual object Get(NamedAndTyped namedAndTyped)
 {
     return(this.map.Get(namedAndTyped));
 }
示例#7
0
        internal virtual bool IsCollapsedRelationship(NamedAndTyped relationshipName)
        {
            object o = Get(relationshipName);

            return(o != null && o is Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter);
        }
示例#8
0
 internal virtual Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter GetAsRelationshipSorter(NamedAndTyped relationship
                                                                                                   )
 {
     return((Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter) this.map.Get(relationship));
 }
示例#9
0
 public virtual bool IsPreInitializedDelegate(NamedAndTyped relationshipName)
 {
     return(GetInitializedReadOnlyAssociation(relationshipName) != null);
 }
示例#10
0
 public virtual Ca.Infoway.Messagebuilder.Marshalling.BeanWrapper CreateSubWrapper(NamedAndTyped relationshipName)
 {
     return(new Ca.Infoway.Messagebuilder.Marshalling.BeanWrapper(this, relationshipName.Name, (RelationshipSorter)this.sorter
                                                                  .Get(relationshipName)));
 }
示例#11
0
        public virtual bool IsAssociationMappedToSameBean(NamedAndTyped relationshipName)
        {
            object @object = this.sorter.Get(relationshipName);

            return(@object != null && @object is RelationshipSorter);
        }
示例#12
0
 private BeanProperty FindBeanProperty(NamedAndTyped relationshipName)
 {
     return((BeanProperty)this.sorter.Get(relationshipName));
 }