Skip to content

Commit

Permalink
Add support for sandboxes to cube.data processes
Browse files Browse the repository at this point in the history
#59 support for sandboxes
  • Loading branch information
lotsaram committed Aug 7, 2019
1 parent 28ba301 commit 2c8be33
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 66 deletions.
43 changes: 31 additions & 12 deletions main/}bedrock.cube.data.clear.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
586,
585,
564,
565,"sKxr\8D5j_XM?2qD1pHasqWk`HWt5@u[`:exS<Hz\woN?:8R?4XGy5\BIy5]xOS2tdH1=4XgkETBzH<>X[O?f?_N5yX@xQarJA4;9sTi<zy:SuPazUw5EvL;0G>vOQ1juYke=?ImGZ?oJ3qkTmH]Y9eE?6UZq4h<m29A_V2GPQVxY34d3G\KGoXVx_dRc4q`<\3I37Ww"
565,"dN@IaZD=a^IsbQ2SFgeFDCPbbZ\owByUEZ@F;X6`O6Yxoq\E\S7khkXXbz0TVT>OY?Io<k>^oDpDaSXV9=D?5A9=<B@HfQ2W1;^YSsxxSnphq3MdEO1rXpiuSml`5vnRa<NVmXWcQY[;9voWzWa0`KR6P4OnpBZnys8eYvkFs1HITzm;CZlLxUgzgVumKK_y;DTDZqet"
559,1
928,0
593,
Expand All @@ -18,14 +18,14 @@
566,0
567,","
588,"."
589,
589,","
568,""""
570,
571,
569,0
592,0
599,1000
560,11
560,12
pLogOutput
pCube
pView
Expand All @@ -37,7 +37,8 @@ pEleStartDelim
pEleDelim
pCubeLogging
pTemp
561,11
pSandbox
561,12
1
2
2
Expand All @@ -49,7 +50,8 @@ pTemp
2
1
1
590,11
2
590,12
pLogOutput,0
pCube,""
pView,""
Expand All @@ -61,7 +63,8 @@ pEleStartDelim,"¦"
pEleDelim,"+"
pCubeLogging,0
pTemp,1
637,11
pSandbox,""
637,12
pLogOutput,"Optional: write parameters and action summary to server message log (Boolean True = 1)"
pCube,"Required: Cube Name (wildcard * and/or cube1&cube2 list)"
pView,"Optional: View name to be cleared (uses pFilter if pView not specified else clears entire cube)"
Expand All @@ -73,22 +76,23 @@ pEleStartDelim,"Required: Delimiter for start of element list"
pEleDelim,"Required: Delimiter between elements"
pCubeLogging,"Required: Cube Logging (0 = No transaction logging, 1 = Logging of transactions)"
pTemp,"Optional: Make Views and subsets Temporary (1=Temporary)"
pSandbox,"OPTIONAL: To use sandbox not base data enter the sandbox name (invalid name will result in process error)"
577,0
578,0
579,0
580,0
581,0
582,0
603,0
572,439
572,454
#Region CallThisProcess
# A snippet of code provided as an example how to call this process should the developer be working on a system without access to an editor with auto-complete.
If( 1 = 0 );
ExecuteProcess( '}bedrock.cube.data.clear', 'pLogOutput', pLogOutput,
'pCube', '', 'pView', '', 'pFilter', '',
'pFilterParallel', '', 'pParallelThreads', 0,
'pDimDelim', '&', 'pEleStartDelim', '¦', 'pEleDelim', '+',
'pCubeLogging', 0, 'pTemp', 1
'pCubeLogging', 0, 'pTemp', 1, 'pSandbox', pSandbox
);
EndIf;
#EndRegion CallThisProcess
Expand Down Expand Up @@ -205,6 +209,21 @@ Else;
nMaxThreads = 1;
EndIf;

# Validate Sandbox
If( TRIM( pSandbox ) @<> '' );
If( ServerSandboxExists( pSandbox ) = 0 );
SetUseActiveSandboxProperty( 0 );
nErrors = nErrors + 1;
sMessage = Expand('Sandbox %pSandbox% is invalid for the current user.');
LogOutput( cMsgErrorLevel, Expand( cMsgErrorContent ) );
Else;
ServerActiveSandboxSet( pSandbox );
SetUseActiveSandboxProperty( 1 );
EndIf;
Else;
SetUseActiveSandboxProperty( 0 );
EndIf;

### Check for errors before continuing
If( nErrors <> 0 );
ProcessBreak;
Expand Down Expand Up @@ -282,7 +301,7 @@ While( nCubeDelimiterIndex <> 0 );
RunProcess( cThisProcName, 'pLogoutput', pLogoutput,
'pCube', pCube, 'pView', pView, 'pFilter', sFilter,
'pFilterParallel', '', 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim,
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp, 'pSandbox', pSandbox
);
nThreadElCounter = 0;
sFilter = '';
Expand All @@ -293,7 +312,7 @@ While( nCubeDelimiterIndex <> 0 );
RunProcess( cThisProcName, 'pLogoutput', pLogoutput,
'pCube', pCube, 'pView', pView, 'pFilter', sFilter,
'pFilterParallel', '', 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim,
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp, 'pSandbox', pSandbox
);
ENDIF;
Else;
Expand Down Expand Up @@ -434,7 +453,7 @@ While( nCubeDelimiterIndex <> 0 );
RunProcess( cThisProcName, 'pLogoutput', pLogoutput,
'pCube', pCube, 'pView', pView, 'pFilter', sFilter,
'pFilterParallel', '', 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim,
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp, 'pSandbox', pSandbox
);
nThreadElCounter = 0;
sFilter = '';
Expand All @@ -445,7 +464,7 @@ While( nCubeDelimiterIndex <> 0 );
RunProcess( cThisProcName, 'pLogoutput', pLogoutput,
'pCube', pCube, 'pView', pView, 'pFilter', sFilter,
'pFilterParallel', '', 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim,
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp
'pEleDelim', pEleDelim, 'pCubeLogging', pCubeLogging, 'pTemp', pTemp, 'pSandbox', pSandbox
);
ENDIF;
Else;
Expand Down
46 changes: 32 additions & 14 deletions main/}bedrock.cube.data.copy.intercube.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
586,"Bedrock Source Cube"
585,"Bedrock Source Cube"
564,
565,"d0PFaZvxzZ:d?exd<_mcwxvHlDFZJ`e^Q?[WdEqs2l=Q1iTZF7OAcH=bpjFK3n9=3`L@Tx<a?S\wTc48T2zCmK6pIt5QFANiL>7qapxu9zDq;MMfih4R6<;OC3L0rpAA]np^bl^tbQ^oEuratBb<7NmYFXxZmQ<d<`w;SlM29Pf0ikhv\b[l6bDE>\dR<T:w=yItkKxd"
565,"wlCvz]wQwvHSHo_tqz50`K2a<lhgp^=g=0Eeq835BdLJqP3qPwtx<qwMdmDKvz42uHWp\QO9G?cs4RZIcn?zKWWEtLWxgAqrg<vc85aB@<1Y80DnwQRJ3VLx0JIqhaW_Y`^9zq^JjGb=11PwkkfO7`B9L<:HZDgaulDZ4H9`q3^qNQ<:GYfjT;gi?R9qimlG`RnhNaf^"
559,1
928,0
593,
Expand All @@ -18,14 +18,14 @@
566,0
567,","
588,"."
589,
589,","
568,""""
570,Default
571,
569,0
592,0
599,1000
560,18
560,19
pLogOutput
pSrcCube
pFilter
Expand All @@ -43,8 +43,9 @@ pEleStartDelim
pEleDelim
pTemp
pCubeLogging
pSandbox
pThreadMode
561,18
561,19
1
2
2
Expand All @@ -62,8 +63,9 @@ pThreadMode
2
1
1
2
1
590,18
590,19
pLogOutput,0
pSrcCube,""
pFilter,""
Expand All @@ -81,8 +83,9 @@ pEleStartDelim,"¦"
pEleDelim,"+"
pTemp,1
pCubeLogging,0
pSandbox,""
pThreadMode,0
637,18
637,19
pLogOutput,"Optional: write parameters and action summary to server message log (Boolean True = 1)"
pSrcCube,"REQUIRED: Cube data is being copied from"
pFilter,"OPTIONAL: Filter on source cube in format Year: 2006 + 2007 & Scenario: Actual + Budget. Blank for whole cube"
Expand All @@ -100,6 +103,7 @@ pEleStartDelim,"OPTIONAL: Delimiter for start of element list"
pEleDelim,"OPTIONAL: Delimiter between elements"
pTemp,"OPTIONAL: Delete temporary view and Subset ( 0 = Retain View and Subsets 1 = Delete View and Subsets 2 = Delete View only )"
pCubeLogging,"OPTIONAL: Cube Logging (0 = No transaction logging, 1 = Logging of transactions)"
pSandbox,"OPTIONAL: To use sandbox not base data enter the sandbox name (invalid name will result in process error)"
pThreadMode,"DO NOT USE: Internal parameter only, please don't use"
577,29
V1
Expand Down Expand Up @@ -282,7 +286,7 @@ VarType=32 ColType=827
VarType=32 ColType=827
VarType=32 ColType=827
603,0
572,1086
572,1100
#Region CallThisProcess
# A snippet of code provided as an example how to call this process should the developer be working on a system without access to an editor with auto-complete.
If( 1 = 0 );
Expand All @@ -294,7 +298,7 @@ If( 1 = 0 );
'pZeroTarget', 1, 'pZeroSource', 0,
'pFactor', 1,
'pDimDelim', '&', 'pEleStartDelim', '¦', 'pEleDelim', '+',
'pTemp', 1, 'pCubeLogging', 0
'pTemp', 1, 'pCubeLogging', 0, 'pSandbox', pSandbox
);
EndIf;
#EndRegion CallThisProcess
Expand Down Expand Up @@ -415,6 +419,21 @@ Else;
nMaxThreads = 1;
EndIf;

# Validate Sandbox
If( TRIM( pSandbox ) @<> '' );
If( ServerSandboxExists( pSandbox ) = 0 );
SetUseActiveSandboxProperty( 0 );
nErrors = nErrors + 1;
sMessage = Expand('Sandbox %pSandbox% is invalid for the current user.');
LogOutput( cMsgErrorLevel, Expand( cMsgErrorContent ) );
Else;
ServerActiveSandboxSet( pSandbox );
SetUseActiveSandboxProperty( 1 );
EndIf;
Else;
SetUseActiveSandboxProperty( 0 );
EndIf;

### Check for errors before continuing
If( nErrors <> 0 );
ProcessBreak;
Expand Down Expand Up @@ -1206,8 +1225,6 @@ WHILE (nChar <= nCharCount);
EndIf;

nElementCount = nElementCount + 1;


sLastDelim = sChar;

# Clear the word
Expand Down Expand Up @@ -1265,7 +1282,7 @@ If( Scan( pEleStartDelim, pFilterParallel ) > 0 );
'pSrcCube', pSrcCube, 'pFilter', sFilter, 'pFilterParallel', '', 'pTgtCube', pTgtCube, 'pMappingToNewDims', pMappingToNewDims,
'pSuppressConsol', pSuppressConsol, 'pSuppressRules', pSuppressRules, 'pZeroTarget', pZeroTarget, 'pZeroSource', pZeroSource,
'pFactor', pFactor, 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim, 'pEleDelim', pEleDelim,
'pTemp', pTemp, 'pCubeLogging', pCubeLogging, 'pThreadMode', 1
'pTemp', pTemp, 'pCubeLogging', pCubeLogging, 'pSandbox', pSandbox, 'pThreadMode', 1
);
nThreadElCounter = 0;
sFilter = '';
Expand All @@ -1277,7 +1294,7 @@ If( Scan( pEleStartDelim, pFilterParallel ) > 0 );
'pSrcCube', pSrcCube, 'pFilter', sFilter, 'pFilterParallel', '', 'pTgtCube', pTgtCube, 'pMappingToNewDims', pMappingToNewDims,
'pSuppressConsol', pSuppressConsol, 'pSuppressRules', pSuppressRules, 'pZeroTarget', pZeroTarget, 'pZeroSource', pZeroSource,
'pFactor', pFactor, 'pDimDelim', pDimDelim, 'pEleStartDelim', pEleStartDelim, 'pEleDelim', pEleDelim,
'pTemp', pTemp, 'pCubeLogging', pCubeLogging, 'pThreadMode', 1
'pTemp', pTemp, 'pCubeLogging', pCubeLogging, 'pSandbox', pSandbox, 'pThreadMode', 1
);
ENDIF;
DataSourceType = 'NULL';
Expand Down Expand Up @@ -1316,8 +1333,9 @@ Else;
'pDimDelim', pDimDelim,
'pEleStartDelim', pEleStartDelim,
'pEleDelim', pEleDelim,
'pTemp', pTemp ,
'pCubeLogging', pCubeLogging
'pTemp', pTemp,
'pCubeLogging', pCubeLogging,
'pSandbox', pSandbox
);

IF(nRet <> 0);
Expand Down
Loading

0 comments on commit 2c8be33

Please sign in to comment.