/** * saveSecurityLevel */ public void saveSecurityLevel(ims.ocrr.vo.SecurityLevelConfigVo voSecurityLevel) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (voSecurityLevel == null) throw new CodingRuntimeException("voSecurityLevel is null in method saveSecurityLevel"); if (!voSecurityLevel.isValidated()) throw new CodingRuntimeException("voSecurityLevel has not been validated in method saveSecurityLevel"); try { getDomainFactory().save(SecurityLevelConfigVoAssembler.extractSecurityLevel(getDomainFactory(), voSecurityLevel)); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("A record with the same name already exists, Please Change."); } }
/** * deleteSecurityLevel - delete record and then reorder the collection that remains */ public void deleteSecurityLevel(ims.ocrr.configuration.vo.SecurityLevelRefVo voSecurityLevel, SecurityLevelConfigVoCollection voCollSecurityLevel) throws ims.domain.exceptions.ForeignKeyViolationException, StaleObjectException { if (voSecurityLevel == null) throw new CodingRuntimeException("voSecurityLevel is null in method deleteSecurityLevel"); getDomainFactory().delete(getDomainFactory().getDomainObject(voSecurityLevel)); //only reorder collection if records exist if(voCollSecurityLevel == null || voCollSecurityLevel.size() == 0) return; List lstSecurityLevel = SecurityLevelConfigVoAssembler.extractSecurityLevelList(getDomainFactory(), voCollSecurityLevel); if(lstSecurityLevel != null) { Iterator it = lstSecurityLevel.iterator(); while(it.hasNext()) { SecurityLevel doSecurityLevel = (SecurityLevel)it.next(); getDomainFactory().save(doSecurityLevel); } } }
public SecurityLevelAndServiceCheckVo getSecurityLevelAndServiceForInvestigation(Integer idInvestigation) { if (idInvestigation == null) throw new CodingRuntimeException("idInvestigation is null in method getSecurityLevelForInvestigation"); SecurityLevelAndServiceCheckVo voToReturn = new SecurityLevelAndServiceCheckVo(); List lstSecLevels = getDomainFactory().find("select invIndex.securityLevel, ls.service from InvestigationIndex as invIndex left join invIndex.investigations as inv left join inv.providerService as ps left join ps.locationService as ls where invIndex.id = " + idInvestigation); //WDEV-11674 if(lstSecLevels != null && lstSecLevels.size() == 1) { Object[] arrVals = (Object[]) lstSecLevels.get(0); SecurityLevel doSecLevel = (SecurityLevel) arrVals[0]; Service doService = (Service) arrVals[1]; if(doSecLevel != null) voToReturn.setSecurityLevel(SecurityLevelConfigVoAssembler.create(doSecLevel)); if(doService != null) voToReturn.setService(new ServiceRefVo(doService.getId(), doService.getVersion())); } return voToReturn; }
/** * saveSecurityLevelSwop - method will be used to swap the security level in one transaction */ public void saveSecurityLevelSwop(ims.ocrr.vo.SecurityLevelConfigVo voSecurityLevelUp, ims.ocrr.vo.SecurityLevelConfigVo voSecurityLevelDown) throws ims.domain.exceptions.StaleObjectException { if (voSecurityLevelUp == null || voSecurityLevelDown == null) throw new CodingRuntimeException("voSecurityLevelUp or voSecurityLevelDown are null in method saveSecurityLevel"); getDomainFactory().save(SecurityLevelConfigVoAssembler.extractSecurityLevel(getDomainFactory(), voSecurityLevelUp)); getDomainFactory().save(SecurityLevelConfigVoAssembler.extractSecurityLevel(getDomainFactory(), voSecurityLevelDown)); }
/** * listSecurityLevel - ordered by SecurityLevel */ public ims.ocrr.vo.SecurityLevelConfigVoCollection listSecurityLevel() { String hql = "from SecurityLevel sec order by sec.securityLevel asc"; List lstSecs = getDomainFactory().find(hql); return SecurityLevelConfigVoAssembler.createSecurityLevelConfigVoCollectionFromSecurityLevel(lstSecs); }
public SecurityLevelConfigVoCollection listSecurityLevel() { String hql = "from SecurityLevel sec order by sec.securityLevel asc"; List lstSecs = getDomainFactory().find(hql); return SecurityLevelConfigVoAssembler.createSecurityLevelConfigVoCollectionFromSecurityLevel(lstSecs); }