Class: Patriarch::DAOServices::BipartiteRelationshipBuilderService
- Inherits:
-
Service
- Object
- Service
- Patriarch::DAOServices::BipartiteRelationshipBuilderService
- Defined in:
- lib/patriarch/dao_services/bipartite_relationship_builder_service.rb
Overview
bipartite behaviours
Instance Method Summary collapse
-
#create(transaction_item) ⇒ Object
Fills current transaction step of the Patriarch::Transaction argument passed with data needed later to execute transaction.
-
#destroy(transaction_item) ⇒ Object
Fills current transaction step of the Patriarch::Transaction argument passed with data needed later to execute transaction.
Instance Method Details
#create(transaction_item) ⇒ Object
Fills current transaction step of the Patriarch::Transaction argument passed with data needed later to execute transaction. This deals with “DO” behaviour steps
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/patriarch/dao_services/bipartite_relationship_builder_service.rb', line 12 def create(transaction_item) t = Time.now.to_f dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item) actor_dao = dao_tab[:actor] target_dao = dao_tab[:target] l = build_struct_for_create(actor_dao,transaction_item.target_id,t) ll = build_struct_for_create(target_dao,transaction_item.actor_id,t) transaction_item.add_to_queue l transaction_item.add_to_queue ll end |
#destroy(transaction_item) ⇒ Object
Fills current transaction step of the Patriarch::Transaction argument passed with data needed later to execute transaction. This deals with “UNDO” behaviour steps
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/patriarch/dao_services/bipartite_relationship_builder_service.rb', line 29 def destroy(transaction_item) dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item) actor_dao = dao_tab[:actor] target_dao = dao_tab[:target] l = Patriarch::RedisInstruction.new(actor_dao,:delete,[transaction_item.target_id]) ll = Patriarch::RedisInstruction.new(target_dao,:delete ,[transaction_item.actor_id]) transaction_item.add_to_queue l transaction_item.add_to_queue ll end |