Supporting custom links in SQL-based custom artifact elements
You can add custom links in CAE editor in a new custom artifact element by using SQL as the query language.
About this task
Custom links can be added in the custom artifact elements by selecting SQL as query language by using following steps.
Procedure
- In the main menu, go to Views > Create Custom artifact element in the page.
- Click Create custom artifact element. As a part of
Initial data for custom artifact element
- Choose Query type, Data source, Select the scope, and Choose the artifact element
- Click OK.
Based on the selection, the Engineering Insights application generates the initial SQL query.
- In the SQL query section of the CAE, add the following
queries.
- Add an extra SQL snippet column in the Select clause in the following format.
$if(_com_ibm_relm_ae_links_RTC_MERGED_STORY1_)$ CASE WHEN rtc_merged_Story1.IS_VERSION_OF_ID = rtc_merged_Story1.SUBJECT_ID THEN CAST((rtc_merged_Story1.URL || '?oslc_config.context=') AS VARCHAR(4000)) ELSE rtc_merged_Story1.URL END AS RTC_MERGED_STORY1 $endif$
- Add an extra SQL snippet column in the From clause in the following format.
$if(_com_ibm_relm_ae_links_RTC_MERGED_STORY1_)$ LEFT JOIN RITRS.WORK_ITEM_REQUIREMENT_RELATIONSHIP rtc_merged_Story1_rtc_merged_Story1_link JOIN RITRS.WORK_ITEM rtc_merged_Story1 -- Type: http://jazz.net/ns/lqe/merge/gensym/cm/Story ON (rtc_merged_Story1.SUBJECT_ID = rtc_merged_Story1_rtc_merged_Story1_link.SOURCE_ID) AND (rtc_merged_Story1.INSTANCE_SHAPE_ID IN (SELECT DISTINCT SUBJECT_ID FROM RITRS.RESOURCE_SHAPE WHERE MERGE_SHAPE_ID = 410255))ON (rtc_merged_Story1_rtc_merged_Story1_link.TARGET_ID = dng_merged_Feature1.SUBJECT_ID AND rtc_merged_Story1_rtc_merged_Story1_link.PROPERTY_ID = 1266) $endif$
In the SELECT clause added, RTC_MERGED_STORY1 is the name of the column under which the linked artifact returns in the result-set.
In the if statement $if(_com_ibm_relm_ae_links_RTC_MERGED_STORY1_)$- _com_ibm_relm_ae_links_ is the common part of all if clauses that need to be used for custom links. This parameter helps Engineering Insightsapplication to understand, that this if clause is applicable only if linking other Artifact or CAE to the current CAE.
- RTC_MERGED_STORY1 is the parameter name that needs to be the same as the
column name from the SELECT clause. It is the differentiating factor between all
the if clauses for custom links in a CAE. Note: This parameter name needs to be in capital letters.
- Add an extra SQL snippet column in the Select clause in the following format.
- In the Links section of the sidebar, click Add.
- Add a new row to set the values of the fields as following
- Column name
- It needs to be the same as the column name used in the SELECT clause. In example, it is RTC_MERGED_STORY1.
- Link label
- It is the label for custom link that is used at the time of creating linked artifacts in View.
- Linked artifact
- It is the target artifact type, for which a target container gets created in View.
- Click Save to see the changes created in custom artifact element.
- To verify the custom links, drag the created SQL-based CAE in View. You can use the
custom link in the Show links to wizard to create the linked container.
To create a new custom artifact element, see Creating custom artifact elements.