-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
/**
* @author n.hoffmann
- * @created Aug 5, 2010
+ * @since Aug 5, 2010
* @version 1.0
*/
@Service
}
dao.delete(node);
+ result.addDeletedObject(node);
+ if(parent!=null){
+ result.addUpdatedObject(parent);
+ }
if (config.isDeleteElement()){
feature = node.getFeature();
termService.delete(feature.getUuid());
+ result.addDeletedObject(feature);
}
}
+ return result;
+ }
+ @Override
+ public UpdateResult createChildFeatureNode(FeatureNode node, Feature featureChild){
+ Feature feature = (Feature) termService.save(featureChild);
+ return addChildFeatureNode(node, feature);
+ }
+ @Override
+ public UpdateResult addChildFeatureNode(FeatureNode node, Feature featureChild){
+ FeatureNode childNode = FeatureNode.NewInstance(featureChild);
+ UpdateResult result = new UpdateResult();
+ node.addChild(childNode);
+ save(childNode);
+ result.addUpdatedObject(node);
+ result.setCdmEntity(childNode);
return result;
}
+ @Override
+ public UpdateResult addChildFeatureNode(UUID nodeUUID, UUID featureChildUuid){
+ FeatureNode node = load(nodeUUID);
+ Feature child = HibernateProxyHelper.deproxy(termService.load(featureChildUuid), Feature.class);
+ return addChildFeatureNode(node, child);
+ }
+
@Override
public DeleteResult isDeletable(FeatureNode node, FeatureNodeDeletionConfigurator config){
DeleteResult result = new DeleteResult();
return result;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid, int position) {
+ UpdateResult result = new UpdateResult();
+ FeatureNode movedNode = HibernateProxyHelper.deproxy(load(movedNodeUuid), FeatureNode.class);
+ FeatureNode targetNode = HibernateProxyHelper.deproxy(load(targetNodeUuid), FeatureNode.class);
+ FeatureNode parent = HibernateProxyHelper.deproxy(movedNode.getParent(), FeatureNode.class);
+ if(position<0){
+ targetNode.addChild(movedNode);
+ }
+ else{
+ targetNode.addChild(movedNode, position);
+ }
+ result.addUpdatedObject(targetNode);
+ if(parent!=null){
+ result.addUpdatedObject(parent);
+ }
+ result.setCdmEntity(movedNode);
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public UpdateResult moveFeatureNode(UUID movedNodeUuid, UUID targetNodeUuid) {
+ return moveFeatureNode(movedNodeUuid, targetNodeUuid, -1);
+ }
+
}