Project

General

Profile

« Previous | Next » 

Revision de3db973

Added by Patrick Plitzner over 5 years ago

ref #7502 code cleaning

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java
11 11
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
12 12
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
13 13
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
14
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
15 14
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
16 15
import eu.etaxonomy.cdm.model.name.HybridRelationship;
17 16
import eu.etaxonomy.cdm.model.name.TaxonName;
......
27 26
public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
28 27

  
29 28
	private static TaxonEditorInput instance;
30
	/** Constant <code>ID="bulkeditor.input.taxon"</code> */
29

  
31 30
	public static final String ID = "bulkeditor.input.taxon";
32 31

  
33 32
	private List<TaxonName> saveNameCandidates = new ArrayList<>();
34 33

  
35

  
36
	/**
37
	 * <p>Getter for the field <code>instance</code>.</p>
38
	 *
39
	 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
40
	 */
41 34
	public static AbstractBulkEditorInput getInstance() {
42 35
		if (instance == null) {
43 36
			instance = new TaxonEditorInput();
......
57 50
		return BulkEditorInputType.TAXON.label;
58 51
	}
59 52

  
60
	/**
61
	 * <p>getID</p>
62
	 *
63
	 * @return a {@link java.lang.Object} object.
64
	 */
65 53
	public static Object getID() {
66 54
		return ID;
67 55
	}
......
75 63
        return sortProviders;
76 64
    }
77 65

  
78
	/* (non-Javadoc)
79
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
80
	 */
81
	/** {@inheritDoc} */
82 66
	@Override
83 67
	public boolean isMergingEnabled() {
84 68
		return false;
......
93 77
        return CdmStore.getService(ITaxonService.class).countByTitle(configurator);
94 78
    }
95 79

  
96
	/** {@inheritDoc} */
97 80
	@Override
98 81
	public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
99 82
//		IFindTaxaAndNamesConfigurator<TaxonBase> newConfig = new FindTaxaAndNamesConfiguratorImpl<>();
......
113 96
		return taxaCopy;
114 97
	}
115 98

  
116

  
117 99
	@Override
118 100
	protected TaxonBase loadEntity(UUID entityUuid) {
119 101
		List<String> propertyPaths = Arrays.asList(new String[]{});
120 102
		return CdmStore.getService(ITaxonService.class).load(entityUuid, propertyPaths);
121 103
	}
122 104

  
123

  
124

  
125
	/** {@inheritDoc}
126
	 * @throws ReferencedObjectUndeletableException */
127 105
	@Override
128 106
    public boolean delete(TaxonBase entity, DeleteConfiguratorBase config) {
129 107
		if (entity instanceof Taxon){
......
146 124
			return CdmStore.getService(ITaxonService.class).deleteSynonym(entity.getUuid(), synConfig) != null;
147 125
		}
148 126
	}
127

  
149 128
	@Override
150 129
	protected IEntityCreator<TaxonBase> createEntityCreator() {
151 130
		return new TaxonCreator();
152 131
	}
153 132

  
154

  
155
    /* (non-Javadoc)
156
     * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
157
     */
158 133
    @Override
159 134
    public void merge() {
160 135

  
......
162 137

  
163 138
    @Override
164 139
    public void addSaveCandidate(TaxonBase taxonBase){
165
       if (!taxonBase.getName().getHybridChildRelations().isEmpty()){
166
           for (HybridRelationship rel: taxonBase.getName().getHybridChildRelations()){
167
               if (!rel.getParentName().isPersited()){
168
                   this.saveNameCandidates.add(rel.getParentName());
169
               }
170
               if (!rel.getHybridName().isPersited()){
171
                   this.saveNameCandidates.add(rel.getHybridName());
172
               }
173
           }
174
       }
175

  
176
       super.addSaveCandidate(taxonBase);
177
   }
140
        if (!taxonBase.getName().getHybridChildRelations().isEmpty()){
141
            for (HybridRelationship rel: taxonBase.getName().getHybridChildRelations()){
142
                if (!rel.getParentName().isPersited()){
143
                    this.saveNameCandidates.add(rel.getParentName());
144
                }
145
                if (!rel.getHybridName().isPersited()){
146
                    this.saveNameCandidates.add(rel.getHybridName());
147
                }
148
            }
149
        }
150

  
151
        super.addSaveCandidate(taxonBase);
152
    }
178 153

  
179 154
    @Override
180 155
    public void saveModel(boolean resetMerge){

Also available in: Unified diff