with

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

【载录】如何处理Lotus的复制与保存冲突-冲突文档的处理

问题:

运行在服务器上以及有多个复本的数据库难免会出现复制与保存冲突的情况。如何处理这种情况是所有Notes管理员和设计者都要面对的问题。

复制与保存冲突可由以下原因造成:

在两次复制之间,如果有两个用户同时编辑或多个用户编辑了不同数据库复本上的相同文档,就会出现复制冲突。

如果有两个或多个用户同时编辑同一个数据库的同一个文档,则会出现保存冲突。

解决方法:

一、可以在表单属性框中的基本付签选中:“合并复制冲突”,并知底功能表单基本付签中的版本选项。

二、在这里介绍一些和处理复制与保存冲突情况有关的方法与技巧:

1、创建列出所有冲突文档的视图:(VewConflict)

冲突文档都包含一个名为“$Conflict”的域,因此可以用下面的试图选择公式列出所有冲突文档。

SELECT @ISAvailable("$Conflict")

2、将冲突文档与主文档同屏显示以便比较两者之间的差别:

由于冲突文档被保存为主文档的答复文档,在打开冲突文档以后使用快捷图标“显示/隐藏预览主文档”,主文档就会被显示在预览窗格中了。

3、附加菜单命令比较两个文档之间的差别:

在Notes.ini文件中加入下面一行:

1 AddInMenus=C:\Notes\nntediff.dll


然后重起Notes,就回发现“操作”菜单中多了一项“Different of 2 document”.

4、找到冲突文档的主文档:

View Code
 1 Sub Click(Source as Button)
2
3 Const FolderName="ReplicationConFlict"
4
5 dim s As New NotesSession
6
7 dim doccol as NotesDocumentCollection
8
9 dim doc as Notesdocument,topdoc as notesdocument
10
11 dim folder as notesView
12
13 set dbcur=s.currentdatabase
14
15 set doccol.dbcur.unprocesseddocuments
16
17 set doc=doccol.getfirstdocument
18
19 while not(doc is nothing)
20
21 set topdoc=gettopdoc(doc)
22
23 call topdoc.putinfolder(Foldername)
24
25 set doc=doccol.getnextdocument(doc)
26
27 wend
28
29 End Sub
View Code
 1 Function GetTopDoc(DocSource as notesDocument) as NotesDocument
2
3 dim doctop as notesdocument
4
5 dim strUNID as String
6
7 set doctop=docsource
8
9 strUNID=doctop.ParentDocumentUNID
10
11 Do While (strUNID<>"")
12
13 set DocTop=dbCur.GetDocumentByUNID(StrUNID)
14
15 strUNID=doctop.ParentdocumentUNID
16
17 loop
18
19 set GetTopDoc=doctop
20
21 End Functiong


5、将冲突文档保存为主文档

选种若干冲突文档后运行下面代理。这个代理把选种的冲突文档保存为主文档。

View Code
 1 dim s as new notessession
2
3 set db=s.currentdatabase
4
5 set dc=db.unprocessedDocuments
6
7 set doc=dc.getfirstdocument
8
9 '$conflict是冲突文档的标志
10
11 call doc.removeItem("$Conflict")
12
13 '得到冲突文档的主文档
14
15 if doc.isResponse then
16
17 Set Parent=db.GetDocumentByUNID(doc.ParentDocumentUNID)
18
19 if parent.IsResponse then
20
21 '如果文档是答复的答复
22
23 dim GrandParant as Notesdocument
24
25 Set GrandParant=db.GetDocumentByUNID(Parent.ParentDocumentUNID)
26
27 call doc.MakeResponse(GrandParent)
28
29 else
30
31 '$Ref 域是答复文档的标志
32
33 call doc.RemoveItem("$Ref")
34
35 end if
36
37 end if
38
39 call doc.save(True,True)


SP:

当使用LS在后台创建文档的时候,表单中“合并复制冲突”选项无效,在文档中加入下面代码:

doc.$Conflicts="1"

posted on 2011-12-01 14:10  with  阅读(368)  评论(0)    收藏  举报