Project

General

Profile

Revision fbc64294

IDfbc64294d4c13ddc0d38512dba01d2480e665490
Parent 0196a8bf
Child c0ed29cc

Added by Patrick Plitzner about 3 years ago

ref #6694 Add service method to add child features

  • also add parent of deleted feature node to DeleteResult

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/FeatureNodeServiceImpl.java
86 86
	         }
87 87

  
88 88
	         dao.delete(node);
89
	         if(parent!=null){
90
	             result.addUpdatedObject(parent);
91
	         }
89 92
	         if (config.isDeleteElement()){
90 93
                 feature = node.getFeature();
91 94
                 termService.delete(feature.getUuid());
92 95
             }
93 96
	     }
97
	     return result;
98
	 }
94 99

  
100
	 @Override
101
    public UpdateResult addChildFeaturNode(FeatureNode node, Feature featureChild){
102
	     return addChildFeaturNode(node.getUuid(), featureChild.getUuid());
103
	 }
95 104

  
105
	 @Override
106
    public UpdateResult addChildFeaturNode(UUID nodeUUID, UUID featureChildUuid){
107
	     FeatureNode node = load(nodeUUID);
108
	     Feature child = HibernateProxyHelper.deproxy(termService.load(featureChildUuid), Feature.class);
109
	     UpdateResult result = new UpdateResult();
110
	     FeatureNode childNode = FeatureNode.NewInstance(child);
111
	     save(childNode);
112
	     node.addChild(childNode);
113
	     result.addUpdatedObject(node);
96 114
	     return result;
97 115
	 }
98 116

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IFeatureNodeService.java
12 12
import java.util.UUID;
13 13

  
14 14
import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
15
import eu.etaxonomy.cdm.model.description.Feature;
15 16
import eu.etaxonomy.cdm.model.description.FeatureNode;
16 17

  
17 18
/**
......
36 37
     */
37 38
    DeleteResult deleteFeatureNode(UUID nodeUuid, FeatureNodeDeletionConfigurator config);
38 39

  
40

  
41
    /**
42
     * Adds the specified feature as a child node to the given feature node
43
     * @param node the feature node where the new feature should be added
44
     * @param featureChild the feature which should be added to the given feature node
45
     * @return the result of the operation
46
     */
47
    public UpdateResult addChildFeaturNode(FeatureNode node, Feature featureChild);
48

  
49
    /**
50
     * Adds the specified feature as a child node to the given feature node
51
     * @param nodeUUID the UUID of the feature node where the new feature should be added
52
     * @param featureChildUuid the UUID of the feature which should be added to the given feature node
53
     * @return the result of the operation
54
     */
55
    public UpdateResult addChildFeaturNode(UUID nodeUUID, UUID featureChildUuid);
56

  
39 57
    /**
40 58
     * Moves a given {@link FeatureNode} to the target node at the given position;
41 59
     * @param movedNodeUuid the node to move

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)