Changeset 1609

Show
Ignore:
Timestamp:
06/09/08 14:18:09 (3 months ago)
Author:
mbriggs
Message:

Update create function to reflect DroneJob addition

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hive/trunk/data_webapp/app/controllers/queue_urls_controller.rb

    r1521 r1609  
    4242  # POST /queue_urls.xml 
    4343  def create 
    44     # TODO: Get this information via the database OR the user 
    45     params[:queue_url][:source_type] = "web" 
    46     params[:queue_url][:source_name] = "drone_interface" 
    47     @queue_url = QueueUrl.new_from_hash(params[:queue_url]) 
     44    # Create a job hash for the requested URL 
     45    job_hash = { 
     46      :source => { 
     47        :feed_type => 'web', 
     48        :name => 'drone_interface', 
     49      }, 
     50      :notify_source => (params[:notify]), 
     51      :queue_urls => { 
     52        params[:queue_url][:url] => params[:queue_url][:priority] 
     53      } 
     54    } 
     55    if not params[:address].nil? 
     56      job_hash[:source][:response_protocol] = 'smtp' 
     57      job_hash[:source][:response_address] = params[:address] 
     58    end 
     59     
     60    # Create a controller object for insert_drone_job logic 
     61    c = HcDatabaseController.new() 
     62    job_id = c.insert_drone_job(job_hash) 
     63    # Get the inserted job 
     64    job = DroneJob.find(job_id) 
     65    @queue_url = []  
     66    if not job.nil? 
     67      @queue_url << job.queue_urls 
     68    end 
    4869 
    4970    respond_to do |format| 
    50       if (not @queue_url.nil?) and @queue_url.save 
     71      if job_id > 0 and @queue_url.size > 0 
    5172        flash[:notice] = 'QueueUrl was successfully created.' 
    5273        format.html { redirect_to(:action => 'new') }