Project

General

Profile

« Previous | Next » 

Revision 7ed19664

Added by Andreas Müller almost 2 years ago

cleanup

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/RegistrationDtoBeanProcessor.java
30 30
                );
31 31
    }
32 32

  
33

  
34

  
35 33
    @Override
36 34
    public JSONObject processBeanSecondStep(RegistrationDTO bean, JSONObject json, JsonConfig jsonConfig) {
37 35
        // nothing to do here
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TimePeriodBeanProcessor.java
22 22
        // TODO Auto-generated method stub
23 23
        return null;
24 24
    }
25

  
26
}
25
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ITermNodeService.java
32 32

  
33 33
    public DeleteResult isDeletable(UUID nodeUuid, TermNodeDeletionConfigurator config);
34 34

  
35
    public DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config);
35
    public <T extends DefinedTermBase<?>>  DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config);
36 36

  
37 37

  
38 38
    /**
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TermNodeServiceImpl.java
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.cdm.api.service;
11 10

  
12 11
import java.util.ArrayList;
......
86 85

  
87 86
	@Override
88 87
	@Transactional(readOnly = false)
89
	public DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config) {
88
	public <T extends DefinedTermBase<?>> DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config) {
90 89
	    DeleteResult result = new DeleteResult();
91
        TermNode node = CdmBase.deproxy(dao.load(nodeUuid));
90
        @SuppressWarnings("unchecked")
91
        TermNode<T> node = CdmBase.deproxy(dao.load(nodeUuid));
92 92
	    result = isDeletable(nodeUuid, config);
93 93
	    if (result.isOk()){
94
	        TermNode<?> parent = node.getParent();
94
	        TermNode<T> parent = node.getParent();
95 95
            parent = CdmBase.deproxy(parent);
96
	        List<TermNode> children = new ArrayList<>(node.getChildNodes());
96
            List<TermNode<T>> children = new ArrayList<>(node.getChildNodes());
97 97

  
98 98
	        if (config.getChildHandling().equals(ChildHandling.DELETE)){
99 99

  
......
104 104
	            if (parent != null){
105 105
	                parent.removeChild(node);
106 106
	            }
107

  
108 107
	        } else{
109

  
110 108
	            if (parent != null){
111 109
	                parent.removeChild(node);
112
	                for (TermNode child: children){
110
	                for (TermNode<T> child: children){
113 111
	                    node.removeChild(child);
114 112
	                    parent.addChild(child);
115 113
	                }
......
134 132
	     return result;
135 133
	 }
136 134

  
137
	 private UpdateResult createChildNode(UUID parentNodeUUID, UUID nodeUuid, DefinedTermBase term, UUID vocabularyUuid){
138
	     UpdateResult result =  createChildNode(parentNodeUUID, term, vocabularyUuid);
139
	     result.getCdmEntity().setUuid(nodeUuid);
140
	     return result;
141
	 }
142

  
143

  
144 135
	 @Override
145 136
     public UpdateResult createChildNode(UUID parentNodeUuid, DefinedTermBase term, UUID vocabularyUuid){
146 137
	     TermVocabulary vocabulary = vocabularyService.load(vocabularyUuid);
......
165 156
             result.addException(new Exception("The parent node does not exist."));
166 157
             return result;
167 158
	     }
168
	     DefinedTermBase<?> child = HibernateProxyHelper.deproxy(termService.load(termChildUuid), DefinedTermBase.class);
159
	     DefinedTermBase child = HibernateProxyHelper.deproxy(termService.load(termChildUuid), DefinedTermBase.class);
169 160

  
170 161
	     if(node.getGraph() != null && !node.getGraph().isAllowDuplicates() && node.getGraph().getDistinctTerms().contains(child)){
171 162
	         result.setError();
......
176 167
	     TermNode childNode;
177 168
         if(position<0) {
178 169
             childNode = node.addChild(child);
179
         }
180
         else{
170
         } else {
181 171
             childNode = node.addChild(child, position);
182 172
         }
183 173
         save(childNode);
......
482 472
                    List<TermVocabulary> termVocs;
483 473
                    if (!uuids.isEmpty()){
484 474
                        termVocs = vocabularyService.load(uuids, null);
485
                        for (TermVocabulary voc: termVocs){
475
                        for (TermVocabulary<DefinedTerm> voc: termVocs){
486 476
                            character.addRecommendedModifierEnumeration(voc);
487 477
                        }
488 478
                    }

Also available in: Unified diff