private OrgVo savePracticeVo(OrgVo vo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { //WDEV-17409 String[] err = vo.validate(); if (err != null && err.length > 0) { String concat = ""; for (int i = 0; i < err.length; i++) { concat = concat + " " + err[i] + " "; } throw new DomainRuntimeException(concat); } else { return domainTaxonomy.savePracticeRecord(vo); } }
private TaxonomyMapCollection searchPracticeCodes(TaxonomyMap filter) throws ims.domain.exceptions.DomainInterfaceException { // TODO Auto-generated method stub try{ ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer taxonomyHql = new StringBuffer(" select distinct org from Organisation org join org.codeMappings as mappings" + " where mappings.taxonomyName = :taxonomyType and upper(mappings.taxonomyCode) like :taxonomyCode and org.type = :gpPractice"); names.add("taxonomyType"); names.add("taxonomyCode"); names.add("gpPractice"); values.add(getDomLookup(TaxonomyType.NAT_LOC_CODE)); values.add("%"+filter.getDescription().toUpperCase()+"%"); values.add(getDomLookup(OrganisationType.GPP)); OrgVoCollection coll = OrgVoAssembler.createOrgVoCollectionFromOrganisation(getDomainFactory().find(taxonomyHql.toString(), names, values)); TaxonomyMapCollection coll_ret = new TaxonomyMapCollection(); if (coll != null && coll.size()>0) { for (int i = 0; i < coll.size(); i++) { OrgVo vo= coll.get(i); /*TaxonomyMap tmCAB = new TaxonomyMap(); tmCAB.setTaxonomyName(TaxonomyType.ICAB); tmCAB.setDescription(vo.getName()); tmCAB.setTaxonomyCode(vo.getCodeMappings().getMappingValue(TaxonomyType.ICAB)); */ TaxonomyMap tmNAT = new TaxonomyMap(); tmNAT.setTaxonomyName(TaxonomyType.NAT_LOC_CODE); tmNAT.setDescription(vo.getName()); tmNAT.setTaxonomyCode(vo.getCodeMappings().getMappingValue(TaxonomyType.NAT_LOC_CODE)); //coll_ret.add(tmCAB); coll_ret.add(tmNAT); } } return coll_ret; } catch (DomainRuntimeException e) { throw new ims.domain.exceptions.DomainInterfaceException("Please contact your system administrator.\n\nError:\n" + e.getMessage()); } }
public OrgVo savePracticeRecord(OrgVo vo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { if (!vo.isValidated()) { throw new DomainRuntimeException("OrgVo Vo has not been validated."); } DomainFactory factory = getDomainFactory(); //Opcs4 opcs4Bo = Opcs4VoAssembler.extractOpcs4(factory, vo); Organisation orgBo = OrgVoAssembler.extractOrganisation(factory, vo); factory.save(orgBo); return OrgVoAssembler.create(orgBo); }
public OrgVo getPracticeCode(String code) throws DomainInterfaceException { if(code == null || code.trim().length() == 0) return null; //OrgVoCollection coll= OrgVoAssembler.createOrgVoCollectionFromOrganisation(getDomainFactory().find("from Organisation as o1_1 left join o1_1.codeMappings as t1_1 left join t1_1.taxonomyName as l1_1 where l1_1.id = -828 and t1_1.taxonomyCode = ") //" )); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer taxonomyHql = new StringBuffer(" select distinct org from Organisation org join org.codeMappings as mappings" + " where mappings.taxonomyName = :taxonomyType and mappings.taxonomyCode = :taxonomyCode and org.type = :gpPractice"); names.add("taxonomyType"); names.add("taxonomyCode"); names.add("gpPractice"); values.add(getDomLookup(TaxonomyType.NAT_LOC_CODE)); values.add(code); values.add(getDomLookup(OrganisationType.GPP)); OrgVoCollection coll = OrgVoAssembler.createOrgVoCollectionFromOrganisation(getDomainFactory().find(taxonomyHql.toString(), names, values)); if (coll != null && coll.size()>0) return coll.get(0); return null; }