try{
ProcessDefinitionVersionRepositoryHomeLocal pdvrhl = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(getTransactionContext());
ProcessDefinitionVersionRepositoryLocal pdvrl = pdvrhl.findByPrimaryKey(new Long(pdvid));
ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
ProcessDefinitionRepositoryLocal pdl = pdhr.findByPrimaryKey(pdvrl.getDefId());
int productionVersion = pdl.getProdVer();
ProcessDefinitionRemote pdr =null;
try{
ProcessDefinition pd = getDefinition(pdvid);
if(pd !=null && pd instanceof ProcessDefinition){
pdr = new ProcessDefinitionRemote(pd, getTransactionContext(), pdvrl);
if(pdl.getObjType() != null){
pdr.setObjType(pdl.getObjType());
}
}
}catch (Exception e) {
pdr = new ProcessDefinitionRemote(pdl, pdvrl);
}