Project

General

Profile

Revision 581deb02

ID581deb02304aacd2ba28408c7746ab028eeec53a
Parent 8c393c2b
Child 03762d0f

Added by Patrick Plitzner over 1 year ago

ref #8242 Add service method to get all terms for a given vocabulary

View differences:

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

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

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

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

  
252 267
    @Override
253 268
    public Collection<TermDto> getTopLevelTerms(UUID vocabularyUuid) {
254 269
        String queryString = TermDto.getTermDtoSelect()
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/term/ITermVocabularyDao.java
115 115
    public Collection<TermDto> getTopLevelTerms(UUID vocabularyUuid);
116 116

  
117 117
    /**
118
     * Loads all terms for the given vocabulary
119
     * @param vocabularyUuid the id of the vocabulary
120
     * @return a collection of terms
121
     */
122
    public Collection<TermDto> getTerms(UUID vocabularyUuid);
123

  
124
    /**
118 125
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
119 126
     *
120 127
     * @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
81 81
	public Collection<TermDto> getTopLevelTerms(UUID vocabularyUuid);
82 82

  
83 83
	/**
84
     * Loads all terms for the given vocabulary
85
     * @param vocabularyUuid the id of the vocabulary
86
     * @return a collection of terms
87
     */
88
    public Collection<TermDto> getTerms(UUID vocabularyUuid);
89

  
90
	/**
84 91
	 * Initializes the complete term hierarchy consisting of {@link TermDto}s
85 92
	 * for the given vocabulary
86 93
	 * @param vocabularyUuid the UUID of the {@link TermVocabulary}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImpl.java
99 99
    }
100 100

  
101 101
    @Override
102
    public Collection<TermDto> getTerms(UUID vocabularyUuid) {
103
        return dao.getTerms(vocabularyUuid);
104
    }
105

  
106
    @Override
102 107
    public Collection<TermDto> getCompleteTermHierarchy(UUID vocabularyUuid) {
103 108
        Collection<TermDto> topLevelTerms = dao.getTopLevelTerms(vocabularyUuid);
104 109
        for (TermDto termDto : topLevelTerms) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)