def create_unavailable_specimen(specimen)
      logger.debug { "Resetting #{specimen} quantities and available flag temporarily to work around caTissue Bug #160..." }
      specimen.is_available = true
      # Capture the intended initial quantity and status.
      oiqty = specimen.initial_quantity
      ostatus = specimen.activity_status
      # Reset the quantities and status to values which caTissue will accept.
      specimen.initial_quantity = 1.0
      specimen.available_quantity = 1.0
      specimen.activity_status = 'Active'
      # Cannot reset a disposed Specimen quantity, so postpone disposal until
      # quantities are reset. 
      dsp = specimen.specimen_events.detect { |sep| CaTissue::DisposalEventParameters === sep }
      if dsp then specimen.specimen_events.delete(dsp) end

      # Delegate to the standard create.
      self.class.superclass.instance_method(:create_object).bind(self).call(specimen)

      logger.debug { "Complete the caTissue Bug #160 work-around by reupdating the created #{specimen} with the initial quantity set back to the original value..." }
      # Restore the available flag and initial quantity.
      specimen.is_available = false
      specimen.initial_quantity = oiqty
      # The available quantity is always zero, since the available flag is set to false.
      specimen.available_quantity = 0.0
      # Leave status Active if there is a disposal event, since quantities cannot be reset
      # on a closed Specimen and creating the disposal event below will close the Specimen.
      specimen.activity_status = ostatus unless dsp
      # Update directly without a cyclic operation check, since update(specimen) of a
      # derived specimen delegates to the parent, which in turn might be the outer
      # save context.
      update_from_template(specimen)
      
      # Finally, create the disposal event if one is pending.
      if dsp then
        specimen.specimen_events << dsp
        create(dsp)
      end
      
      logger.debug { "#{specimen} caTissue Bug #160 work-around completed." }
      specimen
    end
def create_unavailable_specimen(specimen)
      logger.debug { "Resetting #{specimen} quantities and available flag temporarily to work around caTissue Bug #160..." }
      specimen.is_available = true
      # Capture the intended initial quantity and status.
      oiqty = specimen.initial_quantity
      ostatus = specimen.activity_status
      # Reset the quantities and status to values which caTissue will accept.
      specimen.initial_quantity = 1.0
      specimen.available_quantity = 1.0
      specimen.activity_status = 'Active'
      # Cannot reset a disposed Specimen quantity, so postpone disposal until
      # quantities are reset. 
      dsp = specimen.specimen_events.detect { |sep| CaTissue::DisposalEventParameters === sep }
      if dsp then specimen.specimen_events.delete(dsp) end

      # Delegate to the standard create.
      self.class.superclass.instance_method(:create_object).bind(self).call(specimen)

      logger.debug { "Complete the caTissue Bug #160 work-around by reupdating the created #{specimen} with the initial quantity set back to the original value..." }
      # Restore the available flag and initial quantity.
      specimen.is_available = false
      specimen.initial_quantity = oiqty
      # The available quantity is always zero, since the available flag is set to false.
      specimen.available_quantity = 0.0
      # Leave status Active if there is a disposal event, since quantities cannot be reset
      # on a closed Specimen and creating the disposal event below will close the Specimen.
      specimen.activity_status = ostatus unless dsp
      # Update directly without a cyclic operation check, since update(specimen) of a
      # derived specimen delegates to the parent, which in turn might be the outer
      # save context.
      update_from_template(specimen)
      
      # Finally, create the disposal event if one is pending.
      if dsp then
        specimen.specimen_events << dsp
        create(dsp)
      end
      
      logger.debug { "#{specimen} caTissue Bug #160 work-around completed." }
      specimen
    end
Creates the given specimen by working around the following bug:

 @quirk caTissue Bug #160: Missing Is Available? validation.
   Cannot create a Specimen with any of the following conditions:
   * zero available_quantity
   * is_available flag set to false
   * activity_status is +Closed+

   The work-around is to set the flags to true and +Active+, resp., set the quantities
   to a non-zero value, create the Specimen and then update the created Specimen with
   the original values.

   If the specimen has a disposal event, then this work-around interacts with the
   {#save_changed_dependents} work-around as follows:
   * Delete that event from the Specimen.
   * Create the Specimen as described above.
   * Update the Specimen as described above, but do not set the activity_status to +Closed+.
   * Create the pending disposal event.

 @param [CaTissue::Specimen] specimen the specimen to create