cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 23 Jun 2022 10:09:26 +0000 (12:09 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 23 Jun 2022 10:09:26 +0000 (12:09 +0200)
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/RegistrationDtoBeanProcessor.java
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TimePeriodBeanProcessor.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ITermNodeService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TermNodeServiceImpl.java

index 6b4550d4eaa2ec8c5439a4cf1ed5dbeba192423b..cbaec3eb4a6ccd9f816b58f955e41b6da4012763 100644 (file)
@@ -30,8 +30,6 @@ public class RegistrationDtoBeanProcessor extends AbstractBeanProcessor<Registra
                 );
     }
 
-
-
     @Override
     public JSONObject processBeanSecondStep(RegistrationDTO bean, JSONObject json, JsonConfig jsonConfig) {
         // nothing to do here
index e4281c04c265c9855c1c3f42b0cf6e36f443e186..9cc4356e350df2a83887a779b4eb93a6fee06c01 100644 (file)
@@ -22,5 +22,4 @@ public class TimePeriodBeanProcessor extends AbstractModifiableThingBeanProcesso
         // TODO Auto-generated method stub
         return null;
     }
-
-}
+}
\ No newline at end of file
index 5526e1adf0f35cbc78ec4e182c354ea02f8a0b99..427cc5b321c412351e565ebdd973c3a22bfac891 100644 (file)
@@ -32,7 +32,7 @@ public interface ITermNodeService extends IVersionableService<TermNode>{
 
     public DeleteResult isDeletable(UUID nodeUuid, TermNodeDeletionConfigurator config);
 
-    public DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config);
+    public <T extends DefinedTermBase<?>>  DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config);
 
 
     /**
index 403a692d69bc2f3c7a3838371d0dd427d45225b3..712c27a55224822cf93bdd59f026936d50a9d33b 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.cdm.api.service;
 
 import java.util.ArrayList;
@@ -86,14 +85,15 @@ public class TermNodeServiceImpl
 
        @Override
        @Transactional(readOnly = false)
-       public DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config) {
+       public <T extends DefinedTermBase<?>> DeleteResult deleteNode(UUID nodeUuid, TermNodeDeletionConfigurator config) {
            DeleteResult result = new DeleteResult();
-        TermNode node = CdmBase.deproxy(dao.load(nodeUuid));
+        @SuppressWarnings("unchecked")
+        TermNode<T> node = CdmBase.deproxy(dao.load(nodeUuid));
            result = isDeletable(nodeUuid, config);
            if (result.isOk()){
-               TermNode<?> parent = node.getParent();
+               TermNode<T> parent = node.getParent();
             parent = CdmBase.deproxy(parent);
-               List<TermNode> children = new ArrayList<>(node.getChildNodes());
+            List<TermNode<T>> children = new ArrayList<>(node.getChildNodes());
 
                if (config.getChildHandling().equals(ChildHandling.DELETE)){
 
@@ -104,12 +104,10 @@ public class TermNodeServiceImpl
                    if (parent != null){
                        parent.removeChild(node);
                    }
-
                } else{
-
                    if (parent != null){
                        parent.removeChild(node);
-                       for (TermNode child: children){
+                       for (TermNode<T> child: children){
                            node.removeChild(child);
                            parent.addChild(child);
                        }
@@ -134,13 +132,6 @@ public class TermNodeServiceImpl
             return result;
         }
 
-        private UpdateResult createChildNode(UUID parentNodeUUID, UUID nodeUuid, DefinedTermBase term, UUID vocabularyUuid){
-            UpdateResult result =  createChildNode(parentNodeUUID, term, vocabularyUuid);
-            result.getCdmEntity().setUuid(nodeUuid);
-            return result;
-        }
-
-
         @Override
      public UpdateResult createChildNode(UUID parentNodeUuid, DefinedTermBase term, UUID vocabularyUuid){
             TermVocabulary vocabulary = vocabularyService.load(vocabularyUuid);
@@ -165,7 +156,7 @@ public class TermNodeServiceImpl
              result.addException(new Exception("The parent node does not exist."));
              return result;
             }
-            DefinedTermBase<?> child = HibernateProxyHelper.deproxy(termService.load(termChildUuid), DefinedTermBase.class);
+            DefinedTermBase child = HibernateProxyHelper.deproxy(termService.load(termChildUuid), DefinedTermBase.class);
 
             if(node.getGraph() != null && !node.getGraph().isAllowDuplicates() && node.getGraph().getDistinctTerms().contains(child)){
                 result.setError();
@@ -176,8 +167,7 @@ public class TermNodeServiceImpl
             TermNode childNode;
          if(position<0) {
              childNode = node.addChild(child);
-         }
-         else{
+         } else {
              childNode = node.addChild(child, position);
          }
          save(childNode);
@@ -482,7 +472,7 @@ public class TermNodeServiceImpl
                     List<TermVocabulary> termVocs;
                     if (!uuids.isEmpty()){
                         termVocs = vocabularyService.load(uuids, null);
-                        for (TermVocabulary voc: termVocs){
+                        for (TermVocabulary<DefinedTerm> voc: termVocs){
                             character.addRecommendedModifierEnumeration(voc);
                         }
                     }