}
public String addFolder(String folderName, String parentFolder) throws RemoteException{
log("addFolder", new Object[]{folderName, parentFolder});
try{
ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
//if there is no parent folder, this will occur an exception to break this try~catch block
if(parentFolder!=null && !parentFolder.equals("-1")){
pdhr.findByPrimaryKey(new Long(parentFolder));
}
if(!UEngineUtil.isNotEmpty(parentFolder)){
parentFolder = "-1";
}
ProcessDefinitionRepositoryLocal pdr = null;
try {
pdr = pdhr.findByNameSameLevel(folderName, new Long(parentFolder), "folder");
} catch (Exception e) {
pdr = pdhr.create(UniqueKeyGenerator.issueProcessDefinitionKey(getTransactionContext()));
pdr.setName(folderName);
pdr.setParentFolder(new Long(parentFolder));
pdr.setIsFolder(true);
pdr.setObjType("folder");
}