/// class ProspectDirector.Web.UI.Queries.Commands.DuplicateFilter
/// using ProspectDirector.Web.UI.Command

/**
@class DuplicateFilter
@constructor
@namespace Web.UI.Queries.Commands
**/
ProspectDirector.Web.UI.Queries.Commands.DuplicateFilter = ProspectDirector.Web.UI.Command.extend({

    //================================
    // PROPERTIES
    //================================

    get_editor: function () {
        return this.get_options().editor;
    },

    get_selectedConstraint: function () {
        return this.get_options().selectedConstraint;
    },

    //================================
    // PUBLIC METHODS
    //================================

    execute: function () {

        var data = this.get_selectedConstraint().toJSON(),
            duplicate = new ProspectDirector.Web.UI.Queries.Filter({
                data: $.extend({}, data, { id: uuid.v4() })
            });

        this.get_editor().addFilter(duplicate, this.get_selectedConstraint().get_parent().get_id());

    }

});