Adding custom attributes

The BMC Atrium Discovery data model allows additional attributes to be added nodes. You should only ever add additional attributes to inferred nodes. You must never update DDD nodes.

Attributes may be added by patterns at any point in time. It is strongly recommended that you add attributes at creation time when building your own inferred nodes. Modifying system created inferred nodes must be done after creation using a separate pattern.

Once you have modified the node it is necessary to make the attribute visible. There are two ways to do this:

  • Updating the taxonomy by adding a custom taxonomy extension, or
  • Populating the _tw_meta_data_attrs attribute on the inferred node.

You must ensure only one pattern modifies the _tw_meta_data_attrs value on a particular node otherwise the conflicting changes are likely to result in the loss of one of the updates.

To add a custom attribute at node creation

Adding a custom attribute when a node is created is shown in the example below.

jrun_si := model.SoftwareInstance(key := key,
                                  name := name,
                                  type := type,
                                  version := full_version,
                                  product_version := product_version,
                                  build := build,
                                  server_id := server_id,
                                  _tw_meta_data_attrs := ['server_id']);

To add a custom attribute after node creation

You can also add a custom attribute to a node after it is created. This may be in the pattern that creates the node, or where you are adding an attribute to a system created node, in a separate pattern.

   if server_name then
      si_node._tw_meta_data_attrs := ['server_name'];
   end if;

To add a list of attributes

The following example code shows how to add a list of attributes to an existing node. The code creates a list, adds values, and assigns it at once.

      ltw_meta_data_attrs :=[]; // local list of attribute names
      if si.port then
         list.append(ltw_meta_data_attrs, "port");
      end if;
      if si.server_name then
         list.append(ltw_meta_data_attrs, "server_name");
      end if;
   si._tw_meta_data_attrs := ltw_meta_data_attrs; 
Was this page helpful? Yes No Submitting... Thank you

Comments