use of com.synopsys.integration.azure.boards.common.service.process.ProcessWorkItemTypesResponseModel in project hub-alert by blackducksoftware.
the class AzureCustomFieldManager method getWorkItemTypeRefName.
private String getWorkItemTypeRefName(String processId, String workItemTypeName) throws AlertException {
try {
AzureArrayResponseModel<ProcessWorkItemTypesResponseModel> processWorkItemTypes = processService.getWorkItemTypes(organizationName, processId);
ProcessWorkItemTypesResponseModel matchingWorkItemType = processWorkItemTypes.getValue().stream().filter(workItemType -> workItemType.getName().equals(workItemTypeName)).findFirst().orElseThrow(() -> new AlertException(String.format("No work item type '%s' exists for the Azure process with id: '%s'", workItemTypeName, processId)));
if (matchingWorkItemType.getReferenceName().startsWith(UNMODIFIABLE_WORK_ITEM_PREFIX)) {
// if the reference name starts with this prefix, we know it is a system default so it can not be modified and fields can not be added to it, so we need to create a "copy" of it
matchingWorkItemType = copyWorkItem(processId, matchingWorkItemType);
}
return matchingWorkItemType.getReferenceName();
} catch (HttpServiceException e) {
throw new AlertException(String.format("There was a problem trying to get the work item types for the Azure process with id: %s", processId), e);
}
}
Aggregations