final CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();
initialiseEventTypeIds(eventTypeManager);
// create service context to execute search with
JiraServiceContextImpl jiraServiceContextImpl = new JiraServiceContextImpl(user);
final CustomField securityLevel = customFieldManager.getCustomFieldObjectByName(SECURITY_LEVEL);
final CustomField dateResolved = customFieldManager.getCustomFieldObjectByName(DATE_RESOLVED);
final CustomField dateResponded = customFieldManager.getCustomFieldObjectByName(DATE_RESPONDED);
final CustomField slaLastCalculated = customFieldManager.getCustomFieldObjectByName(SLA_LAST_CALCULATED);
final CustomField responseSlaState = customFieldManager.getCustomFieldObjectByName(RESPONSE_SLA_STATE);
final CustomField fixSlaState = customFieldManager.getCustomFieldObjectByName(FIX_KPI_STATE);
final CustomField timeElapsed = customFieldManager.getCustomFieldObjectByName(TIME_ELAPSED);
final CustomField onHold = customFieldManager.getCustomFieldObjectByName(ON_HOLD);
// final CustomField incidentPriority = customFieldManager.getCustomFieldObjectByName(INCIDENT_PRIORITY);
final Iterator iterator = clientSLAConfigurations.iterator();
while (iterator.hasNext()) {
final ClientSLAConfig clientSLAConfig = (ClientSLAConfig) iterator.next();
//**
// log.debug("processing slas for client: "+clientSLAConfig.getClientName());
final String clientName = clientSLAConfig.getClientName();
final String[] projects = clientSLAConfig.getProjects();
Collection<Long> projectCollection = new HashSet<Long>();
Collection<String> issueTypeCollection = new HashSet<String>();
for (int i = 0; i < projects.length; i++) {
final String projectName = projects[i] == null ? null : projects[i].trim();
//**
// log.debug("Found project name " + projectName);
if (projectName != null) {
final Project project = projectManager.getProjectObjByName(projectName);
projectCollection.add(project.getId());
final String id = getIncidentIssueId(issueTypeSchemeManager, project);
if (id != null) {
issueTypeCollection.add(id);
}
}
}
// skip client if there are no incident issue types
if (issueTypeCollection.size() == 0) {
log.warn("No projects for client: " + clientName + " have an issue type of Incident.");
continue;
}
// create the search for the client and projects
Query query = buildSearch(securityLevel, clientName, projectCollection, issueTypeCollection);
//**
// log.debug("Built search request.");
try {
SearchResults searchResults = searchService.search(jiraServiceContextImpl.getUser(), query, PagerFilter.getUnlimitedFilter());
//**
// log.debug("Searching for issues. Found ");
List issues = searchResults.getIssues();
//**