cybertools/organize
helmutm 8572156c11 work in progress: work item (task) management
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3080 fd906abe-77d9-0310-91a1-e0d9ade77398
2008-12-22 21:49:43 +00:00
..
browser added cybertools.agent package (work in progress...) 2008-02-23 14:07:15 +00:00
locales provide a separate translation domain for cybertools.organize + first German translations 2008-12-01 10:21:39 +00:00
__init__.py created 'cybertools.organize' package, removed 'cybertools.contact', moved imports (in testing code only) of the latter package to the former one. 2006-05-10 16:10:51 +00:00
configure.zcml work in progress: work item (task) management 2008-12-22 12:41:20 +00:00
interfaces.py work in progress: work item (task) management 2008-12-22 21:49:43 +00:00
party.py allow hiding of controller macros, e.g. portlets 2008-10-17 09:38:41 +00:00
README.txt work in progress: work item (task) management 2008-12-22 21:49:43 +00:00
service.py added some TODO notes... 2007-12-04 12:51:42 +00:00
task.py extend composer.schema for better support of customized schema factories 2008-02-12 11:40:12 +00:00
tests.py created 'cybertools.organize' package, removed 'cybertools.contact', moved imports (in testing code only) of the latter package to the former one. 2006-05-10 16:10:51 +00:00
work.py work in progress: work item (task) management 2008-12-22 21:49:43 +00:00

==================================================
Organizations: Persons, Institutions, Addresses...
==================================================

  ($Id$)

  >>> from zope import component


Persons and Addresses
=====================

Let's start with a Person:

  >>> from cybertools.organize.party import Person
  >>> john = Person(u'Smith')
  >>> john.lastName
  u'Smith'
  >>> john.firstName
  u''
  >>> john.birthDate is None
  True
  >>> john.addresses
  {}

A Person object knows the age of the person:

  >>> john.age is None
  True
  >>> from datetime import date
  >>> john.birthDate = date(1980, 3, 25)
  >>> now = date(2006, 5, 12)
  >>> john.ageAt(now)
  26
  >>> john.age >= 26
  True

  >>> john.firstName = u'John'
  >>> john.firstName
  u'John'

Addresses
---------

Let's create an address and assign it to a person:

  >>> from cybertools.organize.party import Address
  >>> addr = Address(u'New York', u'Broadway 1')
  >>> john.addresses['standard'] = addr
  >>> john.addresses['standard'].street
  u'Broadway 1'


Tasks
=====

  >>> from cybertools.organize.task import Task


Service Management
==================

  >>> from cybertools.organize.service import Service

(See cyberapps.tumsm for comprehensive description and tests.)


Work
====

Work items are stored in a tracking storage; in order to conveniently access
the work items we have to provide an adapter to the tracking storage.

  >>> from cybertools.tracking.btree import TrackingStorage
  >>> from cybertools.organize.interfaces import IWorkItems
  >>> from cybertools.organize.work import WorkItemTrack, WorkItems
  >>> component.provideAdapter(WorkItems)

The individual work item (a track) is carrying a state attribute that is
governed by a special states definition. We have to register this states
definition as a utility.

  >>> from cybertools.organize.work import workItemStates
  >>> component.provideUtility(workItemStates(), name='organize.workItemStates')

We are now ready to set up the tracking storage.

  >>> tracks = TrackingStorage(trackFactory=WorkItemTrack)
  >>> workItems = component.getAdapter(tracks, IWorkItems)

The work management only deals with the IDs or names of tasks and persons,
so we do not have to set up real objects.

  >>> wi01 = workItems.add('001', 'john')
  >>> wi01
  <WorkItem ['001', 1, 'john', '...', 'created']:
   {'created': ..., 'creator': 'john'}>

Properties that have not been set explicitly default to None; properties
not specified in the IWorkItem interface will lead to an AttributeError.

  >>> wi01.description is None
  True
  >>> wi01.something
  Traceback (most recent call last):
  ...
  AttributeError: something

Certain (not all) properties may be set after creation.

  >>> wi01.setInitData(planStart=1229955772, planDuration=600, party='jim')
  >>> wi01
  <WorkItem ['001', 1, 'jim', '2008-12-22 14:22', 'created']:
   {'created': ..., 'planEnd': 1229956372, 'planDuration': 600,
    'planStart': 1229955772, 'creator': 'john', 'planEffort': 600}>

Change work item states
-----------------------

  >>> wi01.assign()
  >>> wi01.state
  'assigned'

  >>> wi01.startWork(start=1229958000)
  >>> wi01
  <WorkItem ['001', 1, 'jim', '2008-12-22 15:00', 'running']:
   {'created': ..., 'planEnd': 1229956372, 'start': 1229958000,
    'assigned': ..., 'planDuration': 600, 'planStart': 1229955772,
    'creator': 'john', 'planEffort': 600}>