# ------------------------------------------------------------ # Copyright (c) 2005-2024 # Q.W.Page Associates Inc. # www.qwpage.com # All rights reserved. # ------------------------------------------------------------ ::namespace eval ::qw::newviews {} /* { */ } ::proc ::qw::newviews::index_is_closure {sargs} { ::set IfsFilePath [::sargs::get $sargs .path]; ::if {[::qw::odb::index_is_interactive $sargs]} { ::return 0; } ::if {[::string match "*.index/id_closure" $IfsFilePath]} { ::return 1; } ::if {[::string match "*.index" $IfsFilePath]} { /* { Some hi level root indexes are closure and others are not. Also, we never try to populate a root indexes because we know in advance they are always empty (never a hit). It really doen't matter what we return here. */ } #::return 0; } ::set IndexPath [::string map [::list /odb/index ""] $IfsFilePath]; ::set IndexFieldPath [::qw::odb::field_extract .path $IndexPath]; ::switch -glob -- $IndexPath { *.odb_deriveds* { /* { We handle .odb_deriveds indexes separately. It is somewhat of a special case because it starts out non-closure but derived classes add new indexes which are closure. Thus we end up with a mix of closure/non-closure indexes in some of the derived classes. */ } ::switch -- $IndexFieldPath { .odb_deriveds.index - .odb_deriveds.index/id - .odb_deriveds.index/name/folder - .odb_deriveds.index/name - .odb_deriveds.index/description/folder - .odb_deriveds.index/description - .odb_deriveds.index/interactive { /* { */ } ::return 0; } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT* { ::switch -glob -- $IndexFieldPath { *.index/name/root { ::return 0; } } ::return 1; } /OBJECT/NEWVIEWS/JOURNAL* { ::return 1; } /OBJECT/NEWVIEWS/REPORT* { ::return 1; } /OBJECT/NEWVIEWS/ATTACHMENT* { /* { Attachments added both closure and non-closure indexes to .odb_deriveds so even more of a special case. */ } ::switch -- $IndexFieldPath { .odb_deriveds.index/import_source_host - .odb_deriveds.index/import_source_folder - .odb_deriveds.index/import_source_filename - .odb_deriveds.index/import_source_file_type - .odb_deriveds.index/import_source_file_size - .odb_deriveds.index/import_source_date - .odb_deriveds.index/import_date { ::return 0; } .odb_deriveds.index/object_attachments_ref_odb_path_help { ::return 1; } .odb_deriveds.index/object_attachments_ref_description { ::return 1; } } ::qw::bug 314120231229120106 "[::qw::procname] - invalid index path \"$IndexPath\"."; } /OBJECT/SERVER/PORT* { # introduced .index/number and .indext/state, both non-closure ::return 0; } /OBJECT/SERVER/CONNECTION* { # introduced following, all non-closure # .index/hostname # .index/username # .index/file # .index/login_date ::return 0; } /OBJECT/SYSTEM/WINDOW/SCREEN* { # introduced .index/database ::return 0; } } ::return 0; } } ::switch -glob -- $IndexPath { /OBJECT* { ::switch -glob -- $IndexPath { *.access_froms* { ::return 0; } /OBJECT/NEWVIEWS* { ::switch -glob -- $IndexPath { *.attachments.index { /* { pgq_master - .attachments.index closure should be 1 and .is_closure should be deleted from the other .attachments index definitions. The .attachments collection's indexes are all closure so we want .index/id to be closure. But .attachments is unique because it has an interactive index. We have to populate the interactive index from a non-closure index, meaning .index/id must be non-closure. NO! Only the leaf interactives are a hit and the .index/id can be used since it is a leaf and closure means nothing at all We have to ensure that the interactive index cannot be made active except on a leaf. Here is the solution. We make .index/id closure but we also make .index/interactive .is_always_active. Therefore we will never have to populate the interactive index. */ } ::return 0; } *.attachments* { ::return 1; } /OBJECT/NEWVIEWS/REPORT* { ::switch -glob -- $IndexPath { *.accounts* { ::return 0; } } } /OBJECT/NEWVIEWS/ACCOUNT* { ::switch -glob -- $IndexPath { *.postings* { ::return 1; } *.total.kids* { ::return 0; } *.addresses* { ::return 0; } /OBJECT/NEWVIEWS/ACCOUNT/AR/QWPAGE* { ::switch -glob -- $IndexPath { *.contracts* { /* { .contracts, .creditcards and .serialnumbers did not have .index/id indexes. All indexes were closure so we add .index/id indexes and populate them from the primary which is closure. We added the .index/id definitions. Also had to create them in the install. Also true for /SUPPORTREP.contacts. */ } ::return 1; } *.creditcards* { ::return 1; } *.serialnumbers* { ::return 1; } } } } ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/ACCOUNT/AR* { ::switch -glob -- $IndexPath { *.prices* { ::return 0; } } } /OBJECT/NEWVIEWS/ACCOUNT/SALES* { ::switch -glob -- $IndexPath { *.prices* { ::return 0; } } } } } /OBJECT/NEWVIEWS/SYSTEM* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION* { ::switch -glob -- $IndexPath { /OBJECT/NEWVIEWS/SYSTEM/TRANSACTION/PAYROLL/PAYCHECK* { ::switch -glob -- $IndexPath { *.timecards* { ::return 1; } } } } ::return 0; } /OBJECT/NEWVIEWS/SYSTEM/PAYRUN* { ::switch -glob -- $IndexPath { *.paychecks* { ::return 1; } *.timecards* { ::return 1; } } } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE* { ::switch -glob -- $IndexPath { *.accounts* { ::return 0; } *.paychecks* { ::return 1; } *.timecards* { ::return 1; } /OBJECT/NEWVIEWS/SYSTEM/EMPLOYEE/CANADA* { ::switch -glob -- $IndexPath { *.roes.index { # pgq_master - add closure in .index and delete .is_closure from other indexes ::return 0; } *.roes* { ::return 1; } } } } } } } /OBJECT/NEWVIEWS/JOURNAL* { ::switch -glob -- $IndexPath { *.transactions* { ::return 1; } } } /OBJECT/NEWVIEWS/PAYROLL* { ::switch -glob -- $IndexPath { *.employees.index { # pgq_master - add closure in .index and delete .is_closure from other indexes ::return 0; } *.employees* { ::return 1; } *.payruns.index { # pgq_master - add closure in .index and delete .is_closure from other indexes ::return 0; } *.payruns* { ::return 1; } *.paychecks* { ::return 1; } *.payroll_reports.index { # pgq_master - add closure in .index and delete .is_closure from other indexes ::return 0; } *.payroll_reports* { ::return 1; } *.timecards* { ::return 1; } /OBJECT/NEWVIEWS/PAYROLL/CANADA* { ::switch -glob -- $IndexPath { *.roes.index { # pgq_master - add closure in .index and delete .is_closure from other indexes ::return 0; } *.roes* { ::return 1; } } } } } /OBJECT/NEWVIEWS/ADDRESS* { ::qw::bug 314120231229114916 "[::qw::procname] - invalid index path \"$IndexPath\"."; } /OBJECT/NEWVIEWS/ATTACHMENT* { ::switch -glob -- $IndexPath { /* { pgq_master - .is_closure should be set to 1 on .attachments */ } *.index { ::return 0; } } ::return 1; } } } /OBJECT/SYSTEM* { ::switch -glob -- $IndexPath { /OBJECT/SYSTEM/WINDOW* { /* { Turns out that no window indexes are closure whether in a workstation or server database. */ } ::return 0; } /OBJECT/SYSTEM/AUDIT* { /* { The audit class does not introduce any collections and the .odb_deriveds collection should be covered above. */ } ::qw::bug 314120231229102122 "[::qw::procname] - invalid index path \"$IndexPath\"."; ::return 0; } /OBJECT/SYSTEM/SESSION* { ::switch -glob -- $IndexFieldPath { .audit_trail* { ::return 1; } } ::return 0; } /OBJECT/SYSTEM/USER* { ::switch -glob -- $IndexFieldPath { .sessions* { ::return 1; } .audit_trail* { ::return 1; } .access_tos* { ::return 0; } } } } } /OBJECT/SERVER* { ::switch -glob -- $IndexPath { /OBJECT/SERVER/PORT* { ::switch -glob -- $IndexFieldPath { .database_groups* { ::return 0; } .databases.index { ::return 0; } .databases.index/id { ::return 1; } .databases.index/file { ::return 1; } .connections.index { ::return 0; } .connections.index/id { ::return 1; } .connections.index/file { ::return 1; } .connections.index/login_date { ::return 1; } } } /OBJECT/SERVER/DATABASE_GROUP* { ::switch -glob -- $IndexFieldPath { .databases.index { ::return 0; } .databases.index/id { ::return 1; } .databases.index/file { ::return 1; } .connections.index { ::return 0; } .connections.index/id { ::return 1; } .connections.index/file { ::return 1; } .connections.index/login_date { ::return 1} } } /OBJECT/SERVER/DATABASE* { ::switch -glob -- $IndexFieldPath { .connections.index { ::return 0; } .connections.index/id { ::return 1; } } } } } /OBJECT/DATAEASE* { ::switch -glob -- $IndexPath { /OBJECT/DATAEASE/SUPPORTREP* { ::switch -glob -- $IndexFieldPath { *.contacts* { return 0; } } } } } } } } ::qw::bug "314120231229101526" "[::qw::procname] - invalid index path \"$IndexPath\"."; }