func BootstrapWorkItemLinking(ctx context.Context, linkCatRepo *link.GormWorkItemLinkCategoryRepository, spaceRepo *space.GormRepository, linkTypeRepo *link.GormWorkItemLinkTypeRepository) error {
	populateLocker.Lock()
	defer populateLocker.Unlock()
	if err := createOrUpdateSpace(ctx, spaceRepo, space.SystemSpace, "The system space is reserved for spaces that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkCategory(ctx, linkCatRepo, link.SystemWorkItemLinkCategorySystem, "The system category is reserved for link types that are to be manipulated by the system only."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkCategory(ctx, linkCatRepo, link.SystemWorkItemLinkCategoryUser, "The user category is reserved for link types that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkTypeBugBlocker, "One bug blocks a planner item.", link.TopologyNetwork, "blocks", "blocked by", workitem.SystemBug, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkPlannerItemRelated, "One planner item or a subtype of it relates to another one.", link.TopologyNetwork, "relates to", "is related to", workitem.SystemPlannerItem, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkTypeParentChild, "One planner item or a subtype of it which is a parent of another one.", link.TopologyTree, "parent of", "child of", workitem.SystemPlannerItem, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	return nil
}
// BootstrapWorkItemLinking makes sure the database is populated with the correct work item link stuff (e.g. category and some basic types)
BootstrapWorkItemLinking makes sure the database is populated with the correct work item link stuff
// BootstrapWorkItemLinking makes sure the database is populated with the correct work item link stuff ( e . g . category and some basic types )
func BootstrapWorkItemLinking(ctx context.Context, linkCatRepo *link.GormWorkItemLinkCategoryRepository, spaceRepo *space.GormRepository, linkTypeRepo *link.GormWorkItemLinkTypeRepository) error {
	populateLocker.Lock()
	defer populateLocker.Unlock()
	if err := createOrUpdateSpace(ctx, spaceRepo, space.SystemSpace, "The system space is reserved for spaces that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkCategory(ctx, linkCatRepo, link.SystemWorkItemLinkCategorySystem, "The system category is reserved for link types that are to be manipulated by the system only."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkCategory(ctx, linkCatRepo, link.SystemWorkItemLinkCategoryUser, "The user category is reserved for link types that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkTypeBugBlocker, "One bug blocks a planner item.", link.TopologyNetwork, "blocks", "blocked by", workitem.SystemBug, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkPlannerItemRelated, "One planner item or a subtype of it relates to another one.", link.TopologyNetwork, "relates to", "is related to", workitem.SystemPlannerItem, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateWorkItemLinkType(ctx, linkCatRepo, linkTypeRepo, spaceRepo, link.SystemWorkItemLinkTypeParentChild, "One planner item or a subtype of it which is a parent of another one.", link.TopologyTree, "parent of", "child of", workitem.SystemPlannerItem, workitem.SystemPlannerItem, link.SystemWorkItemLinkCategorySystem, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	return nil
}
func BootstrapWorkItemLinking ( ctx context . Context , linkCatRepo * link . GormWorkItemLinkCategoryRepository , spaceRepo * space . GormRepository , linkTypeRepo * link . GormWorkItemLinkTypeRepository ) error { populateLocker . Lock ( ) defer populateLocker . Unlock ( ) if err := createOrUpdateSpace ( ctx , spaceRepo , space . SystemSpace , " " ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateWorkItemLinkCategory ( ctx , linkCatRepo , link . SystemWorkItemLinkCategorySystem , " " ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateWorkItemLinkCategory ( ctx , linkCatRepo , link . SystemWorkItemLinkCategoryUser , " " ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateWorkItemLinkType ( ctx , linkCatRepo , linkTypeRepo , spaceRepo , link . SystemWorkItemLinkTypeBugBlocker , " " , link . TopologyNetwork , " " , " " , workitem . SystemBug , workitem . SystemPlannerItem , link . SystemWorkItemLinkCategorySystem , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateWorkItemLinkType ( ctx , linkCatRepo , linkTypeRepo , spaceRepo , link . SystemWorkItemLinkPlannerItemRelated , " " , link . TopologyNetwork , " " , " " , workitem . SystemPlannerItem , workitem . SystemPlannerItem , link . SystemWorkItemLinkCategorySystem , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateWorkItemLinkType ( ctx , linkCatRepo , linkTypeRepo , spaceRepo , link . SystemWorkItemLinkTypeParentChild , " " , link . TopologyTree , " " , " " , workitem . SystemPlannerItem , workitem . SystemPlannerItem , link . SystemWorkItemLinkCategorySystem , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } return nil }
BootstrapWorkItemLinking makes sure the database is populated with the correct work item link stuff
BootstrapWorkItemLinking makes sure the database is populated with the correct work item link stuff