Workspace deliver and accept flow entries , help! [resolved]
in my migration utility, I need to remap the flow entrys to point to local server artifacts.
Indicates that the specified entry is the default one for the workspace for this direction (Accept or Deliver).
getAcceptSources() and getFlowtargets() make sense.
I can manage those lists..
then there is get default/current AcceptFlow(), and get default/current Deliverflow().
no problem..
but set is ?
+
Indicates that the specified entry is the current one for the workspace for this direction (Accept or Deliver).
setCurrent(IFlowEntry entry)
setDefault(IFlowEntry entry)
Indicates that the specified entry is the default one for the workspace for this direction (Accept or Deliver).
what is the 'for this direction'? the flow TABLE contains both. as per above..
Accepted answer
The part about direction is not applicable at the moment. Flow targets are considered bi-directional and will not restrict users from delivering or accepting. If you're flowing to a target and have permission, you can deliver or accept. There are no one way flows. Accept flows are not used at the moment to enforce direction.
Comments
showing 5 of 12
show 7 more comments
2 other answers
ok, other issues resolved. I missed getDeliverFlow(..)
back to the problem where the loop style
for(IFlowEntry target: flow_table.getDeliverTargets())
{
}
fails null pointer exception (rtc 4.0.4)
the scenario
the workspace was copied from system 1 to system 2 using the copy workspace function (shown at top of code below)
the flow table was NOT updated. the target UUID does not exist in the database.
the system was upgraded from 3.0.1 to 4.0.4
and the same code was used to copy from system2 to system 3.
now we are trying to fixup the flowtargets. the users may have modified 'some' of them
and not others.
(1) loop thru flow targets
(2) try to get a connection to the targets recorded stream
prodiws = prodmgr.getWorkspaceConnection((IWorkspaceHandle) (target.getFlowNode()), null);
(3) if there is an exception (CRJAZ0215E The following record was not found in the database:)
(4) document this case in the workspace description,
(5) remove this entry from the flow table
(1) and then loop to handle any more flow table target entries
(6) null pointer exception in
collections class
public Iterator<E> iterator() {
return new Iterator<E>() {
Iterator<? extends E> i = c.iterator();
public boolean hasNext() {return i.hasNext();} ---- returned true (should have returned false)
public E next() {return i.next();} ----> fails null pointer. ChkForComodification() fails.
public void remove() {
throw new UnsupportedOperationException();
}
};
}
try
{
new_devworkspace= devmgr.copyWorkspace(devowner, prodworkspace, workspacename,
prodworkspace.getDescription(), ourlogger);
// get the table working copy so we can update it
IFlowTable dev_flowtable=new_devworkspace.getFlowTable().getWorkingCopy();
// loop thru the flow targets, if any , non-volatile list -------> fix IFlowEntry[] targets = (IFlowEntry[]) dev_flowtable.deliverTargets().toArray(new IFlowEntry[dev_flowtable.deliverTargets().size()]);
----> (1) for(IFlowEntry target : targets)
{
IWorkspaceConnection prodiws =null;
try
{
// connect to the production workspace
(2) prodiws = prodmgr.getWorkspaceConnection((IWorkspaceHandle) (target.getFlowNode()), null);
// find production workspace by name in dev system
IWorkspaceConnection devtargetStream=finddevStreambyname(devstreams,prodiws.getName());
// if the stream is present on the target system
if(devtargetStream!=null)
{
// update a flow table with the dev system pointers
// add the local system handle instead
dev_flowtable.addDeliverFlow(devtargetStream.getResolvedWorkspace(), devrepo.getId(), devrepo.getRepositoryURI(), null, prodiws.getDescription());
IFlowEntry newnode = dev_flowtable.getDeliverFlow(devtargetStream.getResolvedWorkspace());
// record if this target flow node was current or default
if(target.equals(dev_flowtable.getCurrentDeliverFlow()))
{
dev_flowtable.setCurrent(newnode);
}
if(target.equals(dev_flowtable.getDefaultDeliverFlow()))
{
dev_flowtable.setDefault(newnode);
}
}
else
{
new_devworkspace.setDescription(new_devworkspace.getDescription()+"\n missing deliver target stream=\""+prodiws.getName()+"\" removed", null);
}
}
catch(Exception ex)
{
(3) System.out.println("find flow target workspace failed exception="+ex.getMessage());
// catch the bad workspace handle
// remove the bad info
// and indicate we removed it
(4) new_devworkspace.setDescription(new_devworkspace.getDescription()+"\n unresolvable deliver target ="+target.getFlowNode().getItemId()+" removed", null);
}
// remove it
======>(5) dev_flowtable.removeDeliverFlow(target.getFlowNode());
} // end of loop
// save the updated flow table, no more targets to update
new_devworkspace.setFlowTable(dev_flowtable, null);
}
}
(6) catch (Exception ex)
{
System.out.println("\t\tCopy Workspace " + workspacename
+ " failed, exception=" + ex.getMessage() + " time="
+ sdf.format(Calendar.getInstance().getTime()));
if(ex.getMessage().contains("error occurred: \"java.net.SocketTimeoutException\""))
{
System.out.println("connection timeout, login and try again");
devServer.logout();
devServer.setConnectionTimeout(devServer.getConnectionTimeout()+one_hour);
devServer.login(null);
productionServer.logout();
productionServer.setConnectionTimeout(productionServer.getConnectionTimeout()+one_hour);
productionServer.login(null);
devmgr.deleteWorkspace( (IWorkspaceHandle) new_devworkspace, ourlogger);
ex.printStackTrace();
}
}
Comments
hopefully one last question.
I have two eclipse configurations. one with the 3.0.1 p2, one with the 4.0.4 p2
using 3.x to look at a workspace on 3.x I see (default)(current)
using 3.x to look at a copy of the workspace after a duplicate on system upgraded to 4.x I see (default)
then I replicate the workspace to another 4.0.4 system, and in the fixup, current is not set, but default is.
I debugged into the flowtable, dev_flowtable.setDefault(newnode);
and I see it is added to the 'defaults' list.
later when I use the workspace editor, (default) is not shown.
if I set it manually in the editor, and then save, close the editor, open editor,
'default' is not shown again.
if I sent both default and current manually.. only '(current)' is shown.
is this a UI bug? or a known change of behavior?
if I look at a workspace created on the end system, both (current) and (default) are shown.