Commit a11be0e6 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Domain / Predicate API refactoring


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3278 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2eae4c8
...@@ -71,7 +71,6 @@ class AmountFilter(MappedValue, Amount): ...@@ -71,7 +71,6 @@ class AmountFilter(MappedValue, Amount):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Amount , PropertySheet.Amount
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
) )
......
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# 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.
#
##############################################################################
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Document.Folder import Folder
class BaseDomain(Folder):
"""
Base Domain is the root of a tree of domains which can be used
as nodes in a report tree of ListBox
Domain can be used as MetaNodes or MetaResources. For example,
a Domain viewed as a MetaNode can search for all emerging movements
and compare it with its capacity.
"""
meta_type = 'ERP5 Base Domain'
portal_type = 'Base Domain'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.DublinCore
, PropertySheet.CategoryCore
)
...@@ -34,7 +34,6 @@ from AccessControl import ClassSecurityInfo ...@@ -34,7 +34,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5.Document.Domain import Domain
from Products.ERP5.Variated import Variated from Products.ERP5.Variated import Variated
from zLOG import LOG from zLOG import LOG
......
...@@ -63,7 +63,6 @@ class ContainerCell(DeliveryCell): ...@@ -63,7 +63,6 @@ class ContainerCell(DeliveryCell):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
......
...@@ -68,7 +68,6 @@ class DeliveryCell(MappedValue, Movement): ...@@ -68,7 +68,6 @@ class DeliveryCell(MappedValue, Movement):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
......
...@@ -31,12 +31,16 @@ from AccessControl import ClassSecurityInfo ...@@ -31,12 +31,16 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.MetaResource import MetaResource
from Products.ERP5.Document.MetaNode import MetaNode
from Products.ERP5.Document.Predicate import Predicate from Products.ERP5.Document.Predicate import Predicate
class Domain(Predicate): class Domain(Predicate, MetaNode, MetaResource):
""" """
An abstract class subclassed by reports and mapped values Domain can be used as MetaNodes or MetaResources. For example,
a Domain viewed as a MetaNode can search for all emerging movements
and compare it with its capacity.
Structure is: Structure is:
- base domain (like base category) - base domain (like base category)
- sub domain (like category) - sub domain (like category)
...@@ -63,8 +67,8 @@ class Domain(Predicate): ...@@ -63,8 +67,8 @@ class Domain(Predicate):
meta_type = 'ERP5 Domain' meta_type = 'ERP5 Domain'
portal_type = 'Domain' portal_type = 'Domain'
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isPortalContent = 0 isPortalContent = 1
isRADContent = 0 isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# 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.
#
##############################################################################
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base
class DomainGenerator(Base):
"""
A Domain Generator uses a method (SQL, Python) to select objects
which are then wrapped as Virtual Domains. This can be used for
example to provide the list the 10 best selling shops to
a report tree.
"""
meta_type = 'ERP5 Domain Generator'
portal_type = 'Domain Generator'
isPortalContent = 1
isRADContent = 1
...@@ -63,7 +63,6 @@ class InventoryCell(DeliveryCell): ...@@ -63,7 +63,6 @@ class InventoryCell(DeliveryCell):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
......
...@@ -66,7 +66,6 @@ class InvoiceCell(DeliveryCell): ...@@ -66,7 +66,6 @@ class InvoiceCell(DeliveryCell):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ValueAddedTax , PropertySheet.ValueAddedTax
, PropertySheet.EcoTax , PropertySheet.EcoTax
......
...@@ -32,12 +32,12 @@ from AccessControl import ClassSecurityInfo ...@@ -32,12 +32,12 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import UpperCase
from Products.ERP5.Document.Domain import Domain from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
from zLOG import LOG from zLOG import LOG
class MappedValue(Domain, Amount): class MappedValue(Predicate, Amount):
""" """
A MappedValue allows to associate a value to a domain A MappedValue allows to associate a value to a domain
...@@ -73,7 +73,6 @@ class MappedValue(Domain, Amount): ...@@ -73,7 +73,6 @@ class MappedValue(Domain, Amount):
, PropertySheet.SimpleItem , PropertySheet.SimpleItem
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
) )
...@@ -132,7 +131,7 @@ identify a bank account.""" ...@@ -132,7 +131,7 @@ identify a bank account."""
self._setProperty('mapped_value_property', kw['mapped_value_property']) self._setProperty('mapped_value_property', kw['mapped_value_property'])
if kw.has_key('mapped_value_property_set'): if kw.has_key('mapped_value_property_set'):
self._setProperty('mapped_value_property_set', kw['mapped_value_property_set']) self._setProperty('mapped_value_property_set', kw['mapped_value_property_set'])
Domain._edit(self, REQUEST=REQUEST, force_update = force_update, **kw) Predicate._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
security.declareProtected( Permissions.AccessContentsInformation, 'getProperty' ) security.declareProtected( Permissions.AccessContentsInformation, 'getProperty' )
def getProperty(self, key, d=None): def getProperty(self, key, d=None):
...@@ -152,7 +151,7 @@ identify a bank account.""" ...@@ -152,7 +151,7 @@ identify a bank account."""
# return None # return None
# Standard accessor # Standard accessor
try: try:
result = Domain.getProperty(self, key, d=d) result = Predicate.getProperty(self, key, d=d)
except: except:
result = None result = None
return result return result
......
...@@ -66,7 +66,6 @@ class PaySheetCell(InvoiceCell): ...@@ -66,7 +66,6 @@ class PaySheetCell(InvoiceCell):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ValueAddedTax , PropertySheet.ValueAddedTax
, PropertySheet.EcoTax , PropertySheet.EcoTax
......
...@@ -62,7 +62,6 @@ class ProductionReportCell(DeliveryCell): ...@@ -62,7 +62,6 @@ class ProductionReportCell(DeliveryCell):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Domain
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
......
...@@ -37,7 +37,7 @@ from Products.ERP5Type.Utils import asList, keepIn, rejectIn ...@@ -37,7 +37,7 @@ from Products.ERP5Type.Utils import asList, keepIn, rejectIn
from Products.ERP5.Variated import Variated from Products.ERP5.Variated import Variated
from Products.ERP5.Document.Domain import Domain from Products.ERP5.Document.Predicate import Predicate
from Globals import InitializeClass from Globals import InitializeClass
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
...@@ -46,7 +46,7 @@ import string ...@@ -46,7 +46,7 @@ import string
from Products.CMFCategory.Renderer import Renderer from Products.CMFCategory.Renderer import Renderer
from zLOG import LOG from zLOG import LOG
class Transformation(XMLObject, Domain, Variated): class Transformation(XMLObject, Predicate, Variated):
""" """
Build of material - contains a list of transformed resources Build of material - contains a list of transformed resources
...@@ -72,7 +72,7 @@ class Transformation(XMLObject, Domain, Variated): ...@@ -72,7 +72,7 @@ class Transformation(XMLObject, Domain, Variated):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.VariationRange , PropertySheet.VariationRange
, PropertySheet.Domain , PropertySheet.Predicate
#, PropertySheet.Resource #, PropertySheet.Resource
, PropertySheet.TransformedResource , PropertySheet.TransformedResource
, PropertySheet.Path , PropertySheet.Path
......
...@@ -66,9 +66,3 @@ class Predicate(Interface): ...@@ -66,9 +66,3 @@ class Predicate(Interface):
""" """
pass pass
def getOperatorList(self):
"""
A Predicate can use a built-in operator
"""
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment