Project

General

Profile

Revision 1933a33c

ID1933a33c42ed67711a2c63b4d38a0ae141341868
Parent 14676ea5
Child d1ca5c99

Added by Patrick Plitzner over 1 year ago

ref #8242 Add service method to get all terms for multiple vocabularies

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/term/TermVocabularyDaoImpl.java
250 250
	}
251 251

  
252 252
	@Override
253
	public Collection<TermDto> getTerms(List<UUID> vocabularyUuids) {
254
	    String queryString = TermDto.getTermDtoSelect()
255
	            + "where v.uuid in :vocabularyUuids "
256
	            + "order by a.titleCache";
257
	    Query query =  getSession().createQuery(queryString);
258
	    query.setParameterList("vocabularyUuids", vocabularyUuids);
259

  
260
	    @SuppressWarnings("unchecked")
261
	    List<Object[]> result = query.list();
262

  
263
	    List<TermDto> list = TermDto.termDtoListFrom(result);
264
	    return list;
265
	}
266

  
267
	@Override
253 268
	public Collection<TermDto> getTerms(UUID vocabularyUuid) {
254 269
	    String queryString = TermDto.getTermDtoSelect()
255 270
	            + "where v.uuid = :vocabularyUuid "
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/term/ITermVocabularyDao.java
122 122
    public Collection<TermDto> getTerms(UUID vocabularyUuid);
123 123

  
124 124
    /**
125
     * Loads all terms for the given vocabularies
126
     * @param vocabularyUuids the ids of the vocabularies
127
     * @return a collection of terms
128
     */
129
    public Collection<TermDto> getTerms(List<UUID> vocabularyUuids);
130

  
131
    /**
125 132
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
126 133
     *
127 134
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java
87 87
     */
88 88
    public Collection<TermDto> getTerms(UUID vocabularyUuid);
89 89

  
90
    /**
91
     * Loads all terms for the given vocabularies
92
     * @param vocabularyUuids the ids of the vocabularies
93
     * @return a collection of terms
94
     */
95
    public Collection<TermDto> getTerms(List<UUID> vocabularyUuids);
96

  
90 97
	/**
91 98
	 * Initializes the complete term hierarchy consisting of {@link TermDto}s
92 99
	 * for the given vocabulary
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImpl.java
104 104
    }
105 105

  
106 106
    @Override
107
    public Collection<TermDto> getTerms(List<UUID> vocabularyUuids) {
108
        return dao.getTerms(vocabularyUuids);
109
    }
110

  
111
    @Override
107 112
    public Collection<TermDto> getCompleteTermHierarchy(UUID vocabularyUuid) {
108 113
        Collection<TermDto> topLevelTerms = dao.getTopLevelTerms(vocabularyUuid);
109 114
        for (TermDto termDto : topLevelTerms) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)