blob: 490ac3bd4e9c747acc1f2465c0c9b5c6e52cbb9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?xml version="1.0" encoding="UTF-8"?>
<cristalscript>
<output name="errors" type="org.cristalise.kernel.scripting.ErrorInfo"/>
<script language="javascript" name="CreateNewNumberedVersionFromLast"><![CDATA[
var viewName = job.getActPropString("ViewName");
if (viewName.equals(""))
throw "ViewName not specified. Cannot create new version.";
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;
}
lastView++;
try {
var existingLast = agent.unmarshall(item.queryData("/ViewPoint/"+viewName+"/last"));
} catch (e) {
throw "No data found. You must submit at least one version before executing this activity.";
}
var params = new Array(3);
params[0] = viewName;
params[1] = lastView;
params[2] = existingLast.getEventId();
agent.execute(item, "WriteViewpoint", params);
]]></script>
</cristalscript>
|