remoteworkitem

package
v0.0.0-...-adf365b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemRemoteItemID = "system.remote_item_id"
	SystemTitle        = "system.title"
	SystemDescription  = "system.description"
	SystemState        = "system.state"
	SystemAssignee     = "system.assignee"
	SystemCreator      = "system.creator"

	GithubTitle       = "title"
	GithubDescription = "body"
	GithubState       = "state"
	GithubID          = "url"
	GithubCreator     = "user.login"
	GithubAssignee    = "assignee.login"

	JiraTitle    = "fields.summary"
	JiraBody     = "fields.description"
	JiraState    = "fields.status.name"
	JiraID       = "self"
	JiraCreator  = "fields.creator.key"
	JiraAssignee = "fields.assignee"

	ProviderGithub = "github"
	ProviderJira   = "jira"
)

List of supported attributes

Variables

RemoteWorkItemImplRegistry contains all possible providers

WorkItemKeyMaps relate remote attribute keys to internal representation

Functions

func Flatten

func Flatten(source map[string]interface{}) map[string]interface{}

Flatten Takes the nested map and returns a non nested one with dot delimited keys

func Map

func Map(item AttributeAccessor, mapping WorkItemMap) (app.WorkItem, error)

Map maps the remote WorkItem to a local WorkItem

Types

type AttributeAccessor

type AttributeAccessor interface {
	// Get returns the value based on a commonly understood attribute expression
	Get(field AttributeExpression) interface{}
}

AttributeAccessor defines the interface between a RemoteWorkItem and the Mapper

func NewGitHubRemoteWorkItem

func NewGitHubRemoteWorkItem(item TrackerItem) (AttributeAccessor, error)

NewGitHubRemoteWorkItem creates a new Decoded AttributeAccessor for a GitHub Issue

func NewJiraRemoteWorkItem

func NewJiraRemoteWorkItem(item TrackerItem) (AttributeAccessor, error)

NewJiraRemoteWorkItem creates a new Decoded AttributeAccessor for a GitHub Issue

type AttributeConverter

type AttributeConverter interface {
	Convert(interface{}, AttributeAccessor) (interface{}, error)
}

type AttributeExpression

type AttributeExpression string

AttributeExpression represents a commonly understood String format for a target path

type AttributeMapper

type AttributeMapper struct {
	// contains filtered or unexported fields
}

type BadParameterError

type BadParameterError struct {
	// contains filtered or unexported fields
}

BadParameterError means that a parameter was not as required

func (BadParameterError) Error

func (err BadParameterError) Error() string

Error implements the error interface

type ConversionError

type ConversionError struct {
	// contains filtered or unexported fields
}

ConversionError error means something went wrong converting between different representations

func (ConversionError) Error

func (err ConversionError) Error() string

type GitHubRemoteWorkItem

type GitHubRemoteWorkItem struct {
	// contains filtered or unexported fields
}

GitHubRemoteWorkItem knows how to implement a FieldAccessor on a GitHub Issue JSON struct and it should also know how to convert a value in remote work item for use in local WI

func (GitHubRemoteWorkItem) Get

func (gh GitHubRemoteWorkItem) Get(field AttributeExpression) interface{}

Get attribute from issue map

type GithubStateConverter

type GithubStateConverter struct{}

func (GithubStateConverter) Convert

func (ghc GithubStateConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)

type GithubTracker

type GithubTracker struct {
	URL   string
	Query string
}

GithubTracker represents the Github tracker provider

func (*GithubTracker) Fetch

func (g *GithubTracker) Fetch() chan TrackerItemContent

Fetch tracker items from Github

type GormTrackerQueryRepository

type GormTrackerQueryRepository struct {
	// contains filtered or unexported fields
}

GormTrackerQueryRepository implements TrackerRepository using gorm

func NewTrackerQueryRepository

func NewTrackerQueryRepository(db *gorm.DB) *GormTrackerQueryRepository

NewTrackerQueryRepository constructs a TrackerQueryRepository

func (*GormTrackerQueryRepository) Create

func (r *GormTrackerQueryRepository) Create(ctx context.Context, query string, schedule string, tracker string) (*app.TrackerQuery, error)

Create creates a new tracker query in the repository returns BadParameterError, ConversionError or InternalError

func (*GormTrackerQueryRepository) Delete

Delete deletes the tracker query with the given id returns NotFoundError or InternalError

func (*GormTrackerQueryRepository) List

List returns tracker query selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items

func (*GormTrackerQueryRepository) Load

Load returns the tracker query for the given id returns NotFoundError, ConversionError or InternalError

func (*GormTrackerQueryRepository) Save

Save updates the given tracker query in storage. returns NotFoundError, ConversionError or InternalError

type GormTrackerRepository

type GormTrackerRepository struct {
	// contains filtered or unexported fields
}

GormTrackerRepository implements TrackerRepository using gorm

func NewTrackerRepository

func NewTrackerRepository(db *gorm.DB) *GormTrackerRepository

NewTrackerRepository constructs a TrackerRepository

func (*GormTrackerRepository) Create

func (r *GormTrackerRepository) Create(ctx context.Context, url string, typeID string) (*app.Tracker, error)

Create creates a new tracker configuration in the repository returns BadParameterError, ConversionError or InternalError

func (*GormTrackerRepository) Delete

func (r *GormTrackerRepository) Delete(ctx context.Context, ID string) error

Delete deletes the tracker with the given id returns NotFoundError or InternalError

func (*GormTrackerRepository) List

func (r *GormTrackerRepository) List(ctx context.Context, criteria criteria.Expression, start *int, limit *int) ([]*app.Tracker, error)

List returns tracker selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items

func (*GormTrackerRepository) Load

Load returns the tracker configuration for the given id returns NotFoundError, ConversionError or InternalError

func (*GormTrackerRepository) Save

Save updates the given tracker in storage. returns NotFoundError, ConversionError or InternalError

type InternalError

type InternalError struct {
	// contains filtered or unexported fields
}

InternalError means that the operation failed for some internal, unexpected reason

func (InternalError) Error

func (err InternalError) Error() string

type JiraRemoteWorkItem

type JiraRemoteWorkItem struct {
	// contains filtered or unexported fields
}

JiraRemoteWorkItem knows how to implement a FieldAccessor on a Jira Issue JSON struct

func (JiraRemoteWorkItem) Get

func (jira JiraRemoteWorkItem) Get(field AttributeExpression) interface{}

Get attribute from issue map

type JiraStateConverter

type JiraStateConverter struct{}

func (JiraStateConverter) Convert

func (jhc JiraStateConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)

type JiraTracker

type JiraTracker struct {
	URL   string
	Query string
}

JiraTracker represents the Jira tracker provider

func (*JiraTracker) Fetch

func (j *JiraTracker) Fetch() chan TrackerItemContent

Fetch collects data from Jira

type NotFoundError

type NotFoundError struct {
	ID string
	// contains filtered or unexported fields
}

NotFoundError means the object specified for the operation does not exist

func (NotFoundError) Error

func (err NotFoundError) Error() string

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler represents scheduler

func NewScheduler

func NewScheduler(db *gorm.DB) *Scheduler

NewScheduler creates a new Scheduler

func (*Scheduler) ScheduleAllQueries

func (s *Scheduler) ScheduleAllQueries()

ScheduleAllQueries fetch and import of remote tracker items

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Stop scheduler This should be called only from main

type StateConverter

type StateConverter interface{}

type StringConverter

type StringConverter struct{}

func (StringConverter) Convert

func (sc StringConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)

Convert method map the external tracker item to ALM WorkItem

type Tracker

type Tracker struct {
	gormsupport.Lifecycle
	ID uint64 `gorm:"primary_key"`
	// URL of the tracker
	URL string
	// Type of the tracker (jira, github, bugzilla, trello etc.)
	Type string
}

Tracker represents tracker configuration

type TrackerItem

type TrackerItem struct {
	gormsupport.Lifecycle
	ID uint64 `gorm:"primary_key"`
	// Remote item ID - unique across multiple trackers
	RemoteItemID string `gorm:"not null;unique"`
	// the field values
	Item string
	// FK to tracker
	TrackerID uint64 `gorm:"ForeignKey:Tracker"`
}

TrackerItem represents a remote tracker item Staging area before pushing to work item

type TrackerItemContent

type TrackerItemContent struct {
	ID      string
	Content []byte
}

TrackerItemContent represents a remote tracker item with it's content and unique ID

type TrackerProvider

type TrackerProvider interface {
	Fetch() chan TrackerItemContent // TODO: Change to an interface to enforce the contract
}

TrackerProvider represents a remote tracker

type TrackerQuery

type TrackerQuery struct {
	gormsupport.Lifecycle
	ID uint64 `gorm:"primary_key"`
	// Search query of the tracker
	Query string
	// Schedule to fetch and import remote tracker items
	Schedule string
	// TrackerID is a foreign key for a tracker
	TrackerID uint64 `gorm:"ForeignKey:Tracker"`
}

TrackerQuery represents tracker query

type VersionConflictError

type VersionConflictError struct {
	// contains filtered or unexported fields
}

VersionConflictError means that the version was not as expected in an update operation

func (VersionConflictError) Error

func (err VersionConflictError) Error() string

type WorkItemMap

type WorkItemMap map[AttributeMapper]string

WorkItemMap will define mappings between remote<->internal attribute

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL