protected void setObjectPolicy() { SessionService session = SessionService.getService(PDMConnection.ClientX.Session.getConnection()); ObjectPropertyPolicy policy = new ObjectPropertyPolicy(); policy.AddType(new PolicyType("ItemRevision", new string[] { "IMAN_reference" })); policy.AddType(new PolicyType("Dataset", new string[] { "ref_list" })); session.SetObjectPropertyPolicy(policy); }
public static void setObjectPolicy(DataTable attributes) { SessionService sessService = SessionService.getService(getConnection()); ObjectPropertyPolicy policy = new ObjectPropertyPolicy(); List <String> bomAttributes1 = new List <String> { }; List <String> revAttributes1 = new List <string> { }; int bomAttributeIndex = 0; int revAttributeIndex = 0; foreach (DataRow attribute in attributes.Rows) { if (attribute["ATYPE"].ToString().Equals("BOMLINE")) { String bomAttribute = attribute["ATTRI"].ToString(); bomAttributes1.Add(bomAttribute); bomAttributeIndex++; } else { String revAttribute = attribute["ATTRI"].ToString(); revAttributes1.Add(revAttribute); revAttributeIndex++; } } String[] bomAttributes = new String[bomAttributeIndex]; String[] revAttributes = new String[revAttributeIndex]; for (int ai = 0; ai < bomAttributeIndex; ai++) { bomAttributes[ai] = bomAttributes1[ai].ToString(); } for (int ai = 0; ai < revAttributeIndex; ai++) { revAttributes[ai] = revAttributes1[ai].ToString(); } policy.AddType(new PolicyType("BOMLine", bomAttributes)); policy.AddType(new PolicyType("ModelObject", new string[] { "item_id", "object_type", "object_name", "object_properties" })); policy.AddType(new PolicyType("Item", new string[] { "object_type", "object_name", "bom_view_tags", "revision_list", "item_revision", "vmt9_design_type_cmp", "VMT9_Shn_Tool_RH_Qtys" })); policy.AddType(new PolicyType("ItemRevision", revAttributes)); policy.AddType(new PolicyType("", new string[] { "" }, new string[] { PolicyProperty.WITH_PROPERTIES })); sessService.SetObjectPropertyPolicy(policy); }