Learning
Documentation
Community
Open Exchange
Global Masters
Home / Class Reference / ENSLIB namespace / Ens.Deployment.Utils
Private  Storage   

Ens.Deployment.Utils


abstract class Ens.Deployment.Utils

Ens.Deployment.Utils provides APIs to create deployment packages and is used with Ens.Deployment.Deploy or applied through the Portal.

Dynamic SQL

Examples:

/* Create a deployment file from a Studio Project */
	Set tProjectName = "HL7v2Driver"
	Set tProductionName = "HL7v2Driver.SampleProduction"
	Set tProductionClassIncluded = 1
	Set tExportFilename = "/SomeDirectory/Deployment_"_tProjectName_".xml"
	Set tComments =##class(%Stream.TmpCharacter).%New() /* tComments can be a stream or string */
	Do tComments.WriteLine("This is a test exporting the whole production")
	Do tComments.WriteLine("Created to show HL7 message generation")
	Do tComments.Rewind()
	Set tSC =##class(Ens.Deployment.Utils).CreateExportPackageFromProjectList(tProjectName,.tContentsList,tExportFilename,tProductionName,tComments,tProductionClassIncluded)
	
/* Create a deployment file from a list of items */
	Set tProjectName = "HL7v2Driver"
	Set tProductionName = "HL7v2Driver.SampleProduction"
	Set tProductionClassIncluded = 0
	Set tExportFilename = "/SomeDirectory/Deployment_one_class_"_tProjectName_".xml"
	Set tComments = "Exporting one class and one routine." 
	Set tContentsList("HL7v2Gen.MAC")=""
	Set tContentsList("HL7v2Driver.Service.CLS")=""
	Set tSC =##class(Ens.Deployment.Utils).CreateExportPackageFromProjectList(tProjectName,.tContentsList,tExportFilename,tProductionName,tComments,tProductionClassIncluded)
	
/* Create a Project text document containing settings for an Item */
	Set tItemName = "ToMainLabADT"
	Set tProjectName = "HL7v2Driver"
	Set tProductionName = "HL7v2Driver.SampleProduction"
	Set:(tItemName '[ "||") tItemName = tProductionName_"||"_tItemName
	Set tItem = ##class(Ens.Config.Production).OpenItemByConfigName(tItemName)
	If $IsObject(tItem) Set tSC = ##class(Ens.Deployment.Utils).CreatePTDFromItem(.tItem,.tPTDName)	
	If tPTDName '= "" {
		Set tProductionClassIncluded = 0
 		Set tExportFilename = $$$DeployDirectory_"Deployment_item_"_tProjectName_".xml"
		Set tComments = "just an item"
		Set tContentsList(tPTDName_".PTD")=""
		Set tSC =##class(Ens.Deployment.Utils).CreateExportPackageFromProjectList(tProjectName,.tContentsList,tExportFilename,tProductionName,tComments,tProductionClassIncluded)
	}
	Do ##class(Ens.Util.ProjectTextDocument).Delete(tPTDName_".PTD")
	
/* Create a Project text document containing settings for a Production */
	Set tProjectName = "HL7v2Driver"
	Set tProductionName = "HL7v2Driver.SampleProduction"
	Set tProduction = ##class(Ens.Config.Production).%OpenId(tProductionName)
	If $IsObject(tProduction) Set tSC = ##class(Ens.Deployment.Utils).CreatePTDFromProduction(tProduction,.tPTDName)	
	If tPTDName '= "" {
		Set tProductionClassIncluded = 0
		Set tExportFilename = "/SomeDirectory/Deployment_prod_settings_"_tProjectName_".xml"
		Set tComments = "Production settings"
		Set tContentsList(tPTDName_".PTD")=""
		Set tSC =##class(Ens.Deployment.Utils).CreateExportPackageFromProjectList(tProjectName,.tContentsList,tExportFilename,tProductionName,tComments,tProductionClassIncluded)
	}
	Do ##class(Ens.Util.ProjectTextDocument).Delete(tPTDName_".PTD") /* Clean up tPTDName_".PTD" unless want to keep */
	
/* 	Create a Project text document containing list of items to remove.
	This can then be included in a call to CreateExportPackageFromProjectList()
	To remove a busines host item create the PTD for that item first.
*/
	Set tItemName = "ToMainLabADT"
	Set tProjectName = "HL7v2Driver"
	Set tProductionName = "HL7v2Driver.SampleProduction"
	Set:(tItemName '[ "||") tItemName = tProductionName_"||"_tItemName
	Set tItem = ##class(Ens.Config.Production).OpenItemByConfigName(tItemName)
	If $IsObject(tItem) Set tSC = ##class(Ens.Deployment.Utils).CreatePTDFromItem(.tItem,.tPTDName)	
	If tPTDName '= "" {
		Set tItemsToRemove(tPTDName_".PTD")=""
		Set tSC =##class(Ens.Deployment.Utils).CreateExportRemovePTD(tProjectName,tProductionName,.tItemsToRemove,.tPTDNameRemove)	
		If tPTDNameRemove '= "" {
			Set tProductionClassIncluded = 0
			Set tExportFilename = "/SomeDirectory/Deployment_remove_item_"_tProjectName_".xml"
			Set tComments = "Remove one item but we could have included other items"
			Set tContentsList(tPTDNameRemove_".PTD")=""
			Set tSC =##class(Ens.Deployment.Utils).CreateExportPackageFromProjectList(tProjectName,.tContentsList,tExportFilename,tProductionName,tComments,tProductionClassIncluded)
		}
	}
	Do ##class(Ens.Util.ProjectTextDocument).Delete(tPTDName_".PTD") /* Clean up tPTDName_".PTD" unless want to keep */
	Do ##class(Ens.Util.ProjectTextDocument).Delete(tPTDNameRemove_".PTD") /* Clean up tPTDNameRemove_".PTD" unless want to keep */

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 16


Summary


Methods
CreateExportNotesPTD CreateExportPackageFromProjectList CreateExportRemovePTD
CreatePTDFromItem CreatePTDFromProduction GenerateFileNames
GetItemContentsByItemNumber LoadAndCompileCode SourceControlCheckIn
SourceControlCheckOut SourceControlGetStatus SourceControlProductionSave
WriteDeployLog getProjectItemList getSystemStartTime
getUserDocumentExts


Parameters


• parameter DOMAIN = "Ensemble";

Methods


• classmethod CreateExportNotesPTD(pProjectName As %String, pSourceProduction As %String, pComments As %Stream.Object = "", ByRef pContentsList As %String, pProductionClassIncluded As %Boolean = 0, Output pPTDName, pRollbackFilename As %String = "", pDeploymentFile As %String = "") as %Status
Create a deployment Export Notes Project Text Document pProjectName is a name given to the export project. The notes PTD will be this preceded by EnsExportNotes. The name does not include the .PTD extension. pSourceProduction is the name of the Source production for the notes. pComments is a stream of comments. pContentsList is an array of items that will be exported by a subsequent process. pProductionClassIncluded indicates if the export will include a Production class. pRollbackFilename if specified indicates that these are notes for a rollback deployment file. This is passed by the deployment process. pDeploymentFile if pRollbackFilename is specified then this is the name of the corresponding deployment file.
• classmethod CreateExportPackageFromProjectList(pProjectName As %String, ByRef pContentsList, pExportFilename As %String = "", pSourceProduction As %String, pComments As %Stream.Object = "", pProductionClassIncluded As %Boolean = 0) as %Status
Create a deployment Export package from a studio project pProjectName is the name of the studio project or the name to be used if providing list in pContentsListArray pContentsList - optional. An array of items to include in the export package. If defined this is used and not the StudioProject. If not defined then it is populated with the list of items from the project. After completion the list will also include the temporary project and project text document created and exported. pExportFilename is the OS file to create. If not specified the file name will be generated as EnsExport-then the project name then a date timestamp in the current working directory. pSourceProduction is the name of the Source production for the notes. pComments is a stream of comments to include in the Export notes. pProductionClassIncluded indicates if the export will include a Production class.
• classmethod CreateExportRemovePTD(pProjectName As %String, pSourceProduction As %String, ByRef pItemsToRemove As %String, Output pPTDName, pRollbackFilename As %String = "", pDeploymentFile As %String = "") as %Status
Create a deployment Export Items to Remove Project Text Document If pPTDName is passed back "" then no PTD created as nothing to remove. The name does not include the .PTD extension. pProjectName is a name given to the export project. The notes PTD will be this preceded by EnsExportNotes. pSourceProduction is the name of the Source production for the notes. pItemsToRemove is an array of items that will be added by the deployment and hence need to be marked for removal. pRollbackFilename if specified indicates that these are notes for a rollback deployment file. This is passed by the deployment process. pDeploymentFile if pRollbackFilename is specified then this is the name of the corresponding deployment file.
• classmethod CreatePTDFromItem(pItem As %RegisteredObject, Output pPTDName) as %Status
Create a Project Document Text entry for a given Production Item.
• classmethod CreatePTDFromProduction(pProduction As %RegisteredObject, Output pPTDName) as %Status
Create a Project Document Text for Production Settings This includes the production defined settings only and also does not include Items or SubProductions.
• classmethod GenerateFileNames(pDeploymentFile As %String, Output pRollbackFilename As %String, Output pLogFile As %String, Output pReportFile As %String, pAttempts As %Integer = 20)
Generate rollback, log & report file names based on Deployment file name Used in InterSystems IRIS code: Portal deployment interface.
• classmethod GetItemContentsByItemNumber(pDeploymentFile As %String, pItemNumber As %Integer, Output pItemContents As %String, Output pName As %String, Output pExt As %String) as %Status
Used to retrieve contents of the export file by item number Used in InterSystemsm IRIS code: Portal deployment interface.
• classmethod LoadAndCompileCode(pFilename As %String, ByRef pDeployDetails, ByRef pErrors As %String, ByRef pLoadedList, ByRef pOBJectsToLoad, Output pFailureText) as %Status
Load code and compile code. Check out items if Source Control is enabled (Check in will be done at the end of deployment. Compilation flags default to "ck-d" but can be changed setting the global ^Ens.Configuration("deploy","CompileFlags") the desired compilation flags.
• classmethod SourceControlCheckIn(ByRef pDeployDetails As %String) as %Status
Loop through pDeployDetails("SourceControl","") and for any item that is listed and GetStatus reports item checked out by this user then call CheckIn.
• classmethod SourceControlCheckOut(ByRef pObjectsToLoad, ByRef pDeployDetails As %String, Output pItemsAlreadyCheckedOut As %Boolean) as %Status
Loop through pObjectsToLoad and if item exists and is not in source control call AddToSourceControl If the item does not yet exist in the system mark it to be added in pDeployDetails array.
• classmethod SourceControlGetStatus(ByRef pDeployDetails As %String, Output pItemsAlreadyCheckedOut As %Boolean) as %Status
Loop through pDeployDetails("Items","") and find source control status. Update information about the item.
• classmethod SourceControlProductionSave(pProduction As %String, pAction As %String, ByRef pDeployDetails As %String) as %Status
• classmethod WriteDeployLog(pText As %String = "", pEventLogType As %String = "") as %Status
Log information to combination of Console, Web, Event Log, File pEventLogType is used to have variable control over Event log entry types if the initial log where setting includes EI for Event Log Information
• classmethod getProjectItemList(pProjectName As %String, ByRef pContentsList As %String) as %Status
• classmethod getSystemStartTime() as %Integer
• classmethod getUserDocumentExts(pUserDocumentExts As %String)
Retrieve User Document Extensions and their associated Document Classes.