Project

General

Profile

« Previous | Next » 

Revision 11a2a751

Added by Patrick Plitzner over 4 years ago

ref #7095 specimen generator changes

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/SpecimenGenerator.java
37 37
 */
38 38
public class SpecimenGenerator {
39 39

  
40
    private static final int SPECIMEN_COUNT = 1000;
40
    private static final int SPECIMEN_COUNT = 1;
41 41

  
42 42
    public Collection<SpecimenOrObservationBase> generate(){
43 43
        Collection<SpecimenOrObservationBase> specimens = new HashSet<>();
44 44
        List<DescriptionElementBase> descriptionElements = new ArrayList<>();
45 45

  
46
        descriptionElements.add(generateQuantitativeData("leaf", "length"));
47
        descriptionElements.add(generateCategoricalData("leaf", "color"));
46
//        descriptionElements.add(generateQuantitativeData("leaf", "length"));
47
//        descriptionElements.add(generateCategoricalData("leaf", "color"));
48 48

  
49 49
        for(int i=0;i<SPECIMEN_COUNT;i++){
50
            specimens.add(generateSpecimen(descriptionElements));
50
            specimens.add(generateSpecimen());
51 51
        }
52 52
        return specimens;
53 53
    }
54 54

  
55
    private SpecimenOrObservationBase generateSpecimen(List<DescriptionElementBase> descriptionElements){
55
    private SpecimenOrObservationBase generateSpecimen(){
56
        List<DescriptionElementBase> descriptionElements = new ArrayList<>();
57
        descriptionElements.add(generateQuantitativeData("leaf", "length"));
58

  
56 59
        DerivedUnit specimen = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
57 60
        SpecimenDescription description = SpecimenDescription.NewInstance(specimen);
58 61
        descriptionElements.forEach(descriptionElement->{
......
65 68

  
66 69
    private QuantitativeData generateQuantitativeData(String structure, String property){
67 70
//        Character character = Character.NewInstance(generateFeatureNode(structure), generateFeatureNode(property));
68
        Character character = (Character) CdmStore.getService(ITermService.class).load(UUID.fromString("4e3b8ff8-87fc-4919-b390-fb13a22540ab"));
71
        Character character = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).load(UUID.fromString("9cceec0e-06c2-48b9-85cf-bf4cb29b71ab")), Character.class);
69 72
        QuantitativeData data = QuantitativeData.NewInstance(character);
70 73
        return data;
71 74
    }
72 75

  
73 76
    private CategoricalData generateCategoricalData(String structure, String property){
74 77
//        Character character = Character.NewInstance(generateFeatureNode(structure), generateFeatureNode(property));
75
        Character character = (Character) CdmStore.getService(ITermService.class).load(UUID.fromString("43e3a556-5619-4d20-99d8-aaccab84a914"));
78
        Character character = (Character) CdmStore.getService(ITermService.class).load(UUID.fromString("74dbd215-20b6-4cdd-89cb-dacb81b4a7a4"));
76 79
        CategoricalData data = CategoricalData.NewInstance(character);
77 80
        return data;
78 81
    }

Also available in: Unified diff