Exemplo n.º 1
0
        private Replacer.ReplaceInfo[] GetReferencedPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties, bool isList)
        {
            ArrayList replaceInfosArrayList = new ArrayList();

            foreach (PropertyBase property in properties)
            {
                if (!HasInterface(property.GetType(), "Remotion.ObjectBinding.IBusinessObjectReferenceProperty") || isList != property.IsList)
                {
                    continue;
                }

                Type     itemType = property.IsList ? property.ListInfo.ItemType : property.PropertyType;
                string[] referencedClassNameInfo = itemType.FullName.Split('.');
                string   referencedClassName     = referencedClassNameInfo[referencedClassNameInfo.Length - 1];

                Replacer.ReplaceInfo replaceInfo = new Replacer.ReplaceInfo();

                replaceInfo.replaceInfos = new string[] {
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_REFERENCEDCLASSNAME), referencedClassName,
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier
                };

                replaceInfosArrayList.Add(replaceInfo);
            }

            Replacer.ReplaceInfo[] replaceInfos = new Replacer.ReplaceInfo[replaceInfosArrayList.Count];

            for (int i = 0; i < replaceInfos.Length; i++)
            {
                replaceInfos[i] = (Replacer.ReplaceInfo)replaceInfosArrayList[i];
            }

            return(replaceInfos);
        }
Exemplo n.º 2
0
        private Replacer.ReplaceInfo[] GetEnumInfos(EnumInfo[] enums)
        {
            Replacer.ReplaceInfo[] enumInfos = new Replacer.ReplaceInfo[enums.Length];

            for (int index = 0; index < enums.Length; index++)
            {
                enumInfos[index].replaceInfos = new string[] {
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_ENUMNAME), enums[index].type.Name
                };
            }

            return(enumInfos);
        }
Exemplo n.º 3
0
        private Replacer.ReplaceInfo[] GetClassInfos(IBusinessObjectClass[] classes)
        {
            Replacer.ReplaceInfo[] classInfos = new Replacer.ReplaceInfo[classes.Length];

            for (int index = 0; index < classes.Length; index++)
            {
                classInfos[index].replaceInfos = new string[] {
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_CLASSNAME), GetName(classes[index].Identifier)
                };
            }

            return(classInfos);
        }
Exemplo n.º 4
0
        private Replacer.ReplaceInfo[] GetPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties)
        {
            Replacer.ReplaceInfo[] propertyInfos = new Replacer.ReplaceInfo[properties.Length];

            for (int index = 0; index < properties.Length; index++)
            {
                IBusinessObjectProperty property = properties[index];
                bool found = false;

                foreach (Configuration.ControlInfo controlMapping in _configuration.ControlMappings)
                {
                    if (HasInterface(property.GetType(), controlMapping.propertyType) && property.IsList == controlMapping.isList)
                    {
                        ApplicationConfiguration.ReplaceInfo[] additionalReplaceInfos = new ApplicationConfiguration.ReplaceInfo[] {
                            new ApplicationConfiguration.ReplaceInfo(Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier)
                        };

                        string additionalAttributes = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalAttributes);
                        string additionalElements   = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalElements);

                        propertyInfos[index].replaceInfos = new string[] {
                            Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier,
                            Placeholder.ToString(DefinedPlaceholder.CONTROLTYPE), controlMapping.controlName,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALATTRIBUTES), additionalAttributes,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALELEMENTS), additionalElements
                        };

                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    propertyInfos[index].replaceInfos = null;

                    _warnings.AddWarning(WarningCode.MissingControlMapping, businessObjectClass.Identifier + "." + property.Identifier +
                                         " (" + property.GetType().ToString() + ")");
                }
            }

            return(propertyInfos);
        }
Exemplo n.º 5
0
        private Replacer.ReplaceInfo[] GetReferencedPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties, bool isList)
        {
            ArrayList replaceInfosArrayList = new ArrayList();

            foreach (PropertyBase property in properties)
            {
                if (! HasInterface(property.GetType(), "Remotion.ObjectBinding.IBusinessObjectReferenceProperty") || isList != property.IsList)
                    continue;

              Type itemType = property.IsList ? property.ListInfo.ItemType : property.PropertyType;
            string[] referencedClassNameInfo = itemType.FullName.Split ('.');
                string referencedClassName = referencedClassNameInfo[referencedClassNameInfo.Length - 1];

                Replacer.ReplaceInfo replaceInfo = new Replacer.ReplaceInfo();

                replaceInfo.replaceInfos = new string[] {
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_REFERENCEDCLASSNAME), referencedClassName,
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier
                };

                replaceInfosArrayList.Add(replaceInfo);
            }

            Replacer.ReplaceInfo[] replaceInfos = new Replacer.ReplaceInfo[replaceInfosArrayList.Count];

            for (int i=0; i<replaceInfos.Length; i++)
                replaceInfos[i] = (Replacer.ReplaceInfo)replaceInfosArrayList[i];

            return replaceInfos;
        }
Exemplo n.º 6
0
        private Replacer.ReplaceInfo[] GetPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties)
        {
            Replacer.ReplaceInfo[] propertyInfos = new Replacer.ReplaceInfo[properties.Length];

            for (int index = 0; index < properties.Length; index++)
            {
                IBusinessObjectProperty property = properties[index];
                bool found = false;

                foreach (Configuration.ControlInfo controlMapping in _configuration.ControlMappings)
                {
                    if (HasInterface(property.GetType(), controlMapping.propertyType) && property.IsList == controlMapping.isList)
                    {
                        ApplicationConfiguration.ReplaceInfo[] additionalReplaceInfos = new ApplicationConfiguration.ReplaceInfo[] {
                            new ApplicationConfiguration.ReplaceInfo(Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier)
                        };

                        string additionalAttributes = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalAttributes);
                        string additionalElements = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalElements);

                        propertyInfos[index].replaceInfos = new string[] {
                            Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier,
                            Placeholder.ToString(DefinedPlaceholder.CONTROLTYPE), controlMapping.controlName,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALATTRIBUTES), additionalAttributes,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALELEMENTS), additionalElements
                        };

                        found = true;
                        break;
                    }
                }

                if (! found)
                {
                    propertyInfos[index].replaceInfos = null;

                    _warnings.AddWarning(WarningCode.MissingControlMapping, businessObjectClass.Identifier + "." + property.Identifier +
                            " (" + property.GetType().ToString() + ")");
                }
            }

            return propertyInfos;
        }
Exemplo n.º 7
0
        private Replacer.ReplaceInfo[] GetEnumInfos(EnumInfo[] enums)
        {
            Replacer.ReplaceInfo[] enumInfos = new Replacer.ReplaceInfo[enums.Length];

            for (int index = 0; index < enums.Length; index++)
            {
                enumInfos[index].replaceInfos = new string[] {
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_ENUMNAME), enums[index].type.Name };
            }

            return enumInfos;
        }
Exemplo n.º 8
0
        private Replacer.ReplaceInfo[] GetClassInfos(IBusinessObjectClass[] classes)
        {
            Replacer.ReplaceInfo[] classInfos = new Replacer.ReplaceInfo[classes.Length];

            for (int index = 0; index < classes.Length; index++)
            {
                classInfos[index].replaceInfos = new string[] {
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_CLASSNAME), GetName(classes[index].Identifier) };
            }

            return classInfos;
        }