com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.
Querying for Resources
In Querying resources you will be working on the "REG_RESOURCE" table. "REG_RESOURCE" table contains the following fields:
- REG_RESOURCE
- REG_PATH_ID
- REG_NAME
- REG_VERSION
- REG_MEDIA_TYPE
- REG_CREATOR
- REG_CREATED_TIME
- REG_LAST_UPDATOR
- REG_LAST_UPDATED_TIME
- REG_DESCRIPTION
- REG_CONTENT_ID
In order to return a resource, you always need to return the "REG_PATH_ID, REG_NAME" in your custom query. This is because ("REG_PATH_ID, REG_NAME") fields act together as an ID for the resource.
For example, the following query will return one or more resources that have a given pattern in the description:
SELECT REG_PATH_ID, REG_NAME FROM REG_RESOURCE WHERE REG_DESCRIPTION LIKE?
The following example shows a code snippet that does a custom query.
1. Put a resource with the content as the query.
String sql1 = "SELECT REG_PATH_ID, REG_NAME FROM REG_RESOURCE WHERE REG_DESCRIPTION LIKE ?"; Resource q1 = registry.newResource(); q1.setContent(sql1); q1.setMediaType(RegistryConstants.SQL_QUERY_MEDIA_TYPE); q1.addProperty(RegistryConstants.RESULT_TYPE_PROPERTY_NAME, RegistryConstants.RESOURCES_RESULT_TYPE); registry.put(RegistryConstants.CONFIG_REGISTRY_BASE_PATH + RegistryConstants.QUERIES_COLLECTION_PATH + "/custom-queries", q1);
2. Give the parameters and the query location you have just putted.
Map parameters = new HashMap(); parameters.put("1", "%service%"); Resource result = registry.executeQuery(RegistryConstants.CONFIG_REGISTRY_BASE_PATH + RegistryConstants.QUERIES_COLLECTION_PATH + "/custom-queries", parameters); String[] paths = (String[])result.getContent();
For more information about Queries see Custom Query.
For further information about Querying Resources refer following topics:
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.