Exporting source code data query results

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

About this task

Querying the source code data creates a list of file metadata and logical dependencies that are based on the conditions that you set in your query definition. To save your query results, complete the following steps.

Procedure

  1. Run your source code data query.
  2. From the view menu in the Source Code Data view, select Export All.
  3. From the Export Source Code Data 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.
  4. 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 Related links.)
    7. Install the feature from the update site and restart the Engineering Workflow Management Eclipse client.
    8. Run the source code data query again.
    9. From the view menu in the Source Code Data view, select Export All.
    10. From the Export Source Code Data Query Result dialog, your custom exporter is now available in the File Format options. Browse to the location where you want to store your file. Click OK.
      Note: The customized file option that you create will also be available for exporting package and deployment query results.

video icon Video

Jazz.net channel
Software Education channel

learn icon Courses

IoT Academy
Skills Gateway

ask icon Community

Jazz.net
Jazz.net forums
Jazz.net library

support icon Support

IBM Support Community
Deployment wiki