Project

General

Profile

« Previous | Next » 

Revision ead9700e

Added by Katja Luther over 5 years ago

code cleaning and fix NPE

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ContainerFactoryE4.java
31 31

  
32 32
	}
33 33

  
34
	public static void emptyAcceptedTaxonsHomotypicGroup(
35
            TaxonNameEditorE4 taxonNameEditor) {
36

  
37
	    if (taxonNameEditor.getAcceptedGroup() != null ){
38
	        taxonNameEditor.getAcceptedGroup().emptyGroup();
39
        }
40

  
41
    }
42

  
43
	public static void emptyHeterotypicSynonymsGroups(
44
            TaxonNameEditorE4 taxonNameEditor) {
45
        for (HomotypicalSynonymGroupE4 group: taxonNameEditor.getHeterotypicSynonymGroups()){
46

  
47
                group.emptyGroup();
48

  
49
        }
50
    }
51

  
52
	public static void emptyMisappliedNameGroups(
53
            TaxonNameEditorE4 taxonNameEditor) {
54
	    if (taxonNameEditor.getMisappliedGroup() != null){
55
	        taxonNameEditor.getMisappliedGroup().emptyGroup();
56
	    }
57

  
58
    }
59

  
60

  
61 34
	public static void createOrUpdateHeterotypicSynonymyGroups(
62 35
			TaxonNameEditorE4 taxonNameEditor) {
63 36
		List<HomotypicalSynonymGroupE4> retainedGroups = new ArrayList<>();
......
120 93
	}
121 94

  
122 95
	public static void setMenuToAllContainers(TaxonNameEditorE4 taxonNameEditor){
123
	    taxonNameEditor.getAcceptedGroup().setMenuToGroup();
124
	    for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
125
            homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
126
            HomotypicalSynonymGroupE4 group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
127
            group.setMenuToGroup();
96
	    if (taxonNameEditor == null) {
97
            return;
128 98
        }
129
	    taxonNameEditor.getMisappliedGroup().setMenuToGroup();
99
	    if (taxonNameEditor.getAcceptedGroup() != null){
100
	        taxonNameEditor.getAcceptedGroup().setMenuToGroup();
101
	    }
102
	    if (taxonNameEditor.getTaxon() != null){
103
    	    for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
104
                homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
105
                HomotypicalSynonymGroupE4 group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
106
                if (group != null){
107
                    group.setMenuToGroup();
108
                }
109
            }
110
    	    if (taxonNameEditor.getMisappliedGroup() != null){
111
    	        taxonNameEditor.getMisappliedGroup().setMenuToGroup();
112
    	    }
113
	    }
130 114
	}
131 115

  
132 116
}

Also available in: Unified diff