Find all Components of specific types
As a developer, I want to get a list of all components of specific types (and sub-types).
For example, you wan to find all http-connector operations (subType="http"
), incl. patch operations (subType="rest-beta"
) and web-service listener (subType="wss"
). You need to following query file, to query to appropriate components.
{
"QueryFilter": {
"expression": {
"operator": "and",
"nestedExpression": [
{
"operator": "or",
"nestedExpression": [
{ "operator": "EQUALS", "property": "subType", "argument": ["http" ]},
{ "operator": "EQUALS", "property": "subType", "argument": ["rest-beta" ]},
{ "operator": "EQUALS", "property": "subType", "argument": ["wss" ]}
]
},
{ "property": "type", "operator": "EQUALS", "argument": [ "connector-action" ] },
{ "operator": "EQUALS", "property": "currentVersion", "argument": ["true" ]},
{ "operator": "EQUALS", "property": "deleted", "argument": ["false" ]}
]
}}
}
It is recommended to use a dedicated Workspace directory to collect all information in that directory:
work\http-operations
.
Create that directory in your workspace.
Create a file
q-http-ops.json
with the query from above.
bc comp get /wd work\http-operations /q q-http-ops.json /children none
This command retrieves the metadata of all components matching the query-filter, incl. their children.
component get - Resolve and get component metadata incl. their children.
Specify
/children none
to omit children, to get only the components returned by the query.Otherwise, in that case, all profiles referenced in the operations will be fetched, too.
/wd
Specifies the workspace directory for the current command./q
Specifies the query file - in the current workspace directory - that is used to resolve the components which are subject tocomp get
./t compList.csv
will use the compList.csv template, to render a complete list with all components.

Use a custom template
The default compList.csv
does not contain a column for sub-type, which is quite important for the use-case above.
Get the compList.csv template from the
Templates\Freemarker
directory where BC is installed (default templates).Paste it into your workspace directory under
Templates\Freemarker
ascompList2.csv
bc comp get
/wd work\http-operations
/q q-http-ops.json
/children none
/t compList2.csv
Last updated