diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-07-24 23:59:47 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-07-24 23:59:47 +0200 |
| commit | 7b3b3c6d26742fc6c2bd9ce4f9b0df1c19686e66 (patch) | |
| tree | 0d2e3f4df9d6652eaa9f08f7df3086ad98f98096 /src/main/resources/boot/SC | |
| parent | 5fe73473d17805ecc30bac50a21b619b94fbd25d (diff) | |
MoveLatestVersionToLast activity in defs to make it easier to apply
changes to existing definitions.
Diffstat (limited to 'src/main/resources/boot/SC')
| -rw-r--r-- | src/main/resources/boot/SC/SetLastNumberedVersionToLast.xml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/resources/boot/SC/SetLastNumberedVersionToLast.xml b/src/main/resources/boot/SC/SetLastNumberedVersionToLast.xml new file mode 100644 index 0000000..cd11985 --- /dev/null +++ b/src/main/resources/boot/SC/SetLastNumberedVersionToLast.xml @@ -0,0 +1,28 @@ +<cristalscript> + <output name="errors" type="com.c2kernel.scripting.ErrorInfo"/> + <script language="javascript" name="SetLastNumberedVersionFromLast"><![CDATA[ + + var viewName = job.getActPropString("ViewName"); + + if (viewName == null || viewName.equals("")) + throw "ViewName not specified."; + + var lastView = -1; + var existingViews = item.getContents("/ViewPoint/"+viewName); + for (i=0; i<existingViews.length; i++) { + var thisView = parseInt(existingViews[i]); + if (thisView!=NaN && lastView < thisView) lastView = thisView; + } + if (lastView == -1) + throw "No numbered version found. Please use CreateNewNumberedVersionFromLast."; + try { + var existingLast = agent.unmarshall(item.queryData("/ViewPoint/"+viewName+"/last")); + } catch (e) { + throw "No last view found."; + } + + existingLast.setName(lastView); + agent.execute(item, "AddC2KObject", existingLast); + + ]]></script> +</cristalscript>
\ No newline at end of file |
