public GpLiteWithNameVoCollection listGP(String gpName) throws DomainInterfaceException { if (gpName == null || gpName.trim() == null || gpName.trim().length() == 0) throw new DomainInterfaceException("Can not search for GP with no name provided"); DomainFactory factory = getDomainFactory(); String query = "from Gp as gp "; StringBuffer hql = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); hql.append(" where gp.name.upperSurname like :sName"); markers.add("sName"); values.add(gpName.toUpperCase() + "%"); if (markers.size() > 0) query += hql; return GpLiteWithNameVoAssembler.createGpLiteWithNameVoCollectionFromGp(factory.find(query, markers, values)); }
@Override public GpLiteWithNameVo getGpByTaxonomyCode(String code, TaxonomyType type) { String hql = "select g1 from Gp as g1 left join g1.codeMappings as t1 left join t1.taxonomyName as l1\r\n" + "where t1.taxonomyCode = :taxonomyCode and l1.id = :type order by g1.id"; List<?> list = getDomainFactory().find(hql, new String[] {"taxonomyCode", "type"}, new Object[] {code, type.getID()}); if(list != null && list.size() > 0) return GpLiteWithNameVoAssembler.create((Gp) list.get(0)); return null; }
public GpLiteWithNameVoCollection listGp(String name) throws DomainInterfaceException { if (name == null || name.trim() == null || name.trim().length() == 0) throw new DomainInterfaceException("Can not search for GP with no name provided"); DomainFactory factory = getDomainFactory(); String query = "from Gp as gp "; StringBuffer hql = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); hql.append(" where "); // Break the name String[] splitNames = name.toUpperCase().trim().split(" "); for (int i = 0; i < splitNames.length; i++) { if (splitNames[i] != null || splitNames[i].length() > 0) { hql.append("gp.name.upperSurname like :NAME" + i + " or gp.name.upperForename like :NAME" + i); markers.add("NAME" + i); values.add("%" + splitNames[i].toUpperCase() + "%"); } if (i < splitNames.length - 1) { hql.append(" or "); } } if (markers.size() > 0) query += hql; return GpLiteWithNameVoAssembler.createGpLiteWithNameVoCollectionFromGp(factory.find(query, markers, values)); }
public GpLiteWithNameVo getGP(Integer id) { DomainFactory factory = getDomainFactory(); Gp doGP = (Gp) factory.getDomainObject(Gp.class, id); return GpLiteWithNameVoAssembler.create(doGP); }