Project

General

Profile

Revision 489923b4

ID489923b47f5afd7768e5ad27ca908bdc7b38c204
Parent 7620acb4
Child 0196a8bf

Added by Patrick Plitzner about 3 years ago

ref #6694 Add service method to move FeatureNodes

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/FeatureNodeServiceImpl.java
117 117
	     return result;
118 118
	 }
119 119

  
120
    /**
121
     * {@inheritDoc}
122
     */
123
    @Override
124
    public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid, int position) {
125
        UpdateResult result = new UpdateResult();
126
        FeatureNode movedNode = HibernateProxyHelper.deproxy(dao.load(movedNodeUuid), FeatureNode.class);
127
        FeatureNode targetNode = HibernateProxyHelper.deproxy(dao.load(targetNodeUuid), FeatureNode.class);
128
        if(position<0){
129
            targetNode.addChild(movedNode);
130
        }
131
        else{
132
            targetNode.addChild(movedNode, position);
133
        }
134
        result.addUpdatedObject(targetNode);
135
        if(movedNode.getParent()!=null){
136
            result.addUpdatedObject(movedNode.getParent());
137
        }
138
        result.setCdmEntity(targetNode.getFeatureTree());
139
        return result;
140
    }
141

  
142
    /**
143
     * {@inheritDoc}
144
     */
145
    @Override
146
    public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid) {
147
        return moveFeatureNode(movedNodeUuid, targetNodeUuid, -1);
148
    }
149

  
120 150
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IFeatureNodeService.java
36 36
     */
37 37
    DeleteResult deleteFeatureNode(UUID nodeUuid, FeatureNodeDeletionConfigurator config);
38 38

  
39
    /**
40
     * Moves a given {@link FeatureNode} to the target node at the given position;
41
     * @param movedNodeUuid the node to move
42
     * @param targetNodeUuid the target node
43
     * @param position the position in the list of children of the target node
44
     * @return the result of the operation
45
     */
46
    public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid, int position);
47

  
48
    /**
49
     * Moves a given {@link FeatureNode} to the target node;
50
     * @param movedNodeUuid the node to move
51
     * @param targetNodeUuid the target node
52
     * @return the result of the operation
53
     */
54
    public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid);
55

  
39 56
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)