Exporting package and deployment query results

You can export the results of a package or deployment query to a CSV file so that you can sort, analyze, and save the results. You can also create your own export utility to capture query data in other formats.

About this task

Querying package results and deployed packages creates a list of packages that were created from a particular package definition or deployed packages that were deployed from a particular deployment definition. To save your query results, complete the following steps.

Procedure

Exporting package query results

  1. From your project area in the Team Artifacts view, select Enterprise Extensions > Packages. Right-click your package definition and select Show all packages. The Queried Results view opens with the list of results.
    1. Right-click in the Queried Results view and select Export.
    2. In the Export Query Result dialog, select either CSV using commas or CSV using tabs for the file format. Next, browse to the location to store your file. Click OK. The exported file includes a list of all the package result details that are listed in the Queried Results view.
    1. Optional: Follow the Creating a customized exporter steps to export to a different file format.

Exporting deployment query results

  1. From your project area in the Team Artifacts view, select Enterprise Extensions > Deployments. Right-click your deployment definition and select Query Deployed Packages.
    1. In the Search for Deployed Packages dialog, select a deployment definition, package definition, build agent, and packages, then click OK. The Queried Results view opens with a list of results.
    2. Right-click in the Queried Results view and select Export.
    3. In the Export Query Result dialog, select either CSV using commas or CSV using tabs for the file format. Next, browse to the location to store your file. Click OK. The exported file includes a list of all the deployment result details that are listed in the Queried Results view.
    4. Optional: Follow the Creating a customized exporter steps to export to a different file format.

Creating a customized exporter

  1. Optional: To create a customized exporter so that you can save results to different file formats, complete the following steps.
    1. Create an Eclipse plug-in class and add com.ibm.team.enterprise.metadata.query.ui as one of the dependencies. (Your environment might require extra Eclipse plug-ins.)
    2. In the plugin.xml file, add an extension for com.ibm.team.enterprise.metadata.query.result.exporter.
      For example:
      <extension
               point="com.ibm.team.enterprise.metadata.query.result.exporter">
             <exporter
                   class="com.ibm.team.enterprise.metadata.query.ui.tests.DummyExporter"
                   fileExtension="dummy"
                   id="com.ibm.team.enterprise.metadata.query.ui.tests.DummyExporter"
                   label="Dummy Exporter">
             </exporter>
         </extension>
    3. Create a class that implements com.ibm.team.enterprise.metadata.query.ui.export.IMetadataQueryResultExporter (...ui.tests.DummyExporter in the previous example.)
    4. Optional: Use the new class to extend com.ibm.team.enterprise.metadata.query.ui.export.AbstractMetadataQueryResultExporter.
    5. Implement the required method: serializeToStream(TableData tableData, OutputStream out).
      For example:
      BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
              
              for (ColumnHeader columnHeader: tableData.getColumnHeaders())
              {
                   String columnName = columnHeader.getName();
                   writer.append(columnName);  //output column name.
              }
              if (tableData.getColumnHeaders().size() > 0)
                  writer.append("\n");
      
              for (Row row: tableData.getRows())
              {
                    for (int col=0; col <tableData.getColumnHeaders().size(); col++)
                    {
                        writer.append(row.getColumnValue(col));  //output column value of each row
                    }
                    writer.append("\n");
              }
                      
              writer.flush();
    6. Create an update site to install the feature that contains your extended plug-in. (For more information, see the related links of this topic.)
    7. Install the feature from the update site and restart the Engineering Workflow Management Eclipse client.
    8. Run the package or deployment query again.
    9. From the Queried Results view, right-click the package or deployment result you want to export and select Export.
    10. From the Export Query Result dialog, your custom exporter is now available in the File Format options.
      Note: The customized file option that you create will also be available for exporting source code data query results.