/** * Save AS all the VOs related to this core responsibility structure * * @param newVersion The version for the new VOs * @throws ArchEException */ public void saveAs(ArchEVersionVO newVersion) throws ArchEException { Session openSession = ArchECoreDataProvider.getSessionFactory().getCurrentSession(); if (openSession != null && openSession.isConnected() && openSession.isOpen()) { try { // Save the newly-created raw responsibility structure rawRSVO.setId(newVersion.getId()); ArchEResponsibilityVO itemResp = null; for (Iterator<ArchEResponsibilityVO> it = rawRSVO.getResponsibilities().iterator(); it.hasNext(); ) { itemResp = it.next(); itemResp.setVersion(newVersion); openSession.save(itemResp); this.saveParametersForResponsibilityAs(newVersion, itemResp, openSession); } // Create a copy of the existing translation relations ArchETranslationRelationVO itemTr = null; for (Iterator<ArchETranslationRelationVO> it = trVOs.iterator(); it.hasNext(); ) { itemTr = it.next(); itemTr.setVersion(newVersion); openSession.save(itemTr); } // Create a copy of the existing refinement relations ArchERefinementRelationVO itemRef = null; for (Iterator<ArchERefinementRelationVO> it = refVOs.iterator(); it.hasNext(); ) { itemRef = it.next(); itemRef.setVersion(newVersion); openSession.save(itemRef); } } catch (HibernateException ex) { throw new ArchEException(ex.getMessage(), ex.getCause()); } } }