Sha256: 2692de39d46929ada1c5cf8bff77460b4b8dc6b7532b9d495f81fd06669da8d9

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

(*
 * @param input.tag: t_Owner: of the new tag.
 *
 * Notice: owner name invalid if 'Nil'
 *         owner address invalid if any fields 'Nil'
 *)
procedure s_post_tag( input ) {

  post_tag_start:

       {{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}} print <<"Tag post, input=", input >>;

       (* Validata input *)
       if ( ~ValidateTagData( input.tag ) ) {
             pet_application_error( "tag data not valid" );
             return;
       };

  post_tag_validated_input:

       (* Owner invalidation now allowed if Owner has already been validated  *)
       if ( TagOwnerValidated( input.tag ) /\ ~ValidOwner( input.tag ) ) {

             {{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}} print <<"Tag post, existing owners=", FindTagsByOwnerName( input.tag ) >>;
             pet_application_error( "Owner invalidation not allowed" );
             return;
       };

  post_tag_data_validated:

       (* Generate id using infrastructure service /id/{type}(get) *)
       call infrastructure_id_get( "tag" );

  post_tag_id_generated:
  
       (* Id generation failure? *)
       if ( InfrastructureServiceGetStatus( "/id/{type}(get)" ) # "status_200" ) {
    
              {{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}} print <<"Tag post, v_ids=", v_ids >>;
              pet_application_error( "no id " );
              return;
       };


  post_tag_ok:

       (* All checks passed: enter into database *) 
       enter_tag( New_Tag( input.tag, InfrastructureServiceGetResponse( "/id/{type}(get)" ).id ) );

  post_tag_done:

       return;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tla-sbuilder-0.3.4 src/pet/service_tag_post.tla
tla-sbuilder-0.2.2 src/pet/service_tag_post.tla
tla-sbuilder-0.2.1 src/pet/service_tag_post.tla
tla-sbuilder-0.1.0 src/pet/service_tag_post.tla