diff options
| -rw-r--r-- | build.xml | 47 | ||||
| -rw-r--r-- | resources/boot/CA/ItemDescriptionFactoryWf.xml | 108 | ||||
| -rw-r--r-- | resources/boot/SC/CreateNewNumberedVersionFromLast.xml | 44 | ||||
| -rw-r--r-- | resources/boot/SC/InstantiateItem.xml | 11 | ||||
| -rw-r--r-- | resources/boot/SC/LocalObjectDefCreator.xml | 59 | ||||
| -rw-r--r-- | resources/boot/SC/New.xml | 6 | ||||
| -rw-r--r-- | resources/boot/SC/SetWorkflow.xml | 56 |
7 files changed, 186 insertions, 145 deletions
@@ -1,33 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="cristal-dev">
- <!--===================================================================-->
- <!-- Global properties -->
- <!-- NOTE: Ant will automatically will add all jar files to the -->
- <!-- classpath from the $(ANT_HOME)/lib directory. In cristal2 -->
- <!-- setup this directories are equal to the cristal2/lib -->
- <!-- directory which eliminates thecalculation of classpath for -->
- <!-- the most of the 'javac' tasks -->
- <!--===================================================================-->
<property name="name" value="cristal-dev"/>
<property name="version" value="1.0"/>
- <!--===================================================================-->
- <!-- Directories -->
- <!--===================================================================-->
<property name="src.dir" value="src"/>
<property name="res.dir" value="ch/cern/cristaldev/resources"/>
<property name="build.dir" value="bin"/>
<property name="resource.dir" value="resources"/>
- <!--===================================================================-->
- <!-- Global javacc attributes -->
- <!--===================================================================-->
<property name="debug" value="true"/>
<property name="deprecation" value="false"/>
<property name="optimize" value="true"/>
- <property name="junit.fork" value="false"/>
- <!-- ==================================================================-->
- <!-- The pattern for the support files that need -->
- <!-- to be copied when compiling classes -->
- <!-- ==================================================================-->
+
+ <!-- Resource file patterns -->
<patternset id="resource.files">
<include name="boot/**/*.txt"/>
<include name="boot/**/*.xml"/>
@@ -36,24 +19,11 @@ <include name="images/**/*.jpg"/>
<include name="images/**/*.png"/>
</patternset>
-
- <!--===================================================================-->
- <!-- Prepare the build (takes the timestamp see: Ant1.3 docs) -->
- <!--===================================================================-->
+
<target name="prepare">
<tstamp/>
</target>
- <target name="clean" description="cleans up the build directories">
- <delete dir="${build.dir}"/>
- </target>
- <target name="rebuild" depends="clean, jar" description="deletes and rebuilds the cristal-dev module"/>
- <target name="jar" depends="resources" description="make jar">
- <jar basedir="${build.dir}" includes="**" jarfile="cristaldev.jar"/>
- </target>
- <!--===================================================================-->
- <!-- Assembles cristal2 resources -->
- <!--===================================================================-->
<target name="resources" depends="prepare" description="Moves all resources to the build directory for the Resource class to read">
<mkdir dir="${build.dir}/${res.dir}"/>
<copy todir="${build.dir}/${res.dir}">
@@ -68,4 +38,15 @@ </copy>
</target>
+ <target name="jar" depends="resources" description="make jar">
+ <jar basedir="${build.dir}" includes="**" jarfile="cristaldev.jar"/>
+ </target>
+
+ <target name="clean" description="cleans up the build directories">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="rebuild" depends="clean, jar" description="deletes and rebuilds the cristal-dev module"/>
+
+
</project>
diff --git a/resources/boot/CA/ItemDescriptionFactoryWf.xml b/resources/boot/CA/ItemDescriptionFactoryWf.xml index 43cdfc1..270c473 100644 --- a/resources/boot/CA/ItemDescriptionFactoryWf.xml +++ b/resources/boot/CA/ItemDescriptionFactoryWf.xml @@ -1 +1,107 @@ -<CompositeActivityDef ID="-1" Name="ItemDescriptionFactoryWf" Height="0" Width="0" IsLayoutable="false" IsComposite="true"><childrenGraphModel><GraphModelCastorData ClassNameOfVertexOutlineCreator="com.c2kernel.lifecycle.gui.model.WfVertexDefOutlineCreator" StartVertexId="1" NextId="14"><JoinDef ID="3" Name="" Height="24" Width="60" IsLayoutable="true" IsComposite="false"><CentrePoint x="312" y="390"/><OutlinePoint x="282" y="378"/><OutlinePoint x="342" y="378"/><OutlinePoint x="342" y="402"/><OutlinePoint x="282" y="402"/><InEdgeId>7</InEdgeId><Properties><KeyValuePair Key="Type" String="Join"/></Properties></JoinDef><LoopDef ID="2" Name="" Height="24" Width="60" IsLayoutable="true" IsComposite="false" isNext="0"><CentrePoint x="313" y="204"/><OutlinePoint x="283" y="192"/><OutlinePoint x="343" y="192"/><OutlinePoint x="343" y="216"/><OutlinePoint x="283" y="216"/><InEdgeId>13</InEdgeId><OutEdgeId>6</OutEdgeId><OutEdgeId>7</OutEdgeId><Properties><KeyValuePair Key="LastNum" String="2"/><KeyValuePair Key="RoutingScriptName" String="javascript:true;"/><KeyValuePair Key="RoutingScriptVersion" String=""/></Properties></LoopDef><ActivitySlotDef ID="11" Name="CreateItem slot" Height="60" Width="130" IsLayoutable="true" IsComposite="false"><CentrePoint x="126" y="204"/><OutlinePoint x="61" y="174"/><OutlinePoint x="191" y="174"/><OutlinePoint x="191" y="234"/><OutlinePoint x="61" y="234"/><InEdgeId>12</InEdgeId><OutEdgeId>13</OutEdgeId><Properties><KeyValuePair Key="Name" String="CreateNewDescription"/><KeyValuePair Key="Version" String="last"/></Properties><activityDef>CreateItem</activityDef></ActivitySlotDef><JoinDef ID="1" Name="" Height="24" Width="60" IsLayoutable="true" IsComposite="false"><CentrePoint x="126" y="57"/><OutlinePoint x="96" y="45"/><OutlinePoint x="156" y="45"/><OutlinePoint x="156" y="69"/><OutlinePoint x="96" y="69"/><InEdgeId>6</InEdgeId><OutEdgeId>12</OutEdgeId><Properties><KeyValuePair Key="Type" String="Join"/></Properties></JoinDef><NextDef ID="6" OriginVertexId="2" TerminusVertexId="1"><OriginPoint x="313" y="204"/><TerminusPoint x="126" y="57"/><Properties><KeyValuePair Key="Alias" String="true"/></Properties></NextDef><NextDef ID="13" OriginVertexId="11" TerminusVertexId="2"><OriginPoint x="126" y="204"/><TerminusPoint x="313" y="204"/><Properties/></NextDef><NextDef ID="12" OriginVertexId="1" TerminusVertexId="11"><OriginPoint x="126" y="57"/><TerminusPoint x="126" y="204"/><Properties/></NextDef><NextDef ID="7" OriginVertexId="2" TerminusVertexId="3"><OriginPoint x="313" y="204"/><TerminusPoint x="312" y="390"/><Properties><KeyValuePair Key="Alias" String="false"/></Properties></NextDef></GraphModelCastorData></childrenGraphModel><Properties><KeyValuePair Key="Description" String=""/><KeyValuePair Key="Ignorable" Boolean="false"/><KeyValuePair Key="ScriptVersion" String=""/><KeyValuePair Key="Mail Message" String=""/><KeyValuePair Key="Viewpoint" String=""/><KeyValuePair Key="Agent Name" String=""/><KeyValuePair Key="SchemaVersion" String=""/><KeyValuePair Key="Skippable" Boolean="false"/><KeyValuePair Key="ScriptName" String=""/><KeyValuePair Key="Mail event" String=""/><KeyValuePair Key="Autostart" Boolean="true"/><KeyValuePair Key="Repeatable" Boolean="false"/><KeyValuePair Key="Show time" Boolean="true"/><KeyValuePair Key="Agent Role" String=""/><KeyValuePair Key="AlwaysUseOutcome" Boolean="false"/><KeyValuePair Key="SchemaType" String=""/></Properties></CompositeActivityDef>
\ No newline at end of file +<CompositeActivityDef ID="-1" Name="ItemDescriptionFactoryWf"
+ Height="0" Width="0" IsLayoutable="false" IsComposite="true">
+ <childrenGraphModel>
+ <GraphModelCastorData
+ ClassNameOfVertexOutlineCreator="com.c2kernel.lifecycle.gui.model.WfVertexDefOutlineCreator"
+ StartVertexId="1" NextId="14">
+ <JoinDef ID="3" Name="" Height="24" Width="60" IsLayoutable="true"
+ IsComposite="false">
+ <CentrePoint x="312" y="390" />
+ <OutlinePoint x="282" y="378" />
+ <OutlinePoint x="342" y="378" />
+ <OutlinePoint x="342" y="402" />
+ <OutlinePoint x="282" y="402" />
+ <InEdgeId>7</InEdgeId>
+ <Properties>
+ <KeyValuePair Key="Type" String="Join" />
+ </Properties>
+ </JoinDef>
+ <LoopDef ID="2" Name="" Height="24" Width="60" IsLayoutable="true"
+ IsComposite="false" isNext="0">
+ <CentrePoint x="313" y="204" />
+ <OutlinePoint x="283" y="192" />
+ <OutlinePoint x="343" y="192" />
+ <OutlinePoint x="343" y="216" />
+ <OutlinePoint x="283" y="216" />
+ <InEdgeId>13</InEdgeId>
+ <OutEdgeId>6</OutEdgeId>
+ <OutEdgeId>7</OutEdgeId>
+ <Properties>
+ <KeyValuePair Key="LastNum" String="2" />
+ <KeyValuePair Key="RoutingScriptName" String="javascript:true;" />
+ <KeyValuePair Key="RoutingScriptVersion" String="" />
+ </Properties>
+ </LoopDef>
+ <ActivitySlotDef ID="11" Name="CreateItem slot"
+ Height="60" Width="130" IsLayoutable="true" IsComposite="false">
+ <CentrePoint x="126" y="204" />
+ <OutlinePoint x="61" y="174" />
+ <OutlinePoint x="191" y="174" />
+ <OutlinePoint x="191" y="234" />
+ <OutlinePoint x="61" y="234" />
+ <InEdgeId>12</InEdgeId>
+ <OutEdgeId>13</OutEdgeId>
+ <Properties>
+ <KeyValuePair Key="Name" String="CreateNewDescription" />
+ <KeyValuePair Key="Version" String="last" />
+ </Properties>
+ <activityDef>CreateItem</activityDef>
+ </ActivitySlotDef>
+ <JoinDef ID="1" Name="" Height="24" Width="60" IsLayoutable="true"
+ IsComposite="false">
+ <CentrePoint x="126" y="57" />
+ <OutlinePoint x="96" y="45" />
+ <OutlinePoint x="156" y="45" />
+ <OutlinePoint x="156" y="69" />
+ <OutlinePoint x="96" y="69" />
+ <InEdgeId>6</InEdgeId>
+ <OutEdgeId>12</OutEdgeId>
+ <Properties>
+ <KeyValuePair Key="Type" String="Join" />
+ </Properties>
+ </JoinDef>
+ <NextDef ID="6" OriginVertexId="2" TerminusVertexId="1">
+ <OriginPoint x="313" y="204" />
+ <TerminusPoint x="126" y="57" />
+ <Properties>
+ <KeyValuePair Key="Alias" String="true" />
+ </Properties>
+ </NextDef>
+ <NextDef ID="13" OriginVertexId="11" TerminusVertexId="2">
+ <OriginPoint x="126" y="204" />
+ <TerminusPoint x="313" y="204" />
+ <Properties />
+ </NextDef>
+ <NextDef ID="12" OriginVertexId="1" TerminusVertexId="11">
+ <OriginPoint x="126" y="57" />
+ <TerminusPoint x="126" y="204" />
+ <Properties />
+ </NextDef>
+ <NextDef ID="7" OriginVertexId="2" TerminusVertexId="3">
+ <OriginPoint x="313" y="204" />
+ <TerminusPoint x="312" y="390" />
+ <Properties>
+ <KeyValuePair Key="Alias" String="false" />
+ </Properties>
+ </NextDef>
+ </GraphModelCastorData>
+ </childrenGraphModel>
+ <Properties>
+ <KeyValuePair Key="Description" String="" />
+ <KeyValuePair Key="Ignorable" Boolean="false" />
+ <KeyValuePair Key="ScriptVersion" String="" />
+ <KeyValuePair Key="Mail Message" String="" />
+ <KeyValuePair Key="Viewpoint" String="" />
+ <KeyValuePair Key="Agent Name" String="" />
+ <KeyValuePair Key="SchemaVersion" String="" />
+ <KeyValuePair Key="Skippable" Boolean="false" />
+ <KeyValuePair Key="ScriptName" String="" />
+ <KeyValuePair Key="Mail event" String="" />
+ <KeyValuePair Key="Autostart" Boolean="true" />
+ <KeyValuePair Key="Repeatable" Boolean="false" />
+ <KeyValuePair Key="Show time" Boolean="true" />
+ <KeyValuePair Key="Agent Role" String="" />
+ <KeyValuePair Key="AlwaysUseOutcome" Boolean="false" />
+ <KeyValuePair Key="SchemaType" String="" />
+ </Properties>
+</CompositeActivityDef>
\ No newline at end of file diff --git a/resources/boot/SC/CreateNewNumberedVersionFromLast.xml b/resources/boot/SC/CreateNewNumberedVersionFromLast.xml index bb66f4c..321855a 100644 --- a/resources/boot/SC/CreateNewNumberedVersionFromLast.xml +++ b/resources/boot/SC/CreateNewNumberedVersionFromLast.xml @@ -3,37 +3,25 @@ <output name="errors" type="com.c2kernel.scripting.ErrorInfo"/>
<script language="javascript" name="CreateNewNumberedVersionFromLast"><![CDATA[
- var job = bsf.lookupBean("job");
- var item = bsf.lookupBean("item");
- var agent = bsf.lookupBean("agent");
- var errorBuffer = bsf.lookupBean("errors");
-
var viewName = job.getActPropString("ViewName");
- if (viewName.equals("")) {
- errorBuffer.addError("ViewName not specified. Cannot create new version.");
- errorBuffer.setFatal();
- }
+ if (viewName.equals(""))
+ throw "ViewName not specified. Cannot create new version.";
- if (!(errorBuffer.getFatal())) {
- 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) {
- errorBuffer.addError("No data found. You must submit at least one version before executing this activity.");
- errorBuffer.setFatal();
- }
- if (!(errorBuffer.getFatal())) {
- existingLast.setName(lastView);
- agent.execute(item, "AddC2KObject", existingLast);
- }
+ 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;
}
- errorBuffer;
+ 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.";
+ }
+ existingLast.setName(lastView);
+ agent.execute(item, "AddC2KObject", existingLast);
+
]]></script>
</cristalscript>
diff --git a/resources/boot/SC/InstantiateItem.xml b/resources/boot/SC/InstantiateItem.xml index 0f16a65..4e80e9d 100644 --- a/resources/boot/SC/InstantiateItem.xml +++ b/resources/boot/SC/InstantiateItem.xml @@ -4,12 +4,6 @@ <script language="javascript" name="InstantiateItem"><![CDATA[
importClass(Packages.com.c2kernel.lookup.DomainPath);
- // Load contextual objects
- var job = bsf.lookupBean("job");
- var item = bsf.lookupBean("item");
- var agent = bsf.lookupBean("agent");
- var errorBuffer = bsf.lookupBean("errors");
-
// Get parameters from outcome var name = job.getOutcome().getField("ObjectName"); var folder = job.getOutcome().getField("SubFolder"); @@ -22,14 +16,13 @@ try { agent.execute(item, "CreateItemFromDescription", params); } catch (e) { - errorBuffer.addError("Could not create "+name+": "+e.message); - errorBuffer.setFatal(); + throw "Could not create "+name+": "+e.message; } // If this script is running in the Cristal GUI, open the new item.
var tree = Packages.com.c2kernel.gui.MainFrame.treeBrowser;
if (tree != null)
tree.push(new DomainPath(domPath+"/"+name));
- errorBuffer;
+
]]></script>
</cristalscript>
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>
diff --git a/resources/boot/SC/New.xml b/resources/boot/SC/New.xml index a706310..a07a7b9 100644 --- a/resources/boot/SC/New.xml +++ b/resources/boot/SC/New.xml @@ -3,11 +3,5 @@ <output name="errors" type="com.c2kernel.scripting.ErrorInfo"/>
<script language="javascript" name=""><![CDATA[
- var job = bsf.lookupBean("job");
- var item = bsf.lookupBean("item");
- var agent = bsf.lookupBean("agent");
- var errorBuffer = bsf.lookupBean("errors");
-
- errorBuffer;
]]></script>
</cristalscript>
diff --git a/resources/boot/SC/SetWorkflow.xml b/resources/boot/SC/SetWorkflow.xml index 5dbfa6d..88a061f 100644 --- a/resources/boot/SC/SetWorkflow.xml +++ b/resources/boot/SC/SetWorkflow.xml @@ -1,14 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?>
<cristalscript>
<output name="errors" type="com.c2kernel.scripting.ErrorInfo"/>
- <script language="javascript" name=""><![CDATA[
+ <script language="javascript" name="SetWorkflow"><![CDATA[
importClass(Packages.com.c2kernel.lookup.DomainPath); - var job = bsf.lookupBean("job");
- var item = bsf.lookupBean("item");
- var agent = bsf.lookupBean("agent");
- var errorBuffer = bsf.lookupBean("errors");
-
// Fetch the requested name from the outcome field
var wfDefName = job.getOutcome().getField("WorkflowDefinitionName"); // Look up the description
@@ -17,37 +12,30 @@ try { var wfPath = root.find(wfDefName); wfItem = agent.getItem(wfPath); - } catch (e) { errorBuffer.addError(wfDefName+" is not a valid item"); errorBuffer.setFatal(); } + } catch (e) {
+ throw wfDefName+" is not a valid item";
+ } // Make sure it has the right properties to be a composite activity desc - if (!errorBuffer.getFatal()) { - var itemType = wfItem.getProperty("Type"); - var complex = wfItem.getProperty("Complexity"); - if (!itemType.equals("ActivityDesc")) { - errorBuffer.addError(wfDefName+" is not an activity description"); - errorBuffer.setFatal(); - } - if (!complex.equals("Composite")) { - errorBuffer.addError(wfDefName+" is not a composite activity description"); - errorBuffer.setFatal(); - } - } + var itemType = wfItem.getProperty("Type"); + var complex = wfItem.getProperty("Complexity"); + if (!itemType.equals("ActivityDesc")) + throw wfDefName+" is not an activity description"; + if (!complex.equals("Composite")) + throw wfDefName+" is not a composite activity description"; - if (!errorBuffer.getFatal()) { - // Fetch the 'Workflow' collection
- var coll = item.getObject("/Collection/Workflow"); - if (coll.size() > 0) { // if there's already a member, remove it - var member = coll.getMembers().list.get(0); - coll.removeMember(member.getID()); - } - // add the new member
- coll.addMember(wfItem.getSystemKey()); - // save it back to the item - var params = new Array(1); - params[0] = agent.marshall(coll); - agent.execute(item, "AddC2KObject", params); + // Fetch the 'Workflow' collection
+ var coll = item.getObject("/Collection/Workflow"); + if (coll.size() > 0) { // if there's already a member, remove it + var member = coll.getMembers().list.get(0); + coll.removeMember(member.getID()); } - - errorBuffer;
+ // add the new member
+ coll.addMember(wfItem.getSystemKey()); + // save it back to the item + var params = new Array(1); + params[0] = agent.marshall(coll); + agent.execute(item, "AddC2KObject", params); +
]]></script>
</cristalscript>
|
