Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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"
                                               );
            }
        }
Esempio n. 5
0
 internal Key(NamedAndTyped namedAndTyped)
 {
     this.name = namedAndTyped.Name;
     this.type = namedAndTyped.Type;
 }
Esempio n. 6
0
 internal virtual object Get(NamedAndTyped namedAndTyped)
 {
     return(this.map.Get(namedAndTyped));
 }
Esempio n. 7
0
        internal virtual bool IsCollapsedRelationship(NamedAndTyped relationshipName)
        {
            object o = Get(relationshipName);

            return(o != null && o is Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter);
        }
Esempio n. 8
0
 internal virtual Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter GetAsRelationshipSorter(NamedAndTyped relationship
                                                                                                   )
 {
     return((Ca.Infoway.Messagebuilder.Marshalling.RelationshipSorter) this.map.Get(relationship));
 }
Esempio n. 9
0
 public virtual bool IsPreInitializedDelegate(NamedAndTyped relationshipName)
 {
     return(GetInitializedReadOnlyAssociation(relationshipName) != null);
 }
Esempio n. 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)));
 }
Esempio n. 11
0
        public virtual bool IsAssociationMappedToSameBean(NamedAndTyped relationshipName)
        {
            object @object = this.sorter.Get(relationshipName);

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