예제 #1
0
 public ObjectAttribute(CIMModelContext cimModelContext, string attributeFullName)
 {
     this.modelContext = cimModelContext;
     attributeCode     = -1;
     if (this.modelContext != null)
     {
         attributeCode = this.modelContext.AddOrReadCodeForAttribute(attributeFullName);
     }
 }
예제 #2
0
        //public CIMObject()
        //{
        //    type = string.Empty;
        //    id = null;
        //    myAttributes = new SortedDictionary<int, List<ObjectAttribute>>();
        //    children = new SortedDictionary<string, List<string>>();
        //    parents = new SortedDictionary<string, List<string>>();
        //}

        public CIMObject(CIMModelContext cimModelContext, string typeName)
        {
            this.modelContext = cimModelContext;
            typeCode          = -1;
            if (this.modelContext != null)
            {
                typeCode = modelContext.AddOrReadCodeForCIMType(typeName);
            }
            id           = null;
            myAttributes = new SortedDictionary <int, List <ObjectAttribute> >();
            children     = new SortedDictionary <string, List <string> >();
            parents      = new SortedDictionary <string, List <string> >();
        }
예제 #3
0
        /// <summary>
        /// Method creates ObjectAttribute instance with following property values:
        /// <para>FullName = type + ".Member_Of_" + embeddedCategory</para>
        /// <para>IsReference = true</para>
        /// <para>Value = parentId</para>
        /// <para>This ObjectAttribute represents artificial attribute for representing
        /// info about parent inside of which some CIMObject is embedded.</para>
        /// </summary>
        /// <param name="cimModelContext">model context</param>
        /// <param name="type">CIM type of embedded child object</param>
        /// <param name="embeddedCategory">name of embedded category</param>
        /// <param name="parentId">parent object ID</param>
        /// <returns>ObjectAttribute instance or null if some argument is missing</returns>
        public static ObjectAttribute ConstructEmbeddedParentAttribute(CIMModelContext cimModelContext, string type, string embeddedCategory, string parentId)
        {
            ObjectAttribute specialAtt = null;

            if (!string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(embeddedCategory) && !string.IsNullOrEmpty(parentId))
            {
                if (embeddedCategory.Contains(StringManipulationManager.SeparatorColon))
                {
                    embeddedCategory = embeddedCategory.Substring(embeddedCategory.IndexOf(StringManipulationManager.SeparatorColon) + 1);
                }

                specialAtt             = new ObjectAttribute(cimModelContext, string.Format("{0}.Member_Of_{1}", type, embeddedCategory));
                specialAtt.IsReference = true;
                specialAtt.Value       = parentId;
            }
            return(specialAtt);
        }
예제 #4
0
 public ObjectAttribute(CIMModelContext cimModelContext)
 {
     this.modelContext = cimModelContext;
     attributeCode     = -1;
 }