Project

General

Profile

Revision fa74401f

IDfa74401f483f6b124a2d0dc92bee5d2ed890079a
Parent 9ee0028c
Child 6c08dd61

Added by Patrick Plitzner over 3 years ago

Add propertyPath to service method

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceUtilities.java
710 710
            uuids.add(presenceTermVocabUuid);
711 711

  
712 712

  
713
            for(TermVocabulary vocab : vocabularyService.findByTermType(TermType.PresenceAbsenceTerm)) {
713
            for(TermVocabulary vocab : vocabularyService.findByTermType(TermType.PresenceAbsenceTerm, null)) {
714 714
                if(!uuids.contains(vocab.getUuid())) {
715 715
                    uuids.add(vocab.getUuid());
716 716
                }
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/common/ITermVocabularyDao.java
66 66
     * Return a List of vocabularies that belong to the term type supplied
67 67
     *
68 68
     * @param termType The term type corresponding to the vocabularies of interest
69
     * @param propertyPaths
69 70
     * @return a List of vocabularies
70 71
     */
71
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType);
72
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths);
72 73

  
73 74

  
74 75
	/**
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/TermVocabularyDaoImpl.java
122 122

  
123 123

  
124 124
    @Override
125
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType) {
125
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths) {
126 126

  
127 127
        Criteria criteria = getSession().createCriteria(type);
128 128
        criteria.add(Restrictions.eq("termType", termType));
......
130 130
        //this.addOrder(criteria, orderHints);
131 131

  
132 132
        List<TermVocabulary<T>> result = criteria.list();
133
        defaultBeanInitializer.initializeAll(result, null);
133
        defaultBeanInitializer.initializeAll(result, propertyPaths);
134 134
        return result;
135 135
    }
136 136

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java
66 66
	 * @param termType The term type for which the list of vocabularies is desired
67 67
	 * @return a list of vocabularies
68 68
	 */
69
	public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType);
69
	public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths);
70 70

  
71 71
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImpl.java
56 56
    }
57 57

  
58 58
    @Override
59
	public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType) {
60
		return dao.findByTermType(termType);
59
	public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths) {
60
		return dao.findByTermType(termType, propertyPaths);
61 61
	}
62 62
	/**
63 63
	 * (non-Javadoc)
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImplTest.java
50 50
    @Test
51 51
//    @Ignore //FIXME assertSame does not work yet
52 52
    public void testGetRankVocabulary() {
53
        List<TermVocabulary<Rank>> rankVocabularyList = vocabularyService.findByTermType(TermType.Rank);
53
        List<TermVocabulary<Rank>> rankVocabularyList = vocabularyService.findByTermType(TermType.Rank, null);
54 54
        assertTrue(rankVocabularyList.size() == 1);
55 55
        OrderedTermVocabulary<Rank> rankVocabulary = (OrderedTermVocabulary<Rank>)rankVocabularyList.get(0);
56 56
        assertNotNull(rankVocabulary);
......
69 69
//    @Ignore  //not yet correctly implemented
70 70
    public void testGetTypeDesignationVocabulary() {
71 71
        List<TermVocabulary<SpecimenTypeDesignationStatus>> typeDesignationVocabularyList =
72
        		vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus);
72
        		vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus, null);
73 73
        assertTrue(typeDesignationVocabularyList.size() == 1);
74 74
        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary = (OrderedTermVocabulary<SpecimenTypeDesignationStatus>)typeDesignationVocabularyList.get(0);
75 75

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)