Import/Export of Single Entities
This page is about the import and export of single entities in the PocketQuery administration. If you want to export all of your entities at once for backup or migration, that can be done by a Jira administrator in the add-on Jira administration at the section "PocketQuery".
Security
Export and import of single entities can be done by any PocketQuery administrator or editor, but are limited to the entity types the user is allowed to maintain. A PocketQuery editor cannot import or export a datasource.
For security reasons, the password or datasources will be censored by replacing each letter with an asteriks. This also happens if you export datasources by themselves. For this reason you will have to reenter the passwords to your datasources manually after importing them.
Selective exports are designed to only reveal as much information as visible in the PocketQuery administration. But please be aware that exports may still contain sensitive information, especially if datasources are included.
Export
You can export entities by clicking on "Export" when viewing them. Once you clicked the button you will automatically download an XML file containing your entity.
Related Entities of Queries
Notice that when you export queries you will be asked whether you want the related entities to be be included. Choosing "yes" will create an export that contains not only the query, but also the template, converter and datasource it uses. (For PocketQuery editors the datasource will be left out.)
Example
Here is an example export including the related entities for the query shown in the first picture:
<object-stream>
<list>
<Database>
<type>0</type>
<name>WorldDB</name>
<url>jdbc:mysql://localhost:3306/world</url>
<user>root</user>
<password>********</password>
<driver>com.mysql.jdbc.Driver</driver>
<resourcename></resourcename>
<testurl></testurl>
<applicationlinkid></applicationlinkid>
<consumerkey></consumerkey>
<consumersecret></consumersecret>
<token></token>
<tokensecret></tokensecret>
<signaturemethod></signaturemethod>
<requestparameters></requestparameters>
<requestheaders></requestheaders>
<authurl></authurl>
<clientid></clientid>
<clientsecret></clientsecret>
<accesstoken></accesstoken>
<refreshtoken></refreshtoken>
</Database>
</list>
<list>
<Query>
<name>MyQuery</name>
<statement>SELECT 1;</statement>
<database>WorldDB</database>
<template></template>
<spaces></spaces>
<indexed>false</indexed>
<paramtypes class="com.google.gson.internal.LinkedHashTreeMap" resolves-to="linked-hash-map"/>
<cacheduration></cacheduration>
<jsonpath></jsonpath>
<converter></converter>
</Query>
</list>
<list/>
<list/>
</object-stream>
Import
To import your entities, you have 2 options, you can either use the import section in the global administration:
Or you can use the "Import" tab in the PocketQuery administration. Choose the file you want to import and click the "Import" button.
If your import is successful you will be greeted by a message and are now able to use your imported entities.
Override Mode
If you are trying to import an entity that already exists a number will be attached to the name of your imported entity by default. For example, if you are trying to import a template with the name "my-template" but there already is a template with this name, the newly imported template will be saved as "my-template-2". Instead, if you want to override the existing entity you can enable "Override mode".
Keep in mind that overridden entities can not be restored.
Troubleshooting
The following errors can occur while importing entities and will cancel the import:
Your file is broken or contains invalid XML.
Your import contains a datasource but you are not permitted to maintain datasources. (I.e. you are a PocketQuery editor.)
You are trying to import a query that uses a template, converter or datasource that does not exist (and is not included in the export).
The entity you are trying to import is not valid. Maybe its name contains prohibited symbols or a required attribute is missing.