fabric8-wit: github.com/fabric8-services/fabric8-wit/workitem Index | Files | Directories

package workitem

import "github.com/fabric8-services/fabric8-wit/workitem"

Package workitem contains the code that allows to manage work items, work item types.

Index

Package Files

doc.go enum_type.go expression_compiler.go field_definition.go field_test_data.go json_storage.go list_type.go simple_type.go typegroup.go workitem.go workitem_repository.go workitem_revision.go workitem_revision_repository.go workitem_storage.go workitemtype.go workitemtype_cache.go workitemtype_repository.go

Constants

const (
    SystemVersion = "version"

    SystemRemoteItemID        = "system.remote_item_id"
    SystemNumber              = "system.number"
    SystemTitle               = "system.title"
    SystemDescription         = "system.description"
    SystemDescriptionMarkup   = "system.description.markup"
    SystemDescriptionRendered = "system.description.rendered"
    SystemState               = "system.state"
    SystemAssignees           = "system.assignees"
    SystemCreator             = "system.creator"
    SystemCreatedAt           = "system.created_at"
    SystemUpdatedAt           = "system.updated_at"
    SystemOrder               = "system.order"
    SystemIteration           = "system.iteration"
    SystemArea                = "system.area"
    SystemCodebase            = "system.codebase"
    SystemLabels              = "system.labels"

    SystemStateOpen       = "open"
    SystemStateNew        = "new"
    SystemStateInProgress = "in progress"
    SystemStateResolved   = "resolved"
    SystemStateClosed     = "closed"
)

String constants for the local work item types.

Variables

var (
    // base item type with common fields for planner item types like userstory, experience, bug, feature, etc.
    SystemPlannerItem      = uuid.FromStringOrNil("86af5178-9b41-469b-9096-57e5155c3f31") // "planneritem"
    SystemTask             = uuid.FromStringOrNil("bbf35418-04b6-426c-a60b-7f80beb0b624") // "task"
    SystemValueProposition = uuid.FromStringOrNil("3194ab60-855b-4155-9005-9dce4a05f1eb") // "valueproposition"
    SystemFundamental      = uuid.FromStringOrNil("ee7ca005-f81d-4eea-9b9b-1965df0988d0") // "fundamental"
    SystemExperience       = uuid.FromStringOrNil("b9a71831-c803-4f66-8774-4193fffd1311") // "experience"
    SystemFeature          = uuid.FromStringOrNil("0a24d3c2-e0a6-4686-8051-ec0ea1915a28") // "feature"
    SystemScenario         = uuid.FromStringOrNil("71171e90-6d35-498f-a6a7-2083b5267c18") // "scenario"
    SystemBug              = uuid.FromStringOrNil("26787039-b68f-4e28-8814-c2f93be1ef4e") // "bug"
    SystemPapercuts        = uuid.FromStringOrNil("6d603ab4-7c5e-4c5f-bba8-a3ba9d370985") // "papercuts"
)

Never ever change these UUIDs!!!

func ClearGlobalWorkItemTypeCache Uses

func ClearGlobalWorkItemTypeCache()

ClearGlobalWorkItemTypeCache removes all work items from the global cache

func Compile Uses

func Compile(where criteria.Expression) (whereClause string, parameters []interface{}, err []error)

Compile takes an expression and compiles it to a where clause for use with gorm.DB.Where() Returns the number of expected parameters for the query and a slice of errors if something goes wrong

func ConvertList Uses

func ConvertList(converter Converter, componentType SimpleType, value interface{}) ([]interface{}, error)

func GetFieldTypeTestData Uses

func GetFieldTypeTestData(t *testing.T) map[Kind]ValidInvalid

GetFieldTypeTestData returns a list of legal and illegal values to be used with a given field type (here: the map key).

func GetTypePathSeparator Uses

func GetTypePathSeparator() string

GetTypePathSeparator returns the work item type's path separator "."

func LtreeSafeID Uses

func LtreeSafeID(witID uuid.UUID) string

LtreeSafeID returns the ID of the work item type in an postgres ltree safe manner The returned string can be used as an ltree node.

func ParseWorkItemIDToUint64 Uses

func ParseWorkItemIDToUint64(wiIDStr string) (uint64, error)

ParseWorkItemIDToUint64 does what it says

func TypeGroups Uses

func TypeGroups() []WorkItemTypeGroup

TypeGroups returns the list of work item type groups

func TypeGroupsByBucket Uses

func TypeGroupsByBucket(bucket TypeBucket) []WorkItemTypeGroup

TypeGroupsByBucket returns all type groups which fall into the given bucket

type Converter Uses

type Converter func(FieldType, interface{}) (interface{}, error)

type DirectionType Uses

type DirectionType string
const (
    DirectionAbove  DirectionType = "above"
    DirectionBelow  DirectionType = "below"
    DirectionTop    DirectionType = "top"
    DirectionBottom DirectionType = "bottom"
)

type EnumType Uses

type EnumType struct {
    SimpleType
    BaseType SimpleType
    Values   []interface{}
}

func (EnumType) ConvertFromModel Uses

func (t EnumType) ConvertFromModel(value interface{}) (interface{}, error)

func (EnumType) ConvertToModel Uses

func (t EnumType) ConvertToModel(value interface{}) (interface{}, error)

func (EnumType) Equal Uses

func (t EnumType) Equal(u convert.Equaler) bool

Equal returns true if two EnumType objects are equal; otherwise false is returned.

type FieldDefinition Uses

type FieldDefinition struct {
    Required    bool
    Label       string
    Description string
    Type        FieldType
}

FieldDefinition describes type & other restrictions of a field

func (FieldDefinition) ConvertFromModel Uses

func (f FieldDefinition) ConvertFromModel(name string, value interface{}) (interface{}, error)

ConvertFromModel converts a field value for use in the REST API layer

func (FieldDefinition) ConvertToModel Uses

func (f FieldDefinition) ConvertToModel(name string, value interface{}) (interface{}, error)

ConvertToModel converts a field value for use in the persistence layer

func (FieldDefinition) Equal Uses

func (f FieldDefinition) Equal(u convert.Equaler) bool

Equal returns true if two FieldDefinition objects are equal; otherwise false is returned.

func (*FieldDefinition) UnmarshalJSON Uses

func (f *FieldDefinition) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler

type FieldDefinitions Uses

type FieldDefinitions map[string]FieldDefinition

func (*FieldDefinitions) Scan Uses

func (j *FieldDefinitions) Scan(src interface{}) error

func (FieldDefinitions) Value Uses

func (j FieldDefinitions) Value() (driver.Value, error)

type FieldType Uses

type FieldType interface {
    GetKind() Kind
    // ConvertToModel converts a field value for use in the persistence layer
    ConvertToModel(value interface{}) (interface{}, error)
    // ConvertFromModel converts a field value for use in the REST API layer
    ConvertFromModel(value interface{}) (interface{}, error)
    // Implement the Equaler interface
    Equal(u convert.Equaler) bool
}

FieldType describes the possible values of a FieldDefinition

type Fields Uses

type Fields map[string]interface{}

func (Fields) Equal Uses

func (f Fields) Equal(u convert.Equaler) bool

Equal returns true if two Fields objects are equal; otherwise false is returned. TODO: (kwk) think about a better comparison for Fields map.

func (*Fields) Scan Uses

func (f *Fields) Scan(src interface{}) error

func (Fields) Value Uses

func (f Fields) Value() (driver.Value, error)

type GormRevisionRepository Uses

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

GormRevisionRepository implements RevisionRepository using gorm

func NewRevisionRepository Uses

func NewRevisionRepository(db *gorm.DB) *GormRevisionRepository

NewRevisionRepository creates a GormRevisionRepository

func (*GormRevisionRepository) Create Uses

func (r *GormRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, workitem WorkItemStorage) error

Create stores a new revision for the given work item.

func (*GormRevisionRepository) List Uses

func (r *GormRevisionRepository) List(ctx context.Context, workitemID uuid.UUID) ([]Revision, error)

List retrieves all revisions for a given work item

type GormWorkItemRepository Uses

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

GormWorkItemRepository implements WorkItemRepository using gorm

func NewWorkItemRepository Uses

func NewWorkItemRepository(db *gorm.DB) *GormWorkItemRepository

NewWorkItemRepository creates a GormWorkItemRepository

func (*GormWorkItemRepository) CalculateOrder Uses

func (r *GormWorkItemRepository) CalculateOrder(above, below *float64) float64

CalculateOrder calculates the order of the reorder workitem

func (*GormWorkItemRepository) CheckExists Uses

func (r *GormWorkItemRepository) CheckExists(ctx context.Context, workitemID string) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormWorkItemRepository) Count Uses

func (r *GormWorkItemRepository) Count(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (int, error)

Count returns the amount of work item that satisfy the given criteria.Expression

func (*GormWorkItemRepository) Create Uses

func (r *GormWorkItemRepository) Create(ctx context.Context, spaceID uuid.UUID, typeID uuid.UUID, fields map[string]interface{}, creatorID uuid.UUID) (*WorkItem, error)

Create creates a new work item in the repository returns BadParameterError, ConversionError or InternalError

func (*GormWorkItemRepository) Delete Uses

func (r *GormWorkItemRepository) Delete(ctx context.Context, workitemID uuid.UUID, suppressorID uuid.UUID) error

Delete deletes the work item with the given id returns NotFoundError or InternalError

func (*GormWorkItemRepository) Fetch Uses

func (r *GormWorkItemRepository) Fetch(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (*WorkItem, error)

Fetch fetches the (first) work item matching by the given criteria.Expression.

func (*GormWorkItemRepository) FindFirstItem Uses

func (r *GormWorkItemRepository) FindFirstItem(ctx context.Context, spaceID uuid.UUID, id uuid.UUID) (*float64, error)

FindFirstItem returns the order of the target workitem

func (*GormWorkItemRepository) FindSecondItem Uses

func (r *GormWorkItemRepository) FindSecondItem(ctx context.Context, order *float64, spaceID uuid.UUID, secondItemDirection DirectionType) (*uuid.UUID, *float64, error)

FindSecondItem returns the order of the second workitem required to reorder. Reordering a workitem requires order of two closest workitems: above and below. If direction == "above", then

	FindFirstItem returns the value above which reorder item has to be placed
     FindSecondItem returns the value below which reorder item has to be placed

If direction == "below", then

	FindFirstItem returns the value below which reorder item has to be placed
     FindSecondItem returns the value above which reorder item has to be placed

func (*GormWorkItemRepository) GetCountsForIteration Uses

func (r *GormWorkItemRepository) GetCountsForIteration(ctx context.Context, itr *iteration.Iteration) (map[string]WICountsPerIteration, error)

GetCountsForIteration returns Closed and Total counts of WIs for given iteration It fetches all child iterations of input iteration and then uses list to counts work items SELECT count(*) AS Total,

count(CASE fields->>'system.state'
          WHEN 'closed' THEN '1'
          ELSE NULL
      END) AS Closed

FROM work_items wi WHERE fields->>'system.iteration' IN ('input iteration ID + children IDs')

AND wi.deleted_at IS NULL

func (*GormWorkItemRepository) GetCountsPerIteration Uses

func (r *GormWorkItemRepository) GetCountsPerIteration(ctx context.Context, spaceID uuid.UUID) (map[string]WICountsPerIteration, error)

GetCountsPerIteration counts WIs including iteration-children and returns a map of iterationID->WICountsPerIteration

func (*GormWorkItemRepository) List Uses

func (r *GormWorkItemRepository) List(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression, parentExists *bool, start *int, limit *int) ([]WorkItem, int, error)

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

func (*GormWorkItemRepository) Load Uses

func (r *GormWorkItemRepository) Load(ctx context.Context, spaceID uuid.UUID, wiNumber int) (*WorkItem, error)

Load returns the work item for the given spaceID and item id returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadBatchByID Uses

func (r *GormWorkItemRepository) LoadBatchByID(ctx context.Context, ids []uuid.UUID) ([]*WorkItem, error)

LoadBatchByID returns work items for the given ids

func (*GormWorkItemRepository) LoadBatchFromDB Uses

func (r *GormWorkItemRepository) LoadBatchFromDB(ctx context.Context, ids []uuid.UUID) ([]WorkItemStorage, error)

LoadBatchFromDB returns the work items using IN query expression.

func (*GormWorkItemRepository) LoadBottomWorkitem Uses

func (r *GormWorkItemRepository) LoadBottomWorkitem(ctx context.Context, spaceID uuid.UUID) (*WorkItem, error)

LoadBottomWorkitem returns bottom work item of the list. Bottom most workitem has the lowest order. returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadByID Uses

func (r *GormWorkItemRepository) LoadByID(ctx context.Context, id uuid.UUID) (*WorkItem, error)

LoadByID returns the work item for the given id returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadByIteration Uses

func (r *GormWorkItemRepository) LoadByIteration(ctx context.Context, iterationID uuid.UUID) ([]*WorkItem, error)

LoadByIteration returns the list of work items belongs to given iteration

func (*GormWorkItemRepository) LoadFromDB Uses

func (r *GormWorkItemRepository) LoadFromDB(ctx context.Context, id uuid.UUID) (*WorkItemStorage, error)

LoadFromDB returns the work item with the given natural ID in model representation.

func (*GormWorkItemRepository) LoadHighestOrder Uses

func (r *GormWorkItemRepository) LoadHighestOrder(ctx context.Context, spaceID uuid.UUID) (float64, error)

LoadHighestOrder returns the highest execution order in the given space

func (*GormWorkItemRepository) LoadTopWorkitem Uses

func (r *GormWorkItemRepository) LoadTopWorkitem(ctx context.Context, spaceID uuid.UUID) (*WorkItem, error)

LoadTopWorkitem returns top most work item of the list. Top most workitem has the Highest order. returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LookupIDByNamedSpaceAndNumber Uses

func (r *GormWorkItemRepository) LookupIDByNamedSpaceAndNumber(ctx context.Context, ownerName, spaceName string, wiNumber int) (*uuid.UUID, *uuid.UUID, error)

LookupIDByNamedSpaceAndNumber returns the work item's ID for the given owner name, space name and item number returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) Reorder Uses

func (r *GormWorkItemRepository) Reorder(ctx context.Context, spaceID uuid.UUID, direction DirectionType, targetID *uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)

Reorder places the to-be-reordered workitem above the input workitem. The order of workitems are spaced by a factor of 1000. The new order of workitem := (order of previousitem + order of nextitem)/2 Version must be the same as the one int the stored version

func (*GormWorkItemRepository) Save Uses

func (r *GormWorkItemRepository) Save(ctx context.Context, spaceID uuid.UUID, updatedWorkItem WorkItem, modifierID uuid.UUID) (*WorkItem, error)

Save updates the given work item in storage. Version must be the same as the one int the stored version returns NotFoundError, VersionConflictError, ConversionError or InternalError

type GormWorkItemTypeRepository Uses

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

GormWorkItemTypeRepository implements WorkItemTypeRepository using gorm

func NewWorkItemTypeRepository Uses

func NewWorkItemTypeRepository(db *gorm.DB) *GormWorkItemTypeRepository

NewWorkItemTypeRepository creates a wi type repository based on gorm

func (*GormWorkItemTypeRepository) CheckExists Uses

func (r *GormWorkItemTypeRepository) CheckExists(ctx context.Context, id string) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormWorkItemTypeRepository) Create Uses

func (r *GormWorkItemTypeRepository) Create(ctx context.Context, spaceID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields map[string]FieldDefinition) (*WorkItemType, error)

Create creates a new work item type in the repository returns BadParameterError, ConversionError or InternalError

func (*GormWorkItemTypeRepository) CreateFromModel Uses

func (r *GormWorkItemTypeRepository) CreateFromModel(ctx context.Context, model *WorkItemType) (*WorkItemType, error)

CreateFromModel creates a new work item type in the repository without any fancy stuff.

func (*GormWorkItemTypeRepository) List Uses

func (r *GormWorkItemTypeRepository) List(ctx context.Context, spaceID uuid.UUID, start *int, limit *int) ([]WorkItemType, error)

List returns work item types selected by the given criteria.Expression, starting with start (zero-based) and returning at most "limit" item types.

func (*GormWorkItemTypeRepository) ListPlannerItems Uses

func (r *GormWorkItemTypeRepository) ListPlannerItems(ctx context.Context, spaceID uuid.UUID) ([]WorkItemType, error)

List returns work item types that derives from PlannerItem type

func (*GormWorkItemTypeRepository) Load Uses

func (r *GormWorkItemTypeRepository) Load(ctx context.Context, spaceID uuid.UUID, id uuid.UUID) (*WorkItemType, error)

Load returns the work item for the given spaceID and id returns NotFoundError, InternalError

func (*GormWorkItemTypeRepository) LoadByID Uses

func (r *GormWorkItemTypeRepository) LoadByID(ctx context.Context, id uuid.UUID) (*WorkItemType, error)

LoadByID returns the work item for the given id returns NotFoundError, InternalError

func (*GormWorkItemTypeRepository) LoadTypeFromDB Uses

func (r *GormWorkItemTypeRepository) LoadTypeFromDB(ctx context.Context, id uuid.UUID) (*WorkItemType, error)

LoadTypeFromDB return work item type for the given id

type Kind Uses

type Kind string

Kind is the kind of field type

const (
    KindString    Kind = "string"
    KindInteger   Kind = "integer"
    KindFloat     Kind = "float"
    KindBoolean   Kind = "bool"
    KindInstant   Kind = "instant"
    KindDuration  Kind = "duration"
    KindURL       Kind = "url"
    KindIteration Kind = "iteration"
    KindUser      Kind = "user"
    KindLabel     Kind = "label"
    KindEnum      Kind = "enum"
    KindList      Kind = "list"
    KindMarkup    Kind = "markup"
    KindArea      Kind = "area"
    KindCodebase  Kind = "codebase"
)

constants for describing possible field types

func ConvertAnyToKind Uses

func ConvertAnyToKind(any interface{}) (*Kind, error)

func ConvertStringToKind Uses

func ConvertStringToKind(k string) (*Kind, error)

ConvertStringToKind returns the given string as a Kind object

func (Kind) IsSimpleType Uses

func (k Kind) IsSimpleType() bool

IsSimpleType returns 'true' if the kind is simple, i.e., not a list nor an enum

func (Kind) String Uses

func (k Kind) String() string

String implements the Stringer interface and returns the kind as a string object.

type ListType Uses

type ListType struct {
    SimpleType
    ComponentType SimpleType
}

ListType describes a list of SimpleType values

func (ListType) ConvertFromModel Uses

func (t ListType) ConvertFromModel(value interface{}) (interface{}, error)

ConvertFromModel implements the FieldType interface

func (ListType) ConvertToModel Uses

func (t ListType) ConvertToModel(value interface{}) (interface{}, error)

ConvertToModel implements the FieldType interface

func (ListType) Equal Uses

func (t ListType) Equal(u convert.Equaler) bool

Equal returns true if two ListType objects are equal; otherwise false is returned.

type Revision Uses

type Revision struct {
    ID  uuid.UUID `gorm:"primary_key"`
    // the timestamp of the modification
    Time time.Time `gorm:"column:revision_time"`
    // the type of modification
    Type RevisionType `gorm:"column:revision_type"`
    // the identity of author of the workitem modification
    ModifierIdentity uuid.UUID `sql:"type:uuid" gorm:"column:modifier_id"`
    // the id of the work item that changed
    WorkItemID uuid.UUID `gorm:"column:work_item_id"`
    // Id of the type of this work item
    WorkItemTypeID uuid.UUID `gorm:"column:work_item_type_id"`
    // Version of the workitem that was modified
    WorkItemVersion int `gorm:"column:work_item_version"`
    // the field values (or empty when the work item was deleted)
    WorkItemFields Fields `gorm:"column:work_item_fields" sql:"type:jsonb"`
}

Revision represents a version of a work item

func (Revision) TableName Uses

func (w Revision) TableName() string

TableName implements gorm.tabler

type RevisionRepository Uses

type RevisionRepository interface {
    // Create stores a new revision for the given work item.
    Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, workitem WorkItemStorage) error
    // List retrieves all revisions for a given work item
    List(ctx context.Context, workitemID uuid.UUID) ([]Revision, error)
}

RevisionRepository encapsulates storage & retrieval of historical versions of work items

type RevisionType Uses

type RevisionType int

RevisionType defines the type of revision for a work item

const (

    // RevisionTypeCreate a work item creation
    RevisionTypeCreate RevisionType // 1
    // RevisionTypeDelete a work item deletion
    RevisionTypeDelete // 2

    // RevisionTypeUpdate a work item update
    RevisionTypeUpdate // 4
)

type SimpleType Uses

type SimpleType struct {
    Kind Kind
}

SimpleType is an unstructured FieldType

func (SimpleType) ConvertFromModel Uses

func (t SimpleType) ConvertFromModel(value interface{}) (interface{}, error)

ConvertFromModel implements the t interface

func (SimpleType) ConvertToModel Uses

func (t SimpleType) ConvertToModel(value interface{}) (interface{}, error)

ConvertToModel implements the FieldType interface

func (SimpleType) Equal Uses

func (t SimpleType) Equal(u convert.Equaler) bool

Equal returns true if two SimpleType objects are equal; otherwise false is returned.

func (SimpleType) GetKind Uses

func (t SimpleType) GetKind() Kind

GetKind implements FieldType

type TypeBucket Uses

type TypeBucket string

TypeBucket represents a dedicated string type for a bucket of type groups

const (
    BucketPortfolio   TypeBucket = "portfolio"
    BucketRequirement TypeBucket = "requirement"
    BucketIteration   TypeBucket = "iteration"
)

Use following bucket constants while defining static groups. NOTE: Those buckets can later be used by reporting tools for example to gather information on a collective range of work item types.

func (*TypeBucket) Scan Uses

func (t *TypeBucket) Scan(value interface{}) error

Scan implements the https://golang.org/pkg/database/sql/#Scanner interface See also https://stackoverflow.com/a/25374979/835098 See also https://github.com/jinzhu/gorm/issues/302#issuecomment-80566841

func (TypeBucket) String Uses

func (t TypeBucket) String() string

func (TypeBucket) Value Uses

func (t TypeBucket) Value() (driver.Value, error)

Value implements the https://golang.org/pkg/database/sql/driver/#Valuer interface

type ValidInvalid Uses

type ValidInvalid struct {
    Valid   []interface{}
    Invalid []interface{}
    // When the actual value is a zero (0), it will be interpreted as a
    // float64 rather than an int. To compensate for that ambiguity, a
    // kind can opt-in to provide an construction function that returns
    // the correct value.
    Compensate func(interface{}) interface{}
}

given a bunch of tests with expected error results for each work item type field kind, a work item type for each kind...

type WICountsPerIteration Uses

type WICountsPerIteration struct {
    IterationID string `gorm:"column:iterationid"`
    Total       int
    Closed      int
}

WICountsPerIteration counting work item states by iteration

type WorkItem Uses

type WorkItem struct {
    // unique id per installation (used for references at the DB level)
    ID  uuid.UUID
    // unique number per _space_
    Number int
    // ID of the type of this work item
    Type uuid.UUID
    // Version for optimistic concurrency control
    Version int
    // ID of the space to which this work item belongs
    SpaceID uuid.UUID
    // The field values, according to the field type
    Fields map[string]interface{}
    // contains filtered or unexported fields
}

WorkItem the model structure for the work item.

func ConvertWorkItemStorageToModel Uses

func ConvertWorkItemStorageToModel(wiType *WorkItemType, wi *WorkItemStorage) (*WorkItem, error)

ConvertWorkItemStorageToModel convert work item model to app WI

func (WorkItem) GetETagData Uses

func (wi WorkItem) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (WorkItem) GetLastModified Uses

func (wi WorkItem) GetLastModified() time.Time

GetLastModified returns the last modification time

type WorkItemRepository Uses

type WorkItemRepository interface {
    repository.Exister
    Load(ctx context.Context, spaceID uuid.UUID, wiNumber int) (*WorkItem, error)
    LoadByID(ctx context.Context, id uuid.UUID) (*WorkItem, error)
    LoadBatchByID(ctx context.Context, ids []uuid.UUID) ([]*WorkItem, error)
    LoadByIteration(ctx context.Context, id uuid.UUID) ([]*WorkItem, error)
    LookupIDByNamedSpaceAndNumber(ctx context.Context, ownerName, spaceName string, wiNumber int) (*uuid.UUID, *uuid.UUID, error)
    Save(ctx context.Context, spaceID uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)
    Reorder(ctx context.Context, spaceID uuid.UUID, direction DirectionType, targetID *uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)
    Delete(ctx context.Context, id uuid.UUID, suppressorID uuid.UUID) error
    Create(ctx context.Context, spaceID uuid.UUID, typeID uuid.UUID, fields map[string]interface{}, creatorID uuid.UUID) (*WorkItem, error)
    List(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression, parentExists *bool, start *int, length *int) ([]WorkItem, int, error)
    Fetch(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (*WorkItem, error)
    GetCountsPerIteration(ctx context.Context, spaceID uuid.UUID) (map[string]WICountsPerIteration, error)
    GetCountsForIteration(ctx context.Context, itr *iteration.Iteration) (map[string]WICountsPerIteration, error)
    Count(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (int, error)
}

WorkItemRepository encapsulates storage & retrieval of work items

type WorkItemStorage Uses

type WorkItemStorage struct {
    gormsupport.Lifecycle
    // unique id per installation (used for references at the DB level)
    ID  uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
    // unique number per _space_
    Number int
    // Id of the type of this work item
    Type uuid.UUID `sql:"type:uuid"`
    // Version for optimistic concurrency control
    Version int
    // the field values
    Fields Fields `sql:"type:jsonb"`
    // the position of workitem
    ExecutionOrder float64
    // Reference to one Space
    SpaceID uuid.UUID `sql:"type:uuid"`
    // optional timestamp of the latest addition/removal of a relationship with this workitem
    RelationShipsChangedAt *time.Time `sql:"column:relationships_changed_at"`
}

WorkItemStorage represents a work item as it is stored in the database

func (WorkItemStorage) Equal Uses

func (wi WorkItemStorage) Equal(u convert.Equaler) bool

Equal returns true if two WorkItem objects are equal; otherwise false is returned.

func (WorkItemStorage) TableName Uses

func (wi WorkItemStorage) TableName() string

TableName implements gorm.tabler

type WorkItemType Uses

type WorkItemType struct {
    gormsupport.Lifecycle
    // ID
    ID  uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
    // Name is a human readable name of this work item type
    Name string
    // Description is an optional description of the work item type
    Description *string
    // The CSS icon class to render an icon for the WIT
    Icon string
    // Version for optimistic concurrency control
    Version int
    // the IDs of the parents, separated with a dot (".") separator
    Path string
    // definitions of the fields this work item type supports
    Fields FieldDefinitions `sql:"type:jsonb"`
    // Reference to one Space
    SpaceID uuid.UUID `sql:"type:uuid"`
}

WorkItemType represents a work item type as it is stored in the db

func (WorkItemType) ConvertWorkItemStorageToModel Uses

func (wit WorkItemType) ConvertWorkItemStorageToModel(workItem WorkItemStorage) (*WorkItem, error)

ConvertWorkItemStorageToModel converts a workItem from the storage/persistence layer into a workItem of the model domain layer

func (WorkItemType) Equal Uses

func (wit WorkItemType) Equal(u convert.Equaler) bool

Equal returns true if two WorkItemType objects are equal; otherwise false is returned.

func (WorkItemType) GetETagData Uses

func (wit WorkItemType) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (WorkItemType) GetLastModified Uses

func (wit WorkItemType) GetLastModified() time.Time

GetLastModified returns the last modification time

func (WorkItemType) IsTypeOrSubtypeOf Uses

func (wit WorkItemType) IsTypeOrSubtypeOf(typeID uuid.UUID) bool

IsTypeOrSubtypeOf returns true if the work item type with the given type ID, is of the same type as the current WIT or of it is a subtype; otherwise false is returned.

func (WorkItemType) LtreeSafeID Uses

func (wit WorkItemType) LtreeSafeID() string

LtreeSafeID returns the ID of the work item type in an postgres ltree safe manner. The returned string can be used as an ltree node.

func (WorkItemType) TableName Uses

func (wit WorkItemType) TableName() string

TableName implements gorm.tabler

type WorkItemTypeCache Uses

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

WorkItemTypeCache represents WorkItemType cache

func NewWorkItemTypeCache Uses

func NewWorkItemTypeCache() *WorkItemTypeCache

NewWorkItemTypeCache constructs WorkItemTypeCache

func (*WorkItemTypeCache) Clear Uses

func (c *WorkItemTypeCache) Clear()

Clear clears the cache

func (*WorkItemTypeCache) Get Uses

func (c *WorkItemTypeCache) Get(id uuid.UUID) (WorkItemType, bool)

Get returns WorkItemType by ID. The second value (ok) is a bool that is true if the WorkItemType exists in the cache, and false if not.

func (*WorkItemTypeCache) Put Uses

func (c *WorkItemTypeCache) Put(wit WorkItemType)

Put puts a work item type to the cache

type WorkItemTypeGroup Uses

type WorkItemTypeGroup struct {
    gormsupport.Lifecycle
    ID          uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
    Bucket      TypeBucket
    Name        string      // the name to be displayed to user (is unique)
    TypeList    []uuid.UUID // TODO(kwk): We need to store this outside of this structure in the DB
    DefaultType uuid.UUID   // the work item type that is supposed to be used with the quick add for example.
    Icon        string
    PrevGroupID uuid.UUID
    NextGroupID uuid.UUID
}

WorkItemTypeGroup represents the node in the group of work item types

func TypeGroupByName Uses

func TypeGroupByName(name string) *WorkItemTypeGroup

TypeGroupByName returns a type group based on its name if such a group exists; otherwise nil is returned.

type WorkItemTypeRepository Uses

type WorkItemTypeRepository interface {
    repository.Exister
    Load(ctx context.Context, spaceID uuid.UUID, id uuid.UUID) (*WorkItemType, error)
    Create(ctx context.Context, spaceID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields map[string]FieldDefinition) (*WorkItemType, error)
    CreateFromModel(ctx context.Context, model *WorkItemType) (*WorkItemType, error)
    List(ctx context.Context, spaceID uuid.UUID, start *int, length *int) ([]WorkItemType, error)
    ListPlannerItems(ctx context.Context, spaceID uuid.UUID) ([]WorkItemType, error)
}

WorkItemTypeRepository encapsulates storage & retrieval of work item types

Directories

PathSynopsis
linkPackage link contains the code that provides all the required operations to manage work item link, work item link types and work item link categories.
number_sequence
typegroup

Package workitem imports 31 packages (graph) and is imported by 51 packages. Updated 2017-12-11. Refresh now. Tools for package owners.