List of usage examples for javax.transaction SystemException SystemException
public SystemException(int errcode)
From source file:com.pl.plugins.commons.dal.utils.reports.JasperReportService.java
public JasperPrint generateReport(String reportTemplate, Map parameters, Collection dataBeans) throws SystemException { try {/*from ww w . j a va2s.com*/ JasperReport jasperReport = loadAndCompileReport(reportTemplate); JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(dataBeans); log.debug("dataBeans = " + ReflectionToStringBuilder.reflectionToString(dataBeans)); log.debug("dataSource = " + ReflectionToStringBuilder.reflectionToString(dataSource)); log.debug("reportParams = " + parameters); log.debug("generateReport"); return JasperFillManager.fillReport(jasperReport, parameters, dataSource); } catch (JRException e) { log.error("some exception occured", e); throw new SystemException(e.getMessage()); } }
From source file:com.pl.plugins.commons.dal.utils.reports.JasperReportService.java
private JasperReport loadAndCompileReport(String reportTemplate) throws JRException, SystemException { String reportXML = getXMLTemplate(reportTemplate); if (reportXML == null) { throw new SystemException("Report not found: [" + reportTemplate + "]"); }/* w w w . ja v a2 s . c o m*/ try { JasperReport jasperReport; JasperDesign jd = JRXmlLoader.load(new ByteArrayInputStream(reportXML.getBytes("UTF-8"))); jd.setWhenNoDataType(JasperDesign.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL); jasperReport = JasperCompileManager.compileReport(jd); return jasperReport; } catch (UnsupportedEncodingException e) { log.error(e); throw new SystemException(e.getMessage()); } }
From source file:com.eryansky.web.base.UserAction.java
/** * ?.// w w w .j av a2 s .co m */ @Override public String save() throws Exception { Result result = null; try { // ???? User user = userManager.getUserByLoginName(model.getLoginName()); if (user != null && !user.getId().equals(model.getId())) { result = new Result(Result.WARN, "??[" + model.getLoginName() + "],!", "loginName"); logger.debug(result.toString()); Struts2Utils.renderText(result); return null; } if (model.getId() == null) {// model.setPassword(Encrypt.e(model.getPassword())); } else {// User superUser = userManager.getSuperUser(); User sessionUser = userManager.getCurrentUser(); if (!sessionUser.getId().equals(superUser.getId())) { throw new SystemException("??!"); } } userManager.saveEntity(model); result = Result.successResult(); logger.debug(result.toString()); Struts2Utils.renderText(result); } catch (Exception e) { e.printStackTrace(); throw e; } return null; }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public synchronized void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger(); this.transactionContext.setCompensating(true); this.transactionStatus = Status.STATUS_COMMITTING; compensableLogger.updateTransaction(this.getTransactionArchive()); SystemException systemEx = null; try {/*from w w w .j ava 2s . c o m*/ this.fireNativeParticipantConfirm(); } catch (SystemException ex) { systemEx = ex; logger.info("{}| confirm native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } catch (RuntimeException ex) { systemEx = new SystemException(ex.getMessage()); logger.info("{}| confirm native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } try { this.fireRemoteParticipantConfirm(); } catch (HeuristicMixedException ex) { logger.info("{}| confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (HeuristicRollbackException ex) { logger.info("{}| confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (SystemException ex) { logger.info("{}| confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (RuntimeException ex) { logger.info("{}| confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } if (systemEx != null) { throw systemEx; } else { this.transactionStatus = Status.STATUS_COMMITTED; compensableLogger.updateTransaction(this.getTransactionArchive()); logger.info("{}| compensable transaction committed!", ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId())); } }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public void participantCommit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, CommitRequiredException, SystemException { throw new SystemException("Not supported!"); }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public synchronized void rollback() throws IllegalStateException, SystemException { CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger(); this.transactionStatus = Status.STATUS_ROLLING_BACK; this.transactionContext.setCompensating(true); compensableLogger.updateTransaction(this.getTransactionArchive()); boolean coordinator = this.transactionContext.isCoordinator(); boolean coordinatorTried = false; for (int i = 0; coordinator && i < this.archiveList.size(); i++) { CompensableArchive compensableArchive = this.archiveList.get(i); coordinatorTried = compensableArchive.isTried() ? true : coordinatorTried; }/*from ww w. ja v a2 s . com*/ SystemException systemEx = null; if (coordinator == false || coordinatorTried) { try { this.fireNativeParticipantCancel(); } catch (SystemException ex) { systemEx = ex; logger.info("{}| cancel native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } catch (RuntimeException ex) { systemEx = new SystemException(ex.getMessage()); logger.info("{}| cancel native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } } try { this.fireRemoteParticipantCancel(); } catch (SystemException ex) { logger.info("{}| cancel remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (RuntimeException ex) { logger.info("{}| cancel remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw new SystemException(ex.getMessage()); } if (systemEx != null) { throw systemEx; } else { this.transactionStatus = Status.STATUS_ROLLEDBACK; compensableLogger.updateTransaction(this.getTransactionArchive()); logger.info("{}| compensable transaction rolled back!", ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId())); } }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException { CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger(); if (RemoteResourceDescriptor.class.isInstance(xaRes) == false) { throw new SystemException("Invalid resource!"); }// w w w. jav a 2 s .c o m XAResourceArchive resourceArchive = null; RemoteResourceDescriptor descriptor = (RemoteResourceDescriptor) xaRes; String identifier = descriptor.getIdentifier(); for (int i = 0; i < this.resourceList.size(); i++) { XAResourceArchive resource = this.resourceList.get(i); String resourceKey = resource.getDescriptor().getIdentifier(); if (CommonUtils.equals(identifier, resourceKey)) { resourceArchive = resource; break; } } if (resourceArchive == null) { XidFactory xidFactory = this.beanFactory.getCompensableXidFactory(); TransactionXid globalXid = this.transactionContext.getXid(); TransactionXid branchXid = xidFactory.createBranchXid(globalXid); resourceArchive = new XAResourceArchive(); resourceArchive.setXid(branchXid); resourceArchive.setDescriptor(descriptor); this.resourceList.add(resourceArchive); compensableLogger.createCoordinator(resourceArchive); logger.info("{}| enlist remote resource: {}.", ByteUtils.byteArrayToString(globalXid.getGlobalTransactionId()), identifier); } return true; }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public synchronized void recoveryCommit() throws CommitRequiredException, SystemException { CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger(); this.transactionContext.setCompensating(true); this.transactionStatus = Status.STATUS_COMMITTING; compensableLogger.updateTransaction(this.getTransactionArchive()); SystemException systemEx = null; try {//from w w w . ja va 2s . c o m this.fireNativeParticipantRecoveryConfirm(); } catch (SystemException ex) { systemEx = ex; logger.info("{}| recovery-confirm native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } catch (RuntimeException ex) { systemEx = new SystemException(ex.getMessage()); logger.info("{}| recovery-confirm native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } try { this.fireRemoteParticipantRecoveryConfirm(); } catch (HeuristicMixedException ex) { logger.info("{}| recovery-confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw new SystemException(ex.getMessage()); } catch (HeuristicRollbackException ex) { logger.info("{}| recovery-confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw new SystemException(ex.getMessage()); } catch (SystemException ex) { logger.info("{}| recovery-confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (RuntimeException ex) { logger.info("{}| recovery-confirm remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw new SystemException(ex.getMessage()); } if (systemEx != null) { throw systemEx; } else { this.transactionStatus = Status.STATUS_COMMITTED; compensableLogger.updateTransaction(this.getTransactionArchive()); logger.info("{}| compensable transaction recovery committed!", ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId())); } }
From source file:org.bytesoft.bytetcc.CompensableTransactionImpl.java
public synchronized void recoveryRollback() throws RollbackRequiredException, SystemException { CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger(); this.transactionStatus = Status.STATUS_ROLLING_BACK; this.transactionContext.setCompensating(true); compensableLogger.updateTransaction(this.getTransactionArchive()); SystemException systemEx = null; try {/*from w w w . j av a 2s.c o m*/ this.fireNativeParticipantRecoveryCancel(); } catch (SystemException ex) { systemEx = ex; logger.info("{}| recovery-cancel native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } catch (RuntimeException ex) { systemEx = new SystemException(ex.getMessage()); logger.info("{}| recovery-cancel native branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); } try { this.fireRemoteParticipantRecoveryCancel(); } catch (SystemException ex) { logger.info("{}| recovery-cancel remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw ex; } catch (RuntimeException ex) { logger.info("{}| recovery-cancel remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); throw new SystemException(ex.getMessage()); } if (systemEx != null) { throw systemEx; } else { this.transactionStatus = Status.STATUS_ROLLEDBACK; compensableLogger.updateTransaction(this.getTransactionArchive()); logger.info("{}| compensable transaction recovery rolled back!", ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId())); } }