Project

General

Profile

Revision cd53ed98

IDcd53ed98156490f5b74416d59e91194f6cafa311
Parent a82e8663
Child a9e92136

Added by Katja Luther about 3 years ago

ref #5837 implement search for nomenclatural title

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/DefinedTermDaoImpl.java
213 213

  
214 214
		criteria.setProjection(Projections.rowCount());
215 215

  
216
        return ((Number)criteria.uniqueResult()).intValue();
216
		return ((Number)criteria.uniqueResult()).intValue();
217 217
	}
218 218

  
219 219
	@Override
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/reference/ReferenceDaoHibernateImpl.java
30 30
import eu.etaxonomy.cdm.model.reference.IReport;
31 31
import eu.etaxonomy.cdm.model.reference.IThesis;
32 32
import eu.etaxonomy.cdm.model.reference.Reference;
33
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
33 34
import eu.etaxonomy.cdm.model.reference.ReferenceType;
34 35
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
35 36
import eu.etaxonomy.cdm.persistence.dao.hibernate.common.IdentifiableDaoBase;
......
258 259

  
259 260
		return taxonBaseList;
260 261
	}
262

  
263
    /* (non-Javadoc)
264
     * @see eu.etaxonomy.cdm.persistence.dao.reference.IReferenceDao#getUuidAndAbbrevTitleCache(java.lang.Integer, java.lang.String)
265
     */
266
    @Override
267
    public List<UuidAndTitleCache<Reference>> getUuidAndAbbrevTitleCache(Integer limit, String pattern) {
268
        Session session = getSession();
269
        Reference ref = ReferenceFactory.newArticle();
270

  
271
        Query query = null;
272
        if (pattern != null){
273
            query = session.createQuery("select uuid, id, abbrevTitle, titleCache from " + type.getSimpleName() +" where abbrevTitle like :pattern");
274
            pattern = pattern + "%";
275
            pattern = pattern.replace("*", "%");
276
            pattern = pattern.replace("?", "_");
277
            query.setParameter("pattern", pattern);
278
        } else {
279
            query = session.createQuery("select uuid, id, abbrevTitle, titleCache from " + type.getSimpleName() );
280
        }
281
        if (limit != null){
282
           query.setMaxResults(limit);
283
        }
284

  
285
        return getUuidAndAbbrevTitleCache(query);
286

  
287
    }
261 288
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/reference/IReferenceDao.java
68 68
	 */
69 69
	public List<TaxonBase> listCoveredTaxa(Reference reference, boolean includeSubordinateReferences, List<OrderHint> orderHints, List<String> propertyPaths);
70 70

  
71
	/**
72
     * @param limit
73
     * @param pattern
74
     * @return
75
     */
76
    List<UuidAndTitleCache<Reference>> getUuidAndAbbrevTitleCache(Integer limit, String pattern);
71 77
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IReferenceService.java
82 82
	 * @return
83 83
	 */
84 84
	public List<TaxonBase> listCoveredTaxa(Reference reference, boolean includeSubordinateReferences, List<String> propertyPaths);
85

  
86

  
87
    public List<UuidAndTitleCache<Reference>> getUuidAndAbbrevTitleCache(Integer limit, String pattern);
88

  
89

  
85 90
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ReferenceServiceImpl.java
108 108
    public DeleteResult delete(UUID referenceUuid) {
109 109
        return delete(dao.load(referenceUuid));
110 110
    }
111

  
112
    /* (non-Javadoc)
113
     * @see eu.etaxonomy.cdm.api.service.IReferenceService#getUuidAndAbbrevTitleCache(java.lang.Integer, java.lang.String)
114
     */
115
    @Override
116
    public List<UuidAndTitleCache<Reference>> getUuidAndAbbrevTitleCache(Integer limit, String pattern) {
117
        return dao.getUuidAndAbbrevTitleCache(limit, pattern);
118
    }
119

  
111 120
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)