Arrow.py 20.2 KB
Newer Older
Jean-Paul Smets's avatar
Jean-Paul Smets committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
##############################################################################
#
# 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.
#
##############################################################################

29
from Products.CMFCore.Expression import Expression
Jean-Paul Smets's avatar
Jean-Paul Smets committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

class Arrow:
    """
        Properties which allow to define a generic Arrow. Arrows are
        used by Path and Movements to define a source and a destination
        with attributes (payment, decision, etc.) which allow to qualify
        a movement
    """

    _properties = (
        # Source reference
        {   'id'          : 'source_relative_url',
            'description' : 'The titles of the destination of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source',),
45
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceRelativeUrl', ),
            'mode'        : 'w' },
        {   'id'          : 'source_person_title',
            'description' : 'The title of the source person of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source',),
            'acquisition_portal_type'       : ('Person'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'r' },
        {   'id'          : 'source_organisation_title',
            'description' : 'The title of the source organisation of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source',),
            'acquisition_portal_type'       : ('Organisation'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'r' },
        # Destination reference
        {   'id'          : 'destination_relative_url',
            'description' : 'The titles of the destination of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination',),
74
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationRelativeUrl', ),
            'mode'        : 'w' },
        {   'id'          : 'destination_person_title',
            'description' : 'The title of the destination person of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination',),
            'acquisition_portal_type'       : ('Person'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'r' },
        {   'id'          : 'destination_organisation_title',
            'description' : 'The title of the destination organisation of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination',),
            'acquisition_portal_type'       : ('Organisation'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'r' },
        # Source decision reference
        {   'id'          : 'source_decision_relative_url',
            'description' : 'The titles of the source decision of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_decision',),
103
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
104 105 106 107 108 109 110 111 112 113
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceDecisionRelativeUrl', ),
            'mode'        : 'w' },
        # Destination decision reference
        {   'id'          : 'destination_decision_relative_url',
            'description' : 'The titles of the destination decision of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_decision',),
114
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
115 116 117 118 119 120 121 122 123 124
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationDecisionRelativeUrl', ),
            'mode'        : 'w' },
        # Source section reference
        {   'id'          : 'source_section_relative_url',
            'description' : 'The titles of the source section of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_section',),
125
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
126 127 128 129 130 131 132 133 134 135
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceSectionRelativeUrl', ),
            'mode'        : 'w' },
        # Destination section reference
        {   'id'          : 'destination_section_relative_url',
            'description' : 'The titles of the destination section of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_section',),
136
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
137 138 139 140 141 142 143 144 145 146
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationSectionRelativeUrl', ),
            'mode'        : 'w' },
        # Source administration reference
        {   'id'          : 'source_administration_relative_url',
            'description' : 'The titles of the source administration of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_administration',),
147
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
148 149 150 151 152 153 154 155 156 157
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceAdministrationRelativeUrl', ),
            'mode'        : 'w' },
        # Destination administration reference
        {   'id'          : 'destination_administration_relative_url',
            'description' : 'The titles of the destination administration of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_administration',),
158
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
159 160 161 162 163 164 165 166 167 168
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'alt_accessor_id'               : ('_categoryGetDestinationAdministrationRelativeUrl', ),
            'acquisition_depends'           : None,
            'mode'        : 'w' },
        # Source payment reference
        {   'id'          : 'source_payment_relative_url',
            'description' : 'The titles of the source payment of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_payment',),
169
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
170 171 172 173 174 175 176 177 178 179
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourcePaymentRelativeUrl', ),
            'mode'        : 'w' },
        # Destination payment reference
        {   'id'          : 'destination_payment_relative_url',
            'description' : 'The titles of the destination payment of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_payment',),
180
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationPaymentRelativeUrl', ),
            'mode'        : 'w' },
        # more properties to make the difference between person and organisation
        {   'id'          : 'destination_decision_person_title',
            'description' : 'The title of the destination decision person of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_decision',),
            'acquisition_portal_type'       : 'Person',
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'w' },
        {   'id'          : 'destination_decision_organisation_title',
            'description' : 'The title of the destination decision organisation of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_decision',),
            'acquisition_portal_type'       : 'Organisation',
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'w' },
        {   'id'          : 'destination_administration_person_title',
            'description' : 'The title of the destination administration person of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_administration',),
            'acquisition_portal_type'       : 'Person',
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'w' },
        {   'id'          : 'destination_administration_organisation_title',
            'description' : 'The title of the destination administration organisation of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_administration',),
            'acquisition_portal_type'       : 'Organisation',
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getTitle',
            'acquisition_depends'           : None,
            'mode'        : 'w' },
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
        # Source trade reference
        {   'id'          : 'source_trade_relative_url',
            'description' : 'The titles of the source trade of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_trade',),
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceProjectRelativeUrl', ),
            'mode'        : 'w' },
        # Destination trade reference
        {   'id'          : 'destination_trade_relative_url',
            'description' : 'The titles of the destination trade of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_trade',),
            'acquisition_portal_type'       : Expression('python: portal.getPortalNodeTypeList()'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationProjectRelativeUrl', ),
            'mode'        : 'w' },
245 246 247 248 249
        # Source project reference
        {   'id'          : 'source_project_relative_url',
            'description' : 'The titles of the source project of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_project',),
250
            'acquisition_portal_type'       : Expression('python: portal.getPortalProjectTypeList()'),
251 252 253 254 255 256 257 258 259 260
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceProjectRelativeUrl', ),
            'mode'        : 'w' },
        # Destination project reference
        {   'id'          : 'destination_project_relative_url',
            'description' : 'The titles of the destination project of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_project',),
261
            'acquisition_portal_type'       : Expression('python: portal.getPortalProjectTypeList()'),
262 263 264 265 266
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationProjectRelativeUrl', ),
            'mode'        : 'w' },
Jean-Paul Smets's avatar
Jean-Paul Smets committed
267 268 269 270 271
        # Source function reference
        {   'id'          : 'source_function_relative_url',
            'description' : 'The titles of the source function of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_function',),
272
            'acquisition_portal_type'       : ('Category',),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
273 274 275 276 277 278 279 280 281 282
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceFunctionRelativeUrl', ),
            'mode'        : 'w' },
        # Destination function reference
        {   'id'          : 'destination_function_relative_url',
            'description' : 'The titles of the destination function of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_function',),
283
            'acquisition_portal_type'       : ('Category',),
Jean-Paul Smets's avatar
Jean-Paul Smets committed
284 285 286 287 288
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationFunctionRelativeUrl', ),
            'mode'        : 'w' },
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
        # Source transport reference
        {   'id'          : 'source_transport_relative_url',
            'description' : 'The titles of the source transport of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_transport',),
            'acquisition_portal_type'       : Expression('python: portal.getPortalOrderTypeList()'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceTransportRelativeUrl', ),
            'mode'        : 'w' },
        # Destination transport reference
        {   'id'          : 'destination_transport_relative_url',
            'description' : 'The titles of the destination transport of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_transport',),
            'acquisition_portal_type'       : Expression('python: portal.getPortalOrderTypeList()'),
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationTransportRelativeUrl', ),
            'mode'        : 'w' },
311 312 313 314 315
        # Source advice, use for the consultant who helps taking the decision
        {   'id'          : 'source_advice_relative_url',
            'description' : 'The titles of the source advice of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('source_advice',),
316 317
            'acquisition_portal_type'       : Expression('python: \
                                                portal.getPortalNodeTypeList()'),
318 319 320 321 322 323 324 325 326 327
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetSourceAdviceRelativeUrl', ),
            'mode'        : 'w' },
        # Destination advice
        {   'id'          : 'destination_advice_relative_url',
            'description' : 'The titles of the destination advice of this movement',
            'type'        : 'string',
            'acquisition_base_category'     : ('destination_advice',),
328 329
            'acquisition_portal_type'       : Expression('python: \
                                                portal.getPortalNodeTypeList()'),
330 331 332 333 334
            'acquisition_copy_value'        : 0,
            'acquisition_accessor_id'       : 'getRelativeUrl',
            'acquisition_depends'           : None,
            'alt_accessor_id'               : ('_categoryGetDestinationAdviceRelativeUrl', ),
            'mode'        : 'w' },
335
   )
Jean-Paul Smets's avatar
Jean-Paul Smets committed
336 337 338

    _categories = ( 'source', 'destination',
                    'source_section', 'destination_section',
Jean-Paul Smets's avatar
Jean-Paul Smets committed
339
                    'source_decision', 'destination_decision',
Jean-Paul Smets's avatar
Jean-Paul Smets committed
340
                    'source_administration', 'destination_administration',
341
                    'source_payment', 'destination_payment',
342
                    'source_trade', 'destination_trade',
Alexandre Boeglin's avatar
Alexandre Boeglin committed
343
                    'source_function', 'destination_function',
344
                    'source_project', 'destination_project',
Jean-Paul Smets's avatar
Jean-Paul Smets committed
345 346
                    'source_carrier', 'destination_carrier',
                    'source_referral', 'destination_referral',
347
                    'source_account', 'destination_account',
348 349
                    'source_advice', 'destination_advice',
                    'source_transport', 'destination_transport',
350 351
                    # Virtual categories
                    'source_region', 'destination_region',
352
                    'source_payment_region', 'destination_payment_region',
353
                    )