work in progress: task management with work items
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3086 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
eb524ff2c7
commit
2094355d84
3 changed files with 14 additions and 12 deletions
|
@ -452,7 +452,7 @@ class IWorkItem(Interface):
|
||||||
created = Attribute('The timeStamp of the initial creation of the work item.')
|
created = Attribute('The timeStamp of the initial creation of the work item.')
|
||||||
assigned = Attribute('The timeStamp of the assignment of the work item.')
|
assigned = Attribute('The timeStamp of the assignment of the work item.')
|
||||||
predecessor = Attribute('Optional: a work item this work item was created from.')
|
predecessor = Attribute('Optional: a work item this work item was created from.')
|
||||||
continuation = Attribute('Optional: a work item that was created from this one '
|
successor = Attribute('Optional: a work item that was created from this one '
|
||||||
'to continue the work.')
|
'to continue the work.')
|
||||||
newTask = Attribute('Optional: a new task that has been created based '
|
newTask = Attribute('Optional: a new task that has been created based '
|
||||||
'on this work item.')
|
'on this work item.')
|
||||||
|
|
|
@ -47,8 +47,9 @@ def workItemStates():
|
||||||
State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'),
|
State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'),
|
||||||
color='orange'),
|
color='orange'),
|
||||||
State('finished', 'finished', (), color='green'),
|
State('finished', 'finished', (), color='green'),
|
||||||
State('continued', 'continued', (), color='blue'),
|
State('continued', 'continued', ('finish', 'cancel'), color='blue'),
|
||||||
State('transferred', 'transferred', (), color='lightblue'),
|
State('transferred', 'transferred', ('finish', 'cancel'),
|
||||||
|
color='lightblue'),
|
||||||
State('cancelled', 'cancelled', (), color='grey'),
|
State('cancelled', 'cancelled', (), color='grey'),
|
||||||
Transition('assign', 'assign', 'assigned'),
|
Transition('assign', 'assign', 'assigned'),
|
||||||
Transition('start', 'start', 'running'),
|
Transition('start', 'start', 'running'),
|
||||||
|
@ -169,8 +170,8 @@ class WorkItemTrack(WorkItem, Track):
|
||||||
new = workItems.add(self.taskId, self.userName, self.runId, **newData)
|
new = workItems.add(self.taskId, self.userName, self.runId, **newData)
|
||||||
if transition == 'continue':
|
if transition == 'continue':
|
||||||
new.assign()
|
new.assign()
|
||||||
new.data['predecessor'] = self.__name__
|
new.data['predecessor'] = getName(self)
|
||||||
self.data['continuation'] = new.__name__
|
self.data['successor'] = getName(new)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def reindex(self):
|
def reindex(self):
|
||||||
|
@ -178,7 +179,6 @@ class WorkItemTrack(WorkItem, Track):
|
||||||
|
|
||||||
def checkOverwrite(self, kw):
|
def checkOverwrite(self, kw):
|
||||||
for k, v in kw.items():
|
for k, v in kw.items():
|
||||||
#old = data.get(k)
|
|
||||||
old = getattr(self, k, None)
|
old = getattr(self, k, None)
|
||||||
if old is not None and old != v:
|
if old is not None and old != v:
|
||||||
raise ValueError("Attribute '%s' already set to '%s'." % (k, old))
|
raise ValueError("Attribute '%s' already set to '%s'." % (k, old))
|
||||||
|
|
|
@ -23,14 +23,13 @@ $Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from zope.app.container.btree import BTreeContainer
|
|
||||||
from zope.index.field import FieldIndex
|
|
||||||
|
|
||||||
from persistent import Persistent
|
from persistent import Persistent
|
||||||
from BTrees import OOBTree, IOBTree
|
from BTrees import OOBTree, IOBTree
|
||||||
from BTrees.IFBTree import intersection, union
|
from BTrees.IFBTree import intersection, union
|
||||||
|
from zope.interface import implements
|
||||||
|
from zope.app.container.btree import BTreeContainer
|
||||||
|
from zope.index.field import FieldIndex
|
||||||
|
from zope.traversing.interfaces import IPhysicallyLocatable
|
||||||
|
|
||||||
from interfaces import IRun, ITrackingStorage, ITrack
|
from interfaces import IRun, ITrackingStorage, ITrack
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ class Run(object):
|
||||||
|
|
||||||
class Track(Persistent):
|
class Track(Persistent):
|
||||||
|
|
||||||
implements(ITrack)
|
implements(ITrack, IPhysicallyLocatable)
|
||||||
|
|
||||||
metadata_attributes = ('taskId', 'runId', 'userName', 'timeStamp')
|
metadata_attributes = ('taskId', 'runId', 'userName', 'timeStamp')
|
||||||
index_attributes = metadata_attributes
|
index_attributes = metadata_attributes
|
||||||
|
@ -73,6 +72,9 @@ class Track(Persistent):
|
||||||
self.timeStamp = getTimeStamp()
|
self.timeStamp = getTimeStamp()
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
|
def getName(self):
|
||||||
|
return self.__name__
|
||||||
|
|
||||||
def update(self, newData):
|
def update(self, newData):
|
||||||
if not newData:
|
if not newData:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue