/** * Get the detailed HRG Configuration VO */ public ims.core.vo.HrgConfigVo getHRGConfiguration(ims.core.admin.vo.HrgConfigRefVo configuration) { if (configuration == null) return null; DomainFactory factory = getDomainFactory(); return HrgConfigVoAssembler.create((HrgConfig) factory.getDomainObject(HrgConfig.class, configuration.getID_HrgConfig())); }
/** * Saves an HRG Configuration */ public ims.core.vo.HrgConfigVo saveHRGConfiguration(ims.core.vo.HrgConfigVo configuration) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { // Test for a validated VO provided if (configuration == null) throw new DomainInterfaceException("Can not save an empty HRG Configuration."); if (!configuration.isValidated()) throw new DomainInterfaceException("Invalid HRG Configuration. Can not save"); try { // Save the VO data in the database DomainFactory factory = getDomainFactory(); String hrgCode = areMappingsPairInUse(configuration, factory); if (hrgCode != null) { throw new UniqueKeyViolationException(hrgCode+" HRG Configuration contains a duplicate ICD10/OPCS4 mapping. No duplicates allowed."); } // Check for unique HRG Code (as RIE records are not to be // considered, the check has to be done manually) String query = new String(); if (configuration.getID_HrgConfigIsNotNull()) query = "from HrgConfig as hrg where hRGCode = '" + configuration.getHRGCode() + "' and hrg.id <> " + configuration.getID_HrgConfig().toString() + " and hrg.isRIE is null"; else query = "from HrgConfig as hrg where hRGCode = '" + configuration.getHRGCode() + "' and hrg.isRIE is null"; List results = factory.find(query); if (results != null && results.size() > 0) throw new UniqueKeyViolationException("Another HRG Configuration with the same HRG Code already exists in the system"); HrgConfig hrgConfiguration = HrgConfigVoAssembler.extractHrgConfig(factory, configuration); factory.save(hrgConfiguration); return HrgConfigVoAssembler.create(hrgConfiguration); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("The taxonomy mappings of the HRG Configuration are already in use"); } }