From 68e43e152b6ca1b5b66994b3b56555d67e4b4572 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 21 Dec 2008 11:08:03 +0000 Subject: [PATCH] work in progress: work items git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3073 fd906abe-77d9-0310-91a1-e0d9ade77398 --- composer/message/interfaces.py | 2 +- organize/README.txt | 9 ++++++ organize/interfaces.py | 33 +++++++++++++++++++ organize/work.py | 58 ++++++++++++++++++++++++++++++++++ stateful/publishing.py | 1 - 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 organize/work.py diff --git a/composer/message/interfaces.py b/composer/message/interfaces.py index 5c18e19..768e21b 100644 --- a/composer/message/interfaces.py +++ b/composer/message/interfaces.py @@ -51,7 +51,7 @@ class IMessage(ITemplate): """ A complex message that may be expanded using instance data. """ - name = schema.ASCII( + name = schema.ASCIILine( title=_(u'Name'), description=_(u'The internal name of the message.'), required=True,) diff --git a/organize/README.txt b/organize/README.txt index dca6b51..39ecde6 100644 --- a/organize/README.txt +++ b/organize/README.txt @@ -52,3 +52,12 @@ Service Management ================== >>> from cybertools.organize.service import Service + +(See cyberapps.tumsm for comprehensive description and tests.) + + +Work +==== + + >>> from cybertools.organize.work import WorkItem + diff --git a/organize/interfaces.py b/organize/interfaces.py index 74f504d..49f74f2 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -417,3 +417,36 @@ class IJobManager(Interface): """ 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.') + diff --git a/organize/work.py b/organize/work.py new file mode 100644 index 0000000..274073b --- /dev/null +++ b/organize/work.py @@ -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' + diff --git a/stateful/publishing.py b/stateful/publishing.py index 5b376e3..b30c1fe 100644 --- a/stateful/publishing.py +++ b/stateful/publishing.py @@ -24,7 +24,6 @@ $Id$ from zope.interface import implementer -from cybertools.stateful.definition import registerStatesDefinition from cybertools.stateful.definition import StatesDefinition from cybertools.stateful.definition import State, Transition from cybertools.stateful.interfaces import IStatesDefinition