summaryrefslogtreecommitdiff
path: root/resources/boot/SC/LocalObjectDefCreator.xml
diff options
context:
space:
mode:
authorabranson <abranson@PCUWE01.cern.ch>2012-04-26 00:31:26 +0200
committerabranson <abranson@PCUWE01.cern.ch>2012-04-26 00:31:26 +0200
commiteac30db6329f05cc7cf2a35613497e357b4db3aa (patch)
tree427d12973863e4bc3790b0f6e06f58bb65667651 /resources/boot/SC/LocalObjectDefCreator.xml
parent3ffa8ec426702e8cf95df2a6840f80a27fba3b3e (diff)
Update for javax.script
Diffstat (limited to 'resources/boot/SC/LocalObjectDefCreator.xml')
-rw-r--r--resources/boot/SC/LocalObjectDefCreator.xml59
1 files changed, 25 insertions, 34 deletions
diff --git a/resources/boot/SC/LocalObjectDefCreator.xml b/resources/boot/SC/LocalObjectDefCreator.xml
index 445a517..32b154c 100644
--- a/resources/boot/SC/LocalObjectDefCreator.xml
+++ b/resources/boot/SC/LocalObjectDefCreator.xml
@@ -8,10 +8,6 @@
importClass(Packages.com.c2kernel.lifecycle.CompositeActivityDef);
importClass(Packages.com.c2kernel.lifecycle.ActivityDef);
- var job = bsf.lookupBean("job");
- var item = bsf.lookupBean("item");
- var agent = bsf.lookupBean("agent");
- var errorBuffer = bsf.lookupBean("errors");
var type = job.getActPropString("NewType");
var name = job.getOutcome().getField("ObjectName");
var folder = job.getOutcome().getField("SubFolder");
@@ -24,40 +20,35 @@
params[1] = domPath;
// Create the new item
- if (!(errorBuffer.getFatal())) {
- try {
- agent.execute(item, "CreateItemFromDescription", params);
- } catch (e) {
- errorBuffer.addError("Could not create "+name+": "+e.message);
- errorBuffer.setFatal();
- }
+ try {
+ agent.execute(item, "CreateItemFromDescription", params);
+ } catch (e) {
+ throw "Could not create "+name+": "+e.message;
}
// Store a fresh one in the new item
- if (!(errorBuffer.getFatal())) {
- var newObj;
- // Activities are serialized new instances
- if (type.equals("EA") || type.equals("CA")) {
- var newAct = type.equals("CA")?new CompositeActivityDef(): new ActivityDef();
- newAct.setName(name);
- newObj = CastorXMLUtility.marshall(newAct);
- }
- else {
- // Empty schemas and scripts are stored as outcomes of the factory.
- var fileType = type.equals("OD")?"Schema":"Script";
- newObj = item.getObject("/ViewPoint/"+fileType+"/last").getOutcome().getData();
+
+ var newObj;
+ // Activities are serialized new instances
+ if (type.equals("EA") || type.equals("CA")) {
+ var newAct = type.equals("CA")?new CompositeActivityDef(): new ActivityDef();
+ newAct.setName(name);
+ newObj = CastorXMLUtility.marshall(newAct);
}
- // Store the new object with the 'EditDefinition' activity
- var newPath = new Packages.com.c2kernel.lookup.DomainPath(domPath+"/"+name);
- var newItem = agent.getItem(newPath);
- newItem.requestAction(agent.getSystemKey(), "workflow/domain/EditDefinition", 4, newObj);
-
- // If this script is running in the Cristal GUI, open the new item.
- var tree = Packages.com.c2kernel.gui.MainFrame.treeBrowser;
- if (tree != null) // open new item in the gui
- tree.push(newPath);
-
+ else {
+ // Empty schemas and scripts are stored as outcomes of the factory.
+ var fileType = type.equals("OD")?"Schema":"Script";
+ newObj = item.getObject("/ViewPoint/"+fileType+"/last").getOutcome().getData();
}
- errorBuffer;
+ // Store the new object with the 'EditDefinition' activity
+ var newPath = new Packages.com.c2kernel.lookup.DomainPath(domPath+"/"+name);
+ var newItem = agent.getItem(newPath);
+ newItem.requestAction(agent.getSystemKey(), "workflow/domain/EditDefinition", 4, newObj);
+
+ // If this script is running in the Cristal GUI, open the new item.
+ var tree = Packages.com.c2kernel.gui.MainFrame.treeBrowser;
+ if (tree != null) // open new item in the gui
+ tree.push(newPath);
+
]]></script>
</cristalscript>