public void removeLeadCons(LeadConsultantForSpecialtyConfigVo leadCons) throws ForeignKeyViolationException { if (leadCons == null) throw new CodingRuntimeException("Cannot remove LeadConsultant if null . "); try { DomainFactory factory = getDomainFactory(); SpecialtyLeadConsultant domainLeadCons = LeadConsultantForSpecialtyConfigVoAssembler.extractSpecialtyLeadConsultant(factory, leadCons); factory.delete(domainLeadCons); } catch (ForeignKeyViolationException e) { throw new ForeignKeyViolationException("This Configuration is in use!", e); } }
public ims.ocrr.vo.LeadConsultantForSpecialtyConfigVoCollection listLeadConsultantForSpecialty() { DomainFactory factory = getDomainFactory(); String query = "from SpecialtyLeadConsultant as specLeadCons"; List<?> LeadConsList = factory.find(query); return LeadConsultantForSpecialtyConfigVoAssembler.createLeadConsultantForSpecialtyConfigVoCollectionFromSpecialtyLeadConsultant(LeadConsList); }
public LeadConsultantForSpecialtyConfigVo saveLeadConsultant(LeadConsultantForSpecialtyConfigVo leadConsultant) throws StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (leadConsultant == null ) throw new CodingRuntimeException("Cannot save leadConsultant if null or get LeadConsultant on null ID . "); if (!leadConsultant.isValidated()) throw new CodingRuntimeException("LeadConsultantForSpecialtyConfigFBVo not Validated"); try { DomainFactory factory = getDomainFactory(); SpecialtyLeadConsultant hcpMedic = LeadConsultantForSpecialtyConfigVoAssembler.extractSpecialtyLeadConsultant(factory, leadConsultant); if (getLeadConsultantBySpecialty(leadConsultant.getSpecialty()) && leadConsultant.getID_SpecialtyLeadConsultant()==null) { throw new StaleObjectException(hcpMedic); } factory.save(hcpMedic); return LeadConsultantForSpecialtyConfigVoAssembler.create(hcpMedic); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Lead Consultant already exist for this specialty!", e); } }