func convertToWorkItemModel(ctx context.Context, db *gorm.DB, tID int, item TrackerItemContent, providerType string, spaceID uuid.UUID) (*workitem.WorkItem, error) {
	remoteID := item.ID
	content := string(item.Content)
	trackerItem := TrackerItem{Item: content, RemoteItemID: remoteID, TrackerID: uint64(tID)}
	// Converting the remote item to a local work item
	remoteTrackerItemConvertFunc, ok := RemoteWorkItemImplRegistry[providerType]
	if !ok {
		return nil, BadParameterError{parameter: providerType, value: providerType}
	}
	remoteTrackerItem, err := remoteTrackerItemConvertFunc(trackerItem)
	if err != nil {
		return nil, InternalError{simpleError{message: fmt.Sprintf(" Error parsing the tracker data: %s", err.Error())}}
	}
	remoteWorkItem, err := Map(remoteTrackerItem, RemoteWorkItemKeyMaps[providerType])
	if err != nil {
		return nil, ConversionError{simpleError{message: fmt.Sprintf("Error mapping to local work item: %s", err.Error())}}
	}
	workItem, err := lookupIdentities(ctx, db, remoteWorkItem, providerType, spaceID)
	if err != nil {
		return nil, InternalError{simpleError{message: fmt.Sprintf("Error bind assignees: %s", err.Error())}}
	}
	return upsert(ctx, db, *workItem)
}
// Map a remote work item into an ALM work item and persist it into the database.
Map a remote work item into an ALM work item and persist it into the database.
// Map a remote work item into an ALM work item and persist it into the database .
func convertToWorkItemModel(ctx context.Context, db *gorm.DB, tID int, item TrackerItemContent, providerType string, spaceID uuid.UUID) (*workitem.WorkItem, error) {
	remoteID := item.ID
	content := string(item.Content)
	trackerItem := TrackerItem{Item: content, RemoteItemID: remoteID, TrackerID: uint64(tID)}
	remoteTrackerItemConvertFunc, ok := RemoteWorkItemImplRegistry[providerType]
	if !ok {
		return nil, BadParameterError{parameter: providerType, value: providerType}
	}
	remoteTrackerItem, err := remoteTrackerItemConvertFunc(trackerItem)
	if err != nil {
		return nil, InternalError{simpleError{message: fmt.Sprintf(" Error parsing the tracker data: %s", err.Error())}}
	}
	remoteWorkItem, err := Map(remoteTrackerItem, RemoteWorkItemKeyMaps[providerType])
	if err != nil {
		return nil, ConversionError{simpleError{message: fmt.Sprintf("Error mapping to local work item: %s", err.Error())}}
	}
	workItem, err := lookupIdentities(ctx, db, remoteWorkItem, providerType, spaceID)
	if err != nil {
		return nil, InternalError{simpleError{message: fmt.Sprintf("Error bind assignees: %s", err.Error())}}
	}
	return upsert(ctx, db, *workItem)
}
func convertToWorkItemModel ( ctx context . Context , db * gorm . DB , tID int , item TrackerItemContent , providerType string , spaceID uuid . UUID ) ( * workitem . WorkItem , error ) { remoteID := item . ID content := string ( item . Content ) trackerItem := TrackerItem { Item : content , RemoteItemID : remoteID , TrackerID : uint64 ( tID ) } remoteTrackerItemConvertFunc , ok := RemoteWorkItemImplRegistry [ providerType ] if ! ok { return nil , BadParameterError { parameter : providerType , value : providerType } } remoteTrackerItem , err := remoteTrackerItemConvertFunc ( trackerItem ) if err != nil { return nil , InternalError { simpleError { message : fmt . Sprintf ( " " , err . Error ( ) ) } } } remoteWorkItem , err := Map ( remoteTrackerItem , RemoteWorkItemKeyMaps [ providerType ] ) if err != nil { return nil , ConversionError { simpleError { message : fmt . Sprintf ( " " , err . Error ( ) ) } } } workItem , err := lookupIdentities ( ctx , db , remoteWorkItem , providerType , spaceID ) if err != nil { return nil , InternalError { simpleError { message : fmt . Sprintf ( " " , err . Error ( ) ) } } } return upsert ( ctx , db , * workItem ) }
Map a remote work item into an ALM work item and persist it into the database.
Map a remote work item into an ALM work item and persist it into the database .
// Converting the remote item to a local work item