ImportFinished
If a @CustomField extension is to be called after the import processing of an item is finished, it can provide a @CustomField.ImportFinished method.
The method has access to the following context information using parameters of the appropriate type:
JiraImportController, to receive the controller of the current JIRA import.
ProjectConfiguration or ProjectDto, to receive the target project of the JIRA import.
JiraTrackerSyncConfig, to receive the target tracker of the JIRA import.
TrackerItemDto, to receive the target tracker item, whose import is finished.
TrackerLayoutLabelDto, to receive the target field, whose value was imported.
JiraRestClient, to receive the REST API of the remote JIRA instance from which to import.
ImporterSupport, to receive the current importer
ImportStatistics, to receive the current import statistics
TrackerItemFieldHandler, to receive the handler for the current tracker item field.
This method is called once for each imported item and each item field, with which the @CustomField extension is associated.
For example: Checklist for Jira


package com.intland.codebeamer.controller.jira;

import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.node.JsonNode;
import com.intland.codebeamer.controller.jira.CustomField;
import com.intland.codebeamer.manager.util.ImporterSupport;
import com.intland.codebeamer.persistence.dto.TrackerItemDto;
import com.intland.codebeamer.persistence.dto.TrackerLayoutLabelDto;
import com.intland.codebeamer.wiki.plugins.ChecklistPlugin;


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

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

public class ChecklistForJiraField {



/**

* Remove the cached checklist for the specified field of the specified item, after the item import is finished

* @param item is the current tracker item to import

* @param field is the checklist field

* @param importer is the current import cache/support

*/

@CustomField.ImportFinished

public void resetChecklist(TrackerItemDto item, TrackerLayoutLabelDto field, ImporterSupport importer) {

Map<Integer,JsonNode> checklists = getChecklists(importer, false);

if (checklists != null) {

if (field != null) {

checklists.remove(field.getId());

} else {

checklists.clear();

}

}

}



}
The ChecklistForJira extension needs to reset its cache of checklist values for each field after each item.
Was this helpful?