wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Wipe them out - all of them (when a design refresh doesn't work)


You created that shiney new version of your application, ran (in no particular order) fixup, compact and updall and replaced the design. Still some of the design elements haven't updated. Typically that happens when no attention was paid to the "prohibit design refresh" flag of the database design (all your predecessor's fault of course).
While you can go in and hunt the settings down one-by-one (tip: use an DXL export and just look for the property), it is sometimes faster and more profound to strip the offending database(s) from their design entirely before applying the "Replace Design" action.
To do that I use a script in my little universal toolbox. A word of caution:
  • Use it at your own risk
  • Backup the database beforehand
  • Check in Domino Designer's "Navigator view" (the Eclipse panel, not a Notes view) that they are all gone
  • You have been warned
As usual YMMV
%REM
    Class DesignWiper
    Description: Wipes out entire design of a database
    DEADLY for any folders that are user created
    DEADLY on templates
    Use at your own risk!
%END REM

Public Class DesignWiper
   
    private db As NotesDatabase
   
    %REM
        Sub New
        Description: The database is handed over in the constructor
    %END REM

    Sub New (dbToWipe As NotesDatabase )
        Set me. db = dbToWipe
    End Sub
   
    %REM
        Sub wipeDesign
        Description: Wipes all design, might spare folders
    %END REM

    Public Sub wipeDesign (preserveFolders As Boolean )
       
        Dim morituri As NotesNoteCollection
        Dim curId As String
        Dim nextId As String
       
        If me. thisIsATemplate ( ) Then
            MsgBox "I won't kill a template"
            Exit sub
        End If
       
        'Select all elements and walk backwards
        Set morituri = db. Createnotecollection ( true )
        Call morituri. Selectalladminnotes ( false )
        Call morituri. Selectalldatanotes ( false )
       
        If preserveFolders Then
            morituri. Selectfolders = false
        End If
       
        Call morituri. Buildcollection ( )
       
        curId = morituri. Getfirstnoteid ( )
       
        Do Until curId = ""
            nextId = morituri. Getnextnoteid (curId )         
            Call me. wipeOne (curId )
            curId = nextId
        Loop
       
        MsgBox "It is done, please run fixup, compact and design replace"
       
    End Sub
   
    %REM
        Sub wipeOne
        Description: Wipes one design element
        might go wrong, so the error handler skips it
    %END REM

    Private Sub wipeOne (Noteid As String )
        Dim doc As NotesDocument
        On Error GoTo Err_wipeOne
       
        Set doc = me. db. Getdocumentbyid (Noteid )
        If Not doc Is Nothing Then
            Call doc. Remove ( true )
        End if

        Exit_wipeOne:
        Exit Sub
       
Err_wipeOne:
        Print "Error removing " & NoteId & "(Error: " & CStr ( Err ) & " - " & Error$
        Resume Exit_wipeOne
    End Sub
   
    %REM
        Function thisIsATemplate
        Description: checks if the database is a template
    %END REM

    Private Function thisIsATemplate As Boolean
        thisIsATemplate = (db. Templatename <> "" )
    End Function
   
End Class

Posted by on 05 April 2012 | Comments (b) | categories: Show-N-Tell Thursday

Comments

  1. posted by Karsten Lehmann on Thursday 05 April 2012 AD:
    Really funny things can happen if you delete design elements, wait a few months or years depending on the settings of the database and then somebody comes along and replicates the database with an old replica.

    In that case, all the old design elements return from the death and you have everything twice (I'm seeing this in the MindPlan developer databases every few months).

    For 8.5.3, I guess this can be avoided by using the new PIRC feature:
    { Link }
  2. posted by Stephan H. Wissel on Thursday 05 April 2012 AD:
    @Karsten: agree. What I usually do: make sure the ones who have Designer access are responsible (what an assumption <rofl>). With lower access design wouldn't get replicated back. And I use the catalog to find all server databases and blow the design on all of them. As you mentioned: in 8.5.3 it gets easier with PIRC (wasn't that the name of the captain in Star Wreck: In the Pirkinning)
    Emoticon biggrin.gif stw
  3. posted by Sean Cull on Friday 06 April 2012 AD:
    @Erik,

    I use a varation of this. I replace the current design with a template called "blank".

    I then inspect the design to see what is left behind because of the prohibit flags and delete those elements manually.

    I then go to the proper template and the latest dev build, check those same design elements for the prohibit flag ( which is often still there ) and correct those settings before applying the template.

    Doing it this way sorts the problem out for the future.
  4. posted by Eric Mack on Friday 06 April 2012 AD:
    Some of our users accomplish this by creating a new template with no design elements and using that to replace the design of the suspect file. Net result is it removes design elements not in the template.

    In your experience, is there an advantage to one approach over the other?

  5. posted by Stephan H. Wissel on Friday 06 April 2012 AD:
    @Eric: When a design element for whatever reason is set to "prohibit design refresh" any replace template won't overwrite it (at least that is how it is advertised). Also when you inherit design elements individually from other templates wiping is the only save way to get rid of them.
  6. posted by Eric Mack on Friday 06 April 2012 AD:
    Thanks, Stephan, I've seen this done successfully and used it myself. Notes simply sees the element as not existing so it removes it. (Perhaps design replace only applies to replace, not remove). But, I agree, there's probably a more thorough way to do it. In any case, thanks for the post.
  7. posted by Stephan H. Wissel on Saturday 07 April 2012 AD:
    @Eric: if the 'blank template method works on 'prohibit design refresh', then you would loose all your folders when applying that to a mail database. Is that so?

    @Sami: Could you elaborate how a version control system helps with failed design replacement? The version control can house all the various templates - but that's not the problem here.
  8. posted by sami on Saturday 07 April 2012 AD:
    i'm a manager and don't know technical things much.. sorry.

    I asked my technical consltant, and this is how he responds:

    "We use a combination of DXL & ANT script (we coded a custom ANT task) to automate deployment from a source control tool"

    I'm hoping it answers..he is external consultant and he helping us with domino issues...he brings some tools for us..
  9. posted by Stephan H. Wissel on Saturday 07 April 2012 AD:
    @Sami: Get him to blog about it, sounds interesting
  10. posted by sami on Saturday 07 April 2012 AD:
    i simply use version control system for problems like this..it is much easier.
  11. posted by Tommy Valand on Tuesday 10 April 2012 AD:
    In 8.5.3, there's a simple way to toggle "Prohibit design refresh" for all design elements.

    { Link }

    If I remember correctly, it might not work on all the items that's only visible from Package Manager (java code/properties files/etc).