com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Schemas and Policies with Governance API



Note

Please follow the documentation on how to create a client-side connection to use the Governance API before following these examples.

Schemas

Here is an example of code for handling schemas.

import org.wso2.carbon.governance.api.schema.SchemaFilter;
import org.wso2.carbon.governance.api.schema.SchemaManager;
import org.wso2.carbon.governance.api.schema.dataobjects.Schema;

// starting with the schema manager created with governanceRegistry
SchemaManager schemaManager = new SchemaManager(governanceRegistry);

// creating and adding  new schema
Schema schema = schemaManager.newSchema("http://www.example.com/schema-url.xsd");
schema.addAttribute("creator", "yyy");
schema.addAttribute("version", "0.01");
schemaManager.addSchema(schema);

// updating the schema
schema.addAttribute("version", "0.02");
schemaManager.updateSchema(schema);

// get the OM from the schema.
OMElement schemaContent = schema.getSchemaElement();

// get schemas with attribute "creator" == "yyy"
Schema[] schemas = schemaManager.findSchemas(new SchemaFilter() {
    public boolean matches(Schema schema) throws GovernanceException {
        String attributeVal = schema.getAttribute("creator");
        return (attributeVal != null && attributeVal.equals("yyy"));
    }
});

Policies

The class structures to manage policies have the same structures to manage schemas as mentioned above.

Note

Use the Policy and PolicyManager classes.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.