Class: CaTissue::CollectionProtocolRegistration

Inherits:
Object
  • Object
show all
Includes:
Jinx::Unique
Defined in:
lib/catissue/domain/collection_protocol_registration.rb,
lib/catissue/migration/unique.rb

Overview

The CollectionProtocolRegistration domain class.

Instance Method Summary collapse

Constructor Details

#initializeCollectionProtocolRegistration

Returns a new instance of CollectionProtocolRegistration.



74
75
76
77
78
79
80
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 74

def initialize
  super
  # @quirk JRuby consent_tier_responses property method is not accessible until respond_to? is called.
  respond_to?(:consent_tier_responses)
  # work around caTissue Bug #64
  self.consent_tier_responses ||= Java::JavaUtil::LinkedHashSet.new
end

Instance Method Details

Returns whether the consent available flag is equal to the String ‘true’. This method converts the caTissue String to a Boolean.



18
19
20
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 18

def consent_available
  getIsConsentAvailable == 'true'
end

Sets the consent available flag to the specified value. A Boolean value is converted to a String.



23
24
25
26
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 23

def consent_available=(value)
  value = value.to_s if value
  setIsConsentAvailable(value)
end

Returns the responses.

Returns:

  • (Java::JavaUtil::Set)

    the responses



12
13
14
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 12

def consent_tier_responses
  getConsentTierResponseCollection or (self.consent_tier_responses = Java::JavaUtil::LinkedHashSet.new)
end

#deleteObject

Removes associations to this registration



83
84
85
86
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 83

def delete
  participant.collection_registrations.delete(self) if participant
  protocol.registrations.delete(self) if protocol
end

#protocol_participant_identifier=(value) ⇒ Object

Sets the consent available flag to the specified value. An Integer value is converted to a String.



29
30
31
32
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 29

def protocol_participant_identifier=(value)
  value = value.to_s if value
  setProtocolParticipantIdentifier(value)
end

#specimensObject

Returns all specimens collected for this CollectionProtocolRegistration.

Returns:

  • all specimens collected for this CollectionProtocolRegistration



89
90
91
# File 'lib/catissue/domain/collection_protocol_registration.rb', line 89

def specimens
  Jinx::Flattener.new(specimen_collection_groups.map { |scg| scg.specimens })
end