Java Reference
In-Depth Information
implements
WfActivity {
. . .
public
WfActivityImpl(WfProcess proc,
WfActivityDefinition def) {
. . .
// set up workflow data
try
{
NameValue[] processContext
#
container().process_context();
//NameValueInfo[] signature
#
container().manager().
//context_signature();
Collection restrictions
#
def.getRestrictions();
if
(restrictions.size()
##
0){ // no restriction
// i.e. access to all data
set_process_context(processContext);
}
else
{ // access only according to restrictions
NameValue[] activityContext
#
new NameValue
[restrictions.size()];
Iterator it
#
restrictions.iterator();
for
(
int
i
#
0; it.hasNext();
!!
i){
WfAccessRestriction restriction
#
(WfAccessRestriction)it.next();
NameValue data
#
find
(restriction.data.name,processContext);
if
(restriction.readOnly){
// if read-only make a local copy
activityContext[i]
#
new
NameValue(
data.the_name,doClone(data.the_value));
}
else
// if read-write user the original data
activityContext[i]
#
data;
set_process_context(activityContext);
}
}
}
catch
(Exception e){ }
}
// find the data given the name
private static
NameValue find
(String name, NameValue[] list){
for
(
int
i
#
0; i<list.length;
!!
i)
if
(name.equals(list[i].the_name))
return
list[i];
return null
;
}
private static
Object doClone(Object obj){
// try using a copy constructor, if it is defined