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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
74
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
##############################################################################
#
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
# Fabien Morin <fabien.morin@gmail.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.
#
##############################################################################
try:
from Interface import Interface
except ImportError:
# for Zope versions before 2.6.0
from Interface import Base as Interface
class IConduit(Interface):
"""
A conduit is a piece of code in charge of
- updating an object attributes from an XUpdate XML stream
(Conduits are not in charge of creating new objects which
are eventually missing in a synchronisation process)
If an object has be created during a synchronisation process,
the way to proceed consists in:
1- creating an empty instance of the appropriate class
in the appropriate directory
2- updating that empty instance with the conduit
The first implementation of ERP5 synchronisation
will define a default location to create new objects and
a default class. This will be defined at the level of the synchronisation
tool
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
Look carefully when we are adding elements,
for example, when we do 'insert-after', with 2 xupdate:element,
so adding 2 differents objects, actually it adds only XXXX one XXX object
In this case the getSubObjectDepth(), doesn't have
too much sence
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
There is also one problem, when we synchronize a conflict,
we are not waiting
the response of the client, so that we are not sure if it take into account,
we may have CONFLICT_NOT_SYNCHRONIZED AND CONFLICT_SYNCHRONIZED
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
"""
def constructContent(self, object, object_id, portal_type):
"""
This allows to specify how to construct a new content.
This is really usefull if you want to write your
own Conduit.
object: from where new content is created
object_id: id of the new object
portal_type: portal_type of the new object
return newObject, reset_local_roles boolean, reset_workflow boolean
"""
def addNode(self, xml=None, object=None, previous_xml=None,
object_id=None, sub_object=None, force=0, simulate=0, **kw):
"""
A node is added
xml : the xml wich contains what we want to add
object : from where we want to add something
previous_xml : the previous xml of the object, if any
force : apply updates even if there's a conflict
This fucntion returns conflict_list, wich is of the form,
[conflict1,conflict2,...] where conclict1 is of the form :
[object.getPath(),keyword,local_and_actual_value,subscriber_value]
"""
def deleteNode(self, xml=None, object=None, object_id=None, force=None,
simulate=0, **kw):
"""
A node is deleted
"""
def updateNode(self, xml=None, object=None, previous_xml=None, force=0,
simulate=0, **kw):
"""
A node is updated with some xupdate
- xml : the xml corresponding to the update, it should be xupdate
- object : the object on wich we want to apply the xupdate
- [previous_xml] : the previous xml of the object, it is mandatory
when we have sub objects
"""
def getGidFromObject(self, object):
"""
return the Gid composed with the object informations
"""
def getGidFromXML(self, xml, gid_from_xml_list):
"""
return the Gid composed with xml informations
"""