acs_sc::contract::new_from_spec (public)

 acs_sc::contract::new_from_spec -spec spec

Defined in packages/acs-service-contract/tcl/contract-procs.tcl

Takes a complete service contract specification and creates the new service contract.

The spec looks like this:

    set spec {
        name "Action_SideEffect"
        description "Get the name of the side effect to create action"
        operations {
            GetObjectTypes {
                description "Get the object types for which this implementation is valid."
                output { object_types:string,multiple }
                iscachable_p "t"
            }
            GetPrettyName {
                description "Get the pretty name of this implementation."
                output { pretty_name:string }
                iscachable_p "t"
            }
            DoSideEffect {
                description "Do the side effect"
                input {
                    case_id:integer
                    object_id:integer
                    action_id:integer
                    entry_id:integer
                }
            }
        }
    }

    acs_sc::contract::new_from_spec -spec $spec
    
Here's the detailed explanation:

The spec should be an array-list with 3 entries:

  • name: The name of the service contract.
  • description: A human-readable description.
  • operations: An array-list of operations in this service contract.
The operations array-list has the operation name as key, and another array-list containing the specification for the operation as the value. That array-list has the following entries:
  • description: Human-readable description of the operation.
  • input: Specification of the input to this operation.
  • output: Specification of the output of this operation.
  • iscachable_p: A 't' or 'f' for whether output from this service contract implementation should automatically be cached using util_memoize.

The format of the 'input' and 'output' specs is a Tcl list of parameter specs, each of which consist of name, colon (:), datatype plus an optional comma (,) and the flag 'multiple'.

Switches:
-spec
(required)
The service contract specification as described above.
Returns:
The contract_id of the newly created service contract.
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_sc_impl_new_from_spec acs_sc_impl_new_from_spec (test acs-service-contract) acs_sc::contract::new_from_spec acs_sc::contract::new_from_spec test_acs_sc_impl_new_from_spec->acs_sc::contract::new_from_spec acs_sc::contract::new acs_sc::contract::new (public) acs_sc::contract::new_from_spec->acs_sc::contract::new acs_sc::contract::operation::parse_operations_spec acs_sc::contract::operation::parse_operations_spec (private) acs_sc::contract::new_from_spec->acs_sc::contract::operation::parse_operations_spec db_transaction db_transaction (public) acs_sc::contract::new_from_spec->db_transaction auth::authentication::create_contract auth::authentication::create_contract (private) auth::authentication::create_contract->acs_sc::contract::new_from_spec auth::get_doc::create_contract auth::get_doc::create_contract (private) auth::get_doc::create_contract->acs_sc::contract::new_from_spec auth::password::create_contract auth::password::create_contract (private) auth::password::create_contract->acs_sc::contract::new_from_spec auth::process_doc::create_contract auth::process_doc::create_contract (private) auth::process_doc::create_contract->acs_sc::contract::new_from_spec auth::registration::create_contract auth::registration::create_contract (private) auth::registration::create_contract->acs_sc::contract::new_from_spec

Testcases:
acs_sc_impl_new_from_spec
[ show source ]
Show another procedure: