Autor Thema: Entsperren von Dokumenten  (Gelesen 22669 mal)

Offline buzzy666

  • Aktives Mitglied
  • ***
  • Beiträge: 177
  • Ich liebe dieses Forum!
Entsperren von Dokumenten
« am: 06.12.05 - 09:05:33 »
Tach zusammen,
wir haben ne DB, für die das Sperren von Doks aktiviert ist. Nun kommt es sporadisch vor, dass machen Doks nicht entsperrt werden. Lässt sich nicht an bestimmten Usern festmachen und ist auch nicht reproduzierbar.
Hat jemand ähnliche Erfahrungen gemacht? Ich hab nämlich keinen Bock, stündlich irgendwelchen Leuten nachzutelefonieren, ob sie ein Dok *wirklich* noch in Bearbeitung haben  >:(

Danke & Gruß,
Buzzy

Glombi

  • Gast
Re: Entsperren von Dokumenten
« Antwort #1 am: 06.12.05 - 09:10:47 »
Der Lock-Funktion traue ich nicht über den Weg. Insbesondere vor 6.5.4. kann man die vergessen da zu buggy.

Andreas

Glombi

  • Gast
In diesem Zusammenhang möchte ich folgendes aus der KBASE zitieren:

What is the Difference Between Soft Locking and Hard Locking in Lotus Notes?

Problem

What is the difference between soft locking and document locking (sometimes called hard locking) and when are these locking features are enabled?


Solution
Document Locking:
In Notes/Domino 6.x, a database property feature called "Allow document locking" was introduced.  When this property is enabled, any user with Author access or above can lock a document across all replicas.  This prevents two or more users from making changes to the same document and then replicating - which would create replication conflict documents.
To enable this feature, you can select the database property "Allow document locking" in the basics tab.
Soft Locking:
Soft locking is also a new feature in Notes/Domino 6, but it was not documented as clearly as document locking.  Soft locks are in-memory locks that are enabled when documents are in memory, and are not persistent.  The editor takes out a soft lock on a document when it is opened, and then unlocks it when the document is closed.  During the period of time when it is soft locked, no one else can edit that document but it only affects the current replica where the user is working; it does not affect other replicas of the database.
Prior to release 6.5.1, soft locks could not be disabled.  Beginning in 6.5.1 and 6.0.4, users can add a NOTES.INI parameter EDIT_NO_SOFT_LOCKS=1 to their client's notes.ini.
The EDIT_NO_SOFT_LOCKS=1 ini parameter was added as a workaround for customers who had applications that did not work well with soft locking. The parameter essentially reverts locking behavior back to the R5 style, where soft locking did not exist. This parameter disables all soft locking in all databases accessed by that client.  It cannot be enabled on a database by database basis.
At this time, there is no other way to disable soft locking.  This parameter can be set programmatically in all clients via LotusScript with the following instructions:

Dim session As New NotesSession
Call session.SetEnvironmentVar( "EDIT_NO_SOFT_LOCKS", "1" , True)
The above script can be included in a Hotspot button included in a mail to all users.
An enhancement request, for soft locking be an option that can be enabled or disabled via a database property like document locking,  has been submitted to Quality Engineering as SPR# JGON5WQLMA.  There are no current plans to address this request.

Andreas


Offline buzzy666

  • Aktives Mitglied
  • ***
  • Beiträge: 177
  • Ich liebe dieses Forum!
Re: Entsperren von Dokumenten
« Antwort #3 am: 06.12.05 - 09:28:01 »
Der Lock-Funktion traue ich nicht über den Weg. Insbesondere vor 6.5.4. kann man die vergessen da zu buggy.

Andreas

Ich mittlerweile auch nicht mehr - da war ja meine selber programmierte besser  >:(
Ist denn wenigstens dem Softlocking mehr zu trauen, als dem Hardlocking? Weil die Anwednung liegt nur auf einem Server...?

Danke & Gruß,
Buzzy

Glombi

  • Gast
Re: Entsperren von Dokumenten
« Antwort #4 am: 06.12.05 - 09:40:01 »
Die bösesten Bugs bzgl. Soft-Locking wurden in 6.0.4/6.5.2 behoben. Damit sollte es gehen.

Andreas

Glombi

  • Gast
Re: Entsperren von Dokumenten
« Antwort #5 am: 06.12.05 - 09:41:06 »
Dazu sagt die KBASE:

Opening document or composing memo based on stationery results in error: 'The document is already locked..'



Problem

In mail files which multiple users have access to, the following error message occurs when a user attempts to edit a draft memo, or create a memo using Personal Stationery:

"The document is already locked by <username>"

For example, User A creates a memo based on a particular Stationery document.  When User B attempts to create a memo based on the same stationery the error occurs, indicating that User A has the document locked.

The error can also occur in databases which are not based on a mail template.   The issue occurs whether or not the Database Property, "Allow Document Locking" is enabled.

At times the issue will not occur if the first user closes the database or logs out of Notes (either by selecting the F5 key or by a ID lockout set up in the User Preferences).

Note:  This same error will occur when creating new documents with an Action or Agent that uses LotusScript to create the document.  For more information on this issue see the following document:

 "Error: 'The document is already locked...' when using actions or agents to create documents"   (#1166480)


Solution
This issue is relative to the use of Soft Locking.  Soft Locking goes into effect when a document is opened in Edit mode.  In cases where a document is closed while still in Edit mode the document is not unlocked. 

An additional scenario also exists.  The second scenario is related to the fact that new documents created in the back-end (including User Interface triggered LotusScript code) are assigned a NoteID of 0.  When two or more users create such documents, each document they create has a NoteID of 0.  The soft locking feature locks documents based on the NoteID; so, even though there are two (or more) different documents, the soft locking feature recognizes only that NoteID 0 is already locked.

The issue relative to soft locking and new back-end documents was reported to Quality Engineering as SPR# KHAN5U4NVZ and was fixed in Domino 6.0.4/6.5.2 and 7.0.  The fix resolves a number of scenarios where soft locking errors were encountered, including the one involving the use of Stationery in a mail file.  Refer to the following document for scenarios involving LotusScript:

"Error: 'The document is already locked...' when using actions or agents to create documents" (#1166480)

Excerpt from the Lotus Notes and Domino Release 6.0.4 / 6.5.2 MR fix list (available at http://www.ibm.com/developerworks/lotus):

Database
SPR# KHAN5U4NVZ - This fix prevents a 'not authorized' error that can occur when archiving with compact -a.

In cases where the above fix does not resolve the issue then soft locking can be disabled using a Notes.ini parameter introduced in Notes Domino 6.5.1, 6.0.4 and 7.0.

Excerpt from the Lotus Notes and Domino Release 6.5.1 MR fix list (available at http://www.ibm.com/developerworks/lotus/):

Editor
SPR# GKAA56ETP6 - Document soft-locking can now be disabled client-side in the editor by setting the ini parameter EDIT_NO_SOFT_LOCKS=1.


To programmatically add the new parameter to a user's Notes.ini:
The LotusScript SetEnvironmentVar method (of the NotesSession class) can be used to set or modify environment variables.   To add the parameter to a Notes Client's Notes.ini the following code would need to be executed by the user.  It could be placed in a agent, button or the PostOpen event of the database.  After executing the code users will need to restart their Notes client in order for the parameter to be applied.

Dim session As New NotesSession                                   
Call session.SetEnvironmentVar( "EDIT_NO_SOFT_LOCKS", "1" , True)


To Avoid the Issue in the Future

Forms other than Stationery:
The issue can be avoided in the future by making sure to switch a saved document from Edit mode back into Read mode before closing it.  Forms can easily be redesigned by an application designer to do this.  In the case of the Memo form a designer can add the following below existing code in the QueryClose event:

If Not( Source.IsNewDoc ) And Source.EditMode = True Then 
            Source.EditMode = False                       
End If   

Stationery scenario:
A partial fix can be accomplished by adding LotusScript code to the QueryOpenDocument event of the "(Stationery)" view.  This will only resolve the issue if the one creates a memo based on the stationery by opening the stationery document, and composing and sending the memo.  It will not resolve the issue in cases where the menu is used: New Memo -> New Memo -> Using Stationery.

Code to add to the "(Stationery)" view's QueryOpenDocument event:

Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim docs As NotesDocumentCollection
Dim doc As NotesDocument
Dim newDoc As NotesDocument
 
If Not (session.GetEnvironmentString("MailStEd") = "2") Then
Set docs = Source.Documents
Set doc = docs.GetFirstDocument
Set newDoc = New NotesDocument (doc.ParentDatabase)
Call doc.CopyAllItems (newDoc)
Call newDoc.RemoveItem ("IsMailStationery")
Call ws.EditDocument (True,newDoc)
Continue = False
End If


Workaround:

If the error occurs while attempting to create a memo based on a Stationery document, then the workaround is to create a copy of the Stationery document and then work with the copy.

For other documents not based on a Stationery document use the following steps to work around the issue:
1. Open the document in Edit mode.
2. Place the document into Read mode (press the CTRL+E keys on the keyboard or select Actions --> Edit from the Notes menu to toggle back to Read mode).
3. Close the document.

In addition to the above workarounds there is the option of enabling document locking and then having the original user, or a user with Manager access, use the Unlock Document action to release it.  This methodology has the drawback that additional documents could be locked by users while the property is enabled; and those documents, in turn, would need to be unlocked.  To enable document locking for a database select File -> Database -> Properties and select the 'Allow Document Locking' checkbox on the first tab of the InfoBox that pops up.  To then unlock a document select it and then select from the menu Actions -> Unlock Document.

The above techniques should also assist the user when attempting to unlock a document in cases where the Notes Client crashed or locked prior to the user unlocking the document.  The fact that there is not a specific command or function to unlock Soft Locked documents has been reported to Lotus Software Quality Engineering in SPR MROE5KJT5V.


Supporting Information:
Users can create personal Stationery documents by expanding the Tools folder in the left-hand navigator of the mail file (and the view level) and selecting the Stationery folder.  When the Stationery view opens to the right, select the New action button and select "Stationery - Personal".

Offline robertpp

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 940
  • Geschlecht: Männlich
Re: Entsperren von Dokumenten
« Antwort #6 am: 06.12.05 - 09:43:19 »
Also ich denke die Funktion kann man derzeit noch vergessen. Ich programmiere das auch selber.

Hab dazu auch gerade einen guten Eintrag bei der Hand:

http://searchdomino.techtarget.com/tip/1,289483,sid4_gci765142,00.html
------------------------------------------------------------
1250 Notes User Client von 5.0.5 bis 6.5.4     WIN2000, XP
14 Notes Server von 6.5 bis 6.5.4 WIN2000, XP

32   Notes Server von 5.0.1 bis 6.5.4 in unserer Domain
323 Notes Server weltweit mit 38000 User in einem Adressbuch

Glombi

  • Gast
Re: Entsperren von Dokumenten
« Antwort #7 am: 06.12.05 - 09:54:32 »
Die Zeilen

docBackend.Lock=nnUserName.Common
ersetzen durch
call docBackend.ReplaceItemValue( "Lock", nnUserName.Common )

und

docBackend.Lock=""
ersetzen durch
call docBackend.ReplaceItemValue( "Lock" , "" )

denn "Lock" ist ab R6 reserviert.

Andreas

Offline buzzy666

  • Aktives Mitglied
  • ***
  • Beiträge: 177
  • Ich liebe dieses Forum!
Re: Entsperren von Dokumenten
« Antwort #8 am: 06.12.05 - 11:11:43 »
Also ich werd's vielleicht einfach mal mit einem

If doc.LockHolders(0) = s1.UserName Then      
   Call doc.UnLock()      
End If   

auf dem QueryClose-Event versuchen...vielleicht bringt das ja schon was.
Ausserdem hab ich meine Admins mal angespitzt, sich bzgl. Softlocking schlau zu machen...

Greets,
Buzzy

Offline robertpp

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 940
  • Geschlecht: Männlich
Re: Entsperren von Dokumenten
« Antwort #9 am: 06.12.05 - 12:46:23 »
Ja ich hab das Script auch etwas umgebaut:

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
   If (Source.IsNewDoc) Then
      Exit Sub
   End If
   Dim varLock As Variant
   Dim s As New NotesSession
   Dim doc As NotesDocument
   Dim UserName As New NotesName(s.UserName)   
   Set doc=Source.Document
   varLock=doc.GetItemValue("LockEdit")
   If (varLock(0) <> "") And Source.EditMode Then
      Msgbox ("Document is currently locked by "+varLock(0)+". A read-only copy will be opened for your use.")
      Exit Sub
   End If
   doc.LockEdit= UserName.Common
   doc.LockEditTime = Now
   Call doc.Save(True,False)
End Sub

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
   Dim item As NotesItem
   Dim dos As NotesDocument
   Set doc = Source.Document
   Set item = doc.GetFirstItem("LockEdit")
   If ( Not item Is Nothing ) Then
      If doc.LockEdit(0) <> "" Then
         Dim s As New NotesSession
         Dim UserName As New NotesName(s.UserName)
         If (Strcomp(UserName.Common,doc.LockEdit(0),5)=0) Then
            continue=True
         Else
            Msgbox("Sorry, you are in read-only mode ! This operation cannot be performed. This document is currently used by "+Source.FieldGetText("LockEdit"))
            continue=False
         End If
      End If
   End If
End Sub

Sub Queryclose(Source As Notesuidocument, Continue As Variant)
   Dim s As New NotesSession
   Dim doc As NotesDocument
   Dim UserName As New NotesName(s.UserName)
   Set doc=Source.Document   
   Set item = doc.GetFirstItem( "LockEdit" )
   If ( Not item Is Nothing ) Then
      If (Strcomp(UserName.Common,doc.LockEdit(0),5)=0) Then
         Call doc.RemoveItem("LockEdit")
         Call doc.RemoveItem("LockEditTime")
         Call doc.Save(True, True)
      End If      
   End If
End Sub
------------------------------------------------------------
1250 Notes User Client von 5.0.5 bis 6.5.4     WIN2000, XP
14 Notes Server von 6.5 bis 6.5.4 WIN2000, XP

32   Notes Server von 5.0.1 bis 6.5.4 in unserer Domain
323 Notes Server weltweit mit 38000 User in einem Adressbuch

Offline TMC

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 3.660
  • Geschlecht: Männlich
  • meden agan
Re: Entsperren von Dokumenten
« Antwort #10 am: 07.12.05 - 00:10:08 »
Hmm, setzt Document Locking eigentlich wer von Euch produktiv und erfolgreich ein?

Ich bin da ja immer noch sehr skeptisch, alleine schon wenn ich den Text in der Help lese:
Zitat
Note  If you are working locally or offline, and you attempt to lock a document, Notes displays a message stating that the "Master lock database cannot be reached" and asks you if you want to proceed with locking the document. If you click Yes to proceed with locking the document, you are chancing whether or not your edits get saved. The "master lock" is the database that replicas refer to when a document is locked to make sure the edits get saved in all replicas. If that database cannot be found, and you and another person are editing the same document, the edits may not sync up. When this happens, you receive an e-mail containing your modified document along with a notification that your changes were not incorporated into the document.

100% sauber kann das doch nicht funktionieren. Angenommen man hat weltweit diverse Domino-Server mit 1 Replik einer DB. Ich kann mir nicht vorstellen, dass ich hier in Deutschland eine Meldung bekomme, wenn ein Neuseeländer 0,5 Sekunden vorher das Dokument gelockt hat.
Matthias

A good programmer is someone who looks both ways before crossing a one-way street.


Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Re: Entsperren von Dokumenten
« Antwort #11 am: 07.12.05 - 00:38:16 »
Ich habe nun durchaus "ein paar" Notes-Applikationen in meiner Verantwortung, und ich betreue viele weitere. Document locking betreibe ich niemals.
In der Notes-Welt halte ich das Locking schlicht für "widernatürlich". Wenn sich diese Frage stellt, sollte man zunächst fragen:
- Stimmt die Architektur meiner Applikation ?
- Stimmt die Organisation der Arbeit, die mit dieser Applikation betrieben wird ?
- Ist Notes / Domino überhaupt das richtige Werkzeug (wenn die obigen Fragen zu keinem brauchbaren Resultat geführt haben) ?

Bernhard

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz