Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
72:phase_freezes_prepare [2019/02/19 17:08] – ext-bkkr | 72:phase_freezes_prepare [2019/02/25 16:44] – [Configure Phase Freeze Support in the Metamodel] ext-bkkr | ||
---|---|---|---|
Line 26: | Line 26: | ||
* Frozen core process elements are separated from the core process because they will not be updated anymore when the current valid version and the working revision are merged into a new valid version. | * Frozen core process elements are separated from the core process because they will not be updated anymore when the current valid version and the working revision are merged into a new valid version. | ||
* The process freeze operation will lock the process including the working revision and the valid version as long as the operation is running to ensure a consistent freeze result. This also means that only one freeze operation can be executed at a time in a single workspace. | * The process freeze operation will lock the process including the working revision and the valid version as long as the operation is running to ensure a consistent freeze result. This also means that only one freeze operation can be executed at a time in a single workspace. | ||
+ | |||
+ | ==== Configure Phase Freeze Support in the Metamodel ==== | ||
+ | |||
+ | Phase Freeze needs to be enabled in the process metamodel in <font inherit/ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | [...] | ||
+ | <element ident=" | ||
+ | milestone" | ||
+ | moduleSpec.js"> | ||
+ | < | ||
+ | [...] | ||
+ | </ | ||
+ | < | ||
+ | [...] | ||
+ | </ | ||
+ | </ | ||
+ | [...] | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Freeze Script Programming ==== | ||
+ | |||
+ | The freeze script is used to determine the scope of the phase to freeze. It will call for an element of a freezable subtype and needs to collect all process elements that are part of that phase as well as all associations that need to get frozen. For all associations, | ||
+ | |||
+ | ^Variable^Type^Description| | ||
+ | |currentElement|IBaseElement|The phase root element.| | ||
+ | |moduleElementSet|Set|The result set to be filled with all elements to be frozen together with the current phase (currentElement).| | ||
+ | |moduleAssocSet|Set|The result set to be filled with all associations to be frozen together with the current phase (currentElement).| | ||
+ | |moduleAssocToCommentSet|Set|The result to be filed with all associations to be converted to comments when frozen together with the current phase (currentElement). It needs to be a subset of moduleAssocSet.| | ||
+ | |log|Logger|A means to log messages to the Stages log file.| | ||
+ | |||
+ | **Example** | ||
+ | |||
+ | The phase is here defined by the phase root element, its sequence associations and executed activities including their outputs. The responsible roles of the activities are converted to comments. | ||
+ | |||
+ | < | ||
+ | <font inherit/ | ||
+ | importPackage(Packages.de.methodpark.pkit.facade.impl); | ||
+ | function getSelfAndTransitiveChildren(self) { | ||
+ | var result = new Array(); | ||
+ | result.push(self); | ||
+ | var children = | ||
+ | self.getEntities(" | ||
+ | for (var i = 0; i < | ||
+ | result = result.concat(getSelfAndTransitiveChildren(children[i])); | ||
+ | } | ||
+ | return result; | ||
+ | } | ||
+ | function getAssociatedElementsCollectAssocs(source, | ||
+ | sourceRole, assocSet, remoteAssocSet) { | ||
+ | var assocSpec; | ||
+ | if (sourceRole === null) { | ||
+ | assocSpec = assocType; | ||
+ | } else { | ||
+ | assocSpec = assocType + ", | ||
+ | } | ||
+ | var assocsForward = source.getAssociations(assocSpec); | ||
+ | var targets = new Array(); | ||
+ | for (var j = 0; j < | ||
+ | var forwardAssoc = assocsForward[j]; | ||
+ | assocSet.add(forwardAssoc); | ||
+ | var isRemoteAssoc = forwardAssoc.isRemote(); | ||
+ | //remote associations are converted to comments | ||
+ | if (isRemoteAssoc) { | ||
+ | remoteAssocSet.add(forwardAssoc); | ||
+ | } | ||
+ | var assocTarget = forwardAssoc.getTarget(); | ||
+ | if (!(assocTarget instanceof MockElement)) { | ||
+ | // do not collect remote elements | ||
+ | if (!isRemoteAssoc) { | ||
+ | targets.push(assocTarget); | ||
+ | } | ||
+ | assocSet.add(forwardAssoc.getOpponentAssociation()); | ||
+ | } | ||
+ | } | ||
+ | return targets; | ||
+ | } | ||
+ | function convertToComment(source, | ||
+ | commentAssocSet) { | ||
+ | var assocSpec= assocType; | ||
+ | if (sourceRole !== null) { | ||
+ | assocSpec = assocSpec + ", | ||
+ | } | ||
+ | var assocsForward = source.getAssociations(assocSpec); | ||
+ | for (var j = 0; j < | ||
+ | var forwardAssoc = assocsForward[j]; | ||
+ | assocSet.add(forwardAssoc); | ||
+ | commentAssocSet.add(forwardAssoc); | ||
+ | } | ||
+ | } | ||
+ | //start of script execution ---------------------------------- | ||
+ | //freeze all children of the phase | ||
+ | var phases = getSelfAndTransitiveChildren(currentElement); | ||
+ | Collections.addAll(moduleElementSet, | ||
+ | //freeze the predecessor and successor associations but not the | ||
+ | associated phases themselves | ||
+ | getAssociatedElementsCollectAssocs(currentElement, | ||
+ | " | ||
+ | getAssociatedElementsCollectAssocs(currentElement, | ||
+ | " | ||
+ | //freeze all the activities associated to one of the frozen phase | ||
+ | elements | ||
+ | var allActivities = new Array(); | ||
+ | for (var k = 0; k < | ||
+ | //Add associated ' | ||
+ | var associatedActivities = getAssociatedElementsCollectAssocs(phases[k], | ||
+ | " | ||
+ | allActivities = allActivities.concat(associatedActivities); | ||
+ | } | ||
+ | Collections.addAll(moduleElementSet, | ||
+ | var allOutputs = new Array(); | ||
+ | for (var l = 0; l < | ||
+ | //Freeze the output artifacts of the activities: | ||
+ | var outputs = getAssociatedElementsCollectAssocs(allActivities[l], | ||
+ | " | ||
+ | allOutputs = allOutputs.concat(outputs); | ||
+ | //convert responsible roles to comments | ||
+ | convertToComment(allActivities[l], | ||
+ | moduleAssocToCommentSet); | ||
+ | } | ||
+ | Collections.addAll(moduleElementSet, | ||
+ | </ | ||
+ | |||
+ | \\ | ||