Project

General

Profile

Revision cb00dde8

IDcb00dde8e3f02f01c4adb962d43f19470358fd88
Parent 72966fb1
Child 3e9ab1b7

Added by Andreas Kohlbecker over 2 years ago

ref #7313 creating vocabulary before terms

View differences:

src/main/java/eu/etaxonomy/cdm/dataInserter/RegistrationRequiredDataInserter.java
163 163
        assureGroupHas(groupSubmitter, new CdmAuthority(CdmPermissionClass.COLLECTION, CREATE_READ).toString());
164 164
        repo.getGroupService().saveOrUpdate(groupSubmitter);
165 165

  
166
        TermVocabulary<DefinedTerm> kindOfUnitVocabulary = repo.getVocabularyService().find(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY().getUuid());
167
        if(repo.getVocabularyService().find(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY().getUuid()) == null){
168
            kindOfUnitVocabulary = repo.getVocabularyService().save(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY());
169
        }
166 170

  
167 171
        DefinedTermBase kouSpecimen = repo.getTermService().find(KindOfUnitTerms.SPECIMEN().getUuid());
168 172
        DefinedTermBase kouImage = repo.getTermService().find(KindOfUnitTerms.PUBLISHED_IMAGE().getUuid());
......
182 186
            kouCulture = repo.getTermService().save(KindOfUnitTerms.CULTURE_METABOLIC_INACTIVE());
183 187
        }
184 188

  
185
        TermVocabulary<DefinedTerm> kindOfUnitVocabulary = repo.getVocabularyService().find(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY().getUuid());
186
        if(repo.getVocabularyService().find(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY().getUuid()) == null){
187
            kindOfUnitVocabulary = repo.getVocabularyService().save(KindOfUnitTerms.KIND_OF_UNIT_VOCABULARY());
188
            kindOfUnitVocabulary.addTerm((DefinedTerm)kouSpecimen);
189
            kindOfUnitVocabulary.addTerm((DefinedTerm)kouImage);
190
            kindOfUnitVocabulary.addTerm((DefinedTerm)kouUnpublishedImage);
191
            kindOfUnitVocabulary.addTerm((DefinedTerm)kouCulture);
189
        Set<DefinedTerm> termInVocab = kindOfUnitVocabulary.getTerms();
190
        List<DefinedTermBase> kouTerms = Arrays.asList(kouCulture, kouImage, kouSpecimen, kouUnpublishedImage);
191

  
192
        for(DefinedTermBase t : kouTerms){
193
            if(!termInVocab.contains(t)){
194
                kindOfUnitVocabulary.addTerm((DefinedTerm)t);
195
            }
192 196
        }
193
        txStatus.flush();
194 197

  
195 198
        repo.commitTransaction(txStatus);
196 199

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)