MetaData
If you need to make adjustments to the JIRA custom field schema mapping, then your @CustomField extension must also provide a @CustomField.MetaData method.
The method can have any name and return type and can request the following context information using parameters of the appropriate type:
JiraImportController, to receive the controller of the current JIRA import
TrackerLayoutLabelDto, to receive the Codebeamer tracker field definition that should be mapped to the JIRA custom field.
ObjectNode, to receive the JIRA custom field JSON schema as provided by the JIRA REST API
For example: Checklist for Jira:


package com.intland.codebeamer.controller.jira;

import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.node.ObjectNode;

import com.intland.codebeamer.controller.jira.CustomField;

import com.intland.codebeamer.controller.jira.JiraImportController;

import com.intland.codebeamer.persistence.dto.TrackerLayoutLabelDto;


@Component("com.okapya.jira.checklist:checklist")

@CustomField(type="WikiText", of="Checklist")

public class ChecklistForJiraField {


@CustomField.MetaData

public void setMetaData(TrackerLayoutLabelDto field, ObjectNode metaData, JiraImportController controller) {

// In the JIRA REST-API schema, a checklist field is an array of checklist items, but in CB it's a single value WIKI field'

field.setMultipleSelection(Boolean.FALSE);

// The default value (options) of a checklist, are available in the "allowedValues" property. Only status ID is available with Meta API's. The status name is not.'

field.setDefaultValue(importChecklist(null, metaData.remove("allowedValues"), controller));



// Place checklist on own row with full width

field.setBreakRow(Boolean.TRUE);

field.setColspan(Integer.valueOf(3));

}

}
Was this helpful?