├── dsaltmap.PNG ├── README.md ├── LICENSE └── ds.altmap.CLS /dsaltmap.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/deepsee-globals-alt/master/dsaltmap.PNG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deepsee-globals-alt 2 | [Snippet](ds.altmap.CLS#L5) for [Alternative Mappings for the DeepSee Globals](http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2IMP_ch_setup#D2IMP_setup_globals_alt) 3 | 4 | ![Result](dsaltmap.PNG) 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 doublefint 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ds.altmap.CLS: -------------------------------------------------------------------------------- 1 | /// create additional databases 2 | /// and globals projections for current namespace 3 | /// See: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2IMP_ch_setup#D2IMP_setup_globals_alt 4 | Class ds.altmap [ Abstract ] { 5 | ClassMethod install() { 6 | 7 | // fact tables and their indices 8 | // When you initially build the cube, you might disable journaling for the database that contains these globals. 9 | // After that, enable journaling for the database. 10 | d ..newmap( "ds_facts", 1, "DeepSee.Fact,DeepSee.FactRelation,DeepSee.Index" ) 11 | 12 | // Globals used to keep cube synchronized with the source table 13 | // See the chapter “Keeping the Cubes Current.” 14 | d ..newmap( "ds_sync", 1, "OBJ.DSTIME,DeepSee.Update" ) 15 | 16 | // Cube internals 17 | d ..newmap( "ds_cubes", 1, "DeepSee.Cubes,DeepSee.Dimension,DeepSee.DimensionI" ) 18 | 19 | // Cube Manager - See “Using the Cube Manager” in “Keeping the Cubes Current.” 20 | d ..newmap( "ds_cubeman", 1, "DeepSee.CubeManager,DeepSee.CubeManager.CubeEventD,DeepSee.CubeManager.CubeEventI,DeepSee.CubeManager.CubeRegistr" ) 21 | 22 | // Listing groups - See “Defining Listing Groups” in Defining DeepSee Models. 23 | d ..newmap( "ds_lists", 1, "DeepSee.ListingGroups" ) 24 | 25 | // Result cache (for large data sets) 26 | // You can disable journaling for the database that contains these globals. 27 | // For information on the result cache, see “Cube Updates and the Result Cache,” later in this book. 28 | d ..newmap( "ds_cache", 0, "DeepSee.BucketList,DeepSee.Cache.*,DeepSee.JoinIndex,DeepSee.UpdateCounter,DeepSee.Listing" ) 29 | 30 | // Items created in the Analyzer and in the Dashboard Designer 31 | // See Using the DeepSee Analyzer and Creating DeepSee Dashboards. 32 | d ..newmap( "ds_dash", 1, "DeepSee.Filters,DeepSee.Folder*,DeepSee.FolderItem*" ) 33 | 34 | // Term lists - See the Advanced DeepSee Modeling Guide. 35 | d ..newmap( "ds_terms", 1, "DeepSee.TermList" ) 36 | 37 | // Quality measures - See the Advanced DeepSee Modeling Guide. 38 | d ..newmap( "ds_qual", 1, "DeepSee.QMsrs" ) 39 | 40 | // Pivot variables - See “Defining and Using Pivot Variables” in Using the DeepSee Analyzer. 41 | d ..newmap( "ds_vars", 1, "DeepSee.Variables" ) 42 | 43 | // Other portal options - See “Defining and Using Pivot Variables” in Using the DeepSee Analyzer. 44 | d ..newmap( "ds_opts", 1, 45 | "DeepSee.DashboardSettings" _ // user-specific dashboard settings 46 | ",DeepSee.User.SendTo" _ // user email addresses 47 | ",DeepSee.User.Settings" _ // runtime variables 48 | ",DeepSee.User.Icons" _ // custom icons 49 | ",DeepSee.UserPortalSettings" _ // general settings and worklist settings 50 | ",DeepSee.UserPreferences" _ // recent items, per user 51 | ",DeepSee.PaperSizes" // see “Adding Paper Sizes,” later in this book 52 | ) 53 | 54 | // Custom code - See the chapter “Other Development Work. 55 | d ..newmap( "ds_cust", 1, "DeepSee.InitCode,DeepSee.AuditCode" ) 56 | 57 | // Recent history and logs 58 | d ..newmap( "ds_hist", 1, "DeepSee.AgentLog,DeepSee.Last*,DeepSee.PivotError,DeepSee.QueryLog,DeepSee.Session,DeepSee.SQLError" ) 59 | 60 | // iKnow 61 | d ..newmap( "ds_iknow", 1, "ISC.IK.*" ) 62 | 63 | // Internals used for processing 64 | d ..newmap( "ds_proces", 1, "DeepSee.ActiveTasks,DeepSee.Agents,DeepSee.Build,DeepSee.Cancel" _ 65 | ",DeepSee.ComputedSQL,DeepSee.Functions,DeepSee.IDList,DeepSee.Pivot,DeepSee.Shell" _ 66 | ",DeepSee.TaskGroups,DeepSee.Tasks,DeepSee.UI.Charts" ) 67 | } 68 | 69 | ClassMethod newmap( suffix, journal, gls) As %Status { 70 | 71 | s dbname = $namespace _ "_" _ suffix 72 | s dbpath = $tr( suffix, "_", "/" ) 73 | s dbpath = $zu( 12, dbpath ) 74 | d ##class(%File).CreateDirectoryChain( dbpath ) 75 | d ..createDb( dbname, dbpath, journal ) 76 | s list = $lfs(gls), p=0, gl="" 77 | while $listnext(list, p, gl ){ 78 | d ..moveGlobal( gl, dbpath ) 79 | d ..mapGlobal( gl, dbname ) 80 | } 81 | Q 1 82 | } 83 | 84 | /// Create non-journaling db for logs 85 | ClassMethod createDb( name, path, journal) As %Status { 86 | n $namespace s $namespace = "%SYS" 87 | 88 | #; create file for db 89 | s db=##Class(SYS.Database).%New() 90 | s db.Directory = path 91 | s db.GlobalJournalState = 3 // Journaling enabled 92 | s:'journal db.GlobalJournalState = 2 // 2 => Journaling disabled 93 | s sc = db.%Save() 94 | Q:'sc sc 95 | 96 | #; register dbfile in instance 97 | s conf("Directory")= path 98 | s sc = ##class(Config.Databases).Create( name, .conf ) 99 | Q sc 100 | } 101 | 102 | /// Copy global to target database 103 | /// And remove in current 104 | ClassMethod moveGlobal( glname, dbpath) As %Boolean { 105 | s target = "^[""^^"_dbpath_"""]"_glname 106 | s source = "^"_glname 107 | try { 108 | m @target = @source 109 | k @source 110 | } catch e { 111 | 112 | } 113 | Q 1 114 | } 115 | 116 | /// Map global glname from dbname into ns 117 | ClassMethod mapGlobal( glname, dbname, ns = {$namespace}) { 118 | n $namespace s $namespace = "%SYS" 119 | s props("Database") = dbname 120 | Q ##class(Config.MapGlobals).Create( ns, glname, .props ) 121 | } 122 | 123 | } 124 | --------------------------------------------------------------------------------