protected void changeBindingArguments(String pvId){
if(pvId==null) return;
try{
ProcessDefinition pd = null;
if(pvId.indexOf("@") > -1){
String [] defIdAndVersionId = pvId.split("@");
pd = loadDesign(defIdAndVersionId[1], false); //load with version id;
}else{
pd = loadDesign(pvId, true); //load with definition id;
definitionIdInput.setValue(null); //clear picker's remained selection
definitionIdInput.setValue(pvId + "@" + pd.getId()); //reload version
((XMLValueInput)definitionIdInput).setDisplayValue(pd.getName() + " Version_" + pd.getVersion());
//return;
}
System.out.println("load binding information...");
RoleParameterContext[] oldRPCs = (RoleParameterContext[])bindingRolesInput.getValue();
HashMap oldRPCHM = new HashMap();
if(oldRPCs!=null)
for(int i=0; i<oldRPCs.length; i++)
oldRPCHM.put(oldRPCs[i].getArgument(), oldRPCs[i]);
Role[] roles = pd.getRoles();
RoleParameterContext[] rolePCs = new RoleParameterContext[roles.length];
for(int i=0; i<roles.length; i++){
rolePCs[i] = new RoleParameterContext();
rolePCs[i].setArgument(roles[i].getName());
//rolePCs[i].setRole(roles[i]);
//rolePCs[i].setDirection(rolePCs[i].getDirection());
if(oldRPCs!=null && oldRPCHM.containsKey(rolePCs[i].getArgument())){
RoleParameterContext theRPC = (RoleParameterContext)oldRPCHM.get(rolePCs[i].getArgument());
rolePCs[i].setRole(theRPC.getRole());
rolePCs[i].setDirection(theRPC.getDirection());
}
}
bindingRolesInput.setValue(rolePCs);
//
ParameterContext[] oldpvPCs = (ParameterContext[])bindingVariablesInput.getValue();
HashMap oldpvPCsM = new HashMap();
if(oldpvPCs!=null){
for(int i=0; i<oldpvPCs.length; i++)
oldpvPCsM.put(oldpvPCs[i].getArgument(), oldpvPCs[i]);
}
ProcessVariable[] processVariables = pd.getProcessVariables();
ParameterContext[] pvPCs = new ParameterContext[processVariables.length];
for(int i=0; i<processVariables.length; i++){
pvPCs[i] = new SubProcessParameterContext();
pvPCs[i].getArgument().setText(processVariables[i].getName());