diff options
Diffstat (limited to 'resources/boot/SC/LocalObjectDefCreator.xml')
| -rw-r--r-- | resources/boot/SC/LocalObjectDefCreator.xml | 59 |
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>
|
