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 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; }