The Custom Context Extension Point allows you to pass to called thirdPartyAttributes to the Congree server. These attributes allow you to define fine granular rules for your check profiles.

Please note that this extension point only works for the editor so far.

Technically the custom context extension point is provided via a meta tag in the html head of the editor.

  • Meta tags can be provided using a web-panel plugin module type or by adding them to the html directly
  • The meta tag must define the attribute name="k15t-congree-custom-context"

You should consider a the web-panel plugin module if your context should be calculated dynamically and the same way for all spaces. If you only want to have additional context set for some spaces you should add them directly to the html head of these spaces.

Web-Panel Plugin Module

The following example illustrates what a customer would in general need to do to implement this.

Add a web-panel to your atlassian-plugin.xml and reference the implementing class.

<web-panel key="my-meta-panel" location="atl.header" class="com.mycompany.congree.ui.MetaWebPanel"/>
XML
package com.mycompany.congree.ui;

import com.atlassian.plugin.PluginAccessor;
import com.atlassian.plugin.web.model.AbstractWebPanel;
import java.util.Map;

public class MetaWebPanel extends AbstractWebPanel {

  protected MetaWebPanel(PluginAccessor pluginAccessor) {
    super(pluginAccessor);
  }

  public String getHtml(Map<String, Object> context) {
    // do whatever is required to create the custom context
    String customContext = "";
    return "<meta name=\"k15t-congree-custom-context\" content=\"" + customContext + "\">;
  }

}
JAVA


When the congree sidebar is initialized the app will look for the corresponding meta tag. Its content value will be merged with the default context which is also provided by a meta tag with attribute  name="ajs-k15t-congree-context". Afterwards the default context is used as input to congree.  The content value can be any String in the format 'key=value'.

To provide multiple context information, meta tags of the same name will be aggregated.

<meta name="k15t-congree-custom-context" content="FirstContextKey:FirstContextValue" \>
<meta name="k15t-congree-custom-context" content="SecondContextKey:SecondContextValue" \>
XML

In an ideal world all values defined or generated in the extension point are also configured and mapped in congree. As this is not always possible - especially when values are generated or not known in advance - congree resolve the matching rulesets based on the rule "More complex rules overrule simple rules".

Custom Context Definition

Assume that a customer has multiple criteria with an impact on finding the right resultset(s).

  • Pages live in spaces and some of these e.g. spaces used by a marketing team need to use totally different rulesets
  • Spaces are owned by a department and departments might want to define common rulesets
  • Confluence is just one of the systems available at the customer, so there must be a way to differentiate


Example values available during page edit

<!-- 
  system: 'Confluence',
  department: '123',
  space: 'ABC'
-->
XML


(question) As both system and space are general concepts, these do not need to be considered in a custom context definition and will be provided automatically. In this example only the department has to be defined:

<!-- implicitly generated default context (could potentially be overwritten in custom context) -->
<meta name="k15t-congree-context" content="system:Confluence" \>
<meta name="k15t-congree-context" content="space:ABC" \>

<!-- custom context -->
<meta name="k15t-congree-custom-context" content="department:123" \>
XML