[Erp5-report] r27509 - in /erp5/trunk/products/ERP5: Document/ interfaces/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 11 08:37:11 CEST 2009


Author: jp
Date: Thu Jun 11 08:37:10 2009
New Revision: 27509

URL: http://svn.erp5.org?rev=27509&view=rev
Log:
Updated interface definition for business process related classes

Added:
    erp5/trunk/products/ERP5/interfaces/arrow_base.py
      - copied, changed from r27398, erp5/trunk/products/ERP5/interfaces/arrow.py
Modified:
    erp5/trunk/products/ERP5/Document/BusinessPath.py
    erp5/trunk/products/ERP5/Document/BusinessProcess.py
    erp5/trunk/products/ERP5/Document/BusinessState.py
    erp5/trunk/products/ERP5/interfaces/business_buildable.py
    erp5/trunk/products/ERP5/interfaces/business_state.py

Modified: erp5/trunk/products/ERP5/Document/BusinessPath.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessPath.py?rev=27509&r1=27508&r2=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -39,39 +40,27 @@
 class BusinessPath(Path):
   """
     The BusinessPath class embeds all information related to 
-    lead times and parties involved at a give phase of a business
+    lead times and parties involved at a given phase of a business
     process.
 
-    BusinessPath are also used as helper to build buildable movements.
-    Here is the typical code of an alarm:
-   
-    Approach 1: explanation per explanation
-      builder = portal_deliveries.default_order_builder
-      for path in builder.getSpecialiseRelatedValueList() # or wharever category
-        for explanation in portal_catalog(buildable=1, portal_type='Order'):
-          path.build(explanation)
-
-      Pros: easy explanation based approach
-      Cons: buildable column added in delivery table
-            reexpand of a finished order might generate remaining buildable
-
-    Approach 2: isBuildable is indexed for SimulationMovements
-      isBuildable() method is added to SimulationMovement
-
-      Pros: global select is possible
-      Cons: reindex of simulation is required
-            slow indexing
-
-    Approach 3: isBuildable is invoked during build "after select" process
+    BusinessPath are also used as helper to build deliveries from
+    buildable movements. Here is the typical code of an alarm
+    in charge of the building process.
+
+    The idea is to invoke isBuildable() on the collected simulation
+    movements (which are orphan) during build "after select" process
+
       builder = portal_deliveries.default_order_builder
       for path in builder.getSpecialiseRelatedValueList() # or wharever category
         builder.build(causality_uid=path.getUid(),) # Select movemenents
 
-      Pros: global select is possible
-      Cons: global select retrieves long lists
-            slow build
-
-     Method 3 is best
+      Pros: global select is possible by not providing a causality_uid
+      Cons: global select retrieves long lists of orphan movements which 
+              are not yet buildable
+            the build process could be rather slow or require activities
+
+    TODO:
+      - finish build process implementation
   """
   meta_type = 'ERP5 Business Path'
   portal_type = 'Business Path'
@@ -95,16 +84,20 @@
 
   # Declarative interfaces
   zope.interface.implements(interfaces.ICategoryAccessProvider,
-                            interfaces.IArrow)
-
-  # IBusinessPath Interface
+                            interfaces.IArrowBase,
+                            interfaces.IBusinessPath,
+                            interfaces.IBusinessBuildable,
+                            interfaces.IBusinessCompletable
+                            )
+
+  # IArrowBase implementation
   security.declareProtected(Permissions.AccessContentsInformation, 'getSourceBaseCategoryList')
   def getSourceBaseCategoryList(self):
     """
       Returns all categories which are used to define the source
       of this Arrow
     """
-    # Naive implementation - we must use category groups instead
+    # Naive implementation - we must use category groups instead - XXX
     return ('source', 'source_section', 'source_payment', 'source_project', )
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationBaseCategoryList')
@@ -113,7 +106,7 @@
       Returns all categories which are used to define the destination
       of this Arrow
     """
-    # Naive implementation - we must use category groups instead
+    # Naive implementation - we must use category groups instead - XXX
     return ('destination', 'destination_section', 'destination_payment', 'destination_project', )
 
   # ICategoryAccessProvider overriden methods
@@ -172,7 +165,7 @@
       return method(context)
     return []
 
-  # Core API
+  # IBusinessBuildable implementation
   def isBuildable(self, explanation):
     """
     """
@@ -192,13 +185,24 @@
       Not sure if this will exist some day XXX
     """
 
-  def _getRelatedSimulationMovementList(self, explanation):
+  def build(self, explanation):
+    """
+      Build
+    """
+    builder_list = self.getBuilderList() # Missing method
+    for builder in builder_list:
+      builder.build(causality_uid=self.getUid()) # This is one way of doing
+      builder.build(movement_relative_url_list=
+        self._getRelatedSimulationMovementList(explanation)) # Another way
+
+  def _getRelatedSimulationMovementList(self, explanation): # XXX - What API ?
     """
       
     """
     return self.getCausalityRelatedValueList(portal_type='Simulation Movement',
                                              explanation_uid=explanation.getUid())
 
+  # IBusinessCompletable implementation
   def isCompleted(self, explanation):
     """
       Looks at all simulation related movements
@@ -234,17 +238,7 @@
         return False
     return True
 
-  def build(self, explanation):
-    """
-      Build
-    """
-    builder_list = self.getBuilderList() # Missing method
-    for builder in builder_list:
-      builder.build(causality_uid=self.getUid()) # This is one way of doing
-      builder.build(movement_relative_url_list=
-        self._getRelatedSimulationMovementList(explanation)) # Another way
-
-  # Date calculation
+  # IBusinessPath implementation
   def getExpectedStartDate(self, explanation, predecessor_date=None, *args, **kwargs):
     """
       Returns the expected start date for this

Modified: erp5/trunk/products/ERP5/Document/BusinessProcess.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessProcess.py?rev=27509&r1=27508&r2=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -34,11 +35,16 @@
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5.Document.Path import Path
 
+import zope.interface
+
 class BusinessProcess(Path, XMLObject):
   """
     The BusinessProcess class is a container class which is used
     to describe business processes in the area of trade, payroll
     and production.
+
+    TODO:
+      - finish interface implementation
   """
   meta_type = 'ERP5 Business Process'
   portal_type = 'Business Process'
@@ -58,6 +64,10 @@
                     , PropertySheet.Arrow
                     , PropertySheet.BusinessProcess
                     )
+
+  # Declarative interfaces
+  zope.interface.implements(interfaces.IBusinessProcess,
+                            interfaces.IArrowBase)
 
   # Access to path and states of the business process
   security.declareProtected(Permissions.AccessContentsInformation, 'getPathValueList')
@@ -180,10 +190,10 @@
     for path in self.getBuildablePathValueList(explanation):
       path.build(explanation)
 
-  def isStartDateReferential(self):
+  def isStartDateReferential(self): # XXX - not in interface
     return self.getReferentialDate() == 'start_date'
 
-  def isStopDateReferential(self):
+  def isStopDateReferential(self): # XXX - not in interface
     return self.getReferentialDate() == 'stop_date'
 
   def getTradePhaseList(self):

Modified: erp5/trunk/products/ERP5/Document/BusinessState.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessState.py?rev=27509&r1=27508&r2=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessState.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessState.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -33,11 +34,13 @@
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
 from Products.ERP5Type.XMLObject import XMLObject
 
+import zope.interface
+
 class BusinessState(XMLObject):
   """
-    The BusinessProcess class is a container class which is used
-    to describe business processes in the area of trade, payroll
-    and production.
+    The BusinessState class defines the various states in 
+    a Business Process. It defines the synchronisation milestones
+    between movements related to the trade phases of business.
   """
   meta_type = 'ERP5 Business State'
   portal_type = 'Business State'
@@ -55,7 +58,11 @@
                     , PropertySheet.Comment
                     )
 
-  # Core API
+  # Declarative interfaces
+  zope.interface.implements(interfaces.IBusinessState
+                            )
+
+  # IBusinessCompletable implementation
   def isCompleted(self, explanation):
     """
       If all path which reach this state are completed
@@ -77,7 +84,7 @@
         return False
     return True
 
-  # Duration calculation
+  # IBusinessCompletable - duration calculation
   def getExpectedCompletionDate(self, explanation, *args, **kwargs):
     """
       Returns the expected completion date for this

Copied: erp5/trunk/products/ERP5/interfaces/arrow_base.py (from r27398, erp5/trunk/products/ERP5/interfaces/arrow.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/arrow_base.py?p2=erp5/trunk/products/ERP5/interfaces/arrow_base.py&p1=erp5/trunk/products/ERP5/interfaces/arrow.py&r1=27398&r2=27509&rev=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/arrow.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/arrow_base.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -28,10 +29,11 @@
 
 from zope.interface import Interface
 
-class IArrow(Interface):
-  """The Arrow lists the methods which are available to 
-  access all source and destination categories of
-  a movement or of a delivery.
+class IArrowBase(Interface):
+  """Arrow Base interface specification
+
+  Defines methods to get the list of base categories
+  which define the source and destination of an Arrow
   """
   def getSourceArrowBaseCategoryList():
     """Returns all categories which are used to define the source

Modified: erp5/trunk/products/ERP5/interfaces/business_buildable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/business_buildable.py?rev=27509&r1=27508&r2=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/business_buildable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/business_buildable.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -30,6 +31,10 @@
 
 class IBusinessBuildable(Interface):
   """Business Buildable interface specification
+
+  TODO:
+    - is isFrozen useful ? is it the same as isCompleted ?
+    - why isFrozen is here and not in Completable
   """
   def isBuildable(explanation):
     """Returns True if any of the related Simulation Movement

Modified: erp5/trunk/products/ERP5/interfaces/business_state.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/business_state.py?rev=27509&r1=27508&r2=27509&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/business_state.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/business_state.py [utf8] Thu Jun 11 08:37:10 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -30,4 +31,7 @@
 
 class IBusinessState(IBusinessCompletable):
   """Business State interface specification
+  
+  TODO:
+    - add methods if any or remove if nothing specific to Business State
   """




More information about the Erp5-report mailing list