work in progress: work items

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3073 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-12-21 11:08:03 +00:00
parent 9f2232e2e3
commit 68e43e152b
5 changed files with 101 additions and 2 deletions

View file

@ -51,7 +51,7 @@ class IMessage(ITemplate):
""" A complex message that may be expanded using instance data. """ A complex message that may be expanded using instance data.
""" """
name = schema.ASCII( name = schema.ASCIILine(
title=_(u'Name'), title=_(u'Name'),
description=_(u'The internal name of the message.'), description=_(u'The internal name of the message.'),
required=True,) required=True,)

View file

@ -52,3 +52,12 @@ Service Management
================== ==================
>>> from cybertools.organize.service import Service >>> from cybertools.organize.service import Service
(See cyberapps.tumsm for comprehensive description and tests.)
Work
====
>>> from cybertools.organize.work import WorkItem

View file

@ -417,3 +417,36 @@ class IJobManager(Interface):
""" Do what has to be done... """ Do what has to be done...
""" """
# work
class IWorkItem(Interface):
""" A single piece of work, started and finished at a certain time,
done by exactly one party (usually a person).
"""
task = Attribute('The task this work item belongs to.')
runId = Attribute('Used for recurring tasks: identifies the run '
'(execution instance) of the task the work item belongs to.')
party = Attribute('Whoever does the work, usually a person.')
state = Attribute('The current state the work item is in.')
comment = Attribute('A note about what has been done, and why...')
# optional plan fields; duration (and effort) may be derived from start and end
planStart = Attribute('When the work should start.')
planEnd = Attribute('When the work should be finished.')
planDuration = Attribute('How long it may take to finish the work.')
planEffort = Attribute('How much effort (time units) it might take '
'to finish the work.')
# real stuff; duration (and effort) may be derived from start and end
start = Attribute('When the work was started.')
end = Attribute('When the work was finished.')
duration = Attribute('How long it took to finish the work.')
effort = Attribute('How much effort (time units) it took to finish the work.')
# work item handling
creator = Attribute('The party that has set up the work item.')
predecessor = Attribute('Optional: a work item this work item was created from.')
continuation = Attribute('Optional: a work item that was created from this one '
'to continue the work.')
newTask = Attribute('Optional: a new task that has been created based '
'on this work item.')

58
organize/work.py Normal file
View file

@ -0,0 +1,58 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Planning and recording activities (work items).
$Id$
"""
from zope.component import adapts
from zope.interface import implementer, implements
from cybertools.organize.interfaces import IWorkItem
from cybertools.stateful.base import Stateful
from cybertools.stateful.definition import StatesDefinition
from cybertools.stateful.definition import State, Transition
from cybertools.stateful.interfaces import IStatesDefinition
@implementer(IStatesDefinition)
def workItemStates():
return StatesDefinition('workItemStates',
State('created', 'created', ('assign', 'cancel',), color='red'),
State('assigned', 'assigned', ('start', 'finish', 'cancel', 'transfer'),
color='yellow'),
State('running', 'running', ('finish',), color='green'),
State('finished', 'finished', (), color='blue'),
State('transferred', 'transferred', (), color='grey'),
State('cancelled', 'cancelled', (), color='grey'),
Transition('assign', 'assign', 'assigned'),
Transition('start', 'start', 'running'),
Transition('finish', 'finish', 'finished'),
Transition('transfer', 'transfer', 'transferred'),
Transition('cancel', 'cancel', 'cancelled'),
initialState='created')
class WorkItem(Stateful):
implements(IWorkItem)
statesDefinition = 'organize.workItemStates'

View file

@ -24,7 +24,6 @@ $Id$
from zope.interface import implementer from zope.interface import implementer
from cybertools.stateful.definition import registerStatesDefinition
from cybertools.stateful.definition import StatesDefinition from cybertools.stateful.definition import StatesDefinition
from cybertools.stateful.definition import State, Transition from cybertools.stateful.definition import State, Transition
from cybertools.stateful.interfaces import IStatesDefinition from cybertools.stateful.interfaces import IStatesDefinition