List of usage examples for javax.persistence EntityExistsException getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.clustercontrol.performance.session.PerformanceCollectMasterControllerBean.java
/** * ???//from w w w. j ava2 s. c o m * * @param data * @return ??????true * @throws HinemosUnknown */ public boolean addCollectSubPlatformMaster(CollectorSubPlatformMstData data) throws HinemosUnknown { JpaTransactionManager jtm = null; try { jtm = new JpaTransactionManager(); jtm.begin(); // new RepositoryControllerBean().addCollectorSubPlatformMst(data); jtm.commit(); } catch (EntityExistsException e) { // ????? // ?????????????????????????????? if (jtm != null) jtm.rollback(); return false; } catch (Exception e) { m_log.warn("addCollectSubPlatformMaster() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return true; }
From source file:com.clustercontrol.performance.session.PerformanceCollectMasterControllerBean.java
/** * ???/*from w ww . j av a2 s .c o m*/ * * @param data * @return ??????true * @throws HinemosUnknown */ public boolean addCollectPlatformMaster(CollectorPlatformMstData data) throws HinemosUnknown { JpaTransactionManager jtm = null; try { jtm = new JpaTransactionManager(); jtm.begin(); // RepositoryControllerBean repositoryControllerBean = new RepositoryControllerBean(); repositoryControllerBean.addCollectorPratformMst(data); String osParentFacilityId = FacilityTreeAttributeConstant.OS_PARENT_SCOPE; ScopeInfo osParentScopeInfo = repositoryControllerBean.getScope(osParentFacilityId); ScopeInfo scopeInfo = new ScopeInfo(); scopeInfo.setFacilityId(data.getPlatformId()); scopeInfo.setFacilityName(data.getPlatformName()); scopeInfo.setDescription(data.getPlatformName()); scopeInfo.setFacilityType(osParentScopeInfo.getFacilityType()); scopeInfo.setIconImage(osParentScopeInfo.getIconImage()); scopeInfo.setOwnerRoleId(osParentScopeInfo.getOwnerRoleId()); repositoryControllerBean.addScope(osParentFacilityId, scopeInfo, data.getOrderNo()); jtm.commit(); } catch (EntityExistsException e) { // ????? // ?????????????????????????????? if (jtm != null) jtm.rollback(); return false; } catch (Exception e) { m_log.warn("addCollectPlatformMaster() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return true; }
From source file:com.clustercontrol.repository.session.RepositoryControllerBean.java
/** * ?????<BR>//from w ww. j a va 2 s.co m * * @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 ww w. jav a2s. c om*/ * * @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>/* w w w. j a va 2s . c o 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(); } }
From source file:com.clustercontrol.repository.session.RepositoryControllerBean.java
/** * ??????TOPIC???<BR>/*from www. jav a 2 s . co m*/ * ?????????"?"? * ????? * * @version 3.1.0 * @since 1.0.0 * * @param nodeInfo ?? * @throws FacilityDuplicate * @throws InvalidSetting * @throws HinemosUnknown */ public void addNode(final NodeInfo nodeInfo, boolean topicSendFlg) 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); jtm.addCallback(new NodeCacheUpdateCallback(nodeInfo.getFacilityId())); jtm.addCallback(new FacilityIdCacheInitCallback()); jtm.addCallback(new FacilityTreeCacheRefreshCallback()); jtm.addCallback(new RepositoryChangedNotificationCallback()); jtm.addCallback(new NodeToMonitorCacheChangeCallback()); jtm.addCallback(new EmptyJpaTransactionCallback() { @Override public void postCommit() { NodeMonitorPollerController.registNodeMonitorPoller(nodeInfo); } }); try { ListenerReadWriteLock.readLock(); for (IRepositoryListener listener : _listenerList) { jtm.addCallback(new RepositoryListenerCallback(listener, Type.ADD_NODE, null, nodeInfo.getFacilityId())); } } finally { ListenerReadWriteLock.readUnlock(); } jtm.commit(); } catch (EntityExistsException e) { jtm.rollback(); throw new FacilityDuplicate(e.getMessage(), e); } catch (InvalidSetting e) { jtm.rollback(); throw e; } catch (FacilityNotFound e) { jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } catch (Exception e) { m_log.warn("addNode() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { jtm.close(); } }