Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private OBError doExecuteProcedureCall(String recordID, String processID){
- OBError oberror = new OBError();
- oberror.setType("Success");
- oberror.setTitle("Success");
- OBContext.setAdminMode();
- final Process process = OBDal.getInstance().get(Process.class, processID);
- log4j.debug("execute procedure call "+process.getName());
- final ProcessInstance pInstance = CallProcess.getInstance().call(process, recordID, null);
- long result = pInstance.getResult();
- if (result==0){
- String errormessage = pInstance.getErrorMsg();
- log4j.debug("error message "+errormessage);
- oberror.setType("Error");
- oberror.setTitle("Error");
- oberror.setMessage(errormessage);
- }
- OBContext.restorePreviousMode();
- return oberror;
- }
- try{
- OBError oberror = doExecuteProcedureCall(orderID, orderProcessID);
- if (oberror.getType().equalsIgnoreCase("Error")){
- String message = oberror.getMessage();
- // message = message.substring(8, message.length()-1);
- String convertedMessage = Utility.messageBD(conn, message, vars.getLanguage());
- throw new OBException(convertedMessage);
- }
- }
- catch (OBException e){
- //exception happen, rollback doc status
- order.setDocumentStatus(docstatus);
- order.setDocumentAction(docaction);
- OBDal.getInstance().save(order);
- try {
- OBDal.getInstance().getConnection().commit();
- } catch (SQLException e2) {
- e.printStackTrace();
- throw new OBException(e.getMessage());
- }
- //throw chain exception
- e.printStackTrace();
- throw new OBException(e.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement