List of usage examples for javax.persistence EntityExistsException getMessage
public String getMessage()
From source file:com.clustercontrol.repository.session.RepositoryControllerBean.java
/** * ?????<BR>/*w ww . j a va 2s .com*/ * * @param CollectorPlatformMstData ? * @throws EntityExistsException * @throws HinemosUnknown */ public void addCollectorPratformMst(CollectorPlatformMstData data) throws EntityExistsException, HinemosUnknown { JpaTransactionManager jtm = null; try { jtm = new JpaTransactionManager(); jtm.begin(); FacilityModifier.addCollectorPratformMst(data); jtm.commit(); } catch (EntityExistsException e) { if (jtm != null) jtm.rollback(); throw e; } catch (Exception e) { m_log.warn("addCollectorPratformMst() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } }
From source file:com.clustercontrol.repository.session.RepositoryControllerBean.java
/** * ?????<BR>/*from w w w . j a v a2s. com*/ * * @param CollectorSubPlatformMstData ? * @throws EntityExistsException * @throws HinemosUnknown */ public void addCollectorSubPlatformMst(CollectorSubPlatformMstData data) throws EntityExistsException, HinemosUnknown { JpaTransactionManager jtm = null; try { jtm = new JpaTransactionManager(); jtm.begin(); FacilityModifier.addCollectorSubPratformMst(data); jtm.commit(); } catch (EntityExistsException e) { if (jtm != null) jtm.rollback(); throw e; } catch (Exception e) { m_log.warn("addCollectorSubPlatformMst() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } }
From source file:com.clustercontrol.repository.session.RepositoryControllerBean.java
/** * ????????<BR>//from ww w.j a va 2 s . co m * ?????????? * * @version 5.0.0 * @since 5.0.0 * * @param nodeInfo ?? * @throws FacilityDuplicate * @throws InvalidSetting * @throws HinemosUnknown */ public void addNodeWithoutRefresh(NodeInfo nodeInfo) throws FacilityDuplicate, InvalidSetting, HinemosUnknown { JpaTransactionManager jtm = new JpaTransactionManager(); try { jtm.begin(); // ??null????????????null?? nodeInfo.setDefaultInfo(); // ? RepositoryValidator.validateNodeInfo(nodeInfo); FacilityModifier.addNode(nodeInfo, (String) HinemosSessionContext.instance().getProperty(HinemosSessionContext.LOGIN_USER_ID), FacilitySortOrderConstant.DEFAULT_SORT_ORDER_NODE); final String facilityId = nodeInfo.getFacilityId(); jtm.addCallback(new NodeCacheRemoveCallback(facilityId)); try { ListenerReadWriteLock.readLock(); for (IRepositoryListener listener : _listenerList) { jtm.addCallback(new RepositoryListenerCallback(listener, Type.ADD_NODE, null, facilityId)); } } finally { ListenerReadWriteLock.readUnlock(); } jtm.addCallback(new NodeToMonitorCacheChangeCallback()); final NodeInfo _nodeInfo = nodeInfo; jtm.addCallback(new EmptyJpaTransactionCallback() { @Override public void postCommit() { NodeMonitorPollerController.registNodeMonitorPoller(_nodeInfo); } }); jtm.commit(); } catch (EntityExistsException e) { String errMsg = " ipAddress=" + nodeInfo.getIpAddressV4() + " " + nodeInfo.getIpAddressV6() + " facilityID=" + nodeInfo.getFacilityId() + ","; m_log.warn( "addNodeWithoutRefresh() : " + errMsg + e.getClass().getSimpleName() + ", " + e.getMessage()); jtm.rollback(); throw new FacilityDuplicate(e.getMessage(), e); } catch (InvalidSetting | HinemosUnknown e) { jtm.rollback(); throw e; } catch (FacilityNotFound e) { jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } catch (Exception e) { m_log.warn("addNodeWithoutRefresh() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { jtm.close(); } }