Copying and Deleting

In a Move or Copy operation, the first argument is the thing to move or make a copy of, the second argument is the parent to move or copy to (which will be the same as the current parent for a rename operation), and the third argument is the name to give the resource, which will usually be the current name if the resource is being moved to a different folder

An example from Bandstand:

    @Move
    public void move(Image image, BaseEntity newParent, String newName) {
        Transaction tx = SessionManager.session().beginTransaction();
        if( newParent != image.getBaseEntity()) {
            BaseEntity oldParent = image.getBaseEntity();
            image.setBaseEntity(newParent);
            oldParent.getImages().remove(image);
            if( newParent.getImages() == null ) {
                newParent.setImages(new ArrayList<Image>());
            }
        }
        image.setDisplayName(newName);
        SessionManager.session().save(image);
        SessionManager.session().flush();
        tx.commit();
    }

 

Note that moves and copies are not done recursively by milton, its up to you to ensure that child resources are copied correctly.